Browse Source

remove compiler warnings

master
Felix von Leitner 6 years ago
parent
commit
21ca7d8264
16 changed files with 23 additions and 23 deletions
  1. +1
    -1
      fmt/fmt_8long.c
  2. +1
    -1
      fmt/fmt_8longlong.c
  3. +3
    -3
      fmt/fmt_escapecharc.c
  4. +3
    -3
      fmt/fmt_escapecharjson.c
  5. +1
    -1
      fmt/fmt_fill.c
  6. +2
    -2
      fmt/fmt_httpdate.c
  7. +2
    -2
      fmt/fmt_human.c
  8. +1
    -1
      fmt/fmt_humank.c
  9. +2
    -2
      fmt/fmt_long.c
  10. +1
    -1
      fmt/fmt_pad.c
  11. +1
    -1
      fmt/fmt_strn.c
  12. +1
    -1
      fmt/fmt_tohex.c
  13. +1
    -1
      fmt/fmt_ulong.c
  14. +1
    -1
      fmt/fmt_ulonglong.c
  15. +1
    -1
      fmt/fmt_xlong.c
  16. +1
    -1
      fmt/fmt_xlonglong.c

+ 1
- 1
fmt/fmt_8long.c View File

@@ -6,7 +6,7 @@ size_t fmt_8long(char *dest,unsigned long i) {
for (len=1, tmp=i; tmp>7; ++len) tmp>>=3;
if (dest)
for (tmp=i, dest+=len; ; ) {
*--dest = (tmp&7)+'0';
*--dest = (char)((tmp&7)+'0');
if (!(tmp>>=3)) break;
}
return len;


+ 1
- 1
fmt/fmt_8longlong.c View File

@@ -7,7 +7,7 @@ size_t fmt_8longlong(char *dest,unsigned long long i) {
for (len=1, tmp=i; tmp>7; ++len) tmp>>=3;
if (dest)
for (tmp=i, dest+=len; ; ) {
*--dest = (tmp&7)+'0';
*--dest = (char)((tmp&7)+'0');
if (!(tmp>>=3)) break;
}
return len;


+ 3
- 3
fmt/fmt_escapecharc.c View File

@@ -1,9 +1,9 @@
#include "fmt.h"

static void fmt_oct3(char* dest,uint8_t w) {
dest[2]=(w&7)+'0'; w>>=3;
dest[1]=(w&7)+'0'; w>>=3;
dest[0]=(w&7)+'0';
dest[2]=(char)((w&7)+'0'); w>>=3;
dest[1]=(char)((w&7)+'0'); w>>=3;
dest[0]=(char)((w&7)+'0');
}

size_t fmt_escapecharc(char* dest,uint32_t ch) {


+ 3
- 3
fmt/fmt_escapecharjson.c View File

@@ -22,7 +22,7 @@ size_t fmt_escapecharjson(char* dest,uint32_t ch) {
simple:
if (dest) {
dest[0]='\\';
dest[1]=ch;
dest[1]=(char)ch;
}
return 2;
}
@@ -31,7 +31,7 @@ simple:
if (dest) {
dest[0]='\\';
dest[1]='u';
fmt_hex4(dest+2,0xd800 | (((ch-0x10000)>>10)&0x3ff));
fmt_hex4(dest+2,(uint16_t)(0xd800 | (((ch-0x10000)>>10)&0x3ff)));
dest+=6;
}
ch=(ch&0x3ff)|0xdc00;
@@ -41,7 +41,7 @@ simple:
if (dest) {
dest[0]='\\';
dest[1]='u';
fmt_hex4(dest+2,ch);
fmt_hex4(dest+2,(uint16_t)ch);
}
return n+6;
}

+ 1
- 1
fmt/fmt_fill.c View File

@@ -19,5 +19,5 @@ size_t fmt_fill(char* dest,size_t srclen,size_t padlen,size_t maxlen) {
if (dest>max) break;
*dest=' '; ++dest;
}
return dest-olddest;
return (size_t)(dest-olddest);
}

+ 2
- 2
fmt/fmt_httpdate.c View File

@@ -3,8 +3,8 @@
#include <time.h>

static unsigned int fmt_2digits(char* dest,int i) {
dest[0]=(i/10)+'0';
dest[1]=(i%10)+'0';
dest[0]=(char)((i/10)+'0');
dest[1]=(char)((i%10)+'0');
return 2;
}



+ 2
- 2
fmt/fmt_human.c View File

@@ -2,7 +2,7 @@

size_t fmt_human(char* dest,unsigned long long l) {
char unit;
int i;
size_t i;
if (l<1000) return fmt_ulong(dest,l);
if (l>1000000000000ull) {
/* dang! overflow! */
@@ -22,7 +22,7 @@ size_t fmt_human(char* dest,unsigned long long l) {
if (!dest) return fmt_ulong(0,l)+2;
i=fmt_ulong(dest,l/10);
dest[i]='.';
dest[i+1]=(l%10)+'0';
dest[i+1]=(char)((l%10)+'0');
dest[i+2]=unit;
return i+3;
}

+ 1
- 1
fmt/fmt_humank.c View File

@@ -20,7 +20,7 @@ size_t fmt_humank(char* dest,unsigned long long l) {
if (!dest) return fmt_ulong(0,l)+2;
i=fmt_ulong(dest,l/10);
dest[i]='.';
dest[i+1]=(l%10)+'0';
dest[i+1]=(char)((l%10)+'0');
dest[i+2]=unit;
return i+3;
}

+ 2
- 2
fmt/fmt_long.c View File

@@ -3,7 +3,7 @@
size_t fmt_long(char *dest,long int i) {
if (i<0) {
if (dest) *dest++='-';
return fmt_ulong(dest,-i)+1;
return fmt_ulong(dest,(unsigned long)-i)+1;
} else
return fmt_ulong(dest,i);
return fmt_ulong(dest,(unsigned long)i);
}

+ 1
- 1
fmt/fmt_pad.c View File

@@ -18,7 +18,7 @@ size_t fmt_pad(char* dest,const char* src,size_t srclen,size_t padlen,size_t max
if (dest>max) break;
*dest=' '; ++dest;
}
for (todo=(long)srclen>maxlen?maxlen:srclen; todo>0; --todo) {
for (todo=(long)(srclen>maxlen?maxlen:srclen); todo>0; --todo) {
if (dest>max) break;
*dest=*src; ++dest; ++src;
}


+ 1
- 1
fmt/fmt_strn.c View File

@@ -10,5 +10,5 @@ size_t fmt_strn(char *out,const char *in,size_t limit) {
if (!*t || t==u) break; if (s) { *s=*t; ++s; } ++t;
if (!*t || t==u) break; if (s) { *s=*t; ++s; } ++t;
}
return t-in;
return (size_t)(t-in);
}

+ 1
- 1
fmt/fmt_tohex.c View File

@@ -1,6 +1,6 @@
#include "fmt.h"

char fmt_tohex(char c) {
return c>=10?c-10+'a':c+'0';
return (char)(c>=10?c-10+'a':c+'0');
}


+ 1
- 1
fmt/fmt_ulong.c View File

@@ -6,6 +6,6 @@ size_t fmt_ulong(char *dest,unsigned long i) {
for (len=1, tmp=i; tmp>9; ++len) tmp/=10;
if (dest)
for (tmp=i, dest+=len, len2=len+1; --len2; tmp/=10)
*--dest = (tmp%10)+'0';
*--dest = (char)((tmp%10)+'0');
return len;
}

+ 1
- 1
fmt/fmt_ulonglong.c View File

@@ -7,6 +7,6 @@ size_t fmt_ulonglong(char *dest,unsigned long long int i) {
for (len=1, tmp=i; tmp>9; ++len) tmp/=10;
if (dest)
for (tmp=i, dest+=len, len2=len+1; --len2; tmp/=10)
*--dest = (tmp%10)+'0';
*--dest = (char)((tmp%10)+'0');
return len;
}

+ 1
- 1
fmt/fmt_xlong.c View File

@@ -2,7 +2,7 @@
#include "haveinline.h"

static inline char tohex(char c) {
return c>=10?c-10+'a':c+'0';
return (char)(c>=10?c-10+'a':c+'0');
}

size_t fmt_xlong(char *dest,unsigned long i) {


+ 1
- 1
fmt/fmt_xlonglong.c View File

@@ -1,7 +1,7 @@
#include "fmt.h"

static inline char tohex(char c) {
return c>=10?c-10+'a':c+'0';
return (char)(c>=10?c-10+'a':c+'0');
}

size_t fmt_xlonglong(char *dest,unsigned long long i) {


Loading…
Cancel
Save