summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/mprintf.c
diff options
context:
space:
mode:
authordartraiden <wowemuh@gmail.com>2024-05-24 23:43:03 +0300
committerdartraiden <wowemuh@gmail.com>2024-05-24 23:43:03 +0300
commitff76fe6c8f1e3b34c5571437612a038077f29860 (patch)
tree0ae912a13465fa5658253185d4eeab21d6ecdfde /libs/libcurl/src/mprintf.c
parent174bf88b63eaf4b49c00894a3f14fbf9194cae02 (diff)
libcurl: update to 8.8.0
Diffstat (limited to 'libs/libcurl/src/mprintf.c')
-rw-r--r--libs/libcurl/src/mprintf.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/libs/libcurl/src/mprintf.c b/libs/libcurl/src/mprintf.c
index 9b9e6ed56a..21d62fa654 100644
--- a/libs/libcurl/src/mprintf.c
+++ b/libs/libcurl/src/mprintf.c
@@ -77,7 +77,7 @@ static const char upper_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define OUTCHAR(x) \
do { \
- if(!stream(x, userp)) \
+ if(!stream((unsigned char)x, userp)) \
done++; \
else \
return done; /* return on failure */ \
@@ -243,7 +243,7 @@ static int parsefmt(const char *format,
struct va_input *iptr;
bool loopit = TRUE;
fmt++;
- outlen = fmt - start - 1;
+ outlen = (size_t)(fmt - start - 1);
if(*fmt == '%') {
/* this means a %% that should be output only as %. Create an output
segment. */
@@ -261,7 +261,8 @@ static int parsefmt(const char *format,
continue; /* while */
}
- flags = width = precision = 0;
+ flags = 0;
+ width = precision = 0;
if(use_dollar != DOLLAR_NOPE) {
param = dollarstring(fmt, &fmt);
@@ -291,7 +292,7 @@ static int parsefmt(const char *format,
break;
case '-':
flags |= FLAGS_LEFT;
- flags &= ~FLAGS_PAD_NIL;
+ flags &= ~(unsigned int)FLAGS_PAD_NIL;
break;
case '#':
flags |= FLAGS_ALT;
@@ -549,7 +550,7 @@ static int parsefmt(const char *format,
optr = &out[ocount++];
if(ocount > MAX_SEGMENTS)
return PFMT_MANYSEGS;
- optr->input = param;
+ optr->input = (unsigned int)param;
optr->flags = flags;
optr->width = width;
optr->precision = precision;
@@ -562,7 +563,7 @@ static int parsefmt(const char *format,
}
/* is there a trailing piece */
- outlen = fmt - start;
+ outlen = (size_t)(fmt - start);
if(outlen) {
optr = &out[ocount++];
if(ocount > MAX_SEGMENTS)
@@ -688,7 +689,7 @@ static int formatf(
mp_intmax_t signed_num; /* Used to convert negative in positive. */
char *w;
size_t outlen = optr->outlen;
- int flags = optr->flags;
+ unsigned int flags = optr->flags;
if(outlen) {
char *str = optr->start;
@@ -710,7 +711,7 @@ static int formatf(
else
width = -width;
flags |= FLAGS_LEFT;
- flags &= ~FLAGS_PAD_NIL;
+ flags &= ~(unsigned int)FLAGS_PAD_NIL;
}
}
else
@@ -867,7 +868,7 @@ number:
str = nilstr;
len = sizeof(nilstr) - 1;
/* Disable quotes around (nil) */
- flags &= (~FLAGS_ALT);
+ flags &= ~(unsigned int)FLAGS_ALT;
}
else {
str = "";
@@ -886,13 +887,13 @@ number:
if(flags & FLAGS_ALT)
OUTCHAR('"');
- if(!(flags&FLAGS_LEFT))
+ if(!(flags & FLAGS_LEFT))
while(width-- > 0)
OUTCHAR(' ');
for(; len && *str; len--)
OUTCHAR(*str++);
- if(flags&FLAGS_LEFT)
+ if(flags & FLAGS_LEFT)
while(width-- > 0)
OUTCHAR(' ');
@@ -952,12 +953,13 @@ number:
*fptr = 0;
if(width >= 0) {
+ size_t dlen;
if(width >= (int)sizeof(work))
width = sizeof(work)-1;
/* RECURSIVE USAGE */
- len = curl_msnprintf(fptr, left, "%d", width);
- fptr += len;
- left -= len;
+ dlen = (size_t)curl_msnprintf(fptr, left, "%d", width);
+ fptr += dlen;
+ left -= dlen;
}
if(prec >= 0) {
/* for each digit in the integer part, we can have one less
@@ -965,7 +967,7 @@ number:
size_t maxprec = sizeof(work) - 2;
double val = iptr->val.dnum;
if(width > 0 && prec <= width)
- maxprec -= width;
+ maxprec -= (size_t)width;
while(val >= 10.0) {
val /= 10;
maxprec--;
@@ -1039,7 +1041,7 @@ static int addbyter(unsigned char outc, void *f)
struct nsprintf *infop = f;
if(infop->length < infop->max) {
/* only do this if we haven't reached max length yet */
- *infop->buffer++ = outc; /* store */
+ *infop->buffer++ = (char)outc; /* store */
infop->length++; /* we are now one byte larger */
return 0; /* fputc() returns like this on success */
}
@@ -1139,7 +1141,7 @@ char *curl_maprintf(const char *format, ...)
static int storebuffer(unsigned char outc, void *f)
{
char **buffer = f;
- **buffer = outc;
+ **buffer = (char)outc;
(*buffer)++;
return 0;
}
@@ -1160,9 +1162,7 @@ static int fputc_wrapper(unsigned char outc, void *f)
int out = outc;
FILE *s = f;
int rc = fputc(out, s);
- if(rc == out)
- return 0;
- return 1;
+ return rc == EOF;
}
int curl_mprintf(const char *format, ...)