summaryrefslogtreecommitdiff
path: root/core/fxcrt/bytestring.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-09 21:32:47 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-09 21:32:47 +0000
commitfd7cede17e027a83de2aff3bc0f5ee875271e444 (patch)
treec1576d19a8e8c99ebbcf9dba4e75ef4665e631cc /core/fxcrt/bytestring.cpp
parent60627d6eafd025dde711e532eee6866840c04bef (diff)
downloadpdfium-fd7cede17e027a83de2aff3bc0f5ee875271e444.tar.xz
Move all utf8 decoding under fx_string.h
Put encoder in cfx_utf8encoder.{h,cpp} to parallel decoder. Add tests, and fix one corner case involving 0xff. Change-Id: Ib97540afdc708bcc6280a79c76734ec68ea72690 Reviewed-on: https://pdfium-review.googlesource.com/39770 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcrt/bytestring.cpp')
-rw-r--r--core/fxcrt/bytestring.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/core/fxcrt/bytestring.cpp b/core/fxcrt/bytestring.cpp
index b6c1ce7bbd..3ff0e3537a 100644
--- a/core/fxcrt/bytestring.cpp
+++ b/core/fxcrt/bytestring.cpp
@@ -669,11 +669,7 @@ size_t ByteString::Replace(const ByteStringView& pOld,
}
WideString ByteString::UTF8Decode() const {
- CFX_UTF8Decoder decoder;
- for (size_t i = 0; i < GetLength(); i++) {
- decoder.Input(static_cast<uint8_t>(m_pData->m_String[i]));
- }
- return WideString(decoder.GetResult());
+ return WideString::FromUTF8(AsStringView());
}
int ByteString::Compare(const ByteStringView& str) const {