Skip to content

Commit 03aaaae

Browse files
committed
replace use of deprecated api
1 parent eb4c7ee commit 03aaaae

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

‎fuzz/fuzz_dump.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "NullBuffer.h"
88

99
// example from doc/basics.md#tree-walking-and-json-element-types
10-
void print_json(std::ostream& os, simdjson::dom::element element) {
10+
static void print_json(std::ostream& os, simdjson::dom::element element) {
1111
const char endl='\n';
1212
switch (element.type()) {
1313
case simdjson::dom::element_type::ARRAY:

‎fuzz/fuzz_parser.cpp‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
#include <string>
55
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
66

7-
auto ignored = simdjson::build_parsed_json(Data, Size);
8-
9-
return 0;
7+
try {
8+
simdjson::dom::parser pj;
9+
auto result=pj.parse(Data, Size);
10+
UNUSED auto v=result.value();
11+
}catch(...) {
12+
}
13+
return 0;
1014
}

‎fuzz/fuzz_print_json.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
1010

11-
try {
12-
auto pj = simdjson::build_parsed_json(Data, Size);
13-
NulOStream os;
14-
bool ignored=pj.print_json(os);
15-
(void)ignored;
16-
} catch (...) {
17-
}
18-
return 0;
11+
try {
12+
simdjson::dom::parser pj;
13+
auto elem=pj.parse(Data, Size);
14+
NulOStream os;
15+
os<<elem;
16+
} catch (...) {
17+
}
18+
return 0;
1919
}

0 commit comments

Comments
 (0)