1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-23 16:48:49 -05:00

OS400/ccsidcurl.c: code style fixes

This commit is contained in:
Daniel Stenberg 2019-05-03 23:18:58 +02:00
parent bccf1dce53
commit 0c56faf43d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -94,7 +94,7 @@ iconv_open_CCSID(unsigned int ccsidout, unsigned int ccsidin,
makeOS400IconvCode(fromcode, ccsidin);
makeOS400IconvCode(tocode, ccsidout);
memset(tocode + 13, 0, sizeof tocode - 13); /* Dest. code id format. */
memset(tocode + 13, 0, sizeof(tocode) - 13); /* Dest. code id format. */
if(cstr)
fromcode[18] = '1'; /* Set null-terminator flag. */
@ -254,7 +254,8 @@ curl_version_ccsid(unsigned int ccsid)
i = strlen(aversion) + 1;
i *= MAX_CONV_EXPANSION;
if(!(eversion = Curl_thread_buffer(LK_CURL_VERSION, i)))
eversion = Curl_thread_buffer(LK_CURL_VERSION, i);
if(!eversion)
return (char *) NULL;
if(convert(eversion, i, ccsid, aversion, -1, ASCII_CCSID) < 0)
@ -468,17 +469,17 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
cp = Curl_thread_buffer(LK_VERSION_INFO_DATA, n);
id = (curl_version_info_data *) Curl_thread_buffer(LK_VERSION_INFO,
sizeof *id);
sizeof(*id));
if(!id || !cp)
return (curl_version_info_data *) NULL;
/* Copy data and convert strings. */
memcpy((char *) id, (char *) p, sizeof *p);
memcpy((char *) id, (char *) p, sizeof(*p));
if(id->protocols) {
int i = nproto * sizeof id->protocols[0];
int i = nproto * sizeof(id->protocols[0]);
id->protocols = (const char * const *) cp;
memcpy(cp, (char *) p->protocols, i);
@ -531,7 +532,8 @@ curl_easy_strerror_ccsid(CURLcode error, unsigned int ccsid)
i = MAX_CONV_EXPANSION * (strlen(s) + 1);
if(!(buf = Curl_thread_buffer(LK_EASY_STRERROR, i)))
buf = Curl_thread_buffer(LK_EASY_STRERROR, i);
if(!buf)
return (const char *) NULL;
if(convert(buf, i, ccsid, s, -1, ASCII_CCSID) < 0)
@ -556,7 +558,8 @@ curl_share_strerror_ccsid(CURLSHcode error, unsigned int ccsid)
i = MAX_CONV_EXPANSION * (strlen(s) + 1);
if(!(buf = Curl_thread_buffer(LK_SHARE_STRERROR, i)))
buf = Curl_thread_buffer(LK_SHARE_STRERROR, i);
if(!buf)
return (const char *) NULL;
if(convert(buf, i, ccsid, s, -1, ASCII_CCSID) < 0)
@ -581,7 +584,8 @@ curl_multi_strerror_ccsid(CURLMcode error, unsigned int ccsid)
i = MAX_CONV_EXPANSION * (strlen(s) + 1);
if(!(buf = Curl_thread_buffer(LK_MULTI_STRERROR, i)))
buf = Curl_thread_buffer(LK_MULTI_STRERROR, i);
if(!buf)
return (const char *) NULL;
if(convert(buf, i, ccsid, s, -1, ASCII_CCSID) < 0)
@ -653,7 +657,8 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
case CURLINFO_CERTINFO:
cipf = *(struct curl_certinfo * *) paramp;
if(cipf) {
if(!(cipt = (struct curl_certinfo *) malloc(sizeof *cipt)))
cipt = (struct curl_certinfo *) malloc(sizeof(*cipt));
if(!cipt)
ret = CURLE_OUT_OF_MEMORY;
else {
cipt->certinfo = (struct curl_slist **)
@ -693,9 +698,11 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
default:
slp = (struct curl_slist **) paramp;
if(*slp)
if(!(*slp = slist_convert(ccsid, *slp, ASCII_CCSID)))
if(*slp) {
*slp = slist_convert(ccsid, *slp, ASCII_CCSID);
if(!*slp)
ret = CURLE_OUT_OF_MEMORY;
}
break;
}
}
@ -823,7 +830,7 @@ curl_formadd_ccsid(struct curl_httppost * * httppost,
/* Allocate the local curl_forms array. */
lformlen = ALLOC_GRANULE;
lforms = malloc(lformlen * sizeof *lforms);
lforms = malloc(lformlen * sizeof(*lforms));
if(!lforms)
return CURL_FORMADD_MEMORY;
@ -845,7 +852,7 @@ curl_formadd_ccsid(struct curl_httppost * * httppost,
if(nargs >= lformlen) {
lformlen += ALLOC_GRANULE;
tforms = realloc(lforms, lformlen * sizeof *lforms);
tforms = realloc(lforms, lformlen * sizeof(*lforms));
if(!tforms) {
result = CURL_FORMADD_MEMORY;