Eric Pouech : winhelp: Fixed the parsing of a link containing both a . hlp file and a window name.

Alexandre Julliard julliard at winehq.org
Mon Apr 21 07:46:22 CDT 2008


Module: wine
Branch: master
Commit: 7ceb62f90a308632539d1a76fd7483b2a91b5864
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7ceb62f90a308632539d1a76fd7483b2a91b5864

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Fri Apr 18 21:34:11 2008 +0200

winhelp: Fixed the parsing of a link containing both a .hlp file and a window name.

---

 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 80bf7b8..96542fd 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -1143,28 +1143,33 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
                     char*       ptr = (char*) format + 8;
                     BYTE        type = format[3];
                     int         wnd = -1;
-                    char*       str;
 
-                    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;
                     }
                     HLPFILE_FreeLink(attributes.link);
                     attributes.link = HLPFILE_AllocLink((*format & 4) ? hlp_link_link : hlp_link_popup,
-                                                        str, GET_UINT(format, 4),
+                                                        ptr, GET_UINT(format, 4),
                                                         !(*format & 1), wnd);
                 }
                 format += 3 + GET_USHORT(format, 1);




More information about the wine-cvs mailing list