mirror of
https://github.com/curl/curl.git
synced 2026-08-01 03:38:04 +03:00
parent
1753de9d7a
commit
0417d323c9
52 changed files with 490 additions and 543 deletions
|
|
@ -86,8 +86,8 @@ static curl_off_t uztoso(size_t uznum)
|
|||
# pragma warning(disable:4310) /* cast truncates constant value */
|
||||
#endif
|
||||
|
||||
DEBUGASSERT(uznum <= (size_t) CURL_MASK_SCOFFT);
|
||||
return (curl_off_t)(uznum & (size_t) CURL_MASK_SCOFFT);
|
||||
DEBUGASSERT(uznum <= (size_t)CURL_MASK_SCOFFT);
|
||||
return (curl_off_t)(uznum & (size_t)CURL_MASK_SCOFFT);
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
|
|
@ -192,12 +192,11 @@ void tool_mime_free(struct tool_mime *mime)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Mime part callbacks for stdin. */
|
||||
size_t tool_mime_stdin_read(char *buffer,
|
||||
size_t size, size_t nitems, void *arg)
|
||||
{
|
||||
struct tool_mime *sip = (struct tool_mime *) arg;
|
||||
struct tool_mime *sip = (struct tool_mime *)arg;
|
||||
curl_off_t bytesleft;
|
||||
(void)size; /* Always 1: ignored. */
|
||||
|
||||
|
|
@ -230,7 +229,7 @@ size_t tool_mime_stdin_read(char *buffer,
|
|||
|
||||
int tool_mime_stdin_seek(void *instream, curl_off_t offset, int whence)
|
||||
{
|
||||
struct tool_mime *sip = (struct tool_mime *) instream;
|
||||
struct tool_mime *sip = (struct tool_mime *)instream;
|
||||
|
||||
switch(whence) {
|
||||
case SEEK_CUR:
|
||||
|
|
@ -296,8 +295,8 @@ static CURLcode tool2curlparts(CURL *curl, struct tool_mime *m,
|
|||
FALLTHROUGH();
|
||||
case TOOLMIME_STDINDATA:
|
||||
ret = curl_mime_data_cb(part, m->size,
|
||||
(curl_read_callback) tool_mime_stdin_read,
|
||||
(curl_seek_callback) tool_mime_stdin_seek,
|
||||
(curl_read_callback)tool_mime_stdin_read,
|
||||
(curl_seek_callback)tool_mime_stdin_seek,
|
||||
NULL, m);
|
||||
break;
|
||||
|
||||
|
|
@ -372,8 +371,7 @@ static char *get_param_word(char **str, char **end_pos, char endchar)
|
|||
if(*ptr == '\\' && (ptr[1] == '\\' || ptr[1] == '"'))
|
||||
++ptr;
|
||||
*ptr2++ = *ptr++;
|
||||
}
|
||||
while(ptr < *end_pos);
|
||||
} while(ptr < *end_pos);
|
||||
*end_pos = ptr2;
|
||||
}
|
||||
++ptr;
|
||||
|
|
@ -428,7 +426,7 @@ static int read_field_headers(FILE *fp, struct curl_slist **pheaders)
|
|||
else if(ptr[0] == ' ') /* a continuation from the line before */
|
||||
folded = TRUE;
|
||||
/* trim off trailing CRLFs and whitespaces */
|
||||
while(len && (ISNEWLINE(ptr[len -1]) || ISBLANK(ptr[len - 1])))
|
||||
while(len && (ISNEWLINE(ptr[len - 1]) || ISBLANK(ptr[len - 1])))
|
||||
len--;
|
||||
|
||||
if(!len)
|
||||
|
|
@ -658,7 +656,6 @@ static int get_param_part(char endchar,
|
|||
return sep & 0xFF;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* formparse()
|
||||
|
|
@ -706,13 +703,13 @@ static int get_param_part(char endchar,
|
|||
*
|
||||
***************************************************************************/
|
||||
|
||||
#define SET_TOOL_MIME_PTR(m, field) \
|
||||
do { \
|
||||
if(field) { \
|
||||
(m)->field = curlx_strdup(field); \
|
||||
if(!(m)->field) \
|
||||
goto fail; \
|
||||
} \
|
||||
#define SET_TOOL_MIME_PTR(m, field) \
|
||||
do { \
|
||||
if(field) { \
|
||||
(m)->field = curlx_strdup(field); \
|
||||
if(!(m)->field) \
|
||||
goto fail; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
int formparse(const char *input,
|
||||
|
|
@ -811,9 +808,8 @@ int formparse(const char *input,
|
|||
part->headers = headers;
|
||||
headers = NULL;
|
||||
if(res == CURLE_READ_ERROR) {
|
||||
/* An error occurred while reading stdin: if read has started,
|
||||
issue the error now. Else, delay it until processed by
|
||||
libcurl. */
|
||||
/* An error occurred while reading stdin: if read has started,
|
||||
issue the error now. Else, delay it until processed by libcurl. */
|
||||
if(part->size > 0) {
|
||||
warnf("error while reading standard input");
|
||||
goto fail;
|
||||
|
|
@ -838,8 +834,7 @@ int formparse(const char *input,
|
|||
if(sep < 0)
|
||||
goto fail;
|
||||
|
||||
part = tool_mime_new_filedata(*mimecurrent, data, FALSE,
|
||||
&res);
|
||||
part = tool_mime_new_filedata(*mimecurrent, data, FALSE, &res);
|
||||
if(!part)
|
||||
goto fail;
|
||||
part->headers = headers;
|
||||
|
|
@ -879,7 +874,7 @@ int formparse(const char *input,
|
|||
SET_TOOL_MIME_PTR(part, encoder);
|
||||
|
||||
if(sep) {
|
||||
*contp = (char) sep;
|
||||
*contp = (char)sep;
|
||||
warnf("garbage at end of field specification: %s", contp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue