curl-library
Re: [PATCH] curl: Fix compile warning on Fedora-14.
From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 16 Sep 2017 23:52:28 +0200 (CEST)
Date: Sat, 16 Sep 2017 23:52:28 +0200 (CEST)
On Mon, 11 Sep 2017, Ben Greear wrote:
> This compiles w/out warnings on my Fedora-14 machine. I added braces and
> replaced the , with semi colons.
What about this alternative take. Instead make the loop look like:
for(i = 0; len; len--) {
char c = *src++;
if(c == '"' || c == '\\' || !c) {
dst[i++] = '\\';
if(!c)
c = '0';
}
dst[i++] = c;
}
--- The patch for this is like: diff --git a/lib/mime.c b/lib/mime.c index 9f3d40f1a..312094d7f 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -294,13 +294,16 @@ static char *escape_string(const char *src, size_t len) return NULL; for(i = 0; len; len--) { char c = *src++; - if(c == '"' || c == '\\' || !c) + if(c == '"' || c == '\\' || !c) { dst[i++] = '\\'; - dst[i++] = c? c: '0'; + if(!c) + c = '0'; + } + dst[i++] = c; } dst[i] = '\0'; return dst; } -- / daniel.haxx.se ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2017-09-16