curl / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH 1/2] urlapi: Fix compiler warning on fedora-17.

From: Ben Greear via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 28 Nov 2018 09:20:44 -0800

From: Ben Greear <greearb_at_candelatech.com>

It seems the compiler there gets confused and thinks a char
gets converted to an int. This fixes the warning and should
be equivalent code.

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

---
 lib/urlapi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/urlapi.c b/lib/urlapi.c
index be9958c..0208412 100644
--- a/lib/urlapi.c
+++ b/lib/urlapi.c
@@ -1265,8 +1265,12 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
       if(plusencode) {
         /* space to plus */
         i = part;
-        for(o = enc; *i; ++o, ++i)
-          *o = (*i == ' ') ? '+' : *i;
+        for(o = enc; *i; ++o, ++i) {
+          if (*i == ' ')
+            *o = '+';
+          else
+            *o = *i;
+        }
         *o = 0; /* zero terminate */
         part = strdup(enc);
         if(!part) {
-- 
2.7.5
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-11-28