You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While the name GetSize I arguably obvious that its a byte count, the fact it's on a StringBuffer can make it's use questionable. For example, all examples of serializing a JSON graph to a string do something like so:
While the name
GetSize
I arguably obvious that its a byte count, the fact it's on aStringBuffer
can make it's use questionable. For example, all examples of serializing a JSON graph to a string do something like so:string content(buffer.GetString(), buffer.GetSize());
But when typedef'ing a
StringBuffer
withUTF16<>
, the following code can cause access violations.wstring content(buffer.Getstring(), buffer.GetSize());
Instead, we need to divide the character byte length:
wstring content(buffer.Getstring(), buffer.GetSize() / sizeof(WStringBuffer::Ch));
Since the
Ch
typedef is known, and thus the byte size, adding aGetLength()
and using that in examples to avoid confusion would be advisable.The text was updated successfully, but these errors were encountered: