mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 08:38:49 -05:00
OS400/ccsidcurl.c: code style fixes
This commit is contained in:
parent
bccf1dce53
commit
0c56faf43d
@ -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. */
|
||||
@ -104,8 +104,8 @@ iconv_open_CCSID(unsigned int ccsidout, unsigned int ccsidin,
|
||||
|
||||
|
||||
static int
|
||||
convert(char * d, size_t dlen, int dccsid,
|
||||
const char * s, int slen, int sccsid)
|
||||
convert(char *d, size_t dlen, int dccsid,
|
||||
const char *s, int slen, int sccsid)
|
||||
|
||||
{
|
||||
int i;
|
||||
@ -161,11 +161,11 @@ convert(char * d, size_t dlen, int dccsid,
|
||||
|
||||
|
||||
static char *
|
||||
dynconvert(int dccsid, const char * s, int slen, int sccsid)
|
||||
dynconvert(int dccsid, const char *s, int slen, int sccsid)
|
||||
|
||||
{
|
||||
char * d;
|
||||
char * cp;
|
||||
char *d;
|
||||
char *cp;
|
||||
size_t dlen;
|
||||
int l;
|
||||
static const char nullbyte = 0;
|
||||
@ -213,14 +213,14 @@ dynconvert(int dccsid, const char * s, int slen, int sccsid)
|
||||
|
||||
|
||||
static struct curl_slist *
|
||||
slist_convert(int dccsid, struct curl_slist * from, int sccsid)
|
||||
slist_convert(int dccsid, struct curl_slist *from, int sccsid)
|
||||
|
||||
{
|
||||
struct curl_slist * to = (struct curl_slist *) NULL;
|
||||
struct curl_slist *to = (struct curl_slist *) NULL;
|
||||
|
||||
for(; from; from = from->next) {
|
||||
struct curl_slist *nl;
|
||||
char * cp = dynconvert(dccsid, from->data, -1, sccsid);
|
||||
char *cp = dynconvert(dccsid, from->data, -1, sccsid);
|
||||
|
||||
if(!cp) {
|
||||
curl_slist_free_all(to);
|
||||
@ -243,8 +243,8 @@ curl_version_ccsid(unsigned int ccsid)
|
||||
|
||||
{
|
||||
int i;
|
||||
char * aversion;
|
||||
char * eversion;
|
||||
char *aversion;
|
||||
char *eversion;
|
||||
|
||||
aversion = curl_version();
|
||||
|
||||
@ -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)
|
||||
@ -265,12 +266,12 @@ curl_version_ccsid(unsigned int ccsid)
|
||||
|
||||
|
||||
char *
|
||||
curl_easy_escape_ccsid(CURL * handle, const char * string, int length,
|
||||
curl_easy_escape_ccsid(CURL *handle, const char *string, int length,
|
||||
unsigned int sccsid, unsigned int dccsid)
|
||||
|
||||
{
|
||||
char * s;
|
||||
char * d;
|
||||
char *s;
|
||||
char *d;
|
||||
|
||||
if(!string) {
|
||||
errno = EINVAL;
|
||||
@ -295,13 +296,13 @@ curl_easy_escape_ccsid(CURL * handle, const char * string, int length,
|
||||
|
||||
|
||||
char *
|
||||
curl_easy_unescape_ccsid(CURL * handle, const char * string, int length,
|
||||
int * outlength,
|
||||
curl_easy_unescape_ccsid(CURL *handle, const char *string, int length,
|
||||
int *outlength,
|
||||
unsigned int sccsid, unsigned int dccsid)
|
||||
|
||||
{
|
||||
char * s;
|
||||
char * d;
|
||||
char *s;
|
||||
char *d;
|
||||
|
||||
if(!string) {
|
||||
errno = EINVAL;
|
||||
@ -330,11 +331,11 @@ curl_easy_unescape_ccsid(CURL * handle, const char * string, int length,
|
||||
|
||||
|
||||
struct curl_slist *
|
||||
curl_slist_append_ccsid(struct curl_slist * list,
|
||||
const char * data, unsigned int ccsid)
|
||||
curl_slist_append_ccsid(struct curl_slist *list,
|
||||
const char *data, unsigned int ccsid)
|
||||
|
||||
{
|
||||
char * s;
|
||||
char *s;
|
||||
|
||||
s = (char *) NULL;
|
||||
|
||||
@ -353,10 +354,10 @@ curl_slist_append_ccsid(struct curl_slist * list,
|
||||
|
||||
|
||||
time_t
|
||||
curl_getdate_ccsid(const char * p, const time_t * unused, unsigned int ccsid)
|
||||
curl_getdate_ccsid(const char *p, const time_t * unused, unsigned int ccsid)
|
||||
|
||||
{
|
||||
char * s;
|
||||
char *s;
|
||||
time_t t;
|
||||
|
||||
if(!p)
|
||||
@ -375,7 +376,7 @@ curl_getdate_ccsid(const char * p, const time_t * unused, unsigned int ccsid)
|
||||
|
||||
static int
|
||||
convert_version_info_string(const char * * stringp,
|
||||
char * * bufp, int * left, unsigned int ccsid)
|
||||
char * * bufp, int *left, unsigned int ccsid)
|
||||
|
||||
{
|
||||
/* Helper for curl_version_info_ccsid(): convert a string if defined.
|
||||
@ -403,7 +404,7 @@ curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
|
||||
|
||||
{
|
||||
curl_version_info_data * p;
|
||||
char * cp;
|
||||
char *cp;
|
||||
int n;
|
||||
int nproto;
|
||||
curl_version_info_data * id;
|
||||
@ -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);
|
||||
@ -521,8 +522,8 @@ curl_easy_strerror_ccsid(CURLcode error, unsigned int ccsid)
|
||||
|
||||
{
|
||||
int i;
|
||||
const char * s;
|
||||
char * buf;
|
||||
const char *s;
|
||||
char *buf;
|
||||
|
||||
s = curl_easy_strerror(error);
|
||||
|
||||
@ -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)
|
||||
@ -546,8 +548,8 @@ curl_share_strerror_ccsid(CURLSHcode error, unsigned int ccsid)
|
||||
|
||||
{
|
||||
int i;
|
||||
const char * s;
|
||||
char * buf;
|
||||
const char *s;
|
||||
char *buf;
|
||||
|
||||
s = curl_share_strerror(error);
|
||||
|
||||
@ -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)
|
||||
@ -571,8 +574,8 @@ curl_multi_strerror_ccsid(CURLMcode error, unsigned int ccsid)
|
||||
|
||||
{
|
||||
int i;
|
||||
const char * s;
|
||||
char * buf;
|
||||
const char *s;
|
||||
char *buf;
|
||||
|
||||
s = curl_multi_strerror(error);
|
||||
|
||||
@ -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)
|
||||
@ -610,11 +614,11 @@ curl_certinfo_free_all(struct curl_certinfo *info)
|
||||
|
||||
|
||||
CURLcode
|
||||
curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
|
||||
curl_easy_getinfo_ccsid(CURL *curl, CURLINFO info, ...)
|
||||
|
||||
{
|
||||
va_list arg;
|
||||
void * paramp;
|
||||
void *paramp;
|
||||
CURLcode ret;
|
||||
unsigned int ccsid;
|
||||
char * * cpp;
|
||||
@ -632,7 +636,7 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
|
||||
ret = Curl_getinfo(data, info, paramp);
|
||||
|
||||
if(ret == CURLE_OK)
|
||||
switch ((int) info & CURLINFO_TYPEMASK) {
|
||||
switch((int) info & CURLINFO_TYPEMASK) {
|
||||
|
||||
case CURLINFO_STRING:
|
||||
ccsid = va_arg(arg, unsigned int);
|
||||
@ -649,16 +653,17 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
|
||||
|
||||
case CURLINFO_SLIST:
|
||||
ccsid = va_arg(arg, unsigned int);
|
||||
switch (info) {
|
||||
switch(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 * *)
|
||||
calloc(cipf->num_of_certs +
|
||||
1, sizeof(struct curl_slist *));
|
||||
cipt->certinfo = (struct curl_slist **)
|
||||
calloc(cipf->num_of_certs +
|
||||
1, sizeof(struct curl_slist *));
|
||||
if(!cipt->certinfo)
|
||||
ret = CURLE_OUT_OF_MEMORY;
|
||||
else {
|
||||
@ -692,10 +697,12 @@ curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...)
|
||||
break;
|
||||
|
||||
default:
|
||||
slp = (struct curl_slist * *) paramp;
|
||||
if(*slp)
|
||||
if(!(*slp = slist_convert(ccsid, *slp, ASCII_CCSID)))
|
||||
slp = (struct curl_slist **) paramp;
|
||||
if(*slp) {
|
||||
*slp = slist_convert(ccsid, *slp, ASCII_CCSID);
|
||||
if(!*slp)
|
||||
ret = CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -709,7 +716,7 @@ static int
|
||||
Curl_is_formadd_string(CURLformoption option)
|
||||
|
||||
{
|
||||
switch (option) {
|
||||
switch(option) {
|
||||
|
||||
case CURLFORM_FILENAME:
|
||||
case CURLFORM_CONTENTTYPE:
|
||||
@ -745,8 +752,8 @@ Curl_formadd_convert(struct curl_forms * forms,
|
||||
|
||||
{
|
||||
int l;
|
||||
char * cp;
|
||||
char * cp2;
|
||||
char *cp;
|
||||
char *cp2;
|
||||
|
||||
if(formx < 0 || !forms[formx].value)
|
||||
return 0;
|
||||
@ -795,7 +802,7 @@ curl_formadd_ccsid(struct curl_httppost * * httppost,
|
||||
struct curl_forms * lforms;
|
||||
struct curl_forms * tforms;
|
||||
unsigned int lformlen;
|
||||
const char * value;
|
||||
const char *value;
|
||||
unsigned int ccsid;
|
||||
int nargs;
|
||||
int namex;
|
||||
@ -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;
|
||||
@ -875,7 +882,7 @@ curl_formadd_ccsid(struct curl_httppost * * httppost,
|
||||
|
||||
/* Dispatch by option. */
|
||||
|
||||
switch (option) {
|
||||
switch(option) {
|
||||
|
||||
case CURLFORM_END:
|
||||
forms = (struct curl_forms *) NULL; /* Leave array mode. */
|
||||
@ -1065,11 +1072,11 @@ typedef struct {
|
||||
|
||||
|
||||
static size_t
|
||||
Curl_formget_callback_ccsid(void * arg, const char * buf, size_t len)
|
||||
Curl_formget_callback_ccsid(void *arg, const char *buf, size_t len)
|
||||
|
||||
{
|
||||
cfcdata * p;
|
||||
char * b;
|
||||
char *b;
|
||||
int l;
|
||||
size_t ret;
|
||||
|
||||
@ -1097,7 +1104,7 @@ Curl_formget_callback_ccsid(void * arg, const char * buf, size_t len)
|
||||
|
||||
|
||||
int
|
||||
curl_formget_ccsid(struct curl_httppost * form, void * arg,
|
||||
curl_formget_ccsid(struct curl_httppost *form, void *arg,
|
||||
curl_formget_callback append, unsigned int ccsid)
|
||||
|
||||
{
|
||||
@ -1111,14 +1118,14 @@ curl_formget_ccsid(struct curl_httppost * form, void * arg,
|
||||
|
||||
|
||||
CURLcode
|
||||
curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...)
|
||||
curl_easy_setopt_ccsid(CURL *curl, CURLoption tag, ...)
|
||||
|
||||
{
|
||||
CURLcode result;
|
||||
va_list arg;
|
||||
struct Curl_easy * data;
|
||||
char * s;
|
||||
char * cp;
|
||||
struct Curl_easy *data;
|
||||
char *s;
|
||||
char *cp;
|
||||
unsigned int ccsid;
|
||||
curl_off_t pfsize;
|
||||
static char testwarn = 1;
|
||||
@ -1146,7 +1153,7 @@ curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...)
|
||||
data = (struct Curl_easy *) curl;
|
||||
va_start(arg, tag);
|
||||
|
||||
switch (tag) {
|
||||
switch(tag) {
|
||||
|
||||
case CURLOPT_ABSTRACT_UNIX_SOCKET:
|
||||
case CURLOPT_ALTSVC:
|
||||
|
Loading…
Reference in New Issue
Block a user