[PATCH 10/45] [WinHelp]: removed all paragraph related code

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




A+
---

 programs/winhelp/hlpfile.c |   74 ++++----------------------------------------
 programs/winhelp/hlpfile.h |   33 --------------------
 2 files changed, 6 insertions(+), 101 deletions(-)


diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index d320aaf..b86d68e 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -51,14 +51,6 @@ static inline unsigned GET_UINT(const BYTE* buffer, unsigned i)
 
 static HLPFILE *first_hlpfile = 0;
 
-static struct
-{
-    UINT                wFont;
-    UINT                wIndent;
-    UINT                wHSpace;
-    UINT                wVSpace;
-} attributes;
-
 static BOOL  HLPFILE_DoReadHlpFile(HLPFILE*, LPCSTR);
 static BOOL  HLPFILE_ReadFileToBuffer(HLPFILE*, HFILE);
 static BOOL  HLPFILE_FindSubFile(HLPFILE*, LPCSTR, BYTE**, BYTE**);
@@ -428,7 +420,6 @@ static BOOL HLPFILE_AddPage(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigned off
 
     page->file            = hlpfile;
     page->next            = NULL;
-    page->first_paragraph = NULL;
     page->first_macro     = NULL;
     page->wNumber         = GET_UINT(buf, 0x21);
     page->offset          = offset;
@@ -440,8 +431,6 @@ static BOOL HLPFILE_AddPage(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigned off
                page->wNumber, page->lpszTitle, 
                page->browse_bwd, page->offset, page->browse_fwd);
 
-    memset(&attributes, 0, sizeof(attributes));
-
     /* now load macros */
     ptr = page->lpszTitle + strlen(page->lpszTitle) + 1;
     while (ptr < page->lpszTitle + titlesize)
@@ -592,6 +581,7 @@ static BYTE*    HLPFILE_DecompressGfx(BYTE* src, unsigned csz, unsigned sz, BYTE
     return dst;
 }
 
+#if 0
 /******************************************************************
  *		HLPFILE_LoadBitmap
  *
@@ -813,6 +803,7 @@ static  BOOL    HLPFILE_LoadGfxByIndex(HLPFILE *hlpfile, unsigned index,
     }
     return ret;
 }
+#endif
 
 /***********************************************************************
  *
@@ -821,7 +812,6 @@ static  BOOL    HLPFILE_LoadGfxByIndex(HLPFILE *hlpfile, unsigned index,
 static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigned* len)
 {
     HLPFILE_PAGE      *page;
-    HLPFILE_PARAGRAPH *paragraph, **paragraphptr;
     UINT               textsize;
     BYTE              *format, *format_end;
     char              *text, *text_base, *text_end;
@@ -831,8 +821,6 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
 
     if (!hlpfile->last_page) {WINE_WARN("no page\n"); return FALSE;};
     page = hlpfile->last_page;
-    for (paragraphptr = &page->first_paragraph; *paragraphptr;
-         paragraphptr = &(*paragraphptr)->next) /* Nothing */;
 
     if (buf + 0x19 > end) {WINE_WARN("header too small\n"); return FALSE;};
 
@@ -922,23 +910,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
             textsize = strlen(text) + 1;
             if (textsize > 1)
             {
-                paragraph = HeapAlloc(GetProcessHeap(), 0,
-                                      sizeof(HLPFILE_PARAGRAPH) + textsize);
-                if (!paragraph) return FALSE;
-                *paragraphptr = paragraph;
-                paragraphptr = &paragraph->next;
-
-                paragraph->next            = NULL;
-                paragraph->cookie          = para_normal_text;
-                paragraph->u.text.wFont    = attributes.wFont;
-                paragraph->u.text.wVSpace  = attributes.wVSpace;
-                paragraph->u.text.wHSpace  = attributes.wHSpace;
-                paragraph->u.text.wIndent  = attributes.wIndent;
-                paragraph->u.text.lpszText = (char*)paragraph + sizeof(HLPFILE_PARAGRAPH);
-                strcpy(paragraph->u.text.lpszText, text);
-
-                attributes.wVSpace = 0;
-                attributes.wHSpace = 0;
+
             }
             /* else: null text, keep on storing attributes */
             text += textsize;
@@ -963,24 +935,19 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
                 break;
 
 	    case 0x80:
-                attributes.wFont = GET_USHORT(format, 1);
-                WINE_TRACE("Changing font to %d\n", attributes.wFont);
+                WINE_TRACE("Changing font to %d\n", GET_USHORT(format, 1));
                 format += 3;
                 break;
 
 	    case 0x81:
-                attributes.wVSpace++;
                 format += 1;
                 break;
 
 	    case 0x82:
-                attributes.wVSpace++;
-                attributes.wIndent = 0;
                 format += 1;
                 break;
 
 	    case 0x83:
-                attributes.wIndent++;
                 format += 1;
                 break;
 
@@ -1001,21 +968,13 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
                     format += 2;
                     size = fetch_long(&format);
 
-                    paragraph = HeapAlloc(GetProcessHeap(), 0,
-                                          sizeof(HLPFILE_PARAGRAPH) + textsize);
-                    if (!paragraph) return FALSE;
-                    *paragraphptr = paragraph;
-                    paragraphptr = &paragraph->next;
-
-                    paragraph->next        = NULL;
-                    paragraph->cookie      = para_bitmap;
-                    paragraph->u.gfx.pos   = pos;
                     switch (type)
                     {
                     case 0x22:
                         fetch_ushort(&format); /* hot spot */
                         /* fall thru */
                     case 0x03:
+#if 0
                         switch (GET_SHORT(format, 0))
                         {
                         case 0:
@@ -1033,6 +992,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
                             WINE_FIXME("??? %u\n", GET_SHORT(format, 0));
                             break;
                         }
+#endif
                         break;
                     case 0x05:
                         WINE_FIXME("Got an embedded element %s\n", format + 6);
@@ -1041,7 +1001,6 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
                         WINE_FIXME("Got a type %d picture\n", type);
                         break;
                     }
-                    if (attributes.wVSpace) paragraph->u.gfx.pos |= 0x8000;
 
                     format += size;
                 }
