libroot: Fix ICU locale implementation of wcsxfrm.
* The "size" parameter is the size of "out" not "in", and the return size_t parameter is supposed to always have the total amount of wchar_ts needed, not how many are actually used. * In the case where "outSize == 0", we set "requiredSize" and then return. Fixes crashes seen in glib2 Unicode collation routines, which are used in GTK file dialogs. Thanks to PulkoMandy for glancing at this.
This commit is contained in:
@@ -33,7 +33,7 @@ public:
|
||||
status_t Wcscoll(const wchar_t* a, const wchar_t* b,
|
||||
int& out);
|
||||
status_t Wcsxfrm(wchar_t* out, const wchar_t* in,
|
||||
size_t size, size_t& outSize);
|
||||
size_t outSize, size_t& requiredSize);
|
||||
|
||||
private:
|
||||
status_t _ToUnicodeString(const char* in,
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
virtual status_t Wcscoll(const wchar_t* a, const wchar_t* b,
|
||||
int& out);
|
||||
virtual status_t Wcsxfrm(wchar_t* out, const wchar_t* in,
|
||||
size_t size, size_t& outSize);
|
||||
size_t outSize, size_t& requiredSize);
|
||||
|
||||
virtual status_t TZSet(const char* timeZoneID, const char* tz);
|
||||
virtual status_t Localtime(const time_t* inTime,
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
virtual status_t Wcscoll(const wchar_t* a, const wchar_t* b,
|
||||
int& out) = 0;
|
||||
virtual status_t Wcsxfrm(wchar_t* out, const wchar_t* in,
|
||||
size_t size, size_t& outSize) = 0;
|
||||
size_t outSize, size_t& requiredSize) = 0;
|
||||
|
||||
virtual status_t TZSet(const char* timeZoneID,
|
||||
const char* tz) = 0;
|
||||
|
||||
Reference in New Issue
Block a user