Dmitry Timoshkov : msi: Limit the progress to its maximal value, use MulDiv for better results.

Alexandre Julliard julliard at winehq.org
Thu Oct 29 11:20:40 CDT 2009


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

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Thu Oct 29 20:46:34 2009 +0800

msi: Limit the progress to its maximal value, use MulDiv for better results.

---

 dlls/msi/dialog.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 3f1b571..88cdfa9 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -606,6 +606,8 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
         func = MSI_RecordGetInteger( rec , 1 );
         val = MSI_RecordGetInteger( rec , 2 );
 
+        TRACE("progress: func %u, val %u\n", func, val);
+
         switch (func)
         {
         case 0: /* init */
@@ -618,10 +620,12 @@ void msi_dialog_handle_event( msi_dialog* dialog, LPCWSTR control,
             break;
         case 2: /* move */
             ctrl->progress_current += val;
-            SendMessageW(ctrl->hwnd, PBM_SETPOS, 100*(ctrl->progress_current/ctrl->progress_max), 0);
+            if (ctrl->progress_current > ctrl->progress_max)
+                ctrl->progress_current = ctrl->progress_max;
+            SendMessageW(ctrl->hwnd, PBM_SETPOS, MulDiv(100, ctrl->progress_current, ctrl->progress_max), 0);
             break;
         default:
-            ERR("Unknown progress message %d\n", func);
+            FIXME("Unknown progress message %u\n", func);
             break;
         }
     }




More information about the wine-cvs mailing list