mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b13020d65 | |||
| 75c6c950e5 | |||
| 5ad7698af1 | |||
| f6f359d3eb | |||
| 185e157e0c | |||
| 3f3f6cde7c | |||
| 005054916d | |||
| 338224849d | |||
| ada52641b4 | |||
| ede9d57f22 | |||
| 7bf33f6c8a | |||
| d62b789cb3 | |||
| 33dbd44098 | |||
| e0dcf8adc9 | |||
| 34dcd33a88 | |||
| 17a1a8e187 |
@@ -0,0 +1,24 @@
|
||||
name: Ubuntu 22.04 CI GCC 12 with GLIBCXX_ASSERTIONS
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
ubuntu-build:
|
||||
if: >-
|
||||
! contains(toJSON(github.event.commits.*.message), '[skip ci]') &&
|
||||
! contains(toJSON(github.event.commits.*.message), '[skip github]')
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: dependencies/.cache
|
||||
key: ${{ hashFiles('dependencies/CMakeLists.txt') }}
|
||||
- name: Install gcc12
|
||||
run: sudo apt-get install -y g++-12
|
||||
- name: Use cmake
|
||||
run: |
|
||||
mkdir build &&
|
||||
cd build &&
|
||||
CXX=g++-12 cmake -DCMAKE_BUILD_TYPE=Debug -DSIMDJSON_GLIBCXX_ASSERTIONS=ON -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_DEVELOPER_MODE=ON .. &&
|
||||
cmake --build . &&
|
||||
ctest . -E avoid_
|
||||
+16
-1
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14)
|
||||
project(
|
||||
simdjson
|
||||
# The version number is modified by tools/release.py
|
||||
VERSION 3.1.4
|
||||
VERSION 3.1.6
|
||||
DESCRIPTION "Parsing gigabytes of JSON per second"
|
||||
HOMEPAGE_URL "https://simdjson.org/"
|
||||
LANGUAGES CXX C
|
||||
@@ -95,6 +95,21 @@ if(
|
||||
)
|
||||
endif()
|
||||
|
||||
# GCC and Clang have horrendous Debug builds when using SIMD.
|
||||
# A common fix is to use '-Og' instead.
|
||||
# bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
|
||||
if(
|
||||
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
|
||||
CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
|
||||
CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
)
|
||||
message(STATUS "Adding -Og to compile flag")
|
||||
simdjson_add_props(
|
||||
target_compile_options PRIVATE
|
||||
$<$<CONFIG:DEBUG>:-Og>
|
||||
)
|
||||
endif()
|
||||
|
||||
if(SIMDJSON_ENABLE_THREADS)
|
||||
find_package(Threads REQUIRED)
|
||||
simdjson_add_props(target_link_libraries PUBLIC Threads::Threads)
|
||||
|
||||
@@ -38,7 +38,7 @@ PROJECT_NAME = simdjson
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = "3.1.4"
|
||||
PROJECT_NUMBER = "3.1.6"
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
@@ -564,7 +564,7 @@ static void error_code_twitter_default_profile(State& state) noexcept {
|
||||
for (dom::element tweet : tweets) {
|
||||
dom::object user;
|
||||
if ((error = tweet["user"].get(user))) { return; }
|
||||
bool default_profile;
|
||||
bool default_profile{};
|
||||
if ((error = user["default_profile"].get(default_profile))) { return; }
|
||||
if (default_profile) {
|
||||
std::string_view screen_name;
|
||||
|
||||
@@ -50,6 +50,23 @@ undefined behavior.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(SIMDJSON_SANITIZE_MEMORY "Sanitize memory" OFF)
|
||||
|
||||
|
||||
if(SIMDJSON_SANITIZE_MEMORY)
|
||||
message(STATUS "Setting the memory sanitizer.")
|
||||
add_compile_options(
|
||||
-fsanitize=memory -fno-sanitize-recover=all
|
||||
)
|
||||
link_libraries(
|
||||
-fsanitize=memory -fno-sanitize-recover=all
|
||||
)
|
||||
# Ubuntu bug for GCC 5.0+ (safe for all versions)
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
link_libraries(-fuse-ld=gold)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SIMDJSON_SANITIZE_THREADS)
|
||||
message(STATUS "Setting both the thread sanitizer \
|
||||
and the undefined-behavior sanitizer.")
|
||||
@@ -144,6 +161,11 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
option(SIMDJSON_GLIBCXX_ASSERTIONS "Set _GLIBCXX_ASSERTIONS" OFF)
|
||||
if (SIMDJSON_GLIBCXX_ASSERTIONS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_ASSERTIONS")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Other optional flags
|
||||
#
|
||||
|
||||
+1
-1
@@ -1023,7 +1023,7 @@ bool parse() {
|
||||
cout << "Make/Model: " << make << "/" << model << endl;
|
||||
|
||||
// Casting a JSON element to an integer
|
||||
uint64_t year;
|
||||
uint64_t year{};
|
||||
error = car["year"].get(year);
|
||||
if(error) { std::cerr << error << std::endl; return false; }
|
||||
cout << "- This car is " << 2020 - year << " years old." << endl;
|
||||
|
||||
@@ -9,6 +9,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
unsigned long ret;
|
||||
|
||||
@@ -226,7 +226,7 @@ inline error_code parser::ensure_capacity(document& target_document, size_t desi
|
||||
}
|
||||
|
||||
simdjson_inline void parser::set_max_capacity(size_t max_capacity) noexcept {
|
||||
if(max_capacity < MINIMAL_DOCUMENT_CAPACITY) {
|
||||
if(max_capacity > MINIMAL_DOCUMENT_CAPACITY) {
|
||||
_max_capacity = max_capacity;
|
||||
} else {
|
||||
_max_capacity = MINIMAL_DOCUMENT_CAPACITY;
|
||||
|
||||
@@ -9,6 +9,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#if SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
return (int)_tzcnt_u64(input_num);
|
||||
|
||||
@@ -9,6 +9,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#if SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
return (int)_tzcnt_u64(input_num);
|
||||
|
||||
@@ -148,6 +148,19 @@ use a 64-bit target such as x64, 64-bit ARM or 64-bit PPC.")
|
||||
#define SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#if defined(__has_feature)
|
||||
# if __has_feature(memory_sanitizer)
|
||||
#define SIMDJSON_NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory")))
|
||||
# endif // if __has_feature(memory_sanitizer)
|
||||
#endif // defined(__has_feature)
|
||||
#endif
|
||||
// make sure it is defined as 'nothing' if it is unapplicable.
|
||||
#ifndef SIMDJSON_NO_SANITIZE_MEMORY
|
||||
#define SIMDJSON_NO_SANITIZE_MEMORY
|
||||
#endif
|
||||
|
||||
#if SIMDJSON_VISUAL_STUDIO
|
||||
// This is one case where we do not distinguish between
|
||||
// regular visual studio and clang under visual studio.
|
||||
|
||||
@@ -9,6 +9,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#if SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
unsigned long ret;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define SIMDJSON_SIMDJSON_VERSION_H
|
||||
|
||||
/** The version of simdjson being used (major.minor.revision) */
|
||||
#define SIMDJSON_VERSION "3.1.4"
|
||||
#define SIMDJSON_VERSION "3.1.6"
|
||||
|
||||
namespace simdjson {
|
||||
enum {
|
||||
@@ -19,7 +19,7 @@ enum {
|
||||
/**
|
||||
* The revision (major.minor.REVISION) of simdjson being used.
|
||||
*/
|
||||
SIMDJSON_VERSION_REVISION = 4
|
||||
SIMDJSON_VERSION_REVISION = 6
|
||||
};
|
||||
} // namespace simdjson
|
||||
|
||||
|
||||
@@ -9,6 +9,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#if SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
unsigned long ret;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* auto-generated on 2023-03-09 10:42:23 -0500. Do not edit! */
|
||||
/* auto-generated on 2023-03-13 21:26:32 -0400. Do not edit! */
|
||||
/* begin file src/simdjson.cpp */
|
||||
#include "simdjson.h"
|
||||
|
||||
|
||||
+37
-4
@@ -1,4 +1,4 @@
|
||||
/* auto-generated on 2023-03-09 10:42:23 -0500. Do not edit! */
|
||||
/* auto-generated on 2023-03-13 21:26:32 -0400. Do not edit! */
|
||||
/* begin file include/simdjson.h */
|
||||
#ifndef SIMDJSON_H
|
||||
#define SIMDJSON_H
|
||||
@@ -43,7 +43,7 @@
|
||||
#define SIMDJSON_SIMDJSON_VERSION_H
|
||||
|
||||
/** The version of simdjson being used (major.minor.revision) */
|
||||
#define SIMDJSON_VERSION "3.1.4"
|
||||
#define SIMDJSON_VERSION "3.1.6"
|
||||
|
||||
namespace simdjson {
|
||||
enum {
|
||||
@@ -58,7 +58,7 @@ enum {
|
||||
/**
|
||||
* The revision (major.minor.REVISION) of simdjson being used.
|
||||
*/
|
||||
SIMDJSON_VERSION_REVISION = 4
|
||||
SIMDJSON_VERSION_REVISION = 6
|
||||
};
|
||||
} // namespace simdjson
|
||||
|
||||
@@ -265,6 +265,19 @@ use a 64-bit target such as x64, 64-bit ARM or 64-bit PPC.")
|
||||
#define SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#if defined(__has_feature)
|
||||
# if __has_feature(memory_sanitizer)
|
||||
#define SIMDJSON_NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory")))
|
||||
# endif // if __has_feature(memory_sanitizer)
|
||||
#endif // defined(__has_feature)
|
||||
#endif
|
||||
// make sure it is defined as 'nothing' if it is unapplicable.
|
||||
#ifndef SIMDJSON_NO_SANITIZE_MEMORY
|
||||
#define SIMDJSON_NO_SANITIZE_MEMORY
|
||||
#endif
|
||||
|
||||
#if SIMDJSON_VISUAL_STUDIO
|
||||
// This is one case where we do not distinguish between
|
||||
// regular visual studio and clang under visual studio.
|
||||
@@ -8896,7 +8909,7 @@ inline error_code parser::ensure_capacity(document& target_document, size_t desi
|
||||
}
|
||||
|
||||
simdjson_inline void parser::set_max_capacity(size_t max_capacity) noexcept {
|
||||
if(max_capacity < MINIMAL_DOCUMENT_CAPACITY) {
|
||||
if(max_capacity > MINIMAL_DOCUMENT_CAPACITY) {
|
||||
_max_capacity = max_capacity;
|
||||
} else {
|
||||
_max_capacity = MINIMAL_DOCUMENT_CAPACITY;
|
||||
@@ -9845,6 +9858,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
unsigned long ret;
|
||||
@@ -13956,6 +13973,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#if SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
return (int)_tzcnt_u64(input_num);
|
||||
@@ -16146,6 +16167,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#if SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
return (int)_tzcnt_u64(input_num);
|
||||
@@ -18292,6 +18317,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#if SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
unsigned long ret;
|
||||
@@ -20609,6 +20638,10 @@ namespace {
|
||||
// but the algorithms do not end up using the returned value.
|
||||
// Sadly, sanitizers are not smart enough to figure it out.
|
||||
SIMDJSON_NO_SANITIZE_UNDEFINED
|
||||
// This function can be used safely even if not all bytes have been
|
||||
// initialized.
|
||||
// See issue https://github.com/simdjson/simdjson/issues/1965
|
||||
SIMDJSON_NO_SANITIZE_MEMORY
|
||||
simdjson_inline int trailing_zeroes(uint64_t input_num) {
|
||||
#if SIMDJSON_REGULAR_VISUAL_STUDIO
|
||||
unsigned long ret;
|
||||
|
||||
+12
-12
@@ -59,28 +59,28 @@ private:
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_get(element element, T expected) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_SUCCESS(element.get(actual));
|
||||
return assert_equal(actual, expected);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_get(simdjson_result<element> element, T expected) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_SUCCESS(element.get(actual));
|
||||
return assert_equal(actual, expected);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_get_error(element element, error_code expected_error) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_EQUAL(element.get(actual), expected_error);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_get_error(simdjson_result<element> element, error_code expected_error) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_EQUAL(element.get(actual), expected_error);
|
||||
return true;
|
||||
}
|
||||
@@ -113,28 +113,28 @@ bool cast_tester<T>::test_get_t_error(simdjson_result<element> element, error_co
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_named_get(element element, T expected) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_SUCCESS(named_get(element).get(actual));
|
||||
return assert_equal(actual, expected);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_named_get(simdjson_result<element> element, T expected) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_SUCCESS(named_get(element).get(actual));
|
||||
return assert_equal(actual, expected);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_named_get_error(element element, error_code expected_error) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_EQUAL(named_get(element).get(actual), expected_error);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_named_get_error(simdjson_result<element> element, error_code expected_error) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_EQUAL(named_get(element).get(actual), expected_error);
|
||||
return true;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ bool cast_tester<T>::test_named_get_error(simdjson_result<element> element, erro
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_implicit_cast(element element, T expected) {
|
||||
T actual;
|
||||
T actual{};
|
||||
try {
|
||||
actual = element;
|
||||
} catch(simdjson_error &e) {
|
||||
@@ -155,7 +155,7 @@ bool cast_tester<T>::test_implicit_cast(element element, T expected) {
|
||||
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_implicit_cast(simdjson_result<element> element, T expected) {
|
||||
T actual;
|
||||
T actual{};
|
||||
try {
|
||||
actual = element;
|
||||
} catch(simdjson_error &e) {
|
||||
@@ -168,7 +168,7 @@ bool cast_tester<T>::test_implicit_cast(simdjson_result<element> element, T expe
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_implicit_cast_error(element element, error_code expected_error) {
|
||||
try {
|
||||
simdjson_unused T actual;
|
||||
simdjson_unused T actual{};
|
||||
actual = element;
|
||||
return false;
|
||||
} catch(simdjson_error &e) {
|
||||
@@ -180,7 +180,7 @@ bool cast_tester<T>::test_implicit_cast_error(element element, error_code expect
|
||||
template<typename T>
|
||||
bool cast_tester<T>::test_implicit_cast_error(simdjson_result<element> element, error_code expected_error) {
|
||||
try {
|
||||
simdjson_unused T actual;
|
||||
simdjson_unused T actual{};
|
||||
actual = element;
|
||||
return false;
|
||||
} catch(simdjson_error &e) {
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace number_tests {
|
||||
for (int m = 10; m < 20; m++) {
|
||||
for (int i = -1024; i < 1024; i++) {
|
||||
auto str = std::to_string(i);
|
||||
int64_t actual;
|
||||
int64_t actual{};
|
||||
ASSERT_SUCCESS(parser.parse(str).get(actual));
|
||||
if (actual != i) {
|
||||
std::cerr << "JSON '" << str << "' parsed to " << actual << " instead of " << i << std::endl;
|
||||
|
||||
@@ -634,7 +634,7 @@ namespace document_stream_tests {
|
||||
ASSERT_SUCCESS( odparser.parse_many(json.data(), json.length(), 50).get(odstream) );
|
||||
for (auto doc: odstream) {
|
||||
if(counter < 6) {
|
||||
int64_t val;
|
||||
int64_t val{};
|
||||
ASSERT_SUCCESS(doc.at_pointer("/4").get(val));
|
||||
ASSERT_EQUAL(val, 5);
|
||||
} else {
|
||||
@@ -797,7 +797,7 @@ namespace document_stream_tests {
|
||||
simdjson::dom::document_stream stream;
|
||||
ASSERT_SUCCESS( parser.parse_many(str, batch_size).get(stream) );
|
||||
for (auto doc : stream) {
|
||||
int64_t keyid;
|
||||
int64_t keyid{};
|
||||
ASSERT_SUCCESS( doc["id"].get(keyid) );
|
||||
ASSERT_EQUAL( keyid, int64_t(count) );
|
||||
|
||||
@@ -837,7 +837,7 @@ namespace document_stream_tests {
|
||||
simdjson::dom::document_stream stream;
|
||||
ASSERT_SUCCESS( parser.parse_many(str, batch_size).get(stream) );
|
||||
for (auto doc : stream) {
|
||||
int64_t keyid;
|
||||
int64_t keyid{};
|
||||
ASSERT_SUCCESS( doc["id"].get(keyid) );
|
||||
ASSERT_EQUAL( keyid, int64_t(count) );
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace parser_load {
|
||||
ASSERT_SUCCESS(parser.parse_many(DOC).get(docs));
|
||||
for (auto doc : docs) {
|
||||
count++;
|
||||
uint64_t val;
|
||||
uint64_t val{};
|
||||
auto error = doc.get(val);
|
||||
if (count == 3) {
|
||||
ASSERT_ERROR(error, TAPE_ERROR);
|
||||
@@ -83,7 +83,7 @@ namespace parser_load {
|
||||
ASSERT_SUCCESS(parser.parse_many(DOC).get(docs));
|
||||
for (auto doc : docs) {
|
||||
count++;
|
||||
uint64_t val;
|
||||
uint64_t val{};
|
||||
auto error = doc.get(val);
|
||||
if (count == 3) {
|
||||
ASSERT_ERROR(error, TAPE_ERROR);
|
||||
|
||||
@@ -33,12 +33,12 @@ static bool parse_and_validate(const std::string src, T expected) {
|
||||
simdjson::dom::parser parser;
|
||||
|
||||
if constexpr (std::is_same<int64_t, T>::value) {
|
||||
int64_t actual;
|
||||
int64_t actual{};
|
||||
ASSERT_SUCCESS( parser.parse(pstr)["key"].get(actual) );
|
||||
std::cout << std::boolalpha << "test: " << (expected == actual) << std::endl;
|
||||
ASSERT_EQUAL( expected, actual );
|
||||
} else {
|
||||
uint64_t actual;
|
||||
uint64_t actual{};
|
||||
ASSERT_SUCCESS( parser.parse(pstr)["key"].get(actual) );
|
||||
std::cout << std::boolalpha << "test: " << (expected == actual) << std::endl;
|
||||
ASSERT_EQUAL( expected, actual );
|
||||
|
||||
@@ -140,7 +140,7 @@ bool tester(int seed, size_t volume) {
|
||||
std::vector<char> buffer(1024); // large buffer (can't overflow)
|
||||
simdjson::dom::parser parser;
|
||||
RandomEngine rand(seed);
|
||||
double result;
|
||||
double result{};
|
||||
for (size_t i = 0; i < volume; i++) {
|
||||
if((i%100000) == 0) { std::cout << "."; std::cout.flush(); }
|
||||
size_t length = build_random_string(rand, buffer.data());
|
||||
|
||||
@@ -41,7 +41,7 @@ void basics_error_2() {
|
||||
cout << "Make/Model: " << make << "/" << model << endl;
|
||||
|
||||
// Casting a JSON element to an integer
|
||||
uint64_t year;
|
||||
uint64_t year{};
|
||||
if ((error = car["year"].get(year))) { cerr << error << endl; exit(1); }
|
||||
cout << "- This car is " << 2020 - year << "years old." << endl;
|
||||
|
||||
@@ -132,7 +132,7 @@ void basics_error_2_cpp17() {
|
||||
cout << "Make/Model: " << make << "/" << model << endl;
|
||||
|
||||
// Casting a JSON element to an integer
|
||||
uint64_t year;
|
||||
uint64_t year{};
|
||||
if ((error = car["year"].get(year))) { cerr << error << endl; exit(1); }
|
||||
cout << "- This car is " << 2020 - year << "years old." << endl;
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace array_tests {
|
||||
ondemand::parser parser;
|
||||
ondemand::document doc;
|
||||
ASSERT_SUCCESS(parser.iterate(json).get(doc));
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_SUCCESS(doc.count_elements().get(count));
|
||||
ondemand::array arr;
|
||||
ASSERT_SUCCESS(doc.get_array().get(arr));
|
||||
@@ -182,7 +182,7 @@ namespace array_tests {
|
||||
ASSERT_SUCCESS(doc.get_object().get(obj));
|
||||
ondemand::value v;
|
||||
ASSERT_SUCCESS(doc.find_field("test").get(v));
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_SUCCESS(v.count_elements().get(count));
|
||||
ASSERT_EQUAL(count, 3);
|
||||
ASSERT_SUCCESS(doc.find_field("joe").get(v));
|
||||
@@ -200,7 +200,7 @@ namespace array_tests {
|
||||
ondemand::array array;
|
||||
ASSERT_RESULT( doc_result.type(), json_type::array );
|
||||
ASSERT_SUCCESS( doc_result.get_array().get(array) );
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_SUCCESS( array.count_elements().get(count) );
|
||||
ASSERT_EQUAL(count, expected_value.size());
|
||||
return true;
|
||||
@@ -209,13 +209,13 @@ namespace array_tests {
|
||||
ondemand::array array;
|
||||
ASSERT_RESULT( doc_result.type(), json_type::array );
|
||||
ASSERT_SUCCESS( doc_result.get(array) );
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_SUCCESS( array.count_elements().get(count) );
|
||||
ASSERT_EQUAL(count, expected_value.size());
|
||||
size_t i = 0;
|
||||
std::vector<uint64_t> receiver(count);
|
||||
for (auto value : array) {
|
||||
uint64_t actual;
|
||||
uint64_t actual{};
|
||||
ASSERT_SUCCESS( value.get(actual) );
|
||||
ASSERT_EQUAL(actual, expected_value[i]);
|
||||
receiver[i] = actual;
|
||||
@@ -235,7 +235,7 @@ namespace array_tests {
|
||||
ondemand::array array;
|
||||
ASSERT_RESULT( doc_result.type(), json_type::array );
|
||||
ASSERT_SUCCESS( doc_result.get_array().get(array) );
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_SUCCESS( array.count_elements().get(count) );
|
||||
ASSERT_EQUAL(count, 0);
|
||||
return true;
|
||||
@@ -244,13 +244,13 @@ namespace array_tests {
|
||||
ondemand::array array;
|
||||
ASSERT_RESULT( doc_result.type(), json_type::array );
|
||||
ASSERT_SUCCESS( doc_result.get(array) );
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_SUCCESS( array.count_elements().get(count) );
|
||||
ASSERT_EQUAL(count, 0);
|
||||
size_t i = 0;
|
||||
std::vector<uint64_t> receiver(count);
|
||||
for (auto value : array) {
|
||||
uint64_t actual;
|
||||
uint64_t actual{};
|
||||
ASSERT_SUCCESS( value.get(actual) );
|
||||
i++;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ namespace array_tests {
|
||||
ondemand::array array;
|
||||
ASSERT_RESULT( doc_result.type(), json_type::array );
|
||||
ASSERT_SUCCESS( doc_result.get(array) );
|
||||
size_t count;
|
||||
size_t count{};
|
||||
auto e = array.count_elements().get(count);
|
||||
if( e != TAPE_ERROR) {
|
||||
std::cout << e << "\n";
|
||||
@@ -285,7 +285,7 @@ namespace array_tests {
|
||||
TEST_START();
|
||||
auto empty = R"( [] )"_padded;
|
||||
SUBTEST("ondemand::empty_doc_array", test_ondemand_doc(empty, [&](auto doc_result) {
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_RESULT( doc_result.type(), json_type::array );
|
||||
ASSERT_SUCCESS( doc_result.count_elements().get(count) );
|
||||
ASSERT_EQUAL( count, 0 );
|
||||
@@ -293,7 +293,7 @@ namespace array_tests {
|
||||
}));
|
||||
auto basic = R"( [-1.234, 100000000000000, null, [1,2,3], {"t":true, "f":false}] )"_padded;
|
||||
SUBTEST("ondemand::basic_doc_array", test_ondemand_doc(basic, [&](auto doc_result) {
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_RESULT( doc_result.type(), json_type::array );
|
||||
ASSERT_SUCCESS( doc_result.count_elements().get(count) );
|
||||
ASSERT_EQUAL( count, 5 );
|
||||
@@ -331,7 +331,7 @@ namespace array_tests {
|
||||
|
||||
size_t i = 0;
|
||||
for (auto value : array) {
|
||||
int64_t actual;
|
||||
int64_t actual{};
|
||||
ASSERT_SUCCESS( value.get(actual) );
|
||||
ASSERT_EQUAL(actual, expected_value[i]);
|
||||
i++;
|
||||
@@ -355,7 +355,7 @@ namespace array_tests {
|
||||
ASSERT_SUCCESS( doc_result.get(array) );
|
||||
i = 0;
|
||||
for (auto value : array) {
|
||||
int64_t actual;
|
||||
int64_t actual{};
|
||||
ASSERT_SUCCESS( value.get(actual) );
|
||||
container[i] = actual;
|
||||
i++;
|
||||
@@ -379,7 +379,7 @@ namespace array_tests {
|
||||
array.reset();
|
||||
i = 0;
|
||||
for (auto value : array) {
|
||||
int64_t actual;
|
||||
int64_t actual{};
|
||||
ASSERT_SUCCESS( value.get(actual) );
|
||||
container[i] = actual;
|
||||
i++;
|
||||
@@ -435,7 +435,7 @@ namespace array_tests {
|
||||
TEST_SUCCEED();
|
||||
}
|
||||
bool count_empty(simdjson::ondemand::array arr) {
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_SUCCESS(arr.count_elements().get(count));
|
||||
ASSERT_EQUAL(count, 0);
|
||||
bool is_empty;
|
||||
@@ -466,7 +466,7 @@ namespace array_tests {
|
||||
for (auto d : data) {
|
||||
simdjson::ondemand::array arr;
|
||||
ASSERT_SUCCESS(d.get_array().get(arr));
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_SUCCESS(arr.count_elements().get(count));
|
||||
ASSERT_EQUAL(count, 4);
|
||||
}
|
||||
@@ -528,7 +528,7 @@ namespace array_tests {
|
||||
|
||||
size_t i=0;
|
||||
for (auto value : array) {
|
||||
int64_t actual;
|
||||
int64_t actual{};
|
||||
ASSERT_SUCCESS( value.get(actual) );
|
||||
ASSERT_EQUAL(actual, expected_value[i]);
|
||||
i++;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace document_stream_tests {
|
||||
|
||||
template <typename T>
|
||||
bool process_doc(T &docref) {
|
||||
int64_t val;
|
||||
int64_t val{};
|
||||
ASSERT_SUCCESS(docref.at_pointer("/4").get(val));
|
||||
ASSERT_EQUAL(val, 5);
|
||||
return true;
|
||||
@@ -567,7 +567,7 @@ namespace document_stream_tests {
|
||||
size_t count{0};
|
||||
ASSERT_SUCCESS( parser.iterate_many(str, batch_size).get(stream) );
|
||||
for (auto doc : stream) {
|
||||
int64_t keyid;
|
||||
int64_t keyid{};
|
||||
ASSERT_SUCCESS( doc["id"].get(keyid) );
|
||||
ASSERT_EQUAL( keyid, int64_t(count) );
|
||||
|
||||
@@ -604,7 +604,7 @@ namespace document_stream_tests {
|
||||
ASSERT_SUCCESS( odparser.iterate_many(json.data(), json.length(), 50).get(odstream) );
|
||||
for (auto doc: odstream) {
|
||||
if(counter < 6) {
|
||||
int64_t val;
|
||||
int64_t val{};
|
||||
ASSERT_SUCCESS(doc.at_pointer("/4").get(val));
|
||||
ASSERT_EQUAL(val, 5);
|
||||
} else {
|
||||
@@ -643,7 +643,7 @@ namespace document_stream_tests {
|
||||
size_t count{0};
|
||||
ASSERT_SUCCESS( parser.iterate_many(str, batch_size).get(stream) );
|
||||
for (auto doc : stream) {
|
||||
int64_t keyid;
|
||||
int64_t keyid{};
|
||||
ASSERT_SUCCESS( doc["id"].get(keyid) );
|
||||
ASSERT_EQUAL( keyid, int64_t(count) );
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace misc_tests {
|
||||
ASSERT_SUCCESS(val.get_object().get(obj));
|
||||
ondemand::array arr;
|
||||
ASSERT_SUCCESS(obj["a"].get_array().get(arr));
|
||||
size_t count;
|
||||
size_t count{};
|
||||
ASSERT_SUCCESS(arr.count_elements().get(count));
|
||||
ASSERT_EQUAL(3,count);
|
||||
TEST_SUCCEED();
|
||||
|
||||
@@ -232,13 +232,13 @@ namespace number_tests {
|
||||
for(simdjson_result<ondemand::value> valr : arr) {
|
||||
ondemand::value val;
|
||||
ASSERT_SUCCESS(valr.get(val));
|
||||
ondemand::number_type nt;
|
||||
ondemand::number_type nt{};
|
||||
ASSERT_SUCCESS(val.get_number_type().get(nt));
|
||||
ASSERT_EQUAL(expectedtypes[counter], nt);
|
||||
ondemand::number num;
|
||||
ASSERT_SUCCESS(val.get_number().get(num));
|
||||
ASSERT_EQUAL(is_negative[counter], val.is_negative());
|
||||
bool intvalue;
|
||||
bool intvalue{};
|
||||
ASSERT_SUCCESS(val.is_integer().get(intvalue));
|
||||
ASSERT_EQUAL(is_integer[counter], intvalue);
|
||||
ondemand::number_type t = num.get_number_type();
|
||||
@@ -339,9 +339,9 @@ namespace number_tests {
|
||||
ondemand::document doc;
|
||||
padded_string docdata;
|
||||
ondemand::number number;
|
||||
ondemand::number_type nt;
|
||||
ondemand::number_type nt{};
|
||||
|
||||
bool intvalue;
|
||||
bool intvalue{};
|
||||
|
||||
docdata = R"(1.0)"_padded;
|
||||
ASSERT_SUCCESS(parser.iterate(docdata).get(doc));
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace object_error_tests {
|
||||
bool assert_iterate_object(T &&object, const char **expected_key, V *expected, size_t N, simdjson::error_code *expected_error, size_t N2) {
|
||||
size_t count = 0;
|
||||
for (auto field : object) {
|
||||
V actual;
|
||||
V actual{};
|
||||
auto actual_error = field.value().get(actual);
|
||||
if (count >= N) {
|
||||
ASSERT((count - N) < N2, "Extra error reported");
|
||||
|
||||
@@ -6,6 +6,7 @@ using namespace simdjson;
|
||||
namespace object_tests {
|
||||
using namespace std;
|
||||
using simdjson::ondemand::json_type;
|
||||
|
||||
bool issue1745() {
|
||||
TEST_START();
|
||||
auto json = R"({
|
||||
@@ -225,6 +226,25 @@ namespace object_tests {
|
||||
}
|
||||
|
||||
#if SIMDJSON_EXCEPTIONS
|
||||
|
||||
bool issue1965() {
|
||||
TEST_START();
|
||||
std::string str = "{\"query\":\"ah\"}";
|
||||
std::unique_ptr<char[]> buffer(new char[str.size() + simdjson::SIMDJSON_PADDING]);
|
||||
memcpy(buffer.get(), str.data(), str.size());
|
||||
simdjson::padded_string_view view(buffer.get(), str.size(), str.size() + simdjson::SIMDJSON_PADDING);
|
||||
simdjson::ondemand::parser parser;
|
||||
simdjson::ondemand::document doc = parser.iterate(view);
|
||||
simdjson::ondemand::object root = doc.get_object();
|
||||
simdjson::ondemand::value query = root.find_field("query");
|
||||
simdjson::ondemand::raw_json_string raw = query.get_raw_json_string();
|
||||
std::unique_ptr<uint8_t[]> dst_buffer(new uint8_t[3 + simdjson::SIMDJSON_PADDING]);
|
||||
uint8_t * dst = dst_buffer.get();
|
||||
std::string_view fieldstring = parser.unescape(raw, dst);
|
||||
std::cout << fieldstring << std::endl;
|
||||
TEST_SUCCEED();
|
||||
}
|
||||
|
||||
bool issue1745_with_exceptions() {
|
||||
TEST_START();
|
||||
auto json = R"({
|
||||
@@ -1221,6 +1241,9 @@ namespace object_tests {
|
||||
|
||||
bool run() {
|
||||
return
|
||||
#if SIMDJSON_EXCEPTIONS
|
||||
issue1965() &&
|
||||
#endif
|
||||
issue1876a() &&
|
||||
issue1876() &&
|
||||
test_strager() &&
|
||||
|
||||
@@ -576,7 +576,7 @@ bool using_the_parsed_json_no_exceptions() {
|
||||
cout << "Make/Model: " << make << "/" << model << endl;
|
||||
|
||||
// Casting a JSON element to an integer
|
||||
uint64_t year;
|
||||
uint64_t year{};
|
||||
error = car["year"].get(year);
|
||||
if(error) { std::cerr << error << std::endl; return false; }
|
||||
cout << "- This car is " << 2020 - year << " years old." << endl;
|
||||
@@ -778,9 +778,9 @@ bool ndjson_basics_example() {
|
||||
size_t count{0};
|
||||
int64_t expected[3] = {1,2,3};
|
||||
for (auto doc : docs) {
|
||||
int64_t actual;
|
||||
int64_t actual{};
|
||||
ASSERT_SUCCESS( doc["foo"].get(actual) );
|
||||
ASSERT_EQUAL( actual,expected[count++] );
|
||||
ASSERT_EQUAL( actual, expected[count++] );
|
||||
}
|
||||
TEST_SUCCEED();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace scalar_tests {
|
||||
bool test_scalar_value(const padded_string &json, const T &expected, bool test_twice=true) {
|
||||
std::cout << "- JSON: " << json << endl;
|
||||
SUBTEST( "simdjson_result<document>", test_ondemand_doc(json, [&](auto doc_result) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_RESULT( doc_result.type(), expected_json_type<T>() );
|
||||
ASSERT_SUCCESS( doc_result.get(actual) );
|
||||
ASSERT_EQUAL( actual, expected );
|
||||
@@ -33,7 +33,7 @@ namespace scalar_tests {
|
||||
SUBTEST( "document", test_ondemand_doc(json, [&](auto doc_result) {
|
||||
ondemand::document doc;
|
||||
ASSERT_SUCCESS( std::move(doc_result).get(doc) );
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_RESULT( doc.type(), expected_json_type<T>() );
|
||||
ASSERT_SUCCESS( doc.get(actual) );
|
||||
ASSERT_EQUAL( actual, expected );
|
||||
@@ -50,7 +50,7 @@ namespace scalar_tests {
|
||||
padded_string whitespace_json = std::string(json) + " ";
|
||||
std::cout << "- JSON: " << whitespace_json << endl;
|
||||
SUBTEST( "simdjson_result<document>", test_ondemand_doc(whitespace_json, [&](auto doc_result) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_RESULT( doc_result.type(), expected_json_type<T>() );
|
||||
ASSERT_SUCCESS( doc_result.get(actual) );
|
||||
ASSERT_EQUAL( actual, expected );
|
||||
@@ -65,7 +65,7 @@ namespace scalar_tests {
|
||||
SUBTEST( "document", test_ondemand_doc(whitespace_json, [&](auto doc_result) {
|
||||
ondemand::document doc;
|
||||
ASSERT_SUCCESS( std::move(doc_result).get(doc) );
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_RESULT( doc.type(), expected_json_type<T>() );
|
||||
ASSERT_SUCCESS( doc.get(actual) );
|
||||
ASSERT_EQUAL( actual, expected );
|
||||
@@ -85,7 +85,7 @@ namespace scalar_tests {
|
||||
SUBTEST( "simdjson_result<value>", test_ondemand_doc(array_json, [&](auto doc_result) {
|
||||
int count = 0;
|
||||
for (simdjson_result<ondemand::value> val_result : doc_result) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_RESULT( val_result.type(), expected_json_type<T>() );
|
||||
ASSERT_SUCCESS( val_result.get(actual) );
|
||||
ASSERT_EQUAL(actual, expected);
|
||||
@@ -105,7 +105,7 @@ namespace scalar_tests {
|
||||
for (simdjson_result<ondemand::value> val_result : doc_result) {
|
||||
ondemand::value val;
|
||||
ASSERT_SUCCESS( val_result.get(val) );
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_RESULT( val.type(), expected_json_type<T>() );
|
||||
ASSERT_SUCCESS( val.get(actual) );
|
||||
ASSERT_EQUAL(actual, expected);
|
||||
@@ -129,7 +129,7 @@ namespace scalar_tests {
|
||||
SUBTEST( "simdjson_result<value>", test_ondemand_doc(whitespace_array_json, [&](auto doc_result) {
|
||||
int count = 0;
|
||||
for (simdjson_result<ondemand::value> val_result : doc_result) {
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_RESULT( val_result.type(), expected_json_type<T>() );
|
||||
ASSERT_SUCCESS( val_result.get(actual) );
|
||||
ASSERT_EQUAL(actual, expected);
|
||||
@@ -150,7 +150,7 @@ namespace scalar_tests {
|
||||
for (simdjson_result<ondemand::value> val_result : doc_result) {
|
||||
ondemand::value val;
|
||||
ASSERT_SUCCESS( val_result.get(val) );
|
||||
T actual;
|
||||
T actual{};
|
||||
ASSERT_RESULT( val.type(), expected_json_type<T>() );
|
||||
ASSERT_SUCCESS( val.get(actual) );
|
||||
ASSERT_EQUAL(actual, expected);
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace twitter_tests {
|
||||
std::string_view screen_name;
|
||||
ASSERT_SUCCESS( user["screen_name"].get(screen_name) );
|
||||
|
||||
bool default_profile;
|
||||
bool default_profile{};
|
||||
ASSERT_SUCCESS( user["default_profile"].get(default_profile) );
|
||||
if (default_profile) {
|
||||
default_users.insert(screen_name);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
template<typename T, typename F>
|
||||
bool test_ondemand(simdjson::ondemand::parser &parser, const simdjson::padded_string &json, const F& f) {
|
||||
auto doc = parser.iterate(json);
|
||||
T val;
|
||||
T val{};
|
||||
ASSERT_SUCCESS( doc.get(val) );
|
||||
return f(val);
|
||||
}
|
||||
|
||||
+2
-2
@@ -123,7 +123,7 @@ void recurse(simdjson::dom::element element, stat_t &s, size_t depth) {
|
||||
if (element.is<int64_t>()) {
|
||||
s.integer_count++; // because an int can be sometimes represented as a double, we
|
||||
// to check whether it is an integer first!!!
|
||||
int64_t v;
|
||||
int64_t v{};
|
||||
error = element.get(v);
|
||||
SIMDJSON_ASSUME(!error);
|
||||
if((v >= std::numeric_limits<int32_t>::min()) and (v <= std::numeric_limits<int32_t>::max()) ) {
|
||||
@@ -138,7 +138,7 @@ void recurse(simdjson::dom::element element, stat_t &s, size_t depth) {
|
||||
} else if (element.is<double>()) {
|
||||
s.float_count++;
|
||||
} else if (element.is<bool>()) {
|
||||
bool v;
|
||||
bool v{};
|
||||
error = element.get(v);
|
||||
SIMDJSON_ASSUME(!error);
|
||||
if (v) {
|
||||
|
||||
Reference in New Issue
Block a user