218604196a
* 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.
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
/*
|
|
* Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _ICU_COLLATE_DATA_H
|
|
#define _ICU_COLLATE_DATA_H
|
|
|
|
|
|
#include "ICUCategoryData.h"
|
|
|
|
#include <unicode/coll.h>
|
|
|
|
|
|
namespace BPrivate {
|
|
namespace Libroot {
|
|
|
|
|
|
class ICUCollateData : public ICUCategoryData {
|
|
typedef ICUCategoryData inherited;
|
|
|
|
public:
|
|
ICUCollateData(pthread_key_t tlsKey);
|
|
virtual ~ICUCollateData();
|
|
|
|
virtual status_t SetTo(const U_NAMESPACE_QUALIFIER Locale&
|
|
locale,
|
|
const char* posixLocaleName);
|
|
virtual status_t SetToPosix();
|
|
|
|
status_t Strcoll(const char* a, const char* b, int& out);
|
|
status_t Strxfrm(char* out, const char* in, size_t size,
|
|
size_t& outSize);
|
|
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 outSize, size_t& requiredSize);
|
|
|
|
private:
|
|
status_t _ToUnicodeString(const char* in,
|
|
U_NAMESPACE_QUALIFIER UnicodeString& out);
|
|
|
|
U_NAMESPACE_QUALIFIER Collator* fCollator;
|
|
};
|
|
|
|
|
|
} // namespace Libroot
|
|
} // namespace BPrivate
|
|
|
|
|
|
#endif // _ICU_COLLATE_DATA_H
|