Browse Source

--- Merging r41648 into '.':
U packages/paszlib/src/ziputils.pas
--- Recording mergeinfo for merge of r41648 into '.':
U .
--- Merging r41803 into '.':
U rtl/objpas/sysutils/fmtflt.inc
--- Recording mergeinfo for merge of r41803 into '.':
G .
--- Merging r41807 into '.':
U packages/paszlib/src/zipper.pp
--- Recording mergeinfo for merge of r41807 into '.':
G .
--- Merging r41818 into '.':
U rtl/objpas/classes/cregist.inc
--- Recording mergeinfo for merge of r41818 into '.':
G .

# revisions: 41648,41803,41807,41818
r41648 | michael | 2019-03-09 15:58:53 +0100 (Sat, 09 Mar 2019) | 1 line
Changed paths:
M /trunk/packages/paszlib/src/ziputils.pas

* Fix bug #35211, open mode when unzipping
r41803 | michael | 2019-03-30 16:47:50 +0100 (Sat, 30 Mar 2019) | 1 line
Changed paths:
M /trunk/rtl/objpas/sysutils/fmtflt.inc

* Fix formatfloat in case E not followed by +/- (bug id 35297)
r41807 | michael | 2019-03-31 18:22:10 +0200 (Sun, 31 Mar 2019) | 1 line
Changed paths:
M /trunk/packages/paszlib/src/zipper.pp

* Fix bug ID #35269, patch from Bart Broersma
r41818 | michael | 2019-04-01 19:25:29 +0200 (Mon, 01 Apr 2019) | 1 line
Changed paths:
M /trunk/rtl/objpas/classes/cregist.inc

* Patch from Ondrej Pokorny to make RegisterClassAlias thread-safe

git-svn-id: branches/fixes_3_2@41927 -

marco 6 years ago
parent
commit
d0b2f3852a

+ 19 - 2
packages/paszlib/src/zipper.pp

@@ -633,16 +633,33 @@ Type
 
 
 
 
   constructor TFileStream.Create(const AFileName: rawbytestring; Mode: Word; Rights: Cardinal);
   constructor TFileStream.Create(const AFileName: rawbytestring; Mode: Word; Rights: Cardinal);
+    {$ifdef Windows}
+    function FixLongFilename(const Fn: RawByteString): RawByteString;
+    begin
+      Result := Fn;
+      if (Length(Fn)>MAX_PATH) and not ((Pos('\\?\', Fn)=1) or (Pos('\\.\', Fn)=1) or (Pos('\\?\UNC\', Fn)=1)) then
+        begin
+          if (Pos('\\', Fn)=1) and (length(FN)>2) then
+            Insert('?\UNC\',Result,3)
+          else
+            Result:='\\?\'+Fn;
+        end;
+    end;
+    {$endif}
 
 
   Var
   Var
     H : Thandle;
     H : Thandle;
 
 
   begin
   begin
+    {$ifdef Windows}
+    FFileName:=FixLongFilename(AFileName);
+    {$else}
     FFileName:=AFileName;
     FFileName:=AFileName;
+    {$endif}
     If (Mode and fmCreate) > 0 then
     If (Mode and fmCreate) > 0 then
-      H:=FileCreate(AFileName,Mode,Rights)
+      H:=FileCreate(FFileName,Mode,Rights)
     else
     else
-      H:=FileOpen(AFileName,Mode);
+      H:=FileOpen(FFileName,Mode);
 
 
     If (THandle(H)=feInvalidHandle) then
     If (THandle(H)=feInvalidHandle) then
       If Mode=fmcreate then
       If Mode=fmcreate then

+ 1 - 1
packages/paszlib/src/ziputils.pas

@@ -98,7 +98,7 @@ begin
   fp := nil;
   fp := nil;
   try
   try
     case mode of
     case mode of
-      fopenread: fp  := TFileStream.Create(strpas(filename), fmOpenRead);
+      fopenread: fp  := TFileStream.Create(strpas(filename), fmOpenRead or fmShareDenyWrite);
       fopenwrite: fp := TFileStream.Create(strpas(filename), fmCreate);
       fopenwrite: fp := TFileStream.Create(strpas(filename), fmCreate);
       fappendwrite:
       fappendwrite:
       begin
       begin

+ 8 - 3
rtl/objpas/classes/cregist.inc

@@ -44,9 +44,14 @@ procedure RegisterClassAlias(AClass: TPersistentClass; const Alias: string);
   var
   var
     I : integer;
     I : integer;
   begin
   begin
-    i := ClassAliasList.IndexOf(Alias);
-    if I = -1 then
-      ClassAliasList.AddObject( Alias, TObject(AClass) );
+    ClassList.LockList;
+    try
+      i := ClassAliasList.IndexOf(Alias);
+      if I = -1 then
+        ClassAliasList.AddObject( Alias, TObject(AClass) );
+    finally
+      ClassList.UnlockList;
+    end;
   end;
   end;
 
 
 
 

+ 12 - 9
rtl/objpas/sysutils/fmtflt.inc

@@ -369,18 +369,21 @@ begin
       'e', 'E':
       'e', 'E':
         begin
         begin
         ToResult(C); // Always needed
         ToResult(C); // Always needed
-        Inc(I);
-        if I<=Section.Length then
+        if IsScientific then
           begin
           begin
-          C:=Section[I];
-          if (C in ['+','-']) then
+          Inc(I);
+          if I<=Section.Length then
             begin
             begin
-            AddToResult(FormatExponent(C,FV.Exponent-DecimalPos+1));
-            // Skip rest
-            while (I<SectionLength) and (Section[i+1]='0') do
-              Inc(I);
+            C:=Section[I];
+            if (C in ['+','-']) then
+              begin
+              AddToResult(FormatExponent(C,FV.Exponent-DecimalPos+1));
+              // Skip rest
+              while (I<SectionLength) and (Section[i+1]='0') do
+                Inc(I);
+              end;
             end;
             end;
-          end;
+          end;  
         end;
         end;
       else
       else
         ToResult(C);
         ToResult(C);