Module: wine Branch: stable Commit: 51e25fb82d0e246a3f5a016b3588698b2f084420 URL: http://source.winehq.org/git/wine.git/?a=commit;h=51e25fb82d0e246a3f5a016b35...
Author: Jean-Christophe Cardot wine@cardot.net Date: Sun Apr 10 22:06:07 2016 +0200
winhlp32: Replace magic numbers by symbols.
Signed-off-by: Jean-Christophe Cardot wine@cardot.net Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 58f16273c307a240d7c149adbd2f9f7ced0e5d70) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
programs/winhlp32/hlpfile.c | 24 ++++++++++++------------ programs/winhlp32/hlpfile.h | 5 +++++ 2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/programs/winhlp32/hlpfile.c b/programs/winhlp32/hlpfile.c index 3669d11..bc422d3 100644 --- a/programs/winhlp32/hlpfile.c +++ b/programs/winhlp32/hlpfile.c @@ -1270,13 +1270,13 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, format = buf + 0x15; format_end = buf + GET_UINT(buf, 0x10);
- if (buf[0x14] == 0x20 || buf[0x14] == 0x23) + if (buf[0x14] == HLP_DISPLAY || buf[0x14] == HLP_TABLE) { fetch_long(&format); *parlen = fetch_ushort(&format); }
- if (buf[0x14] == 0x23) + if (buf[0x14] == HLP_TABLE) { char type;
@@ -1338,7 +1338,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, if (!HLPFILE_RtfAddControl(rd, "\intbl")) goto done; } else nc++; - if (buf[0x14] == 0x01) + if (buf[0x14] == HLP_DISPLAY30) format += 6; else format += 4; @@ -1811,12 +1811,12 @@ BOOL HLPFILE_BrowsePage(HLPFILE_PAGE* page, struct RtfData* rd,
switch (buf[0x14]) { - case 0x02: + case HLP_TOPICHDR: if (count++) goto done; break; - case 0x01: - case 0x20: - case 0x23: + case HLP_DISPLAY30: + case HLP_DISPLAY: + case HLP_TABLE: if (!HLPFILE_BrowseParagraph(page, rd, buf, end, &parlen)) return FALSE; if (relative > index * 0x8000 + offs) rd->char_pos_rel = rd->char_pos; @@ -2617,7 +2617,7 @@ static BOOL HLPFILE_SkipParagraph(HLPFILE *hlpfile, const BYTE *buf, const BYTE if (buf + 0x19 > end) {WINE_WARN("header too small\n"); return FALSE;};
tmp = buf + 0x15; - if (buf[0x14] == 0x20 || buf[0x14] == 0x23) + if (buf[0x14] == HLP_DISPLAY || buf[0x14] == HLP_TABLE) { fetch_long(&tmp); *len = fetch_ushort(&tmp); @@ -2692,7 +2692,7 @@ static BOOL HLPFILE_DoReadHlpFile(HLPFILE *hlpfile, LPCSTR lpszPath)
switch (buf[0x14]) { - case 0x02: + case HLP_TOPICHDR: /* Topic Header */ if (hlpfile->version <= 16) topicoffset = ref + index * 12; else @@ -2700,9 +2700,9 @@ static BOOL HLPFILE_DoReadHlpFile(HLPFILE *hlpfile, LPCSTR lpszPath) if (!HLPFILE_AddPage(hlpfile, buf, end, ref, topicoffset)) return FALSE; break;
- case 0x01: - case 0x20: - case 0x23: + case HLP_DISPLAY30: + case HLP_DISPLAY: + case HLP_TABLE: if (!HLPFILE_SkipParagraph(hlpfile, buf, end, &len)) return FALSE; offs += len; break; diff --git a/programs/winhlp32/hlpfile.h b/programs/winhlp32/hlpfile.h index c3fa4b0..6c40c3a 100644 --- a/programs/winhlp32/hlpfile.h +++ b/programs/winhlp32/hlpfile.h @@ -199,3 +199,8 @@ struct RtfData {
BOOL HLPFILE_BrowsePage(HLPFILE_PAGE*, struct RtfData* rd, unsigned font_scale, unsigned relative); + +#define HLP_DISPLAY30 0x01 /* version 3.0 displayable information */ +#define HLP_TOPICHDR 0x02 /* topic header information */ +#define HLP_DISPLAY 0x20 /* version 3.1 displayable information */ +#define HLP_TABLE 0x23 /* version 3.1 table */