forked from weaselab/weaseljson
Address review feedback
This commit is contained in:
@@ -67,7 +67,7 @@ void WeaselJsonParser_destroy(WeaselJsonParser *parser);
|
||||
/** Incrementally parse `len` more bytes starting at `buf`. `buf` may be
|
||||
* modified. Call with `len` 0 to indicate end of data. `buf` may be null if
|
||||
* `len` is 0. `len` must not be negative; a negative length is treated as a
|
||||
* rejected input. */
|
||||
* rejected input. Returns WeaselJson_NULL if parser is null */
|
||||
WeaselJsonStatus WeaselJsonParser_parse(WeaselJsonParser *parser, char *buf,
|
||||
int len);
|
||||
|
||||
|
||||
+1
-2
@@ -331,8 +331,7 @@ TEST_CASE("parse rejects negative length") {
|
||||
}
|
||||
|
||||
TEST_CASE("Calling parse with nullptr doesn't crash") {
|
||||
char buf[10] = "hello";
|
||||
REQUIRE(WeaselJsonParser_parse(nullptr, buf, -1) == WeaselJson_NULL);
|
||||
REQUIRE(WeaselJsonParser_parse(nullptr, nullptr, 0) == WeaselJson_NULL);
|
||||
}
|
||||
|
||||
TEST_CASE("streaming") { testStreaming(json); }
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ int main(int argc, char **argv) {
|
||||
case WeaselJson_OVERFLOW:
|
||||
return 1;
|
||||
case WeaselJson_NULL:
|
||||
fprintf(stderr, "Could not create parser\n");
|
||||
fprintf(stderr, "parse called with a null parser\n");
|
||||
return 1;
|
||||
}
|
||||
if (l == 0) {
|
||||
|
||||
Reference in New Issue
Block a user