From 28c7844c1ef5ea0c8727b890e9ff56b593119a00 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 12 May 2016 15:52:14 -0700 Subject: Add CFX_ByteStringC::CharAt() to avoid c_str() and casts. Most of the time, we want to operate on chars as if they were unsigned, but there are a few places where we need the default (questionably signed) values. Consolidate the casting in a single place rather than forcing callers to get a char* ptr. BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1972053003 --- core/fxcrt/include/fx_string.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/fxcrt/include') diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index 8c1a6174b2..617e02ee5a 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -94,6 +94,9 @@ class CFX_ByteStringC { bool IsEmpty() const { return m_Length == 0; } uint8_t GetAt(FX_STRSIZE index) const { return m_Ptr[index]; } + FX_CHAR CharAt(FX_STRSIZE index) const { + return static_cast(m_Ptr[index]); + } FX_STRSIZE Find(FX_CHAR ch) const { const uint8_t* found = -- cgit v1.2.3