Opened 13 years ago

Closed 13 years ago

#3367 closed Bugs (fixed)

all wchar_t c-strings are truncated on deserialization

Reported by: anonymous Owned by: Robert Ramey
Milestone: Boost 1.40.0 Component: serialization
Version: Boost 1.39.0 Severity: Problem
Keywords: wchar_t Cc:

Description

basic_binary_iprimitive<Archive, Elem, Tr>::load(wchar_t * ws) {

std::size_t l;

this->This()->load(l);

load_binary(ws, l * sizeof(wchar_t) / sizeof(char));

ws[l / sizeof(wchar_t)] = L'\0';

}

l is determined by std::wcslen on saving, which returns the number of wchar_t characters in the string. not the length in bytes. the \0 insert treats l as it was an offset in bytes.

Change History (1)

comment:1 by Robert Ramey, 13 years ago

Resolution: fixed
Status: newclosed

Fixed in trunk

Robert Ramey

Note: See TracTickets for help on using tickets.