summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/fpdf_parser.h7
-rw-r--r--core/include/fpdfdoc/fpdf_doc.h2
-rw-r--r--core/include/fxcrt/fx_string.h7
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp6
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp2
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp6
-rw-r--r--core/src/fpdfdoc/doc_basic.cpp2
-rw-r--r--core/src/fpdfdoc/doc_form.cpp5
-rw-r--r--core/src/fpdfdoc/doc_formfield.cpp8
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp4
-rw-r--r--core/src/fxcrt/fx_basic_wstring.cpp4
12 files changed, 26 insertions, 31 deletions
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
{
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index 40d57236cd..31480f90bc 100644
--- a/core/include/fpdfdoc/fpdf_doc.h
+++ b/core/include/fpdfdoc/fpdf_doc.h
@@ -1162,7 +1162,7 @@ public:
int FindOption(CFX_WideString csOptLabel);
- int FindOptionValue(FX_LPCWSTR csOptValue, int iStartIndex = 0);
+ int FindOptionValue(const CFX_WideString& csOptValue, int iStartIndex = 0);
diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h
index 1efb814b08..0dbba4ca85 100644
--- a/core/include/fxcrt/fx_string.h
+++ b/core/include/fxcrt/fx_string.h
@@ -636,15 +636,8 @@ public:
return m_pData ? m_pData->m_String : L"";
}
- // Implicit conversion to C-style wide string -- deprecated
- operator FX_LPCWSTR() const
- {
- return m_pData ? m_pData->m_String : L"";
- }
-
void Empty();
-
FX_BOOL IsEmpty() const
{
return !GetLength();
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index 9514065eeb..0bb66da209 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -436,10 +436,6 @@ 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 db4d0dba43..5bacfd7393 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);
+ result = ChangeSlash(filepath.c_str());
}
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);
+ return ChangeSlash(wsFileName.c_str());
}
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);
+ result += ChangeSlash(wsFileName.c_str());
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 912af297f5..008349c61c 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, str.GetLength());
+ m_String = PDF_EncodeText(str);
}
CPDF_Array::~CPDF_Array()
{
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index ccc800aa1a..8a195a747d 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -464,7 +464,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
vt.SetLimitChar(dwMaxLen);
}
vt.Initialize();
- vt.SetText(swValue);
+ vt.SetText(swValue.c_str());
vt.RearrangeAll();
CPDF_Rect rcContent = vt.GetContentRect();
CPDF_Point ptOffset(0.0f, 0.0f);
@@ -502,7 +502,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
vt.SetFontSize(fFontSize);
}
vt.Initialize();
- vt.SetText(swValue);
+ vt.SetText(swValue.c_str());
vt.RearrangeAll();
CPDF_Rect rcContent = vt.GetContentRect();
CPDF_Point ptOffset = CPDF_Point(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f);
@@ -573,7 +573,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
vt.SetFontSize(fFontSize);
}
vt.Initialize();
- vt.SetText(swItem);
+ vt.SetText(swItem.c_str());
vt.RearrangeAll();
FX_FLOAT fItemHeight = vt.GetContentRect().Height();
if (bSelected) {
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index 496ed86122..48f3ccae98 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -567,6 +567,6 @@ FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const
}
FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const
{
- CFX_ByteString bsLabel = PDF_EncodeText((CFX_WideString)wsLabel);
+ CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr());
return GetPageByLabel(bsLabel);
}
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 47f4a9139c..db56adc58d 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -34,7 +34,7 @@ class _CFieldNameExtractor
public:
_CFieldNameExtractor(const CFX_WideString& full_name)
{
- m_pStart = full_name;
+ m_pStart = full_name.c_str();
m_pEnd = m_pStart + full_name.GetLength();
m_pCur = m_pStart;
}
@@ -733,7 +733,8 @@ int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, const CFX_Byte
}
int CPDF_InterForm::CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2)
{
- FX_LPCWSTR ptr1 = name1, ptr2 = name2;
+ FX_LPCWSTR ptr1 = name1.c_str();
+ FX_LPCWSTR ptr2 = name2.c_str();
if (name1.GetLength() != name2.GetLength()) {
int i = 0;
while (ptr1[i] == ptr2[i]) {
diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp
index a2f0fbd297..6de46de08a 100644
--- a/core/src/fpdfdoc/doc_formfield.cpp
+++ b/core/src/fpdfdoc/doc_formfield.cpp
@@ -646,7 +646,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL b
if (m_Type == ListBox) {
SelectOption(index, TRUE);
if (!(m_Flags & FORMLIST_MULTISELECT)) {
- m_pDict->SetAtString("V", PDF_EncodeText(opt_value, opt_value.GetLength()));
+ m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
} else {
CPDF_Array* pArray = CPDF_Array::Create();
if (pArray == NULL) {
@@ -668,7 +668,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL b
m_pDict->SetAt("V", pArray);
}
} else if (m_Type == ComboBox) {
- m_pDict->SetAtString("V", PDF_EncodeText(opt_value, opt_value.GetLength()));
+ m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
CPDF_Array* pI = CPDF_Array::Create();
if (pI == NULL) {
return FALSE;
@@ -783,7 +783,7 @@ int CPDF_FormField::FindOption(CFX_WideString csOptLabel)
}
return -1;
}
-int CPDF_FormField::FindOptionValue(FX_LPCWSTR csOptValue, int iStartIndex)
+int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue, int iStartIndex)
{
if (iStartIndex < 0) {
iStartIndex = 0;
@@ -811,7 +811,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, FX_BOOL bChecked, FX_BOO
if (bNotify && m_pForm->m_pFormNotify != NULL) {
SaveCheckedFieldStatus(this, statusArray);
}
- CFX_WideString csWExport = pControl->GetExportValue();
+ CFX_WideString csWExport = pControl->GetExportValue();
CFX_ByteString csBExport = PDF_EncodeText(csWExport);
int iCount = CountControls();
FX_BOOL bUnison = PDF_FormField_IsUnison(this);
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index 2b9a079006..be92c86d60 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -2379,7 +2379,7 @@ FX_BOOL CPDF_TextPageFind::FindNext()
continue;
}
int endIndex;
- nResultPos = m_strText.Find(csWord, nStartPos);
+ nResultPos = m_strText.Find(csWord.c_str(), nStartPos);
if (nResultPos == -1) {
m_IsFind = FALSE;
return m_IsFind;
@@ -2496,7 +2496,7 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat)
int index = 0;
while(1) {
CFX_WideString csWord = TEXT_EMPTY;
- int ret = ExtractSubString(csWord, findwhat, index, TEXT_BLANK_CHAR);
+ int ret = ExtractSubString(csWord, findwhat.c_str(), index, TEXT_BLANK_CHAR);
if(csWord.IsEmpty()) {
if(ret) {
m_csFindWhatArray.Add(CFX_WideString(L""));
diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp
index dfdbef8bd6..e255aa0779 100644
--- a/core/src/fxcrt/fx_basic_wstring.cpp
+++ b/core/src/fxcrt/fx_basic_wstring.cpp
@@ -1062,13 +1062,13 @@ static CFX_ByteString _DefMap_GetByteString(CFX_CharMap* pCharMap, const CFX_Wid
{
int src_len = widestr.GetLength();
int codepage = pCharMap->m_GetCodePage ? pCharMap->m_GetCodePage() : 0;
- int dest_len = FXSYS_WideCharToMultiByte(codepage, 0, widestr, src_len, NULL, 0, NULL, NULL);
+ int dest_len = FXSYS_WideCharToMultiByte(codepage, 0, widestr.c_str(), src_len, NULL, 0, NULL, NULL);
if (dest_len == 0) {
return CFX_ByteString();
}
CFX_ByteString bytestr;
FX_LPSTR dest_buf = bytestr.GetBuffer(dest_len);
- FXSYS_WideCharToMultiByte(codepage, 0, widestr, src_len, dest_buf, dest_len, NULL, NULL);
+ FXSYS_WideCharToMultiByte(codepage, 0, widestr.c_str(), src_len, dest_buf, dest_len, NULL, NULL);
bytestr.ReleaseBuffer(dest_len);
return bytestr;
}