| Index: base/string_util.cc
|
| ===================================================================
|
| --- base/string_util.cc (revision 10809)
|
| +++ base/string_util.cc (working copy)
|
| @@ -27,6 +27,16 @@
|
|
|
| namespace {
|
|
|
| +// Force the singleton used by Empty[W]String[16] to be a unique type. This
|
| +// prevents other code that might accidentally use Singleton<string> from
|
| +// getting our internal one.
|
| +struct EmptyStrings {
|
| + EmptyStrings() {}
|
| + const std::string s;
|
| + const std::wstring ws;
|
| + const string16 s16;
|
| +};
|
| +
|
| // Hack to convert any char-like type to its unsigned counterpart.
|
| // For example, it will convert char, signed char and unsigned char to unsigned
|
| // char.
|
| @@ -323,13 +333,17 @@
|
|
|
|
|
| const std::string& EmptyString() {
|
| - return *Singleton<std::string>::get();
|
| + return Singleton<EmptyStrings>::get()->s;
|
| }
|
|
|
| const std::wstring& EmptyWString() {
|
| - return *Singleton<std::wstring>::get();
|
| + return Singleton<EmptyStrings>::get()->ws;
|
| }
|
|
|
| +const string16& EmptyString16() {
|
| + return Singleton<EmptyStrings>::get()->s16;
|
| +}
|
| +
|
| const wchar_t kWhitespaceWide[] = {
|
| 0x0009, // <control-0009> to <control-000D>
|
| 0x000A,
|
|
|