@@ -2010,26 +1969,6 @@ static BOOL HLPFILE_GetMap(HLPFILE *hlpfile)
 
 /***********************************************************************
  *
- *           HLPFILE_DeleteParagraph
- */
-static void HLPFILE_DeleteParagraph(HLPFILE_PARAGRAPH* paragraph)
-{
-    HLPFILE_PARAGRAPH* next;
-
-    while (paragraph)
-    {
-        next = paragraph->next;
-
-        if (paragraph->cookie == para_metafile)
-            DeleteMetaFile(paragraph->u.gfx.u.mfp.hMF);
-
-        HeapFree(GetProcessHeap(), 0, paragraph);
-        paragraph = next;
-    }
-}
-
-/***********************************************************************
- *
  *           DeleteMacro
  */
 static void HLPFILE_DeleteMacro(HLPFILE_MACRO* macro)
@@ -2055,7 +1994,6 @@ static void HLPFILE_DeletePage(HLPFILE_PAGE* page)
     while (page)
     {
         next = page->next;
-        HLPFILE_DeleteParagraph(page->first_paragraph);
         HLPFILE_DeleteMacro(page->first_macro);
         HeapFree(GetProcessHeap(), 0, page);
         page = next;
diff --git a/programs/winhelp/hlpfile.h b/programs/winhelp/hlpfile.h
index 87f7224..777d12f 100644
--- a/programs/winhelp/hlpfile.h
+++ b/programs/winhelp/hlpfile.h
@@ -35,38 +35,6 @@ typedef struct
     COLORREF    nsr_color;      /* color for non scrollable region */
 } HLPFILE_WINDOWINFO;
 
-enum para_type {para_normal_text, para_debug_text, para_bitmap, para_metafile};
-
-typedef struct tagHlpFileParagraph
-{
-    enum para_type              cookie;
-
-    union
-    {
-        struct
-        {
-            LPSTR                       lpszText;
-            unsigned                    wFont;
-            unsigned                    wIndent;
-            unsigned                    wHSpace;
-            unsigned                    wVSpace;
-        } text;
-        struct
-        {
-            unsigned                    pos;    /* 0: center, 1: left, 2: right */
-            union 
-            {
-                struct 
-                {
-                    HBITMAP             hBitmap;
-                } bmp;
-                METAFILEPICT            mfp;
-            } u;
-        } gfx; /* for bitmaps and metafiles */
-    } u;
-    struct tagHlpFileParagraph* next;
-} HLPFILE_PARAGRAPH;
-
 typedef struct tagHlpFileMacro
 {
     LPCSTR                      lpszMacro;
@@ -76,7 +44,6 @@ typedef struct tagHlpFileMacro
 typedef struct tagHlpFilePage
 {
     LPSTR                       lpszTitle;
-    HLPFILE_PARAGRAPH*          first_paragraph;
     HLPFILE_MACRO*              first_macro;
 
     unsigned                    wNumber;





More information about the wine-patches mailing list