Ignore UTF-8 byte order mark if present

This commit is contained in:
Eric Fischer 2017-02-08 10:20:45 -08:00
parent 240ccbd219
commit dd0a135b01
4 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,6 @@
## 1.19.2
* Ignore UTF-8 byte order mark if present
## 1.19.1
* Add an option to increase maxzoom if features are still being dropped

View File

@ -36,14 +36,14 @@ json_pull *json_begin(ssize_t (*read)(struct json_pull *, char *buffer, size_t n
static inline int peek(json_pull *j) {
if (j->buffer_head < j->buffer_tail) {
return j->buffer[j->buffer_head];
return (unsigned char) j->buffer[j->buffer_head];
} else {
j->buffer_head = 0;
j->buffer_tail = j->read(j, j->buffer, BUFFER);
if (j->buffer_head >= j->buffer_tail) {
return EOF;
}
return j->buffer[j->buffer_head];
return (unsigned char) j->buffer[j->buffer_head];
}
}
@ -295,6 +295,22 @@ again:
return NULL;
}
// Byte-order mark
if (c == 0xEF) {
int c2 = peek(j);
if (c2 == 0xBB) {
c2 = read_wrap(j);
c2 = peek(j);
if (c2 == 0xBF) {
c2 = read_wrap(j);
c = ' ';
continue;
}
}
j->error = "Corrupt byte-order mark found";
return NULL;
}
} while (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 0x1E);
/////////////////////////// Arrays

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
#define VERSION "tippecanoe v1.19.1\n"
#define VERSION "tippecanoe v1.19.2\n"