--- Merging r39866 into '.':

U    rtl/unix/sysutils.pp
--- Recording mergeinfo for merge of r39866 into '.':
 U   .
--- Merging r39870 into '.':
U    utils/bin2obj.pp
--- Recording mergeinfo for merge of r39870 into '.':
 G   .
--- Merging r39973 into '.':
U    packages/fcl-image/src/fpimage.pp
--- Recording mergeinfo for merge of r39973 into '.':
 G   .
--- Merging r39995 into '.':
U    packages/gmp/src/gmp.pas
U    rtl/objpas/math.pp
--- Recording mergeinfo for merge of r39995 into '.':
 G   .
--- Merging r40215 into '.':
U    packages/paszlib/src/zipper.pp
--- Recording mergeinfo for merge of r40215 into '.':
 G   .

# revisions: 39866,39870,39973,39995,40215,

git-svn-id: branches/fixes_3_2@40528 -
This commit is contained in:
marco 2018-12-11 21:19:56 +00:00
parent fa58ed1df7
commit 1f921d4ac0
6 changed files with 60 additions and 14 deletions

View File

@ -721,7 +721,10 @@ function TryHtmlToFPColor(const S: String; out FPColor: TFPColor): Boolean;
begin
Val('$'+Hex, W, Code);
Result := (Code = 0);
if not Result then W := 0;
if Result then
W := W or (W shl 8)
else
W := 0;
end;
var

View File

@ -1751,7 +1751,7 @@ end;
procedure propagate_prec(var result, op1, op2: MPFloat);
begin
f_set_prec(result, max(valsint(f_get_prec(op1)), f_get_prec(op2)));
f_set_prec(result, max( int64(f_get_prec(op1)), Int64(f_get_prec(op2)) ) );
end;
// --- ext bindings ----

View File

