Eric Pouech : winhelp: Store the history in correct order.

Alexandre Julliard julliard at winehq.org
Wed Apr 23 07:59:28 CDT 2008


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

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Tue Apr 22 21:59:45 2008 +0200

winhelp: Store the history in correct order.

---

 programs/winhelp/winhelp.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index e0f2532..e5860fa 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -491,16 +491,17 @@ static void     WINHELP_AddHistory(WINHELP_WINDOW* win, HLPFILE_PAGE* page)
     if (i == Globals.history.index)
     {
         num = sizeof(Globals.history.set) / sizeof(Globals.history.set[0]);
+        /* we're full, remove latest entry */
         if (Globals.history.index == num)
         {
-            /* we're full, remove latest entry */
-            HLPFILE_FreeHlpFile(Globals.history.set[0].page->file);
-            memmove(&Globals.history.set[0], &Globals.history.set[1],
-                    (num - 1) * sizeof(Globals.history.set[0]));
+            HLPFILE_FreeHlpFile(Globals.history.set[num - 1].page->file);
             Globals.history.index--;
         }
-        Globals.history.set[Globals.history.index].page = page;
-        Globals.history.set[Globals.history.index++].wininfo = win->info;
+        memmove(&Globals.history.set[1], &Globals.history.set[0],
+                Globals.history.index * sizeof(Globals.history.set[0]));
+        Globals.history.set[0].page = page;
+        Globals.history.set[0].wininfo = win->info;
+        Globals.history.index++;
         page->file->wRefCount++;
         if (win->hHistoryWnd) InvalidateRect(win->hHistoryWnd, NULL, TRUE);
     }
@@ -1297,7 +1298,8 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
 
         for (i = 0; i < Globals.history.index; i++)
         {
-            TextOut(hDc, 0, i * tm.tmHeight, Globals.history.set[i].page->lpszTitle,
+            TextOut(hDc, 0, i * tm.tmHeight,
+                    Globals.history.set[i].page->lpszTitle,
                     strlen(Globals.history.set[i].page->lpszTitle));
         }
         EndPaint(hWnd, &ps);




More information about the wine-cvs mailing list