mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
mime: fix some implicit curl_off_t --> size_t conversion warnings.
This commit is contained in:
parent
3baf36edf6
commit
045b076ae8
@ -282,7 +282,7 @@ static size_t mime_mem_read(char *buffer, size_t size, size_t nitems,
|
|||||||
void *instream)
|
void *instream)
|
||||||
{
|
{
|
||||||
struct Curl_mimepart *part = (struct Curl_mimepart *) instream;
|
struct Curl_mimepart *part = (struct Curl_mimepart *) instream;
|
||||||
size_t sz = part->datasize - part->state.offset;
|
size_t sz = (size_t) part->datasize - part->state.offset;
|
||||||
|
|
||||||
(void) size; /* Always 1.*/
|
(void) size; /* Always 1.*/
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ static int mime_mem_seek(void *instream, curl_off_t offset, int whence)
|
|||||||
if(offset < 0 || offset > part->datasize)
|
if(offset < 0 || offset > part->datasize)
|
||||||
return CURL_SEEKFUNC_FAIL;
|
return CURL_SEEKFUNC_FAIL;
|
||||||
|
|
||||||
part->state.offset = offset;
|
part->state.offset = (size_t) offset;
|
||||||
return CURL_SEEKFUNC_OK;
|
return CURL_SEEKFUNC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,14 +210,18 @@ static const NameValue setopt_nv_CURLNONZERODEFAULTS[] = {
|
|||||||
|
|
||||||
/* Escape string to C string syntax. Return NULL if out of memory.
|
/* Escape string to C string syntax. Return NULL if out of memory.
|
||||||
* Is this correct for those wacky EBCDIC guys? */
|
* Is this correct for those wacky EBCDIC guys? */
|
||||||
static char *c_escape(const char *str, ssize_t len)
|
static char *c_escape(const char *str, ssize_t plen)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
char *escaped, *e;
|
char *escaped, *e;
|
||||||
|
size_t len = plen == -1? strlen(str): (size_t) plen;
|
||||||
|
|
||||||
|
/* Check for possible overflow. */
|
||||||
|
if(len > (~(size_t) 0) / 4)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Allocate space based on worst-case */
|
/* Allocate space based on worst-case */
|
||||||
if(len < 0)
|
|
||||||
len = strlen(str);
|
|
||||||
escaped = malloc(4 * len + 1);
|
escaped = malloc(4 * len + 1);
|
||||||
if(!escaped)
|
if(!escaped)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -474,7 +478,7 @@ static CURLcode libcurl_generate_mime(curl_mime *mime, int *mimeno)
|
|||||||
;
|
;
|
||||||
size = (cp == data + part->datasize)? (curl_off_t) -1: part->datasize;
|
size = (cp == data + part->datasize)? (curl_off_t) -1: part->datasize;
|
||||||
Curl_safefree(escaped);
|
Curl_safefree(escaped);
|
||||||
escaped = c_escape(data, part->datasize);
|
escaped = c_escape(data, (ssize_t) part->datasize);
|
||||||
if(data != part->data)
|
if(data != part->data)
|
||||||
Curl_safefree(data);
|
Curl_safefree(data);
|
||||||
if(!escaped)
|
if(!escaped)
|
||||||
|
Loading…
Reference in New Issue
Block a user