fixed: calculating buffer length in Space: sizeof(char) -> sizeof(wchar_t)

pull/4/head
Tomasz Sowa 2 years ago
parent a2339eed34
commit a1e8f13f46

@ -46,7 +46,7 @@
#include <cwchar>
#include "textstream/types.h"
#include "convert/inttostr.h"
#include <errno.h>
@ -877,7 +877,7 @@ protected:
void serialize_space_long(StreamType & str) const
{
wchar_t buffer[50];
size_t buffer_len = sizeof(buffer) / sizeof(char);
size_t buffer_len = sizeof(buffer) / sizeof(wchar_t);
PT::Toa(value.value_long, buffer, buffer_len);
serialize_string_buffer(buffer, str, Escape::escape_space);
@ -887,7 +887,7 @@ protected:
void serialize_space_float(StreamType & str) const
{
wchar_t buffer[100];
size_t buffer_len = sizeof(buffer) / sizeof(char);
size_t buffer_len = sizeof(buffer) / sizeof(wchar_t);
int chars_written = std::swprintf(buffer, buffer_len, L"%e", static_cast<double>(value.value_float));
@ -1057,7 +1057,7 @@ protected:
void serialize_json_long(StreamType & str) const
{
wchar_t buffer[50];
size_t buffer_len = sizeof(buffer) / sizeof(char);
size_t buffer_len = sizeof(buffer) / sizeof(wchar_t);
PT::Toa(value.value_long, buffer, buffer_len);
serialize_string_buffer(buffer, str, Escape::escape_json);
@ -1067,7 +1067,7 @@ protected:
void serialize_json_float(StreamType & str) const
{
wchar_t buffer[100];
size_t buffer_len = sizeof(buffer) / sizeof(char);
size_t buffer_len = sizeof(buffer) / sizeof(wchar_t);
int chars_written = std::swprintf(buffer, buffer_len, L"%e", static_cast<double>(value.value_float));

Loading…
Cancel
Save