From f7a7d7e07396c3a0fae617ed8f15f29fd491bc3a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 27 Apr 2015 11:31:26 -0700 Subject: Revert "Kill operator LPCWSTR from CFX_WideString()." This reverts commit 15a62973b9b89c3e229cc0ab501c45967f91b325. Reason for revert: broke build on windows, mac. I must have missed some platform-specific conversions. TBR=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1108883002 --- core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 4 ++++ core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp | 6 +++--- core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'core/src/fpdfapi') diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index 0bb66da209..9514065eeb 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -436,6 +436,10 @@ CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap } return result; } +CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr, CFX_CharMap* pCharMap) +{ + return PDF_DecodeText((FX_LPCBYTE)bstr.c_str(), bstr.GetLength(), pCharMap); +} CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap) { if (len == -1) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp index 5bacfd7393..db4d0dba43 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp @@ -141,7 +141,7 @@ void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec, const CFX_WideString& fi } else if (filepath.GetLength() > 1 && filepath[0] == '\\' && filepath[1] == '\\') { result = ChangeSlash(filepath.c_str() + 1); } else { - result = ChangeSlash(filepath.c_str()); + result = ChangeSlash(filepath); } if (pFileSpec->GetType() == PDFOBJ_STRING) { pFileSpec->SetString(CFX_ByteString::FromUnicode(result)); @@ -173,7 +173,7 @@ CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString()); } if (wsFileName[0] != '/') { - return ChangeSlash(wsFileName.c_str()); + return ChangeSlash(wsFileName); } if (wsFileName[2] == '/') { CFX_WideString result; @@ -184,7 +184,7 @@ CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) } else { CFX_WideString result; result += '\\'; - result += ChangeSlash(wsFileName.c_str()); + result += ChangeSlash(wsFileName); return result; } } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index 008349c61c..912af297f5 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -375,7 +375,7 @@ void CPDF_Number::SetNumber(FX_FLOAT value) m_Float = value; } CPDF_String::CPDF_String(const CFX_WideString& str) : CPDF_Object(PDFOBJ_STRING), m_bHex(FALSE) { - m_String = PDF_EncodeText(str); + m_String = PDF_EncodeText(str, str.GetLength()); } CPDF_Array::~CPDF_Array() { -- cgit v1.2.3