Browse Source

minor range checks fixes.

Ugochukwu Mmaduekwe 7 years ago
parent
commit
13cf6f3cbc

+ 1 - 1
QRCodeGenLib/src/QRCodeGen/QlpBitBuffer.pas

@@ -244,7 +244,7 @@ begin
   for LIdx := 0 to System.Pred(System.Length(Result)) do
   for LIdx := 0 to System.Pred(System.Length(Result)) do
   begin
   begin
     Result[LIdx] := Byte(TBits.Asr32(FData[TBits.Asr32(LIdx, 2)],
     Result[LIdx] := Byte(TBits.Asr32(FData[TBits.Asr32(LIdx, 2)],
-      ((not LIdx) shl 3)));
+      Byte((not LIdx) shl 3)));
   end;
   end;
 end;
 end;
 
 

+ 1 - 1
QRCodeGenLib/src/QRCodeGen/QlpQrCodeCommons.pas

@@ -42,7 +42,7 @@ implementation
 
 
 class function TQrCodeCommons.GetBit(Ax, Ai: Int32): Int32;
 class function TQrCodeCommons.GetBit(Ax, Ai: Int32): Int32;
 begin
 begin
-  result := (TBits.Asr32(Ax, Ai)) and 1;
+  result := (TBits.Asr32(Ax, Byte(Ai))) and 1;
 end;
 end;
 
 
 end.
 end.

+ 2 - 2
QRCodeGenLib/src/QRCodeGen/QlpQrSegment.pas

@@ -422,8 +422,8 @@ begin
   System.SetLength(LBits, (System.Length(AData) + 3) shr 2);
   System.SetLength(LBits, (System.Length(AData) + 3) shr 2);
   for LIdx := System.Low(AData) to System.High(AData) do
   for LIdx := System.Low(AData) to System.High(AData) do
   begin
   begin
-    LBits[TBits.Asr32(LIdx, 2)] := LBits[TBits.Asr32(LIdx, 2)] or
-      Int64((AData[LIdx] and $FF) shl ((not LIdx) shl 3));
+    LBits[TBits.Asr32(LIdx, 2)] := Int32(LBits[TBits.Asr32(LIdx, 2)] or
+          Int64((AData[LIdx] and $FF) shl ((not LIdx) shl 3)));
   end;
   end;
   result := TQrSegment.Create(TQrSegmentMode.qsmByte, System.Length(AData),
   result := TQrSegment.Create(TQrSegmentMode.qsmByte, System.Length(AData),
     LBits, System.Length(AData) * 8);
     LBits, System.Length(AData) * 8);