🚑 fix for #1021
This commit is contained in:
parent
d2dd27dc3b
commit
a9baab76c2
4 changed files with 108 additions and 12 deletions
|
@ -149,9 +149,19 @@ class binary_writer
|
|||
break;
|
||||
}
|
||||
|
||||
case value_t::number_float: // Double-Precision Float
|
||||
case value_t::number_float:
|
||||
{
|
||||
oa->write_character(static_cast<CharType>(0xFB));
|
||||
switch (sizeof(typename BasicJsonType::number_float_t))
|
||||
{
|
||||
case 4: // Single-Precision Float
|
||||
oa->write_character(static_cast<CharType>(0xFA));
|
||||
break;
|
||||
case 8: // Double-Precision Float
|
||||
oa->write_character(static_cast<CharType>(0xFB));
|
||||
break;
|
||||
default:
|
||||
JSON_THROW(other_error::create(502, "type for number_float_t is not supported"));
|
||||
}
|
||||
write_number(j.m_value.number_float);
|
||||
break;
|
||||
}
|
||||
|
@ -409,9 +419,19 @@ class binary_writer
|
|||
break;
|
||||
}
|
||||
|
||||
case value_t::number_float: // float 64
|
||||
case value_t::number_float:
|
||||
{
|
||||
oa->write_character(static_cast<CharType>(0xCB));
|
||||
switch (sizeof(typename BasicJsonType::number_float_t))
|
||||
{
|
||||
case 4: // float 32
|
||||
oa->write_character(static_cast<CharType>(0xCA));
|
||||
break;
|
||||
case 8: // float 64
|
||||
oa->write_character(static_cast<CharType>(0xCB));
|
||||
break;
|
||||
default:
|
||||
JSON_THROW(other_error::create(502, "type for number_float_t is not supported"));
|
||||
}
|
||||
write_number(j.m_value.number_float);
|
||||
break;
|
||||
}
|
||||
|
@ -712,7 +732,17 @@ class binary_writer
|
|||
{
|
||||
if (add_prefix)
|
||||
{
|
||||
oa->write_character(static_cast<CharType>('D')); // float64
|
||||
switch (sizeof(typename BasicJsonType::number_float_t))
|
||||
{
|
||||
case 4: // float 32
|
||||
oa->write_character(static_cast<CharType>('d'));
|
||||
break;
|
||||
case 8: // float 64
|
||||
oa->write_character(static_cast<CharType>('D'));
|
||||
break;
|
||||
default:
|
||||
JSON_THROW(other_error::create(502, "type for number_float_t is not supported"));
|
||||
}
|
||||
}
|
||||
write_number(n);
|
||||
}
|
||||
|
@ -892,7 +922,15 @@ class binary_writer
|
|||
}
|
||||
|
||||
case value_t::number_float:
|
||||
return 'D';
|
||||
switch (sizeof(typename BasicJsonType::number_float_t))
|
||||
{
|
||||
case 4: // float 32
|
||||
return 'd';
|
||||
case 8: // float 64
|
||||
return 'D';
|
||||
default:
|
||||
JSON_THROW(other_error::create(502, "type for number_float_t is not supported"));
|
||||
}
|
||||
|
||||
case value_t::string:
|
||||
return 'S';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue