Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarJsonParser.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-08-18 19:12:31 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-08-18 19:12:31 +1000
commitab03c224dd154a4cce9cf60e20bb166e57f33d01 (patch)
tree50d0f9e0b6561d2099baaac0d4b01721c421c478 /source/core/StarJsonParser.hpp
parent572291047fe2713a50bd4c584fd91b758c60337d (diff)
Parse scientific notation Json numbers as double
Diffstat (limited to 'source/core/StarJsonParser.hpp')
-rw-r--r--source/core/StarJsonParser.hpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/core/StarJsonParser.hpp b/source/core/StarJsonParser.hpp
index 87a4bd9..fc14d84 100644
--- a/source/core/StarJsonParser.hpp
+++ b/source/core/StarJsonParser.hpp
@@ -198,7 +198,7 @@ private:
void number() {
std::basic_string<char32_t> buffer;
- bool hasDot = false;
+ bool isDouble = false;
if (m_char == '-') {
buffer += '-';
@@ -218,7 +218,7 @@ private:
}
if (m_char == '.') {
- hasDot = true;
+ isDouble = true;
buffer += '.';
next();
while (m_char >= '0' && m_char <= '9') {
@@ -228,6 +228,7 @@ private:
}
if (m_char == 'e' || m_char == 'E') {
+ isDouble = true;
buffer += m_char;
next();
if (m_char == '-' || m_char == '+') {
@@ -240,7 +241,7 @@ private:
}
}
- if (hasDot) {
+ if (isDouble) {
try {
m_stream.putDouble(buffer.c_str(), buffer.length());
} catch (std::exception const& e) {