[PATCH 1/6] strmbase: Fix printing negative values in debugstr_time().

Zebediah Figura z.figura12 at gmail.com
Thu Jan 30 19:05:16 CST 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 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 b03258bc416..4b0468d7c47 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 = llabs(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;
-- 
2.25.0




More information about the wine-devel mailing list