Browse Source

* stream positioning fix from mantis 12897 as well as some minor style fixing I had lying around

git-svn-id: trunk@13126 -
marco 16 years ago
parent
commit
8c3305824a
2 changed files with 7 additions and 4 deletions
  1. 1 1
      packages/chm/src/chmreader.pas
  2. 6 3
      packages/chm/src/chmwriter.pas

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

@@ -683,7 +683,7 @@ var
     I: Integer;
   begin
     OldPosn := ChunkStream.Position;
-    Posn := ChunkStream.Size-1-SizeOf(Word);
+    Posn := ChunkStream.Size-SizeOf(Word);
     ChunkStream.Position := Posn;
     
     ItemCount := LEToN(ChunkStream.ReadWord);

+ 6 - 3
packages/chm/src/chmwriter.pas

@@ -283,7 +283,8 @@ const
     ParentIndex,
     TmpIndex: TPMGIDirectoryChunk;
   begin
-    with IndexHeader do begin
+    with IndexHeader do 
+    begin
       PMGIsig := PMGI;
       UnusedSpace := NToLE(IndexBlock.FreeSpace);
     end;
@@ -291,10 +292,12 @@ const
     IndexBlock.WriteChunkToStream(FDirectoryListings, ChunkIndex, ShouldFinish);
     IndexBlock.Clear;
     if HeaderSection1.IndexOfRootChunk < 0 then HeaderSection1.IndexOfRootChunk := ChunkIndex;
-    if ShouldFinish then begin;
+    if ShouldFinish then 
+    begin
       HeaderSection1.IndexTreeDepth := 2;
       ParentIndex := IndexBlock.ParentChunk;
-      if ParentIndex <> nil then repeat // the parent index is notified by our child index when to write
+      if ParentIndex <> nil then 
+      repeat // the parent index is notified by our child index when to write
         HeaderSection1.IndexOfRootChunk := ChunkIndex;
         TmpIndex := ParentIndex;
         ParentIndex := ParentIndex.ParentChunk;