Eric Pouech : winhelp: Fix trailing space in window name for JumpID macro.

Alexandre Julliard julliard at winehq.org
Mon Jun 14 13:01:15 CDT 2010


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

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Sat Jun 12 21:54:59 2010 +0200

winhelp: Fix trailing space in window name for JumpID macro.

---

 programs/winhlp32/macro.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/programs/winhlp32/macro.c b/programs/winhlp32/macro.c
index cd497ef..f75b63d 100644
--- a/programs/winhlp32/macro.c
+++ b/programs/winhlp32/macro.c
@@ -575,13 +575,17 @@ static void CALLBACK MACRO_JumpID(LPCSTR lpszPathWindow, LPCSTR topic_id)
     if ((ptr = strchr(lpszPathWindow, '>')) != NULL)
     {
         LPSTR   tmp;
-        size_t  sz = ptr - lpszPathWindow;
+        size_t  sz;
 
-        tmp = HeapAlloc(GetProcessHeap(), 0, sz + 1);
+        tmp = HeapAlloc(GetProcessHeap(), 0, strlen(lpszPathWindow) + 1);
         if (tmp)
         {
-            memcpy(tmp, lpszPathWindow, sz);
-            tmp[sz] = '\0';
+            strcpy(tmp, lpszPathWindow);
+            tmp[ptr - lpszPathWindow] = '\0';
+            ptr += tmp - lpszPathWindow; /* ptr now points to '>' in tmp buffer */
+            /* in some cases, we have a trailing space that we need to get rid of */
+            /* FIXME: check if it has to be done in lexer rather than here */
+            for (sz = strlen(ptr + 1); sz >= 1 && ptr[sz] == ' '; sz--) ptr[sz] = '\0';
             MACRO_JumpHash(tmp, ptr + 1, HLPFILE_Hash(topic_id));
             HeapFree(GetProcessHeap(), 0, tmp);
         }




More information about the wine-cvs mailing list