tool_formparse.c: make curlx_uztoso a static in here
And drop the prefix. This function was not use elsewhere and it should certainly not be present in libcurl code when not used in the library. Closes #15796
This commit is contained in:
parent
28dd14aafe
commit
3f8452dde7
@ -100,28 +100,6 @@ unsigned char curlx_ultouc(unsigned long ulnum)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** unsigned size_t to signed curl_off_t
|
||||
*/
|
||||
|
||||
curl_off_t curlx_uztoso(size_t uznum)
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */
|
||||
#elif defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# 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);
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** unsigned size_t to signed int
|
||||
*/
|
||||
|
||||
@ -39,8 +39,6 @@ unsigned char curlx_ultouc(unsigned long ulnum);
|
||||
|
||||
int curlx_uztosi(size_t uznum);
|
||||
|
||||
curl_off_t curlx_uztoso(size_t uznum);
|
||||
|
||||
unsigned long curlx_uztoul(size_t uznum);
|
||||
|
||||
unsigned int curlx_uztoui(size_t uznum);
|
||||
|
||||
@ -42,7 +42,6 @@ if($ARGV[0] eq "--unit") {
|
||||
my $file = $ARGV[0];
|
||||
|
||||
my %wl = (
|
||||
'curlx_uztoso' => 'cmdline tool use',
|
||||
'Curl_xfer_write_resp' => 'internal api',
|
||||
'Curl_creader_def_init' => 'internal api',
|
||||
'Curl_creader_def_close' => 'internal api',
|
||||
|
||||
@ -75,6 +75,31 @@ static struct tool_mime *tool_mime_new_data(struct tool_mime *parent,
|
||||
return m;
|
||||
}
|
||||
|
||||
/*
|
||||
** unsigned size_t to signed curl_off_t
|
||||
*/
|
||||
|
||||
#define CURL_MASK_UCOFFT ((unsigned CURL_TYPEOF_CURL_OFF_T)~0)
|
||||
#define CURL_MASK_SCOFFT (CURL_MASK_UCOFFT >> 1)
|
||||
|
||||
static curl_off_t uztoso(size_t uznum)
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */
|
||||
#elif defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# 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);
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct tool_mime *tool_mime_new_filedata(struct tool_mime *parent,
|
||||
const char *filename,
|
||||
bool isremotefile,
|
||||
@ -137,7 +162,7 @@ static struct tool_mime *tool_mime_new_filedata(struct tool_mime *parent,
|
||||
}
|
||||
break;
|
||||
}
|
||||
size = curlx_uztoso(stdinsize);
|
||||
size = uztoso(stdinsize);
|
||||
origin = 0;
|
||||
}
|
||||
m = tool_mime_new(parent, TOOLMIME_STDIN);
|
||||
@ -186,7 +211,7 @@ size_t tool_mime_stdin_read(char *buffer,
|
||||
if(sip->curpos >= sip->size)
|
||||
return 0; /* At eof. */
|
||||
bytesleft = sip->size - sip->curpos;
|
||||
if(curlx_uztoso(nitems) > bytesleft)
|
||||
if(uztoso(nitems) > bytesleft)
|
||||
nitems = curlx_sotouz(bytesleft);
|
||||
}
|
||||
if(nitems) {
|
||||
@ -206,7 +231,7 @@ size_t tool_mime_stdin_read(char *buffer,
|
||||
return CURL_READFUNC_ABORT;
|
||||
}
|
||||
}
|
||||
sip->curpos += curlx_uztoso(nitems);
|
||||
sip->curpos += uztoso(nitems);
|
||||
}
|
||||
return nitems;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user