reduce scope of warning silencing

This commit is contained in:
heckflosse
2017-10-25 16:50:03 +02:00
parent fb02e6883e
commit 7b3c36c7c6

View File

@@ -31,7 +31,6 @@
#include <limits.h>
#include <ctype.h>
#include "cJSON.h"
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
static const char *ep;
@@ -192,12 +191,21 @@ static const char *parse_string(cJSON *item,const char *str)
len=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len;
#ifdef __GNUC__ // silence warning
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
switch (len) {
case 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
case 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
case 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
case 1: *--ptr2 =(uc | firstByteMark[len]);
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
ptr2+=len;
break;
default: *ptr2++=*ptr; break;