Kirill K. Smirnov : winhlp32: Use TopicOffset mapping and get rid of unused function.
Alexandre Julliard
julliard at winehq.org
Tue Aug 19 08:47:00 CDT 2008
Module: wine
Branch: master
Commit: 2bca1c86ada7820065179eb757743c36206edd50
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2bca1c86ada7820065179eb757743c36206edd50
Author: Kirill K. Smirnov <lich at math.spbu.ru>
Date: Wed Aug 6 19:50:22 2008 +0400
winhlp32: Use TopicOffset mapping and get rid of unused function.
---
programs/winhlp32/hlpfile.c | 36 ++++++++++++++++--------------------
1 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/programs/winhlp32/hlpfile.c b/programs/winhlp32/hlpfile.c
index e54d3bf..99043ac 100644
--- a/programs/winhlp32/hlpfile.c
+++ b/programs/winhlp32/hlpfile.c
@@ -71,23 +71,6 @@ static BOOL HLPFILE_Uncompress3(HLPFILE*, char*, const char*, const BYTE*, cons
static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE* dst, unsigned dstsz);
static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile);
-/***********************************************************************
- *
- * HLPFILE_PageByNumber
- */
-static HLPFILE_PAGE *HLPFILE_PageByNumber(HLPFILE* hlpfile, UINT wNum)
-{
- HLPFILE_PAGE *page;
- UINT temp = wNum;
-
- WINE_TRACE("<%s>[%u]\n", hlpfile->lpszPath, wNum);
-
- for (page = hlpfile->first_page; page && temp; page = page->next) temp--;
- if (!page)
- WINE_ERR("Page of number %u not found in file %s\n", wNum, hlpfile->lpszPath);
- return page;
-}
-
/******************************************************************
* HLPFILE_PageByOffset
*
@@ -154,8 +137,8 @@ HLPFILE_PAGE *HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash, ULONG* relative)
/* For win 3.0 files hash values are really page numbers */
if (hlpfile->version <= 16)
{
- *relative = 0;
- return HLPFILE_PageByNumber(hlpfile, lHash);
+ if (lHash >= hlpfile->wTOMapLen) return NULL;
+ return HLPFILE_PageByOffset(hlpfile, hlpfile->TOMap[lHash], relative);
}
ptr = HLPFILE_BPTreeSearch(hlpfile->Context, LongToPtr(lHash), comp_PageByHash);
@@ -438,6 +421,19 @@ static BOOL HLPFILE_AddPage(HLPFILE *hlpfile, const BYTE *buf, const BYTE *end,
page->browse_bwd = GET_UINT(buf, 0x19);
page->browse_fwd = GET_UINT(buf, 0x1D);
+ if (hlpfile->version <= 16)
+ {
+ if (page->browse_bwd == 0xFFFF || page->browse_bwd == 0xFFFFFFFF)
+ page->browse_bwd = 0xFFFFFFFF;
+ else
+ page->browse_bwd = hlpfile->TOMap[page->browse_bwd];
+
+ if (page->browse_fwd == 0xFFFF || page->browse_fwd == 0xFFFFFFFF)
+ page->browse_fwd = 0xFFFFFFFF;
+ else
+ page->browse_fwd = hlpfile->TOMap[page->browse_fwd];
+ }
+
WINE_TRACE("Added page[%d]: title='%s' %08x << %08x >> %08x\n",
page->wNumber, page->lpszTitle,
page->browse_bwd, page->offset, page->browse_fwd);
@@ -1439,7 +1435,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd,
case 0xE1:
WINE_WARN("jump topic 1 => %u\n", GET_UINT(format, 1));
HLPFILE_AllocLink(rd, (*format & 1) ? hlp_link_link : hlp_link_popup,
- page->file->lpszPath, -1, GET_UINT(format, 1)-16, 1, -1);
+ page->file->lpszPath, -1, GET_UINT(format, 1), 1, -1);
format += 5;
More information about the wine-cvs
mailing list