diff options
author | tsepez <tsepez@chromium.org> | 2016-05-11 16:51:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-11 16:51:20 -0700 |
commit | 94dfd56acc7ceb2acfc2e5c7ae516e34b160ea15 (patch) | |
tree | 7c8c5e2ae30ecf14fcfea0286fcb6e35ea162366 /core/fpdfapi | |
parent | 0d1318777ec9075746090776f877f338e074d7c7 (diff) | |
download | pdfium-94dfd56acc7ceb2acfc2e5c7ae516e34b160ea15.tar.xz |
Remove c_str() from fpdf_font.cpp
BUG=pdfium:493
Review-Url: https://codereview.chromium.org/1967223002
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/fpdf_font/fpdf_font.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp index f3f651c52e..dccce5656b 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp @@ -132,20 +132,19 @@ uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { // Static. uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { - const FX_CHAR* buf = str.c_str(); int len = str.GetLength(); if (len == 0) return 0; int result = 0; - if (buf[0] == '<') { - for (int i = 1; i < len && std::isxdigit(buf[i]); ++i) - result = result * 16 + FXSYS_toHexDigit(buf[i]); + if (str[0] == '<') { + for (int i = 1; i < len && std::isxdigit(str[i]); ++i) + result = result * 16 + FXSYS_toHexDigit(str[i]); return result; } - for (int i = 0; i < len && std::isdigit(buf[i]); ++i) - result = result * 10 + FXSYS_toDecimalDigit(buf[i]); + for (int i = 0; i < len && std::isdigit(str[i]); ++i) + result = result * 10 + FXSYS_toDecimalDigit(static_cast<FX_CHAR>(str[i])); return result; } @@ -172,17 +171,16 @@ static CFX_WideString StringDataAdd(CFX_WideString str) { // Static. CFX_WideString CPDF_ToUnicodeMap::StringToWideString( const CFX_ByteStringC& str) { - const FX_CHAR* buf = str.c_str(); int len = str.GetLength(); if (len == 0) return CFX_WideString(); CFX_WideString result; - if (buf[0] == '<') { + if (str[0] == '<') { int byte_pos = 0; FX_WCHAR ch = 0; - for (int i = 1; i < len && std::isxdigit(buf[i]); ++i) { - ch = ch * 16 + FXSYS_toHexDigit(buf[i]); + for (int i = 1; i < len && std::isxdigit(str[i]); ++i) { + ch = ch * 16 + FXSYS_toHexDigit(str[i]); byte_pos++; if (byte_pos == 4) { result += ch; |