@ -1609,6 +1609,8 @@ Begin
begin
Compressed_Size := FZip.Size;
LocalZip64Fld.Compressed_Size := 0;
if LocalZip64Fld.Original_Size > 0 then
IsZip64 := true;
end;
if AZipVersionReqd > Extract_Version_Reqd then
Extract_Version_Reqd := AZipVersionReqd;
@ -1623,7 +1625,6 @@ Begin
FOutStream.WriteBuffer(ZFileName[1],Length(ZFileName));
if IsZip64 then
begin
LocalZip64ExtHdr.Header_ID:=ZIP64_HEADER_ID;
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapEDFH{$ENDIF}(LocalZip64ExtHdr),SizeOf(LocalZip64ExtHdr));
FOutStream.WriteBuffer({$IFDEF ENDIAN_BIG}SwapZ64EIF{$ENDIF}(LocalZip64Fld),SizeOf(LocalZip64Fld));
end;
@ -1682,7 +1683,7 @@ Begin
end;
end;
// Move past extra fields
FOutStream.Seek(SavePos+LocalHdr.Extra_Field_Length,soFromBeginning);
//FOutStream.Seek(SavePos+LocalHdr.Extra_Field_Length,soFromBeginning);
end;
SavePos := FOutStream.Position;
FillChar(CentralHdr,SizeOf(CentralHdr),0);
@ -1732,9 +1733,16 @@ Begin
else
Local_Header_Offset := HdrPos;
end;
if IsZip64 then
begin
CentralHdr.Extra_Field_Length:=SizeOf(LocalZip64ExtHdr)+SizeOf(LocalZip64Fld);
end else CentralHdr.Extra_Field_Length :=0;
FOutStream.Seek(0,soEnd);
FOutStream.WriteBuffer({$IFDEF FPC_BIG_ENDIAN}SwapCFH{$ENDIF}(CentralHdr),SizeOf(CentralHdr));
FOutStream.WriteBuffer(ZFileName[1],Length(ZFileName));
if IsZip64 then
begin
FOutStream.Seek(0,soEnd);
@ -1744,7 +1752,7 @@ Begin
Inc(ACount);
// Move past compressed file data to next header:
if Iszip64 then
if LocalZip64Fld.Compressed_Size > 0 then
FOutStream.Seek(SavePos + LocalZip64Fld.Compressed_Size,soBeginning)
else
FOutStream.Seek(SavePos + LocalHdr.Compressed_Size,soBeginning);
@ -2093,7 +2101,7 @@ function TUnZipper.OpenOutput(OutFileName: RawByteString;
Var
Path: RawByteString;
OldDirectorySeparators: set of char;
Begin
{ the default RTL behavior is broken on Unix platforms
for Windows compatibility: it allows both '/' and '\'
@ -2521,7 +2529,10 @@ Begin
end;
end;
// Move past extra fields and file comment to next header
FZipStream.Seek(SavePos+Extra_Field_Length+File_Comment_Length,soFromBeginning);
if File_Comment_Length > 0 then
FZipStream.Seek(File_Comment_Length,soFromCurrent);
// this doesn't work properly when zip file size is over 4Gb, so commented off
//FZipStream.Seek(SavePos+Extra_Field_Length+File_Comment_Length,soFromBeginning);
end;
end;
end;
@ -2605,7 +2616,7 @@ Var
OnProgress:=Self.OnProgress;
OnPercent:=Self.OnPercent;
DeCompress;
Self.FTotPos := FTotPos;
Self.FTotPos := FTotPos;
if Item.CRC32 <> Crc32Val then
raise EZipError.CreateFmt(SErrInvalidCRC,[Item.ArchiveFileName]);
Finally

View File

@ -165,6 +165,8 @@ function Max(a, b: Cardinal): Cardinal; overload;
}
function Min(a, b: Int64): Int64;inline; overload;
function Max(a, b: Int64): Int64;inline; overload;
function Min(a, b: QWord): QWord;inline; overload;
function Max(a, b: QWord): QWord;inline; overload;
{$ifdef FPC_HAS_TYPE_SINGLE}
function Min(a, b: Single): Single;inline; overload;
function Max(a, b: Single): Single;inline; overload;
@ -2056,6 +2058,22 @@ begin
Result := b;
end;
function Min(a, b: QWord): QWord; inline;
begin
if a < b then
Result := a
else
Result := b;
end;
function Max(a, b: QWord): Qword;inline;
begin
if a > b then
Result := a
else
Result := b;
end;
{$ifdef FPC_HAS_TYPE_SINGLE}
function Min(a, b: Single): Single;inline;
begin

View File

@ -1128,7 +1128,7 @@ var
fs : tstatfs;
Begin
if ((Drive in [Low(FixDriveStr)..High(FixDriveStr)]) and (not (fixdrivestr[Drive]=nil)) and (fpstatfs(StrPas(fixdrivestr[drive]),@fs)<>-1)) or
((Drive <= High(drivestr)) and (not (drivestr[Drive]=nil)) and (fpstatfs(StrPas(drivestr[drive]),@fs)<>-1)) then
((Drive in [Low(DriveStr)..High(DriveStr)]) and (not (drivestr[Drive]=nil)) and (fpstatfs(StrPas(drivestr[drive]),@fs)<>-1)) then
Diskfree:=int64(fs.bavail)*int64(fs.bsize)
else
Diskfree:=-1;
@ -1141,7 +1141,7 @@ var
fs : tstatfs;
Begin
if ((Drive in [Low(FixDriveStr)..High(FixDriveStr)]) and (not (fixdrivestr[Drive]=nil)) and (fpstatfs(StrPas(fixdrivestr[drive]),@fs)<>-1)) or
((drive <= High(drivestr)) and (not (drivestr[Drive]=nil)) and (fpstatfs(StrPas(drivestr[drive]),@fs)<>-1)) then
((Drive in [Low(DriveStr)..High(DriveStr)]) and (not (drivestr[Drive]=nil)) and (fpstatfs(StrPas(drivestr[drive]),@fs)<>-1)) then
DiskSize:=int64(fs.blocks)*int64(fs.bsize)
else
DiskSize:=-1;

View File

@ -26,7 +26,8 @@ var
WriteAsciiData,
CompressData,
EnCodeData,
CompileUnit : Boolean;
CompileUnit,
WriteHex : Boolean;
Cryptkey : IDEAcryptKey;
InStream,
MemStream,
@ -39,6 +40,7 @@ begin
Writeln ('Usage: bin2obj [options] -c constname [infile] ');
Writeln ('Where options is a combination of : ');
Writeln (' -a write asciii data instead of bytes');
Writeln (' -x write numerical values as hexadecimal numbers');
Writeln (' -z compress data.');
Writeln (' -e key encrypt data with key (must have 8 characters)');
Writeln (' -o output filename');
@ -62,13 +64,15 @@ begin
UnitName:='';
NeedUnitName:=False;
WriteAsciiData:=False;
WriteHex:=False;
Repeat
c:=GetOpt('ac:e:o:zhu::U::');
c:=GetOpt('ac:e:o:zhu::U::x');
Case C of
'a' : WriteAsciiData:=True;
'c' : ConstName:=OptArg;
'h','?' : usage;
'z' : CompressData := True;
'x' : WriteHex := True;
'e' : begin
EncodeData:=True;
If Length(OptArg)<8 then
@ -209,13 +213,23 @@ begin
begin
MemStream.Read(B,1);
If Not WriteAsciiData then
ToAdd:=Format('%3d',[b])
begin
if WriteHex then
ToAdd:=Format('$%2.2x',[b])
else
ToAdd:=Format('%3d',[b]);
end
else
If (B in [32..127]) and not (B in [10,13,39]) then
ToAdd:=''''+Chr(b)+''''
else
// ToAdd:=Format('''%s''',[Chr(b)]);
ToAdd:=Format('#%d',[B]);
begin
if WriteHex then
ToAdd:=Format('#$%x',[B])
else
ToAdd:=Format('#%d',[B]);
end;
If I<Count then
ToAdd:=ToAdd+',';
Line:=Line+ToAdd;