@ -8,6 +8,7 @@
#include "scan/scan_ulong.c"
#include "scan/scan_ulongn.c"
#include "fmt/fmt_utf8.c"
#include "fmt/fmt_tohex.c"
#include "fmt/fmt_escapecharc.c"
char tmp[20];
@ -11,7 +11,7 @@ size_t scan_double(const char *in, double *dest) {
register const char *c=in;
char neg=0;
switch (*c) {
case '-': neg=1;
case '-': neg=1; /* fall through */
case '+': c++; break;
default: break;
}
@ -31,7 +31,7 @@ size_t scan_double(const char *in, double *dest) {
if (c[1]<'0') {
default:
d=0;
@ -10,7 +10,7 @@ size_t scan_int(const char* src,int* dest) {
int ok;
tmp=src; l=0; ok=0; neg=0;
switch (*tmp) {
case '+': ++tmp;
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;
while (n-->0 && (c=(unsigned char)(*tmp-'0'))<10) {
@ -3,7 +3,7 @@
size_t scan_plusminus(const char *src,signed int *dest) {
*dest=1;
switch (*src) {
case '-': *dest=-1;
case '-': *dest=-1; /* fall through */
case '+': return 1; break;
return 0;
@ -10,7 +10,7 @@ size_t scan_short(const char* src,short* dest) {
tmp=src; l=0; ok=neg=0;
@ -126,6 +126,7 @@ int main(int argc,char* argv[]) {
(void)writecb;
(void)argc;
(void)argv;
(void)c;
assert(fmt_jsonescape(buf,"foo\nbar\\",8)==10 && byte_equal(buf,10,"foo\\nbar\\\\"));
memset(buf,0,sizeof(buf));
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;
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;
/* fall through */
case '.': /* dot at start of line needs to be escaped */
if (!linelen) goto dontescape;