mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 07:38:49 -05:00
removed pedantic compiler warnings
This commit is contained in:
parent
3e5ba33e2d
commit
7b49d40bb0
51
src/main.c
51
src/main.c
@ -53,6 +53,8 @@
|
|||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
#include "urlglob.h"
|
#include "urlglob.h"
|
||||||
|
#include "writeout.h"
|
||||||
|
|
||||||
#define CURLseparator "--_curl_--"
|
#define CURLseparator "--_curl_--"
|
||||||
#define MIMEseparator "_curl_"
|
#define MIMEseparator "_curl_"
|
||||||
|
|
||||||
@ -360,7 +362,6 @@ struct Configurable {
|
|||||||
static int parseconfig(char *filename,
|
static int parseconfig(char *filename,
|
||||||
struct Configurable *config);
|
struct Configurable *config);
|
||||||
static char *my_get_line(FILE *fp);
|
static char *my_get_line(FILE *fp);
|
||||||
static char *my_get_token(const char *line);
|
|
||||||
|
|
||||||
static void GetStr(char **string,
|
static void GetStr(char **string,
|
||||||
char *value)
|
char *value)
|
||||||
@ -408,14 +409,13 @@ static char *file2string(FILE *file)
|
|||||||
static char *file2memory(FILE *file, long *size)
|
static char *file2memory(FILE *file, long *size)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
char *ptr;
|
|
||||||
char *string=NULL;
|
char *string=NULL;
|
||||||
char *newstring=NULL;
|
char *newstring=NULL;
|
||||||
long len=0;
|
long len=0;
|
||||||
long stringlen=0;
|
long stringlen=0;
|
||||||
|
|
||||||
if(file) {
|
if(file) {
|
||||||
while(len = fread(buffer, 1, sizeof(buffer), file)) {
|
while((len = fread(buffer, 1, sizeof(buffer), file))) {
|
||||||
if(string) {
|
if(string) {
|
||||||
newstring = realloc(string, len+stringlen);
|
newstring = realloc(string, len+stringlen);
|
||||||
if(newstring)
|
if(newstring)
|
||||||
@ -708,7 +708,6 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
/* the data begins with a '@' letter, it means that a file name
|
/* the data begins with a '@' letter, it means that a file name
|
||||||
or - (stdin) follows */
|
or - (stdin) follows */
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char *ptr;
|
|
||||||
|
|
||||||
nextarg++; /* pass the @ */
|
nextarg++; /* pass the @ */
|
||||||
|
|
||||||
@ -962,7 +961,6 @@ static int parseconfig(char *filename,
|
|||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char configbuffer[4096];
|
|
||||||
char filebuffer[256];
|
char filebuffer[256];
|
||||||
bool usedarg;
|
bool usedarg;
|
||||||
char *home=NULL;
|
char *home=NULL;
|
||||||
@ -1007,7 +1005,7 @@ static int parseconfig(char *filename,
|
|||||||
alloced_param=FALSE;
|
alloced_param=FALSE;
|
||||||
|
|
||||||
/* lines with # in the fist column is a comment! */
|
/* lines with # in the fist column is a comment! */
|
||||||
while(isspace(*line))
|
while(isspace((int)*line))
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
switch(*line) {
|
switch(*line) {
|
||||||
@ -1023,7 +1021,7 @@ static int parseconfig(char *filename,
|
|||||||
|
|
||||||
/* the option keywords starts here */
|
/* the option keywords starts here */
|
||||||
option = line;
|
option = line;
|
||||||
while(*line && !isspace(*line) && !isseparator(*line))
|
while(*line && !isspace((int)*line) && !isseparator(*line))
|
||||||
line++;
|
line++;
|
||||||
/* ... and has ended here */
|
/* ... and has ended here */
|
||||||
|
|
||||||
@ -1034,7 +1032,7 @@ static int parseconfig(char *filename,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* pass spaces and separator(s) */
|
/* pass spaces and separator(s) */
|
||||||
while(isspace(*line) || isseparator(*line))
|
while(isspace((int)*line) || isseparator(*line))
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
/* the parameter starts here (unless quoted) */
|
/* the parameter starts here (unless quoted) */
|
||||||
@ -1079,7 +1077,7 @@ static int parseconfig(char *filename,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
param=line; /* parameter starts here */
|
param=line; /* parameter starts here */
|
||||||
while(*line && !isspace(*line))
|
while(*line && !isspace((int)*line))
|
||||||
line++;
|
line++;
|
||||||
*line=0; /* zero terminate */
|
*line=0; /* zero terminate */
|
||||||
}
|
}
|
||||||
@ -1185,8 +1183,6 @@ int myprogress (void *clientp,
|
|||||||
int barwidth;
|
int barwidth;
|
||||||
int num;
|
int num;
|
||||||
int i;
|
int i;
|
||||||
int prevblock;
|
|
||||||
int thisblock;
|
|
||||||
|
|
||||||
struct ProgressData *bar = (struct ProgressData *)clientp;
|
struct ProgressData *bar = (struct ProgressData *)clientp;
|
||||||
size_t total = dltotal + ultotal;
|
size_t total = dltotal + ultotal;
|
||||||
@ -1774,36 +1770,3 @@ static char *my_get_line(FILE *fp)
|
|||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *my_get_token(const char *line)
|
|
||||||
{
|
|
||||||
static const char *save = NULL;
|
|
||||||
const char *first = NULL;
|
|
||||||
const char *last = NULL;
|
|
||||||
char *retval = NULL;
|
|
||||||
size_t size;
|
|
||||||
|
|
||||||
if (NULL == line)
|
|
||||||
line = save;
|
|
||||||
if (NULL == line)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
while (('\0' != *line) && (isspace(*line)))
|
|
||||||
line++;
|
|
||||||
first = line;
|
|
||||||
while (('\0' != *line) && (!isspace(*line)))
|
|
||||||
line++;
|
|
||||||
save = line;
|
|
||||||
while ('\0' != *line)
|
|
||||||
line++;
|
|
||||||
last = line;
|
|
||||||
|
|
||||||
size = last - first;
|
|
||||||
if (0 == size)
|
|
||||||
return NULL;
|
|
||||||
if (NULL == (retval = malloc(size + 1)))
|
|
||||||
return NULL;
|
|
||||||
memcpy(retval, first, size);
|
|
||||||
retval[size] = '\0';
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
@ -70,5 +70,6 @@ typedef struct {
|
|||||||
int glob_url(URLGlob**, char*, int *);
|
int glob_url(URLGlob**, char*, int *);
|
||||||
char* next_url(URLGlob*);
|
char* next_url(URLGlob*);
|
||||||
char* match_url(char*, URLGlob);
|
char* match_url(char*, URLGlob);
|
||||||
|
void glob_cleanup(URLGlob* glob);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <curl/types.h>
|
#include <curl/types.h>
|
||||||
#include <curl/easy.h>
|
#include <curl/easy.h>
|
||||||
|
|
||||||
|
#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
#include "writeout.h"
|
#include "writeout.h"
|
||||||
@ -175,6 +177,8 @@ void ourWriteOut(CURL *curl, char *writeinfo)
|
|||||||
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &doubleinfo))
|
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &doubleinfo))
|
||||||
fprintf(stream, "%.3f", doubleinfo);
|
fprintf(stream, "%.3f", doubleinfo);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user