Eric Pouech : winhlp32: Fix hlpfile content decompression in phrase40 mode.

Alexandre Julliard julliard at winehq.org
Wed Nov 16 12:46:45 CST 2011


Module: wine
Branch: master
Commit: a494cbb63b6f9bbba11f3da8ffec1e506656f103
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a494cbb63b6f9bbba11f3da8ffec1e506656f103

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Tue Nov 15 22:08:38 2011 +0100

winhlp32: Fix hlpfile content decompression in phrase40 mode.

---

 programs/winhlp32/hlpfile.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/programs/winhlp32/hlpfile.c b/programs/winhlp32/hlpfile.c
index fcdca60..add53e6 100644
--- a/programs/winhlp32/hlpfile.c
+++ b/programs/winhlp32/hlpfile.c
@@ -2358,14 +2358,14 @@ static BOOL HLPFILE_Uncompress_Phrases40(HLPFILE* hlpfile)
     INT dec_size, cpr_size;
     BYTE *buf_idx, *end_idx;
     BYTE *buf_phs, *end_phs;
-    LONG* ptr, mask = 0;
+    ULONG* ptr, mask = 0;
     unsigned int i;
     unsigned short bc, n;
 
     if (!HLPFILE_FindSubFile(hlpfile, "|PhrIndex", &buf_idx, &end_idx) ||
         !HLPFILE_FindSubFile(hlpfile, "|PhrImage", &buf_phs, &end_phs)) return FALSE;
 
-    ptr = (LONG*)(buf_idx + 9 + 28);
+    ptr = (ULONG*)(buf_idx + 9 + 28);
     bc = GET_USHORT(buf_idx, 9 + 24) & 0x0F;
     num = hlpfile->num_phrases = GET_USHORT(buf_idx, 9 + 4);
 
@@ -2400,9 +2400,10 @@ static BOOL HLPFILE_Uncompress_Phrases40(HLPFILE* hlpfile)
         return FALSE;
     }
 
-#define getbit() (ptr += (mask < 0), mask = mask*2 + (mask<=0), (*ptr & mask) != 0)
+#define getbit() ((mask <<= 1) ? (*ptr & mask) != 0: (*++ptr & (mask=1)) != 0)
 
     hlpfile->phrases_offsets[0] = 0;
+    ptr--; /* as we'll first increment ptr because mask is 0 on first getbit() call */
     for (i = 0; i < num; i++)
     {
         for (n = 1; getbit(); n += 1 << bc);




More information about the wine-cvs mailing list