[PATCH 16/45] [WinHelp]: fixed the parsing of a link containing both a .hlp file and a window name

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




A+
---

 programs/winhelp/hlpfile.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)


diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index 986448b..bc297d9 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -1181,27 +1181,32 @@ BOOL HLPFILE_BrowseParagraph(HLPFILE *hlpfile, struct RtfData* rd, BYTE *buf, BY
                 {
                     char*       ptr = (char*) format + 8;
                     BYTE        type = format[3];
-                    char*       str;
                     int         wnd = -1;
 
-                    if (type == 1) wnd = *ptr++;
-                    if (type == 4 || type == 6)
-                    {
-                        str = ptr;
-                        ptr += strlen(ptr) + 1;
-                    }
-                    else
-                        str = hlpfile->lpszPath;
-                    if (type == 6)
+                    switch (type)
                     {
+                    case 1:
+                        wnd = *ptr;
+                        /* fall through */
+                    case 0:
+                        ptr = hlpfile->lpszPath;
+                        break;
+                    case 6:
                         for (wnd = hlpfile->numWindows - 1; wnd >= 0; wnd--)
                         {
                             if (!strcmp(ptr, hlpfile->windows[wnd].name)) break;
                         }
                         if (wnd == -1)
                             WINE_WARN("Couldn't find window info for %s\n", ptr);
+                        ptr += strlen(ptr) + 1;
+                        /* fall through */
+                    case 4:
+                        break;
+                    default:
+                        WINE_WARN("Unknown link type %d\n", type);
+                        break;
                     }
-                    alloc_link(rd, hlp_link_link, str, GET_UINT(format, 4), wnd);
+                    alloc_link(rd, hlp_link_link, ptr, GET_UINT(format, 4), wnd);
                     rd->force_color = !(*format & 4);
                 }
                 format += 3 + GET_USHORT(format, 1);





More information about the wine-patches mailing list