remove new compiler warnings from gcc 7

master
leitner 8 years ago
parent 660c314341
commit dba47741bf

@ -8,6 +8,7 @@
#include "scan/scan_ulong.c" #include "scan/scan_ulong.c"
#include "scan/scan_ulongn.c" #include "scan/scan_ulongn.c"
#include "fmt/fmt_utf8.c" #include "fmt/fmt_utf8.c"
#include "fmt/fmt_tohex.c"
#include "fmt/fmt_escapecharc.c" #include "fmt/fmt_escapecharc.c"
char tmp[20]; char tmp[20];

@ -11,7 +11,7 @@ size_t scan_double(const char *in, double *dest) {
register const char *c=in; register const char *c=in;
char neg=0; char neg=0;
switch (*c) { switch (*c) {
case '-': neg=1; case '-': neg=1; /* fall through */
case '+': c++; break; case '+': c++; break;
default: break; default: break;
} }
@ -31,7 +31,7 @@ size_t scan_double(const char *in, double *dest) {
char neg=0; char neg=0;
if (c[1]<'0') { if (c[1]<'0') {
switch (*c) { switch (*c) {
case '-': neg=1; case '-': neg=1; /* fall through */
case '+': c++; break; case '+': c++; break;
default: default:
d=0; d=0;

@ -10,7 +10,7 @@ size_t scan_int(const char* src,int* dest) {
int ok; int ok;
tmp=src; l=0; ok=0; neg=0; tmp=src; l=0; ok=0; neg=0;
switch (*tmp) { switch (*tmp) {
case '-': neg=1; case '-': neg=1; /* fall through */
case '+': ++tmp; case '+': ++tmp;
} }
while ((c=(unsigned char)(*tmp-'0'))<10) { while ((c=(unsigned char)(*tmp-'0'))<10) {

@ -11,7 +11,7 @@ size_t scan_longn(const char *src,size_t n,long *dest) {
if (!n--) return 0; if (!n--) return 0;
tmp=src; l=0; ok=0; neg=0; tmp=src; l=0; ok=0; neg=0;
switch (*tmp) { switch (*tmp) {
case '-': neg=1; case '-': neg=1; /* fall through */
case '+': ++tmp; case '+': ++tmp;
} }
while (n-->0 && (c=(unsigned char)(*tmp-'0'))<10) { while (n-->0 && (c=(unsigned char)(*tmp-'0'))<10) {

@ -3,7 +3,7 @@
size_t scan_plusminus(const char *src,signed int *dest) { size_t scan_plusminus(const char *src,signed int *dest) {
*dest=1; *dest=1;
switch (*src) { switch (*src) {
case '-': *dest=-1; case '-': *dest=-1; /* fall through */
case '+': return 1; break; case '+': return 1; break;
} }
return 0; return 0;

@ -10,7 +10,7 @@ size_t scan_short(const char* src,short* dest) {
int ok; int ok;
tmp=src; l=0; ok=neg=0; tmp=src; l=0; ok=neg=0;
switch (*tmp) { switch (*tmp) {
case '-': neg=1; case '-': neg=1; /* fall through */
case '+': ++tmp; case '+': ++tmp;
} }
while ((c=(unsigned char)(*tmp-'0'))<10) { while ((c=(unsigned char)(*tmp-'0'))<10) {

1
t.c

@ -126,6 +126,7 @@ int main(int argc,char* argv[]) {
(void)writecb; (void)writecb;
(void)argc; (void)argc;
(void)argv; (void)argv;
(void)c;
assert(fmt_jsonescape(buf,"foo\nbar\\",8)==10 && byte_equal(buf,10,"foo\\nbar\\\\")); assert(fmt_jsonescape(buf,"foo\nbar\\",8)==10 && byte_equal(buf,10,"foo\\nbar\\\\"));
memset(buf,0,sizeof(buf)); memset(buf,0,sizeof(buf));
assert(scan_jsonescape("foo\\u000abar\\\\",buf,&l)==14 && l==8 && byte_equal(buf,8,"foo\nbar\\")); assert(scan_jsonescape("foo\\u000abar\\\\",buf,&l)==14 && l==8 && byte_equal(buf,8,"foo\nbar\\"));

@ -16,6 +16,7 @@ size_t fmt_yenc(char* dest,const char* src,size_t len) {
goto dontescape; goto dontescape;
case 'F': /* escape "^From " */ case 'F': /* escape "^From " */
if (s[i+1]+42!='r' || s[i+2]+42!='o' || s[i+3]+42!='m' || s[i+4]+42!=' ') goto dontescape; if (s[i+1]+42!='r' || s[i+2]+42!='o' || s[i+3]+42!='m' || s[i+4]+42!=' ') goto dontescape;
/* fall through */
case '.': /* dot at start of line needs to be escaped */ case '.': /* dot at start of line needs to be escaped */
if (!linelen) goto dontescape; if (!linelen) goto dontescape;
/* fall through */ /* fall through */

Loading…
Cancel
Save