summaryrefslogtreecommitdiffstats
path: root/base/word_iterator.cc
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-11 21:26:52 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-11 21:26:52 +0000
commitb1080093bca40696fae18292fbd40129412cb381 (patch)
tree51c1ab105688b2464e8bbe683d45be36a4db3479 /base/word_iterator.cc
parent783f5be582cb485e42018d1ff948000eeac1bc2f (diff)
downloadchromium_src-b1080093bca40696fae18292fbd40129412cb381.zip
chromium_src-b1080093bca40696fae18292fbd40129412cb381.tar.gz
chromium_src-b1080093bca40696fae18292fbd40129412cb381.tar.bz2
Fixes word_iterator to actually compile. Next time, never just paste code in that _should_ fix things without actually compiling :(
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@672 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/word_iterator.cc')
-rw-r--r--base/word_iterator.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/base/word_iterator.cc b/base/word_iterator.cc
index b0161f2..fcd32f5 100644
--- a/base/word_iterator.cc
+++ b/base/word_iterator.cc
@@ -31,6 +31,7 @@
#include "base/logging.h"
#include "unicode/ubrk.h"
+#include "unicode/ustring.h"
const int WordIterator::npos = -1;
@@ -61,25 +62,25 @@ bool WordIterator::Init() {
NOTREACHED();
break_type = UBRK_LINE;
}
-#ifdef U_WCHAR_IS_UTF16
+#if defined(WCHAR_T_IS_UTF16)
iter_ = ubrk_open(break_type, NULL,
string_.data(), static_cast<int32_t>(string_.size()),
&status);
-#else // U_WCHAR_IS_UTF16
+#else // WCHAR_T_IS_UTF16
// When wchar_t is wider than UChar (16 bits), transform |string_| into a
// UChar* string. Size the UChar* buffer to be large enough to hold twice
// as many UTF-16 code points as there are UCS-4 characters, in case each
// character translates to a UTF-16 surrogate pair, and leave room for a NUL
// terminator.
// TODO(avi): avoid this alloc
- chars_.resize(wide.length() * sizeof(UChar) + 1);
+ chars_.resize(string_.length() * sizeof(UChar) + 1);
UErrorCode error = U_ZERO_ERROR;
int32_t destLength;
u_strFromWCS(&chars_[0], chars_.size(), &destLength, string_.data(),
string_.length(), &error);
- iter_ = ubrk_open(break_type, NULL, chars_, destLength, &status);
+ iter_ = ubrk_open(break_type, NULL, &chars_[0], destLength, &status);
#endif
if (U_FAILURE(status)) {
NOTREACHED() << "ubrk_open failed";