From 6fe7d2174a47107578da912299c93b4dfb9f2add Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 6 Apr 2016 10:51:14 -0700 Subject: Make CFX_WideString::FromUTF8() take a CFX_ByteStringC argument. Methods that take string arguments and do not persist them should take *StringC types as argument rather than discrete ptr/len args. Avoids a number of implicit casts from CFX_ByteString to char*. BUG= Review URL: https://codereview.chromium.org/1861183002 --- xfa/fxbarcode/BC_UtilCodingConvert.cpp | 5 +++-- xfa/fxbarcode/cbc_codabar.cpp | 2 +- xfa/fxbarcode/cbc_code128.cpp | 2 +- xfa/fxbarcode/cbc_code39.cpp | 2 +- xfa/fxbarcode/cbc_datamatrix.cpp | 2 +- xfa/fxbarcode/cbc_ean13.cpp | 2 +- xfa/fxbarcode/cbc_ean8.cpp | 2 +- xfa/fxbarcode/cbc_pdf417i.cpp | 2 +- xfa/fxbarcode/cbc_qrcode.cpp | 2 +- xfa/fxbarcode/cbc_upca.cpp | 2 +- 10 files changed, 12 insertions(+), 11 deletions(-) (limited to 'xfa/fxbarcode') diff --git a/xfa/fxbarcode/BC_UtilCodingConvert.cpp b/xfa/fxbarcode/BC_UtilCodingConvert.cpp index 8421e280f3..79311691e2 100644 --- a/xfa/fxbarcode/BC_UtilCodingConvert.cpp +++ b/xfa/fxbarcode/BC_UtilCodingConvert.cpp @@ -36,14 +36,15 @@ void CBC_UtilCodingConvert::Utf8ToLocale(const CFX_ByteArray& src, for (int32_t i = 0; i < src.GetSize(); i++) { utf8 += src[i]; } - CFX_WideString unicode = CFX_WideString::FromUTF8(utf8, utf8.GetLength()); + CFX_WideString unicode = CFX_WideString::FromUTF8(utf8.AsByteStringC()); dst = CFX_ByteString::FromUnicode(unicode); } void CBC_UtilCodingConvert::Utf8ToLocale(const uint8_t* src, int32_t count, CFX_ByteString& dst) { - CFX_WideString unicode = CFX_WideString::FromUTF8((const char*)src, count); + CFX_WideString unicode = + CFX_WideString::FromUTF8(CFX_ByteStringC(src, count)); dst = CFX_ByteString::FromUnicode(unicode); } diff --git a/xfa/fxbarcode/cbc_codabar.cpp b/xfa/fxbarcode/cbc_codabar.cpp index d038904095..ae2b1f2ba2 100644 --- a/xfa/fxbarcode/cbc_codabar.cpp +++ b/xfa/fxbarcode/cbc_codabar.cpp @@ -120,5 +120,5 @@ CFX_WideString CBC_Codabar::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { CBC_BinaryBitmap bitmap(&binarizer); CFX_ByteString str = m_pBCReader->Decode(&bitmap, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); - return CFX_WideString::FromUTF8(str, str.GetLength()); + return CFX_WideString::FromUTF8(str.AsByteStringC()); } diff --git a/xfa/fxbarcode/cbc_code128.cpp b/xfa/fxbarcode/cbc_code128.cpp index 2f7be93140..93417b4e16 100644 --- a/xfa/fxbarcode/cbc_code128.cpp +++ b/xfa/fxbarcode/cbc_code128.cpp @@ -103,5 +103,5 @@ CFX_WideString CBC_Code128::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { CBC_BinaryBitmap bitmap(&binarizer); CFX_ByteString str = m_pBCReader->Decode(&bitmap, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); - return CFX_WideString::FromUTF8(str, str.GetLength()); + return CFX_WideString::FromUTF8(str.AsByteStringC()); } diff --git a/xfa/fxbarcode/cbc_code39.cpp b/xfa/fxbarcode/cbc_code39.cpp index a590f7e39a..69549406e3 100644 --- a/xfa/fxbarcode/cbc_code39.cpp +++ b/xfa/fxbarcode/cbc_code39.cpp @@ -111,7 +111,7 @@ CFX_WideString CBC_Code39::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { CBC_BinaryBitmap bitmap(&binarizer); CFX_ByteString str = m_pBCReader->Decode(&bitmap, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); - return CFX_WideString::FromUTF8(str, str.GetLength()); + return CFX_WideString::FromUTF8(str.AsByteStringC()); } FX_BOOL CBC_Code39::SetTextLocation(BC_TEXT_LOC location) { diff --git a/xfa/fxbarcode/cbc_datamatrix.cpp b/xfa/fxbarcode/cbc_datamatrix.cpp index d3e1a073a5..6eb2e34af4 100644 --- a/xfa/fxbarcode/cbc_datamatrix.cpp +++ b/xfa/fxbarcode/cbc_datamatrix.cpp @@ -79,5 +79,5 @@ CFX_WideString CBC_DataMatrix::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { CBC_BinaryBitmap bitmap(&binarizer); CFX_ByteString retStr = m_pBCReader->Decode(&bitmap, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); - return CFX_WideString::FromUTF8(retStr, retStr.GetLength()); + return CFX_WideString::FromUTF8(retStr.AsByteStringC()); } diff --git a/xfa/fxbarcode/cbc_ean13.cpp b/xfa/fxbarcode/cbc_ean13.cpp index 149c5a6a63..bb578b286e 100644 --- a/xfa/fxbarcode/cbc_ean13.cpp +++ b/xfa/fxbarcode/cbc_ean13.cpp @@ -111,5 +111,5 @@ CFX_WideString CBC_EAN13::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { CBC_BinaryBitmap bitmap(&binarizer); CFX_ByteString str = m_pBCReader->Decode(&bitmap, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); - return CFX_WideString::FromUTF8(str, str.GetLength()); + return CFX_WideString::FromUTF8(str.AsByteStringC()); } diff --git a/xfa/fxbarcode/cbc_ean8.cpp b/xfa/fxbarcode/cbc_ean8.cpp index 12a821385b..3316963ea0 100644 --- a/xfa/fxbarcode/cbc_ean8.cpp +++ b/xfa/fxbarcode/cbc_ean8.cpp @@ -110,5 +110,5 @@ CFX_WideString CBC_EAN8::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { CBC_BinaryBitmap bitmap(&binarizer); CFX_ByteString str = m_pBCReader->Decode(&bitmap, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); - return CFX_WideString::FromUTF8(str, str.GetLength()); + return CFX_WideString::FromUTF8(str.AsByteStringC()); } diff --git a/xfa/fxbarcode/cbc_pdf417i.cpp b/xfa/fxbarcode/cbc_pdf417i.cpp index b27af1cefc..1f9f1ff257 100644 --- a/xfa/fxbarcode/cbc_pdf417i.cpp +++ b/xfa/fxbarcode/cbc_pdf417i.cpp @@ -87,5 +87,5 @@ CFX_WideString CBC_PDF417I::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { CBC_BinaryBitmap bitmap(&binarizer); CFX_ByteString bytestring = m_pBCReader->Decode(&bitmap, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); - return CFX_WideString::FromUTF8(bytestring, bytestring.GetLength()); + return CFX_WideString::FromUTF8(bytestring.AsByteStringC()); } diff --git a/xfa/fxbarcode/cbc_qrcode.cpp b/xfa/fxbarcode/cbc_qrcode.cpp index 4518594944..f0261d79b6 100644 --- a/xfa/fxbarcode/cbc_qrcode.cpp +++ b/xfa/fxbarcode/cbc_qrcode.cpp @@ -97,5 +97,5 @@ CFX_WideString CBC_QRCode::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { CBC_BinaryBitmap bitmap(&binarizer); CFX_ByteString retStr = m_pBCReader->Decode(&bitmap, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); - return CFX_WideString::FromUTF8(retStr, retStr.GetLength()); + return CFX_WideString::FromUTF8(retStr.AsByteStringC()); } diff --git a/xfa/fxbarcode/cbc_upca.cpp b/xfa/fxbarcode/cbc_upca.cpp index 79aa922e46..a770bb4e20 100644 --- a/xfa/fxbarcode/cbc_upca.cpp +++ b/xfa/fxbarcode/cbc_upca.cpp @@ -113,5 +113,5 @@ CFX_WideString CBC_UPCA::Decode(CFX_DIBitmap* pBitmap, int32_t& e) { CBC_BinaryBitmap bitmap(&binarizer); CFX_ByteString str = m_pBCReader->Decode(&bitmap, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, FX_WSTRC(L"")); - return CFX_WideString::FromUTF8(str, str.GetLength()); + return CFX_WideString::FromUTF8(str.AsByteStringC()); } -- cgit v1.2.3