Loading packages/OS400/ccsidcurl.c +18 −23 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -167,7 +167,6 @@ dynconvert(int dccsid, const char * s, int slen, int sccsid) char * cp; size_t dlen; int l; int l2; static const char nullbyte = 0; /* Like convert, but the destination is allocated and returned. */ Loading @@ -191,7 +190,7 @@ dynconvert(int dccsid, const char * s, int slen, int sccsid) Since destination code size is unknown, use a conversion to generate terminator. */ l2 = convert(d + l, dlen - l, dccsid, &nullbyte, -1, ASCII_CCSID); int l2 = convert(d + l, dlen - l, dccsid, &nullbyte, -1, ASCII_CCSID); if(l2 < 0) { free(d); Loading @@ -217,10 +216,11 @@ slist_convert(int dccsid, struct curl_slist * from, int sccsid) { struct curl_slist * to = (struct curl_slist *) NULL; char * cp; for(; from; from = from->next) { if(!(cp = dynconvert(dccsid, from->data, -1, sccsid))) { char * cp = dynconvert(dccsid, from->data, -1, sccsid); if(!cp) { curl_slist_free_all(to); return (struct curl_slist *) NULL; } Loading Loading @@ -269,7 +269,7 @@ curl_easy_escape_ccsid(CURL * handle, const char * string, int length, return (char *) NULL; } s = dynconvert(ASCII_CCSID, s, length? length: -1, sccsid); s = dynconvert(ASCII_CCSID, string, length? length: -1, sccsid); if(!s) return (char *) NULL; Loading Loading @@ -300,7 +300,7 @@ curl_easy_unescape_ccsid(CURL * handle, const char * string, int length, return (char *) NULL; } s = dynconvert(ASCII_CCSID, s, length? length: -1, sccsid); s = dynconvert(ASCII_CCSID, string, length? length: -1, sccsid); if(!s) return (char *) NULL; Loading Loading @@ -370,15 +370,13 @@ convert_version_info_string(const char * * stringp, char * * bufp, int * left, unsigned int ccsid) { int l; /* Helper for curl_version_info_ccsid(): convert a string if defined. Result is stored in the `*left'-byte buffer at `*bufp'. `*bufp' and `*left' are updated accordingly. Return 0 if ok, else -1. */ if(*stringp) { l = convert(*bufp, *left, ccsid, *stringp, -1, ASCII_CCSID); int l = convert(*bufp, *left, ccsid, *stringp, -1, ASCII_CCSID); if(l <= 0) return -1; Loading @@ -400,7 +398,6 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid) char * cp; int n; int nproto; int i; curl_version_info_data * id; /* The assertion below is possible, because although the second operand Loading Loading @@ -473,8 +470,9 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid) memcpy((char *) id, (char *) p, sizeof *p); if(id->protocols) { int i = nproto * sizeof id->protocols[0]; id->protocols = (const char * const *) cp; i = nproto * sizeof id->protocols[0]; memcpy(cp, (char *) p->protocols, i); cp += i; n -= i; Loading Loading @@ -589,11 +587,11 @@ void curl_certinfo_free_all(struct curl_certinfo *info) { int i; /* Free all memory used by certificate info. */ if(info) { if(info->certinfo) { int i; for(i = 0; i < info->num_of_certs; i++) curl_slist_free_all(info->certinfo[i]); free((char *) info->certinfo); Loading @@ -612,13 +610,10 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...) CURLcode ret; unsigned int ccsid; char * * cpp; char * s; char * d; struct SessionHandle * data; struct curl_slist * * slp; struct curl_certinfo * cipf; struct curl_certinfo * cipt; int i; /* WARNING: unlike curl_easy_get_info(), the strings returned by this procedure have to be free'ed. */ Loading @@ -634,13 +629,11 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...) case CURLINFO_STRING: ccsid = va_arg(arg, unsigned int); cpp = (char * *) paramp; s = *cpp; if(s) { d = dynconvert(ccsid, s, -1, ASCII_CCSID); *cpp = d; if(*cpp) { *cpp = dynconvert(ccsid, *cpp, -1, ASCII_CCSID); if(!d) if(!*cpp) ret = CURLE_OUT_OF_MEMORY; } Loading @@ -661,6 +654,8 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...) if(!cipt->certinfo) ret = CURLE_OUT_OF_MEMORY; else { int i; cipt->num_of_certs = cipf->num_of_certs; for(i = 0; i < cipf->num_of_certs; i++) if(cipf->certinfo[i]) Loading Loading @@ -1107,7 +1102,6 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...) char * s; char * cp; unsigned int ccsid; size_t len; curl_off_t pfsize; static char testwarn = 1; Loading Loading @@ -1228,6 +1222,7 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...) } else { /* Data length specified. */ size_t len; if(pfsize < 0 || pfsize > SIZE_MAX) { result = CURLE_OUT_OF_MEMORY; Loading packages/OS400/os400sys.c +3 −6 Original line number Diff line number Diff line Loading @@ -94,11 +94,9 @@ static void thdbufdestroy(void * private) { localkey_t i; buffer_t * p; if(private) { p = (buffer_t *) private; buffer_t * p = (buffer_t *) private; localkey_t i; for(i = (localkey_t) 0; i < LK_LAST; i++) { if(p->buf) Loading Loading @@ -1095,14 +1093,13 @@ struct berval * * Curl_ldap_get_values_len_a(void * ld, LDAPMessage * entry, const char * attr) { int i; char * cp; struct berval * * result; cp = (char *) NULL; if(attr) { i = strlen(attr); int i = strlen(attr); if(!(cp = malloc(i + 1))) { ldap_set_lderrno(ld, LDAP_NO_MEMORY, NULL, Loading Loading
packages/OS400/ccsidcurl.c +18 −23 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -167,7 +167,6 @@ dynconvert(int dccsid, const char * s, int slen, int sccsid) char * cp; size_t dlen; int l; int l2; static const char nullbyte = 0; /* Like convert, but the destination is allocated and returned. */ Loading @@ -191,7 +190,7 @@ dynconvert(int dccsid, const char * s, int slen, int sccsid) Since destination code size is unknown, use a conversion to generate terminator. */ l2 = convert(d + l, dlen - l, dccsid, &nullbyte, -1, ASCII_CCSID); int l2 = convert(d + l, dlen - l, dccsid, &nullbyte, -1, ASCII_CCSID); if(l2 < 0) { free(d); Loading @@ -217,10 +216,11 @@ slist_convert(int dccsid, struct curl_slist * from, int sccsid) { struct curl_slist * to = (struct curl_slist *) NULL; char * cp; for(; from; from = from->next) { if(!(cp = dynconvert(dccsid, from->data, -1, sccsid))) { char * cp = dynconvert(dccsid, from->data, -1, sccsid); if(!cp) { curl_slist_free_all(to); return (struct curl_slist *) NULL; } Loading Loading @@ -269,7 +269,7 @@ curl_easy_escape_ccsid(CURL * handle, const char * string, int length, return (char *) NULL; } s = dynconvert(ASCII_CCSID, s, length? length: -1, sccsid); s = dynconvert(ASCII_CCSID, string, length? length: -1, sccsid); if(!s) return (char *) NULL; Loading Loading @@ -300,7 +300,7 @@ curl_easy_unescape_ccsid(CURL * handle, const char * string, int length, return (char *) NULL; } s = dynconvert(ASCII_CCSID, s, length? length: -1, sccsid); s = dynconvert(ASCII_CCSID, string, length? length: -1, sccsid); if(!s) return (char *) NULL; Loading Loading @@ -370,15 +370,13 @@ convert_version_info_string(const char * * stringp, char * * bufp, int * left, unsigned int ccsid) { int l; /* Helper for curl_version_info_ccsid(): convert a string if defined. Result is stored in the `*left'-byte buffer at `*bufp'. `*bufp' and `*left' are updated accordingly. Return 0 if ok, else -1. */ if(*stringp) { l = convert(*bufp, *left, ccsid, *stringp, -1, ASCII_CCSID); int l = convert(*bufp, *left, ccsid, *stringp, -1, ASCII_CCSID); if(l <= 0) return -1; Loading @@ -400,7 +398,6 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid) char * cp; int n; int nproto; int i; curl_version_info_data * id; /* The assertion below is possible, because although the second operand Loading Loading @@ -473,8 +470,9 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid) memcpy((char *) id, (char *) p, sizeof *p); if(id->protocols) { int i = nproto * sizeof id->protocols[0]; id->protocols = (const char * const *) cp; i = nproto * sizeof id->protocols[0]; memcpy(cp, (char *) p->protocols, i); cp += i; n -= i; Loading Loading @@ -589,11 +587,11 @@ void curl_certinfo_free_all(struct curl_certinfo *info) { int i; /* Free all memory used by certificate info. */ if(info) { if(info->certinfo) { int i; for(i = 0; i < info->num_of_certs; i++) curl_slist_free_all(info->certinfo[i]); free((char *) info->certinfo); Loading @@ -612,13 +610,10 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...) CURLcode ret; unsigned int ccsid; char * * cpp; char * s; char * d; struct SessionHandle * data; struct curl_slist * * slp; struct curl_certinfo * cipf; struct curl_certinfo * cipt; int i; /* WARNING: unlike curl_easy_get_info(), the strings returned by this procedure have to be free'ed. */ Loading @@ -634,13 +629,11 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...) case CURLINFO_STRING: ccsid = va_arg(arg, unsigned int); cpp = (char * *) paramp; s = *cpp; if(s) { d = dynconvert(ccsid, s, -1, ASCII_CCSID); *cpp = d; if(*cpp) { *cpp = dynconvert(ccsid, *cpp, -1, ASCII_CCSID); if(!d) if(!*cpp) ret = CURLE_OUT_OF_MEMORY; } Loading @@ -661,6 +654,8 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...) if(!cipt->certinfo) ret = CURLE_OUT_OF_MEMORY; else { int i; cipt->num_of_certs = cipf->num_of_certs; for(i = 0; i < cipf->num_of_certs; i++) if(cipf->certinfo[i]) Loading Loading @@ -1107,7 +1102,6 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...) char * s; char * cp; unsigned int ccsid; size_t len; curl_off_t pfsize; static char testwarn = 1; Loading Loading @@ -1228,6 +1222,7 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...) } else { /* Data length specified. */ size_t len; if(pfsize < 0 || pfsize > SIZE_MAX) { result = CURLE_OUT_OF_MEMORY; Loading
packages/OS400/os400sys.c +3 −6 Original line number Diff line number Diff line Loading @@ -94,11 +94,9 @@ static void thdbufdestroy(void * private) { localkey_t i; buffer_t * p; if(private) { p = (buffer_t *) private; buffer_t * p = (buffer_t *) private; localkey_t i; for(i = (localkey_t) 0; i < LK_LAST; i++) { if(p->buf) Loading Loading @@ -1095,14 +1093,13 @@ struct berval * * Curl_ldap_get_values_len_a(void * ld, LDAPMessage * entry, const char * attr) { int i; char * cp; struct berval * * result; cp = (char *) NULL; if(attr) { i = strlen(attr); int i = strlen(attr); if(!(cp = malloc(i + 1))) { ldap_set_lderrno(ld, LDAP_NO_MEMORY, NULL, Loading