mirror of
https://github.com/nlohmann/json.git
synced 2026-11-02 19:05:35 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7a7534872 | ||
|
|
eaee875178 | ||
|
|
3724295333 |
No files matched your search
@@ -1174,9 +1174,8 @@ indent_done:
|
||||
{
|
||||
++p;
|
||||
}
|
||||
else if (!negative || NLOHMANN_VIEW_LIKELY(cur() >= '1' && cur() <= '9'))
|
||||
else if (NLOHMANN_VIEW_LIKELY(cur() >= '1' && cur() <= '9'))
|
||||
{
|
||||
// (without a sign, the dispatch saw a digit)
|
||||
p = skip_digits(p + 1, e);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -251,8 +251,12 @@ std::string diagnostics(const error_site site)
|
||||
std::string context;
|
||||
#if JSON_DIAGNOSTICS
|
||||
std::vector<std::string> tokens;
|
||||
// a value that is not found leaves no tokens, like the root
|
||||
static_cast<void>(edited ? value_path<true>(d, site.value(), tokens) : value_path<false>(d, site.value(), tokens));
|
||||
const bool found = edited ? value_path<true>(d, site.value(), tokens) : value_path<false>(d, site.value(), tokens);
|
||||
if (!found)
|
||||
{
|
||||
// a value that is not found has no path, and with it no bytes
|
||||
return context;
|
||||
}
|
||||
if (!tokens.empty())
|
||||
{
|
||||
// the root value has no path, but still has a byte range
|
||||
|
||||
Generated
+7
-4
@@ -2479,9 +2479,8 @@ indent_done:
|
||||
{
|
||||
++p;
|
||||
}
|
||||
else if (!negative || NLOHMANN_VIEW_LIKELY(cur() >= '1' && cur() <= '9'))
|
||||
else if (NLOHMANN_VIEW_LIKELY(cur() >= '1' && cur() <= '9'))
|
||||
{
|
||||
// (without a sign, the dispatch saw a digit)
|
||||
p = skip_digits(p + 1, e);
|
||||
}
|
||||
else
|
||||
@@ -5080,8 +5079,12 @@ std::string diagnostics(const error_site site)
|
||||
std::string context;
|
||||
#if JSON_DIAGNOSTICS
|
||||
std::vector<std::string> tokens;
|
||||
// a value that is not found leaves no tokens, like the root
|
||||
static_cast<void>(edited ? value_path<true>(d, site.value(), tokens) : value_path<false>(d, site.value(), tokens));
|
||||
const bool found = edited ? value_path<true>(d, site.value(), tokens) : value_path<false>(d, site.value(), tokens);
|
||||
if (!found)
|
||||
{
|
||||
// a value that is not found has no path, and with it no bytes
|
||||
return context;
|
||||
}
|
||||
if (!tokens.empty())
|
||||
{
|
||||
// the root value has no path, but still has a byte range
|
||||
|
||||
@@ -1026,7 +1026,10 @@ TEST_CASE("insert() provides its documented exception guarantees (#5986)")
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(JSON_NOEXCEPTION)
|
||||
// the no-exceptions CI job has no std::bad_alloc to catch; with iterator
|
||||
// debugging (MSVC STL debug builds) containers allocate inside noexcept
|
||||
// functions, so failing an allocation there terminates the program
|
||||
#if !defined(JSON_NOEXCEPTION) && !(defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL > 0)
|
||||
namespace
|
||||
{
|
||||
// the allocation numbered sweep_fail_at (counted from 1) throws; 0 never fails
|
||||
|
||||
Reference in new issue
Block a user