lib/subdirs: fix formatting nits

Closes #19757
This commit is contained in:
Viktor Szakats 2025-11-29 02:16:52 +01:00
parent 0eed8b7330
commit 2253bc330f
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
64 changed files with 1218 additions and 1416 deletions

View file

@ -31,12 +31,12 @@
#include "base64.h"
/* ---- Base64 Encoding/Decoding Table --- */
const char Curl_base64encdec[]=
const char Curl_base64encdec[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/* The Base 64 encoding with a URL and filename safe alphabet, RFC 4648
section 5 */
static const char base64url[]=
static const char base64url[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
static const unsigned char decodetable[] =
@ -188,18 +188,18 @@ static CURLcode base64_encode(const char *table64,
return CURLE_OUT_OF_MEMORY;
while(insize >= 3) {
*output++ = table64[ in[0] >> 2 ];
*output++ = table64[ ((in[0] & 0x03) << 4) | (in[1] >> 4) ];
*output++ = table64[ ((in[1] & 0x0F) << 2) | ((in[2] & 0xC0) >> 6) ];
*output++ = table64[ in[2] & 0x3F ];
*output++ = table64[in[0] >> 2];
*output++ = table64[((in[0] & 0x03) << 4) | (in[1] >> 4)];
*output++ = table64[((in[1] & 0x0F) << 2) | ((in[2] & 0xC0) >> 6)];
*output++ = table64[in[2] & 0x3F];
insize -= 3;
in += 3;
}
if(insize) {
/* this is only one or two bytes now */
*output++ = table64[ in[0] >> 2 ];
*output++ = table64[in[0] >> 2];
if(insize == 1) {
*output++ = table64[ ((in[0] & 0x03) << 4) ];
*output++ = table64[((in[0] & 0x03) << 4)];
if(padbyte) {
*output++ = padbyte;
*output++ = padbyte;
@ -207,8 +207,8 @@ static CURLcode base64_encode(const char *table64,
}
else {
/* insize == 2 */
*output++ = table64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xF0) >> 4) ];
*output++ = table64[ ((in[1] & 0x0F) << 2) ];
*output++ = table64[((in[0] & 0x03) << 4) | ((in[1] & 0xF0) >> 4)];
*output++ = table64[((in[1] & 0x0F) << 2)];
if(padbyte)
*output++ = padbyte;
}

View file

@ -156,7 +156,6 @@ CURLcode curlx_dyn_tail(struct dynbuf *s, size_t trail)
s->bufr[s->leng] = 0;
}
return CURLE_OK;
}
/*

View file

@ -32,7 +32,7 @@ struct dynbuf {
size_t allc; /* size of the current allocation */
size_t toobig; /* size limit for the buffer */
#ifdef DEBUGBUILD
int init; /* detect API usage mistakes */
int init; /* detect API usage mistakes */
#endif
};
@ -62,24 +62,24 @@ int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
char *curlx_dyn_take(struct dynbuf *s, size_t *plen);
/* Dynamic buffer max sizes */
#define MAX_DYNBUF_SIZE (SIZE_MAX/2)
#define MAX_DYNBUF_SIZE (SIZE_MAX / 2)
#define DYN_DOH_RESPONSE 3000
#define DYN_DOH_CNAME 256
#define DYN_PAUSE_BUFFER (64 * 1024 * 1024)
#define DYN_HAXPROXY 2048
#define DYN_HTTP_REQUEST (1024*1024)
#define DYN_HTTP_REQUEST (1024 * 1024)
#define DYN_APRINTF 8000000
#define DYN_RTSP_REQ_HEADER (64*1024)
#define DYN_TRAILERS (64*1024)
#define DYN_RTSP_REQ_HEADER (64 * 1024)
#define DYN_TRAILERS (64 * 1024)
#define DYN_PROXY_CONNECT_HEADERS 16384
#define DYN_QLOG_NAME 1024
#define DYN_H1_TRAILER 4096
#define DYN_PINGPPONG_CMD (64*1024)
#define DYN_IMAP_CMD (64*1024)
#define DYN_MQTT_RECV (64*1024)
#define DYN_PINGPPONG_CMD (64 * 1024)
#define DYN_IMAP_CMD (64 * 1024)
#define DYN_MQTT_RECV (64 * 1024)
#define DYN_MQTT_SEND 0xFFFFFFF
#define DYN_CRLFILE_SIZE (400*1024*1024) /* 400mb */
#define DYN_CERTFILE_SIZE (100*1024) /* 100KiB */
#define DYN_KEYFILE_SIZE (100*1024) /* 100KiB */
#define DYN_CRLFILE_SIZE (400 * 1024 * 1024) /* 400MiB */
#define DYN_CERTFILE_SIZE (100 * 1024) /* 100KiB */
#define DYN_KEYFILE_SIZE (100 * 1024) /* 100KiB */
#endif

