[PATCH 09/45] [WinHelp]: get rid of old handling for links

Eric Pouech eric.pouech at orange.fr
Sun Mar 23 04:18:01 CDT 2008




A+
---

 programs/winhelp/hlpfile.c |   70 --------------------------------------------
 programs/winhelp/hlpfile.h |   14 ---------
 2 files changed, 0 insertions(+), 84 deletions(-)


diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index acca8ab..d320aaf 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -57,7 +57,6 @@ static struct
     UINT                wIndent;
     UINT                wHSpace;
     UINT                wVSpace;
-    HLPFILE_LINK*       link;
 } attributes;
 
 static BOOL  HLPFILE_DoReadHlpFile(HLPFILE*, LPCSTR);
@@ -815,37 +814,6 @@ static  BOOL    HLPFILE_LoadGfxByIndex(HLPFILE *hlpfile, unsigned index,
     return ret;
 }
 
-/******************************************************************
- *		HLPFILE_AllocLink
- *
- *
- */
-static HLPFILE_LINK*       HLPFILE_AllocLink(int cookie, const char* str, LONG hash,
-                                             BOOL clrChange, unsigned wnd)
-{
-    HLPFILE_LINK*  link;
-    char*          link_str;
-
-    /* FIXME: should build a string table for the attributes.link.lpszPath
-     * they are reallocated for each link
-     */
-    link = HeapAlloc(GetProcessHeap(), 0, sizeof(HLPFILE_LINK) + strlen(str) + 1);
-    if (!link) return NULL;
-
-    link->cookie     = cookie;
-    link->lpszString = link_str = (char*)link + sizeof(HLPFILE_LINK);
-    strcpy(link_str, str);
-    link->lHash      = hash;
-    link->bClrChange = clrChange ? 1 : 0;
-    link->window     = wnd;
-    link->wRefCount   = 1;
-
-    WINE_TRACE("Link[%d] to %s@%08x:%d\n",
-               link->cookie, link->lpszString, 
-               link->lHash, link->window);
-    return link;
-}
-
 /***********************************************************************
  *
  *           HLPFILE_AddParagraph
@@ -961,8 +929,6 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
                 paragraphptr = &paragraph->next;
 
                 paragraph->next            = NULL;
-                paragraph->link            = attributes.link;
-                if (paragraph->link) paragraph->link->wRefCount++;
                 paragraph->cookie          = para_normal_text;
                 paragraph->u.text.wFont    = attributes.wFont;
                 paragraph->u.text.wVSpace  = attributes.wVSpace;
@@ -1042,8 +1008,6 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
                     paragraphptr = &paragraph->next;
 
                     paragraph->next        = NULL;
-                    paragraph->link        = attributes.link;
-                    if (paragraph->link) paragraph->link->wRefCount++;
                     paragraph->cookie      = para_bitmap;
                     paragraph->u.gfx.pos   = pos;
                     switch (type)
@@ -1084,8 +1048,6 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
                 break;
 
 	    case 0x89:
-                HLPFILE_FreeLink(attributes.link);
-                attributes.link = NULL;
                 format += 1;
                 break;
 
@@ -1104,22 +1066,12 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
             case 0xC8:
             case 0xCC:
                 WINE_TRACE("macro => %s\n", format + 3);
-                HLPFILE_FreeLink(attributes.link);
-                attributes.link = HLPFILE_AllocLink(hlp_link_macro, (const char*)format + 3, 
-                                                    0, !(*format & 4), -1);
                 format += 3 + GET_USHORT(format, 1);
                 break;
 
             case 0xE0:
             case 0xE1:
                 WINE_WARN("jump topic 1 => %u\n", GET_UINT(format, 1));
-                HLPFILE_FreeLink(attributes.link);
-                attributes.link = HLPFILE_AllocLink((*format & 1) ? hlp_link_link : hlp_link_popup,
-                                                    hlpfile->lpszPath,
-                                                    GET_UINT(format, 1)-16,
-                                                    1, -1);
-
-
                 format += 5;
                 break;
 
@@ -1127,11 +1079,6 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
 	    case 0xE3:
             case 0xE6:
             case 0xE7:
-                HLPFILE_FreeLink(attributes.link);
-                attributes.link = HLPFILE_AllocLink((*format & 1) ? hlp_link_link : hlp_link_popup,
-                                                    hlpfile->lpszPath, 
-                                                    GET_UINT(format, 1), 
-                                                    !(*format & 4), -1);
                 format += 5;
                 break;
 
@@ -1162,10 +1109,6 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
                         if (wnd == -1)
                             WINE_WARN("Couldn't find window info for %s\n", ptr);
                     }
-                    HLPFILE_FreeLink(attributes.link);
-                    attributes.link = HLPFILE_AllocLink((*format & 4) ? hlp_link_link : hlp_link_popup,
-                                                        str, GET_UINT(format, 4),
-                                                        !(*format & 1), wnd);
                 }
                 format += 3 + GET_USHORT(format, 1);
                 break;
@@ -2065,17 +2008,6 @@ static BOOL HLPFILE_GetMap(HLPFILE *hlpfile)
     return TRUE;
 }
 
-/******************************************************************
- *		HLPFILE_DeleteLink
- *
- *
- */
-void HLPFILE_FreeLink(HLPFILE_LINK* link)
-{
-    if (link && !--link->wRefCount)
-        HeapFree(GetProcessHeap(), 0, link);
-}
-
 /***********************************************************************
  *
  *           HLPFILE_DeleteParagraph
@@ -2091,8 +2023,6 @@ static void HLPFILE_DeleteParagraph(HLPFILE_PARAGRAPH* paragraph)
         if (paragraph->cookie == para_metafile)
             DeleteMetaFile(paragraph->u.gfx.u.mfp.hMF);
 
-        HLPFILE_FreeLink(paragraph->link);
-
         HeapFree(GetProcessHeap(), 0, paragraph);
         paragraph = next;
     }
diff --git a/programs/winhelp/hlpfile.h b/programs/winhelp/hlpfile.h
index 4d4dfce..87f7224 100644
--- a/programs/winhelp/hlpfile.h
+++ b/programs/winhelp/hlpfile.h
@@ -35,16 +35,6 @@ typedef struct
     COLORREF    nsr_color;      /* color for non scrollable region */
 } HLPFILE_WINDOWINFO;
 
-typedef struct
-{
-    enum {hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
-    LPCSTR      lpszString;     /* name of the file to for the link (NULL if same file) */
-    LONG        lHash;          /* topic index */
-    unsigned    bClrChange : 1, /* true if the link is green & underlined */
-                wRefCount;      /* number of internal references to this object */
-    unsigned    window;         /* window number for displaying the link (-1 is current) */
-} HLPFILE_LINK;
-
 enum para_type {para_normal_text, para_debug_text, para_bitmap, para_metafile};
 
 typedef struct tagHlpFileParagraph
@@ -74,9 +64,6 @@ typedef struct tagHlpFileParagraph
             } u;
         } gfx; /* for bitmaps and metafiles */
     } u;
-
-    HLPFILE_LINK*               link;
-
     struct tagHlpFileParagraph* next;
 } HLPFILE_PARAGRAPH;
 
@@ -191,7 +178,6 @@ HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash);
 HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap);
 HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset);
 LONG          HLPFILE_Hash(LPCSTR lpszContext);
-void          HLPFILE_FreeLink(HLPFILE_LINK* link);
 void          HLPFILE_FreeHlpFile(HLPFILE*);
 
 void* HLPFILE_BPTreeSearch(BYTE*, const void*, HLPFILE_BPTreeCompare);





More information about the wine-patches mailing list