aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Paland <marco@paland.com>2017-10-30 13:38:59 +0100
committerMarco Paland <marco@paland.com>2017-10-30 13:38:59 +0100
commite50beaa69ea4832dd984fef2e4c297df3495801b (patch)
treee476b48ff3e1cfe16501d2d63c528afb7adf95fc
parentf54e549e4b8053eb9266f87491877896790eadb8 (diff)
downloadprintf-e50beaa69ea4832dd984fef2e4c297df3495801b.tar.gz
printf-e50beaa69ea4832dd984fef2e4c297df3495801b.tar.bz2
printf-e50beaa69ea4832dd984fef2e4c297df3495801b.zip
Fixed compiler warnings
-rw-r--r--printf.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/printf.cpp b/printf.cpp
index 22831d0..5eb8840 100644
--- a/printf.cpp
+++ b/printf.cpp
@@ -85,7 +85,7 @@ static inline unsigned int _atoi(const char** str)
{
unsigned int i = 0U;
while (_is_digit(**str)) {
- i = i * 10U + *((*str)++) - '0';
+ i = i * 10U + (unsigned int)(*((*str)++) - '0');
}
return i;
}
@@ -197,8 +197,8 @@ static size_t _ftoa(double value, char* buffer, size_t maxlen, unsigned int prec
const double thres_max = (double)0x7FFFFFFF;
char buf[FTOA_BUFFER_SIZE];
- size_t len = 0U;
- double diff = 0.0;
+ size_t len = 0U;
+ double diff = 0;
// powers of 10
static const double pow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
@@ -225,7 +225,7 @@ static size_t _ftoa(double value, char* buffer, size_t maxlen, unsigned int prec
if (diff > 0.5) {
++frac;
- // handle rollover, e.g. case 0.99 with prec 1 is 1.0
+ // handle rollover, e.g. case 0.99 with prec 1 is 1.0
if (frac >= pow10[prec]) {
frac = 0;
++whole;
@@ -479,7 +479,7 @@ static size_t vsnprintf(char* buffer, size_t buffer_len, const char* format, va_
}
}
// char output
- buffer[idx++] = va_arg(va, char);
+ buffer[idx++] = (char)va_arg(va, int);
// post padding
if (flags & FLAGS_LEFT) {
while ((idx < buffer_len) && (l++ < width)) {