curl / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] curl: Fix compile warning on Fedora-14.

From: <greearb_at_candelatech.com>
Date: Thu, 7 Sep 2017 12:20:07 -0700

From: Ben Greear <greearb_at_candelatech.com>

I guess the compiler is lame, but the end code should be similar
either way. This fixes the warning:

cc1: warnings being treated as errors
mime.c: In function 'escape_string':
mime.c:301:5: error: conversion to 'char' from 'int' may alter its value

[greearb_at_v-f14-64 ~]$ gcc --version
gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)

Signed-off-by: Ben Greear <greearb_at_candelatech.com>

---
 lib/mime.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/mime.c b/lib/mime.c
index 514f6b2..5ed8849 100644
--- a/lib/mime.c
+++ b/lib/mime.c
@@ -298,7 +298,10 @@ static char *escape_string(const char *src, size_t len)
 
     if(c == '"' || c == '\\' || !c)
       dst[i++] = '\\';
-    dst[i++] = c? c: '0';
+    if(c)
+      dst[i++] = c;
+    else
+      dst[i++] = '0';
   }
 
   dst[i] = '\0';
-- 
2.7.5
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-09-07