Browse Source

--- Merging r22153 into '.':
U packages/fcl-process/src/unix/process.inc
--- Merging r22285 into '.':
U packages/paszlib/src/zipper.pp
--- Merging r22324 into '.':
G packages/fcl-process/src/unix/process.inc
--- Merging r22355 into '.':
U packages/winunits-base/src/activex.pp
--- Merging r22499 into '.':
U packages/chm/src/chmfiftimain.pas
U packages/chm/src/chmreader.pas

# revisions: 22153,22285,22324,22355,22499
r22153 | michael | 2012-08-21 00:29:08 +0200 (Tue, 21 Aug 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-process/src/unix/process.inc

* Set terminal correctly (fix for 21028)
r22285 | nickysn | 2012-09-02 19:46:16 +0200 (Sun, 02 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/paszlib/src/zipper.pp

+ TZipper: added support for zip file comments
r22324 | michael | 2012-09-05 13:37:48 +0200 (Wed, 05 Sep 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-process/src/unix/process.inc

* improved KDE detection
r22355 | marco | 2012-09-08 12:49:26 +0200 (Sat, 08 Sep 2012) | 2 lines
Changed paths:
M /trunk/packages/winunits-base/src/activex.pp

* Size_t (IMalloc interface mainly) to PTRUINT, mantis #22835
r22499 | marco | 2012-09-28 22:04:00 +0200 (Fri, 28 Sep 2012) | 3 lines
Changed paths:
M /trunk/packages/chm/src/chmfiftimain.pas
M /trunk/packages/chm/src/chmreader.pas

* some potential rangecheck errors fixed, Mantis #22933, suggested fixes
by Anton

git-svn-id: branches/fixes_2_6@22637 -

marco 13 years ago
parent
commit
109b50bcda

+ 2 - 1
packages/chm/src/chmfiftimain.pas

@@ -821,7 +821,8 @@ begin
   if CopyLastWordCharCount > 0 then
     Result := Copy(ALastWord, 1, CopyLastWordCharCount);
   SetLength(Result, (WordLength-1) + CopyLastWordCharCount);
-  FStream.Read(Result[1+CopyLastWordCharCount], WordLength-1);
+  if WordLength > 1 then
+    FStream.Read(Result[1+CopyLastWordCharCount], WordLength-1);
 end;
 
 function TChmSearchReader.ReadIndexNodeEntry (ALastWord: String;  out AWord: String; out

+ 1 - 1
packages/chm/src/chmreader.pas

@@ -277,7 +277,7 @@ procedure TChmReader.ReadCommonData;
      repeat
        Stream.Read(buf, 50);
        Result := Result + buf;
-     until Pos(#0, buf) > -1;
+     until IndexByte(buf, 50, 0) <> -1;
      if FixURL then
        Result := StringReplace(Result, '\', '/', [rfReplaceAll]);
    end;

+ 4 - 4
packages/fcl-process/src/unix/process.inc

@@ -99,6 +99,8 @@ Function DetectXterm : String;
 
   begin
     Result:=FileSearch(s,GetEnvironmentVariable('PATH'),False)<>'';
+    If Result then
+      XTermProgram:=S;
   end;
 
   Function TestTerminals(Terminals : Array of String) : Boolean;
@@ -111,9 +113,7 @@ Function DetectXterm : String;
     While (Not Result) and (I<=High(Terminals)) do
       begin
       Result:=TestTerminal(Terminals[i]);
-      If Result then
-        XTermProgram:=Terminals[i];
-       inc(i);
+      inc(i);
       end;
   end;
 
@@ -136,7 +136,7 @@ begin
     if (XTermProgram='') then
       begin
       D:=LowerCase(GetEnvironmentVariable('DESKTOP_SESSION'));
-      If (D='kde') then
+      If (Pos('kde',D)<>0) then
         begin
         TestTerminal('konsole');
         end

+ 5 - 1
packages/paszlib/src/zipper.pp

@@ -309,6 +309,7 @@ Type
     FZipping    : Boolean;
     FBufSize    : LongWord;
     FFileName   :  String;         { Name of resulting Zip file                 }
+    FFileComment: String;
     FFiles      : TStrings;
     FInMemSize  : Integer;
     FOutStream  : TStream;
@@ -352,6 +353,7 @@ Type
     Property OnStartFile : TOnStartFileEvent Read FOnStartFile Write FOnStartFile;
     Property OnEndFile : TOnEndOfFileEvent Read FOnEndOfFile Write FOnEndOfFile;
     Property FileName : String Read FFileName Write SetFileName;
+    Property FileComment: String Read FFileComment Write FFileComment;
     // Deprecated. Use Entries.AddFileEntry(FileName) or Entries.AddFileEntries(List) instead.
     Property Files : TStrings Read FFiles; deprecated;
     Property InMemSize : Integer Read FInMemSize Write FInMemSize;
@@ -1382,8 +1384,10 @@ Begin
      Total_Entries := ACount;
      Central_Dir_Size := FOutStream.Size-CenDirPos;
      Start_Disk_Offset := CenDirPos;
-     ZipFile_Comment_Length := 0;
+     ZipFile_Comment_Length := Length(FFileComment);
      FOutStream.WriteBuffer({$IFDEF FPC_BIG_ENDIAN}SwapECD{$ENDIF}(EndHdr), SizeOf(EndHdr));
+     if Length(FFileComment) > 0 then
+       FOutStream.WriteBuffer(FFileComment[1],Length(FFileComment));
      end;
 end;
 

+ 1 - 1
packages/winunits-base/src/activex.pp

@@ -44,7 +44,7 @@ type
    pFMTID = pGUID;
 
    { Glue types, should be linked to the proper windows unit types}
-   Size_t              = DWord;       {??, probably, like Unix, typecastable to pointer?!?}
+   Size_t              = PTRUINT;       {??, probably, like Unix, typecastable to pointer?!?}
    OleChar             = WChar;
    LPOLESTR            = ^OLECHAR;
    POLECHAR            = LPOLESTR;