mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
(un)signed and const cleanup
This commit is contained in:
parent
ccb3a13ce6
commit
3a37c0ae23
20
src/main.c
20
src/main.c
@ -269,7 +269,7 @@ int SetHTTPrequest(HttpReq req, HttpReq *store)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void helpf(char *fmt, ...)
|
static void helpf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
if(fmt) {
|
if(fmt) {
|
||||||
@ -363,8 +363,8 @@ static void help(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct LongShort {
|
struct LongShort {
|
||||||
char *letter;
|
const char *letter;
|
||||||
char *lname;
|
const char *lname;
|
||||||
bool extraparam;
|
bool extraparam;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -573,9 +573,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
char letter;
|
char letter;
|
||||||
char subletter=0; /* subletters can only occur on long options */
|
char subletter=0; /* subletters can only occur on long options */
|
||||||
|
|
||||||
char *parse=NULL;
|
const char *parse=NULL;
|
||||||
int res;
|
int res;
|
||||||
int j;
|
unsigned int j;
|
||||||
time_t now;
|
time_t now;
|
||||||
int hit=-1;
|
int hit=-1;
|
||||||
bool longopt=FALSE;
|
bool longopt=FALSE;
|
||||||
@ -715,7 +715,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
return PARAM_OPTION_UNKNOWN;
|
return PARAM_OPTION_UNKNOWN;
|
||||||
}
|
}
|
||||||
if(!longopt && aliases[hit].extraparam && parse[1]) {
|
if(!longopt && aliases[hit].extraparam && parse[1]) {
|
||||||
nextarg=&parse[1]; /* this is the actual extra parameter */
|
nextarg=(char *)&parse[1]; /* this is the actual extra parameter */
|
||||||
singleopt=TRUE; /* don't loop anymore after this */
|
singleopt=TRUE; /* don't loop anymore after this */
|
||||||
}
|
}
|
||||||
else if((!nextarg || !*nextarg) && aliases[hit].extraparam) {
|
else if((!nextarg || !*nextarg) && aliases[hit].extraparam) {
|
||||||
@ -1146,7 +1146,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
}
|
}
|
||||||
now=time(NULL);
|
now=time(NULL);
|
||||||
config->condtime=curl_getdate(nextarg, &now);
|
config->condtime=curl_getdate(nextarg, &now);
|
||||||
if(((unsigned ) ~0) == config->condtime) {
|
if(-1 == (int)config->condtime) {
|
||||||
/* now let's see if it is a file name to get the time from instead! */
|
/* now let's see if it is a file name to get the time from instead! */
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
if(-1 == stat(nextarg, &statbuf)) {
|
if(-1 == stat(nextarg, &statbuf)) {
|
||||||
@ -1311,10 +1311,10 @@ static int parseconfig(char *filename,
|
|||||||
if(res != PARAM_OK) {
|
if(res != PARAM_OK) {
|
||||||
/* the help request isn't really an error */
|
/* the help request isn't really an error */
|
||||||
if(!strcmp(filename, "-")) {
|
if(!strcmp(filename, "-")) {
|
||||||
filename="<stdin>";
|
filename=(char *)"<stdin>";
|
||||||
}
|
}
|
||||||
if(PARAM_HELP_REQUESTED != res) {
|
if(PARAM_HELP_REQUESTED != res) {
|
||||||
char *reason;
|
const char *reason;
|
||||||
switch(res) {
|
switch(res) {
|
||||||
default:
|
default:
|
||||||
case PARAM_GOT_EXTRA_PARAMETER:
|
case PARAM_GOT_EXTRA_PARAMETER:
|
||||||
@ -1623,7 +1623,7 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
else {
|
else {
|
||||||
bool used;
|
bool used;
|
||||||
/* just add the URL please */
|
/* just add the URL please */
|
||||||
res = getparameter("--url", argv[i], &used, config);
|
res = getparameter((char *)"--url", argv[i], &used, config);
|
||||||
if(res)
|
if(res)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ char *match_url(char *filename, URLGlob *glob)
|
|||||||
int stringlen=0;
|
int stringlen=0;
|
||||||
char numbuf[18];
|
char numbuf[18];
|
||||||
char *appendthis;
|
char *appendthis;
|
||||||
size_t appendlen;
|
int appendlen;
|
||||||
|
|
||||||
/* We cannot use the glob_buffer for storage here since the filename may
|
/* We cannot use the glob_buffer for storage here since the filename may
|
||||||
* be longer than the URL we use. We allocate a good start size, then
|
* be longer than the URL we use. We allocate a good start size, then
|
||||||
@ -424,7 +424,7 @@ char *match_url(char *filename, URLGlob *glob)
|
|||||||
switch (pat.type) {
|
switch (pat.type) {
|
||||||
case UPTSet:
|
case UPTSet:
|
||||||
appendthis = pat.content.Set.elements[pat.content.Set.ptr_s];
|
appendthis = pat.content.Set.elements[pat.content.Set.ptr_s];
|
||||||
appendlen = strlen(pat.content.Set.elements[pat.content.Set.ptr_s]);
|
appendlen = (int)strlen(pat.content.Set.elements[pat.content.Set.ptr_s]);
|
||||||
break;
|
break;
|
||||||
case UPTCharRange:
|
case UPTCharRange:
|
||||||
numbuf[0]=pat.content.CharRange.ptr_c;
|
numbuf[0]=pat.content.CharRange.ptr_c;
|
||||||
@ -435,7 +435,7 @@ char *match_url(char *filename, URLGlob *glob)
|
|||||||
case UPTNumRange:
|
case UPTNumRange:
|
||||||
sprintf(numbuf, "%0*d", pat.content.NumRange.padlength, pat.content.NumRange.ptr_n);
|
sprintf(numbuf, "%0*d", pat.content.NumRange.padlength, pat.content.NumRange.ptr_n);
|
||||||
appendthis = numbuf;
|
appendthis = numbuf;
|
||||||
appendlen = strlen(numbuf);
|
appendlen = (int)strlen(numbuf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("internal error: invalid pattern type (%d)\n", pat.type);
|
printf("internal error: invalid pattern type (%d)\n", pat.type);
|
||||||
|
@ -49,7 +49,7 @@ typedef enum {
|
|||||||
} replaceid;
|
} replaceid;
|
||||||
|
|
||||||
struct variable {
|
struct variable {
|
||||||
char *name;
|
const char *name;
|
||||||
replaceid id;
|
replaceid id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ static struct variable replacements[]={
|
|||||||
{"size_upload", VAR_SIZE_UPLOAD},
|
{"size_upload", VAR_SIZE_UPLOAD},
|
||||||
{"speed_download", VAR_SPEED_DOWNLOAD},
|
{"speed_download", VAR_SPEED_DOWNLOAD},
|
||||||
{"speed_upload", VAR_SPEED_UPLOAD},
|
{"speed_upload", VAR_SPEED_UPLOAD},
|
||||||
{NULL}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
void ourWriteOut(CURL *curl, char *writeinfo)
|
void ourWriteOut(CURL *curl, char *writeinfo)
|
||||||
|
Loading…
Reference in New Issue
Block a user