Zebediah Figura : strmbase: Fix printing negative values in debugstr_time().

Alexandre Julliard julliard at winehq.org
Sun Feb 2 12:56:44 CST 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Jan 30 19:05:16 2020 -0600

strmbase: Fix printing negative values in debugstr_time().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/strmbase/strmbase_private.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/strmbase/strmbase_private.h b/dlls/strmbase/strmbase_private.h
index b03258bc41..f9ddcad9a6 100644
--- a/dlls/strmbase/strmbase_private.h
+++ b/dlls/strmbase/strmbase_private.h
@@ -34,15 +34,17 @@
 
 static inline const char *debugstr_time(REFERENCE_TIME time)
 {
+    ULONGLONG abstime = time >= 0 ? time : -time;
     unsigned int i = 0, j = 0;
-    char buffer[22], rev[22];
+    char buffer[23], rev[23];
 
-    while (time || i <= 8)
+    while (abstime || i <= 8)
     {
-        buffer[i++] = '0' + (time % 10);
-        time /= 10;
+        buffer[i++] = '0' + (abstime % 10);
+        abstime /= 10;
         if (i == 7) buffer[i++] = '.';
     }
+    if (time < 0) buffer[i++] = '-';
 
     while (i--) rev[j++] = buffer[i];
     rev[j] = 0;




More information about the wine-cvs mailing list