From 15a62973b9b89c3e229cc0ab501c45967f91b325 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 27 Apr 2015 11:22:20 -0700 Subject: Kill operator LPCWSTR from CFX_WideString(). This involves adding some explicit c_str() calls. Doing so flagged PDF_EncodeText() and FindOptionValue() as having suboptimal signatures, in that we are often throwing away a perfectly fine length and recomputing it. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1101933003 --- core/include/fpdfapi/fpdf_parser.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/include/fpdfapi') diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index c72acc834f..20766702e2 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -793,9 +793,14 @@ CFX_ByteString PDF_NameDecode(FX_BSTR orig); CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex = FALSE); -CFX_WideString PDF_DecodeText(const CFX_ByteString& str, CFX_CharMap* pCharMap = NULL); CFX_WideString PDF_DecodeText(FX_LPCBYTE pData, FX_DWORD size, CFX_CharMap* pCharMap = NULL); +inline CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr, CFX_CharMap* pCharMap = NULL) { + return PDF_DecodeText((FX_LPCBYTE)bstr.c_str(), bstr.GetLength(), pCharMap); +} CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len = -1, CFX_CharMap* pCharMap = NULL); +inline CFX_ByteString PDF_EncodeText(const CFX_WideString& str, CFX_CharMap* pCharMap = NULL) { + return PDF_EncodeText(str.c_str(), str.GetLength(), pCharMap); +} FX_FLOAT PDF_ClipFloat(FX_FLOAT f); class CFDF_Document : public CPDF_IndirectObjects { -- cgit v1.2.3