View file

@ -51,11 +51,12 @@ int curlx_win32_open(const char *filename, int oflag, ...);
#endif
#ifdef CURLDEBUG
#define curlx_fopen(file,mode) curl_dbg_fopen(file,mode,__LINE__,__FILE__)
#define curlx_freopen(file,mode,fh) \
curl_dbg_freopen(file,mode,fh,__LINE__,__FILE__)
#define curlx_fdopen(file,mode) curl_dbg_fdopen(file,mode,__LINE__,__FILE__)
#define curlx_fclose(file) curl_dbg_fclose(file,__LINE__,__FILE__)
#define curlx_fopen(file, mode) curl_dbg_fopen(file, mode, __LINE__, __FILE__)
#define curlx_freopen(file, mode, fh) \
curl_dbg_freopen(file, mode, fh, __LINE__, __FILE__)
#define curlx_fdopen(file, mode) \
curl_dbg_fdopen(file, mode, __LINE__, __FILE__)
#define curlx_fclose(file) curl_dbg_fclose(file, __LINE__, __FILE__)
#else
#define curlx_fopen CURLX_FOPEN_LOW
#define curlx_freopen CURLX_FREOPEN_LOW

View file

@ -109,17 +109,18 @@ static char *inet_ntop6(const unsigned char *src, char *dst, size_t size)
*/
memset(words, '\0', sizeof(words));
for(i = 0; i < IN6ADDRSZ; i++)
words[i/2] |= ((unsigned int)src[i] << ((1 - (i % 2)) << 3));
words[i / 2] |= ((unsigned int)src[i] << ((1 - (i % 2)) << 3));
best.base = -1;
cur.base = -1;
cur.base = -1;
best.len = 0;
cur.len = 0;
for(i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {
if(words[i] == 0) {
if(cur.base == -1) {
cur.base = i; cur.len = 1;
cur.base = i;
cur.len = 1;
}
else
cur.len++;
@ -152,7 +153,7 @@ static char *inet_ntop6(const unsigned char *src, char *dst, size_t size)
/* Is this address an encapsulated IPv4?
*/
if(i == 6 && best.base == 0 &&
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
if(!inet_ntop4(src + 12, tp, sizeof(tmp) - (tp - tmp))) {
return NULL;
}
@ -219,4 +220,4 @@ char *curlx_inet_ntop(int af, const void *src, char *buf, size_t size)
return NULL;
}
}
#endif /* HAVE_INET_NTOP */
#endif /* HAVE_INET_NTOP */

View file

@ -37,11 +37,11 @@
#include <arpa/inet.h>
#endif
#ifdef __AMIGA__
#define curlx_inet_ntop(af,addr,buf,size) \
#define curlx_inet_ntop(af, addr, buf, size) \
(char *)inet_ntop(af, CURL_UNCONST(addr), (unsigned char *)buf, \
(curl_socklen_t)(size))
#else
#define curlx_inet_ntop(af,addr,buf,size) \
#define curlx_inet_ntop(af, addr, buf, size) \
inet_ntop(af, addr, buf, (curl_socklen_t)(size))
#endif
#else

View file

@ -54,8 +54,8 @@
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
static int inet_pton4(const char *src, unsigned char *dst);
static int inet_pton6(const char *src, unsigned char *dst);
static int inet_pton4(const char *src, unsigned char *dst);
static int inet_pton6(const char *src, unsigned char *dst);
/* int
* inet_pton(af, src, dst)
@ -73,8 +73,7 @@ static int inet_pton6(const char *src, unsigned char *dst);
* author:
* Paul Vixie, 1996.
*/
int
curlx_inet_pton(int af, const char *src, void *dst)
int curlx_inet_pton(int af, const char *src, void *dst)
{
switch(af) {
case AF_INET:
@ -98,8 +97,7 @@ curlx_inet_pton(int af, const char *src, void *dst)
* author:
* Paul Vixie, 1996.
*/
static int
inet_pton4(const char *src, unsigned char *dst)
static int inet_pton4(const char *src, unsigned char *dst)
{
int saw_digit, octets, ch;
unsigned char tmp[INADDRSZ], *tp;
@ -151,8 +149,7 @@ inet_pton4(const char *src, unsigned char *dst)
* author:
* Paul Vixie, 1996.
*/
static int
inet_pton6(const char *src, unsigned char *dst)
static int inet_pton6(const char *src, unsigned char *dst)
{
unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
const char *curtok;
@ -187,14 +184,14 @@ inet_pton6(const char *src, unsigned char *dst)
}
if(tp + INT16SZ > endp)
return 0;
*tp++ = (unsigned char) ((val >> 8) & 0xff);
*tp++ = (unsigned char) (val & 0xff);
*tp++ = (unsigned char)((val >> 8) & 0xff);
*tp++ = (unsigned char)(val & 0xff);
saw_xdigit = 0;
val = 0;
continue;
}
if(ch == '.' && ((tp + INADDRSZ) <= endp) &&
inet_pton4(curtok, tp) > 0) {
inet_pton4(curtok, tp) > 0) {
tp += INADDRSZ;
saw_xdigit = 0;
break; /* '\0' was seen by inet_pton4(). */
@ -204,8 +201,8 @@ inet_pton6(const char *src, unsigned char *dst)
if(saw_xdigit) {
if(tp + INT16SZ > endp)
return 0;
*tp++ = (unsigned char) ((val >> 8) & 0xff);
*tp++ = (unsigned char) (val & 0xff);
*tp++ = (unsigned char)((val >> 8) & 0xff);
*tp++ = (unsigned char)(val & 0xff);
}
if(colonp) {
/*

View file

@ -37,9 +37,11 @@
#include <arpa/inet.h>
#endif
#ifdef __AMIGA__
#define curlx_inet_pton(x,y,z) inet_pton(x,(unsigned char *)CURL_UNCONST(y),z)
#define curlx_inet_pton(x, y, z) \
inet_pton(x, (unsigned char *)CURL_UNCONST(y), z)
#else
#define curlx_inet_pton(x,y,z) inet_pton(x,y,z)
#define curlx_inet_pton(x, y, z) \
inet_pton(x, y, z)
#endif
#else
int curlx_inet_pton(int, const char *, void *);

View file

@ -88,6 +88,6 @@ int curlx_nonblock(curl_socket_t sockfd, /* operate on this */
return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
#else
# error "no non-blocking method was found/used/set"
#error "no non-blocking method was found/used/set"
#endif
}

View file

@ -43,8 +43,7 @@
* codes (WSAGetLastError) to error messages.
* Returns NULL if no error message was found for error code.
*/
static const char *
get_winsock_error(int err, char *buf, size_t len)
static const char *get_winsock_error(int err, char *buf, size_t len)
{
#ifndef CURL_DISABLE_VERBOSE_STRINGS
const char *p;

View file

@ -66,8 +66,7 @@ int curlx_str_until(const char **linep, struct Curl_str *out,
/* Get a word until the first space or end of string. At least one byte long.
return non-zero on error */
int curlx_str_word(const char **linep, struct Curl_str *out,
const size_t max)
int curlx_str_word(const char **linep, struct Curl_str *out, const size_t max)
{
return curlx_str_until(linep, out, max, ' ');
}
@ -95,7 +94,6 @@ int curlx_str_untilnl(const char **linep, struct Curl_str *out,
return STRE_OK;
}
/* Get a "quoted" word. No escaping possible.
return non-zero on error */
int curlx_str_quotedword(const char **linep, struct Curl_str *out,
@ -141,8 +139,8 @@ int curlx_str_singlespace(const char **linep)
}
/* given an ASCII character and max ascii, return TRUE if valid */
#define valid_digit(x,m) \
(((x) >= '0') && ((x) <= m) && Curl_hexasciitable[(x)-'0'])
#define valid_digit(x, m) \
(((x) >= '0') && ((x) <= m) && Curl_hexasciitable[(x) - '0'])
/* We use 16 for the zero index (and the necessary bitwise AND in the loop)
to be able to have a non-zero value there to make valid_digit() able to

View file

@ -84,5 +84,5 @@ struct timeval *curlx_mstotv(struct timeval *tv, timediff_t ms)
*/
timediff_t curlx_tvtoms(struct timeval *tv)
{
return (tv->tv_sec*1000) + (timediff_t)(tv->tv_usec/1000);
return (tv->tv_sec * 1000) + (timediff_t)(tv->tv_usec / 1000);
}

View file

@ -79,7 +79,7 @@ struct curltime curlx_now(void)
return now;
}
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) || \
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) || \
defined(HAVE_CLOCK_GETTIME_MONOTONIC_RAW)
struct curltime curlx_now(void)
@ -103,7 +103,7 @@ struct curltime curlx_now(void)
** called on unsupported OS version.
*/
#if defined(__APPLE__) && defined(HAVE_BUILTIN_AVAILABLE) && \
(HAVE_BUILTIN_AVAILABLE == 1)
(HAVE_BUILTIN_AVAILABLE == 1)
bool have_clock_gettime = FALSE;
if(__builtin_available(macOS 10.12, iOS 10, tvOS 10, watchOS 3, *))
have_clock_gettime = TRUE;
@ -111,8 +111,8 @@ struct curltime curlx_now(void)
#ifdef HAVE_CLOCK_GETTIME_MONOTONIC_RAW
if(
#if defined(__APPLE__) && defined(HAVE_BUILTIN_AVAILABLE) && \
(HAVE_BUILTIN_AVAILABLE == 1)
#if defined(__APPLE__) && defined(HAVE_BUILTIN_AVAILABLE) && \
(HAVE_BUILTIN_AVAILABLE == 1)
have_clock_gettime &&
#endif
(clock_gettime(CLOCK_MONOTONIC_RAW, &tsnow) == 0)) {
@ -124,7 +124,7 @@ struct curltime curlx_now(void)
if(
#if defined(__APPLE__) && defined(HAVE_BUILTIN_AVAILABLE) && \
(HAVE_BUILTIN_AVAILABLE == 1)
(HAVE_BUILTIN_AVAILABLE == 1)
have_clock_gettime &&
#endif
(clock_gettime(CLOCK_MONOTONIC, &tsnow) == 0)) {
@ -222,12 +222,12 @@ struct curltime curlx_now(void)
*/
timediff_t curlx_timediff_ms(struct curltime newer, struct curltime older)
{
timediff_t diff = (timediff_t)newer.tv_sec-older.tv_sec;
if(diff >= (TIMEDIFF_T_MAX/1000))
timediff_t diff = (timediff_t)newer.tv_sec - older.tv_sec;
if(diff >= (TIMEDIFF_T_MAX / 1000))
return TIMEDIFF_T_MAX;
else if(diff <= (TIMEDIFF_T_MIN/1000))
else if(diff <= (TIMEDIFF_T_MIN / 1000))
return TIMEDIFF_T_MIN;
return diff * 1000 + (newer.tv_usec-older.tv_usec)/1000;
return diff * 1000 + (newer.tv_usec - older.tv_usec) / 1000;
}
/*
@ -237,12 +237,12 @@ timediff_t curlx_timediff_ms(struct curltime newer, struct curltime older)
timediff_t curlx_timediff_ceil_ms(struct curltime newer,
struct curltime older)
{
timediff_t diff = (timediff_t)newer.tv_sec-older.tv_sec;
if(diff >= (TIMEDIFF_T_MAX/1000))
timediff_t diff = (timediff_t)newer.tv_sec - older.tv_sec;
if(diff >= (TIMEDIFF_T_MAX / 1000))
return TIMEDIFF_T_MAX;
else if(diff <= (TIMEDIFF_T_MIN/1000))
else if(diff <= (TIMEDIFF_T_MIN / 1000))
return TIMEDIFF_T_MIN;
return diff * 1000 + (newer.tv_usec - older.tv_usec + 999)/1000;
return diff * 1000 + (newer.tv_usec - older.tv_usec + 999) / 1000;
}
/*
@ -251,10 +251,10 @@ timediff_t curlx_timediff_ceil_ms(struct curltime newer,
*/
timediff_t curlx_timediff_us(struct curltime newer, struct curltime older)
{
timediff_t diff = (timediff_t)newer.tv_sec-older.tv_sec;
if(diff >= (TIMEDIFF_T_MAX/1000000))
timediff_t diff = (timediff_t)newer.tv_sec - older.tv_sec;
if(diff >= (TIMEDIFF_T_MAX / 1000000))
return TIMEDIFF_T_MAX;
else if(diff <= (TIMEDIFF_T_MIN/1000000))
else if(diff <= (TIMEDIFF_T_MIN / 1000000))
return TIMEDIFF_T_MIN;
return diff * 1000000 + newer.tv_usec-older.tv_usec;
return diff * 1000000 + newer.tv_usec - older.tv_usec;
}

View file

@ -74,7 +74,7 @@ int curlx_wait_ms(timediff_t timeout_ms)
/* prevent overflow, timeout_ms is typecast to ULONG/DWORD. */
#if TIMEDIFF_T_MAX >= ULONG_MAX
if(timeout_ms >= ULONG_MAX)
timeout_ms = ULONG_MAX-1;
timeout_ms = ULONG_MAX - 1;
/* do not use ULONG_MAX, because that is equal to INFINITE */
#endif
Sleep((DWORD)timeout_ms);

View file

@ -27,10 +27,10 @@
#if defined(__INTEL_COMPILER) && defined(__unix__)
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#include <arpa/inet.h>
#endif
#endif /* __INTEL_COMPILER && __unix__ */
@ -56,15 +56,15 @@
unsigned char curlx_ultouc(unsigned long ulnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(ulnum <= (unsigned long) CURL_MASK_UCHAR);
return (unsigned char)(ulnum & (unsigned long) CURL_MASK_UCHAR);
DEBUGASSERT(ulnum <= (unsigned long)CURL_MASK_UCHAR);
return (unsigned char)(ulnum & (unsigned long)CURL_MASK_UCHAR);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -75,15 +75,15 @@ unsigned char curlx_ultouc(unsigned long ulnum)
int curlx_uztosi(size_t uznum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(uznum <= (size_t) CURL_MASK_SINT);
return (int)(uznum & (size_t) CURL_MASK_SINT);
DEBUGASSERT(uznum <= (size_t)CURL_MASK_SINT);
return (int)(uznum & (size_t)CURL_MASK_SINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -94,17 +94,17 @@ int curlx_uztosi(size_t uznum)
unsigned long curlx_uztoul(size_t uznum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
#if ULONG_MAX < SIZE_MAX
DEBUGASSERT(uznum <= (size_t) CURL_MASK_ULONG);
DEBUGASSERT(uznum <= (size_t)CURL_MASK_ULONG);
#endif
return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG);
return (unsigned long)(uznum & (size_t)CURL_MASK_ULONG);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -115,17 +115,17 @@ unsigned long curlx_uztoul(size_t uznum)
unsigned int curlx_uztoui(size_t uznum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
#if UINT_MAX < SIZE_MAX
DEBUGASSERT(uznum <= (size_t) CURL_MASK_UINT);
DEBUGASSERT(uznum <= (size_t)CURL_MASK_UINT);
#endif
return (unsigned int)(uznum & (size_t) CURL_MASK_UINT);
return (unsigned int)(uznum & (size_t)CURL_MASK_UINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -136,18 +136,18 @@ unsigned int curlx_uztoui(size_t uznum)
int curlx_sltosi(long slnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(slnum >= 0);
#if INT_MAX < LONG_MAX
DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_SINT);
DEBUGASSERT((unsigned long)slnum <= (unsigned long)CURL_MASK_SINT);
#endif
return (int)(slnum & (long) CURL_MASK_SINT);
return (int)(slnum & (long)CURL_MASK_SINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -158,18 +158,18 @@ int curlx_sltosi(long slnum)
unsigned int curlx_sltoui(long slnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(slnum >= 0);
#if UINT_MAX < LONG_MAX
DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_UINT);
DEBUGASSERT((unsigned long)slnum <= (unsigned long)CURL_MASK_UINT);
#endif
return (unsigned int)(slnum & (long) CURL_MASK_UINT);
return (unsigned int)(slnum & (long)CURL_MASK_UINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -180,16 +180,16 @@ unsigned int curlx_sltoui(long slnum)
unsigned short curlx_sltous(long slnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(slnum >= 0);
DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_USHORT);
return (unsigned short)(slnum & (long) CURL_MASK_USHORT);
DEBUGASSERT((unsigned long)slnum <= (unsigned long)CURL_MASK_USHORT);
return (unsigned short)(slnum & (long)CURL_MASK_USHORT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -200,15 +200,15 @@ unsigned short curlx_sltous(long slnum)
ssize_t curlx_uztosz(size_t uznum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(uznum <= (size_t) CURL_MASK_SSIZE_T);
return (ssize_t)(uznum & (size_t) CURL_MASK_SSIZE_T);
DEBUGASSERT(uznum <= (size_t)CURL_MASK_SSIZE_T);
return (ssize_t)(uznum & (size_t)CURL_MASK_SSIZE_T);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -219,15 +219,15 @@ ssize_t curlx_uztosz(size_t uznum)
size_t curlx_sotouz(curl_off_t sonum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(sonum >= 0);
return (size_t)(sonum & (curl_off_t) CURL_MASK_USIZE_T);
return (size_t)(sonum & (curl_off_t)CURL_MASK_USIZE_T);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -238,18 +238,18 @@ size_t curlx_sotouz(curl_off_t sonum)
int curlx_sztosi(ssize_t sznum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(sznum >= 0);
#if INT_MAX < SSIZE_MAX
DEBUGASSERT((size_t) sznum <= (size_t) CURL_MASK_SINT);
DEBUGASSERT((size_t)sznum <= (size_t)CURL_MASK_SINT);
#endif
return (int)(sznum & (ssize_t) CURL_MASK_SINT);
return (int)(sznum & (ssize_t)CURL_MASK_SINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -260,15 +260,15 @@ int curlx_sztosi(ssize_t sznum)
unsigned short curlx_uitous(unsigned int uinum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(uinum <= (unsigned int) CURL_MASK_USHORT);
return (unsigned short) (uinum & (unsigned int) CURL_MASK_USHORT);
DEBUGASSERT(uinum <= (unsigned int)CURL_MASK_USHORT);
return (unsigned short)(uinum & (unsigned int)CURL_MASK_USHORT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -279,15 +279,15 @@ unsigned short curlx_uitous(unsigned int uinum)
size_t curlx_sitouz(int sinum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#pragma warning(push)
#pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(sinum >= 0);
return (size_t) sinum;
return (size_t)sinum;
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#pragma warning(pop)
#endif
}
@ -333,7 +333,6 @@ bool curlx_sotouz_fits(curl_off_t sonum, size_t *puznum)
return TRUE;
}
bool curlx_sltouz(long slnum, size_t *puznum)
{
if(slnum < 0) {

View file

@ -31,7 +31,7 @@
#endif
#define CURLX_FUNCTION_CAST(target_type, func) \
(target_type)(void (*) (void))(func)
(target_type)(void (*)(void))(func)
unsigned char curlx_ultouc(unsigned long ulnum);

View file

@ -57,8 +57,8 @@ const char *curlx_get_winapi_error(DWORD err, char *buf, size_t buflen)
/* Truncate multiple lines */
p = strchr(buf, '\n');
if(p) {
if(p > buf && *(p-1) == '\r')
*(p-1) = '\0';
if(p > buf && *(p - 1) == '\r')
*(p - 1) = '\0';
else
*p = '\0';
}
@ -89,7 +89,6 @@ const char *curlx_winapi_strerror(DWORD err, char *buf, size_t buflen)
#if defined(__GNUC__) && __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif
}
#else
{