[PATCH 2/4] dwrite: Explicitly cast to signed type for abs().

Nikolay Sivov nsivov at codeweavers.com
Tue Mar 30 06:06:16 CDT 2021


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/dwrite/font.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 2fd6ad90f1f..68d3b1256ea 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -3910,16 +3910,17 @@ static BOOL font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA
     weight = font_extract_weight(&tokens, font->weight, &weight_name);
 
     /* resolve weight */
-    if (weight != font->weight) {
+    if (weight != font->weight)
+    {
         if (!(weight < DWRITE_FONT_WEIGHT_NORMAL && font->weight < DWRITE_FONT_WEIGHT_NORMAL) &&
             !(weight > DWRITE_FONT_WEIGHT_MEDIUM && font->weight > DWRITE_FONT_WEIGHT_MEDIUM) &&
             !((weight == DWRITE_FONT_WEIGHT_NORMAL && font->weight == DWRITE_FONT_WEIGHT_MEDIUM) ||
               (weight == DWRITE_FONT_WEIGHT_MEDIUM && font->weight == DWRITE_FONT_WEIGHT_NORMAL)) &&
-            !(abs(weight - font->weight) <= 150 &&
+            !(abs((int)weight - (int)font->weight) <= 150 &&
               font->weight != DWRITE_FONT_WEIGHT_NORMAL &&
               font->weight != DWRITE_FONT_WEIGHT_MEDIUM &&
-              font->weight != DWRITE_FONT_WEIGHT_BOLD)) {
-
+              font->weight != DWRITE_FONT_WEIGHT_BOLD))
+        {
             font->weight = weight;
         }
     }
-- 
2.30.2




More information about the wine-devel mailing list