From fc58ad18b7ab32e7b0bb3959b07dbe7538a7cebd Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 5 Apr 2016 12:22:15 -0700 Subject: Make down-conversion explicit from CFX_Widetring to CFX_WideStringC. Companion to https://codereview.chromium.org/1853233002 BUG= Review URL: https://codereview.chromium.org/1857073002 --- core/fpdfdoc/doc_basic.cpp | 2 +- core/fxcrt/fx_xml_parser.cpp | 7 +- core/fxcrt/include/fx_string.h | 30 ++++---- fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 6 +- fpdfsdk/fsdk_baseform.cpp | 12 ++-- fpdfsdk/javascript/PublicMethods.cpp | 16 ++--- testing/libfuzzer/pdf_fm2js_fuzzer.cc | 2 +- xfa/fgas/font/fgas_stdfontmgr.cpp | 3 +- xfa/fgas/localization/fgas_locale.cpp | 67 +++++++++--------- xfa/fwl/basewidget/fwl_barcodeimp.cpp | 2 +- xfa/fwl/basewidget/fwl_editimp.cpp | 2 +- xfa/fwl/core/fwl_formimp.cpp | 2 +- xfa/fxbarcode/cbc_codabar.cpp | 13 ++-- xfa/fxbarcode/cbc_code128.cpp | 11 +-- xfa/fxbarcode/cbc_code39.cpp | 17 +++-- xfa/fxbarcode/cbc_ean13.cpp | 7 +- xfa/fxbarcode/cbc_ean8.cpp | 7 +- xfa/fxbarcode/cbc_upca.cpp | 7 +- xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp | 4 +- xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp | 3 +- xfa/fxfa/app/xfa_ffbarcode.cpp | 2 +- xfa/fxfa/app/xfa_ffchoicelist.cpp | 10 +-- xfa/fxfa/app/xfa_ffdocview.cpp | 7 +- xfa/fxfa/app/xfa_fffield.cpp | 6 +- xfa/fxfa/app/xfa_ffimageedit.cpp | 6 +- xfa/fxfa/app/xfa_ffpageview.cpp | 2 +- xfa/fxfa/app/xfa_fftextedit.cpp | 9 +-- xfa/fxfa/app/xfa_ffwidget.cpp | 4 +- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 39 +++++++---- xfa/fxfa/app/xfa_fontmgr.cpp | 9 ++- xfa/fxfa/app/xfa_textlayout.cpp | 19 +++-- xfa/fxfa/app/xfa_textlayout.h | 4 +- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 62 ++++++++++------- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 22 +++--- xfa/fxfa/parser/xfa_document_serialize.cpp | 2 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 2 +- xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp | 4 +- xfa/fxfa/parser/xfa_locale.cpp | 6 +- xfa/fxfa/parser/xfa_localemgr.cpp | 4 +- xfa/fxfa/parser/xfa_localevalue.cpp | 8 ++- xfa/fxfa/parser/xfa_object_imp.cpp | 80 +++++++++++++--------- xfa/fxfa/parser/xfa_objectacc_imp.cpp | 34 ++++----- xfa/fxfa/parser/xfa_parser_imp.cpp | 36 +++++----- xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 31 +++++---- xfa/fxfa/parser/xfa_script_imp.cpp | 40 ++++++----- xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 2 +- xfa/fxfa/parser/xfa_script_nodehelper.cpp | 5 +- xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 15 ++-- .../parser/xfa_script_signaturepseudomodel.cpp | 5 +- xfa/include/fxfa/xfa_ffwidget.h | 2 +- 50 files changed, 397 insertions(+), 300 deletions(-) diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index ad21db815c..2555d4839b 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -335,7 +335,7 @@ bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const { } else { return false; } - *csFileName = DecodeFileName(*csFileName); + *csFileName = DecodeFileName(csFileName->AsWideStringC()); return true; } diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp index b39c32bfbd..d59a6b9780 100644 --- a/core/fxcrt/fx_xml_parser.cpp +++ b/core/fxcrt/fx_xml_parser.cpp @@ -398,7 +398,8 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, CFX_WideString attr_value; GetAttrValue(attr_value); pElement->m_AttrMap.SetAt(attr_space.AsByteStringC(), - attr_name.AsByteStringC(), attr_value); + attr_name.AsByteStringC(), + attr_value.AsWideStringC()); } m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (m_dwIndex < m_dwBufferSize || IsEOF()) { @@ -461,7 +462,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, if (!bCDATA && !m_bSaveSpaceChars) { dataStr.TrimRight(L" \t\r\n"); } - InsertContentSegment(bCDATA, dataStr, pElement); + InsertContentSegment(bCDATA, dataStr.AsWideStringC(), pElement); content.Clear(); decoder.Clear(); bCDATA = FALSE; @@ -505,7 +506,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, if (!m_bSaveSpaceChars) { dataStr.TrimRight(L" \t\r\n"); } - InsertContentSegment(bCDATA, dataStr, pElement); + InsertContentSegment(bCDATA, dataStr.AsWideStringC(), pElement); content.Clear(); decoder.Clear(); bCDATA = FALSE; diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index d48b26c30f..9373b058ee 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -431,8 +431,6 @@ class CFX_WideStringC { m_Length = src.m_Length; } - CFX_WideStringC(const CFX_WideString& src); - CFX_WideStringC& operator=(const FX_WCHAR* src) { m_Ptr = src; m_Length = FXSYS_wcslen(src); @@ -557,13 +555,20 @@ class CFX_WideString { static FX_STRSIZE WStringLength(const unsigned short* str); // Explicit conversion to C-style wide string. + // Note: |this| must outlive the use of the result. const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } // Implicit conversion to C-style wide string -- deprecated. + // Note: |this| must outlive the use of the result. operator const FX_WCHAR*() const { return m_pData ? m_pData->m_String : L""; } - void Empty(); + // Explicit conversion to CFX_WideStringC. + // Note: |this| must outlive the use of the result. + CFX_WideStringC AsWideStringC() const { + return CFX_WideStringC(c_str(), GetLength()); + } + void Empty(); bool IsEmpty() const { return !GetLength(); } FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } @@ -685,10 +690,7 @@ class CFX_WideString { StringData* m_pData; friend class fxcrt_WideStringConcatInPlace_Test; }; -inline CFX_WideStringC::CFX_WideStringC(const CFX_WideString& src) { - m_Ptr = src.c_str(); - m_Length = src.GetLength(); -} + inline CFX_WideStringC& CFX_WideStringC::operator=(const CFX_WideString& src) { m_Ptr = src.c_str(); m_Length = src.GetLength(); @@ -715,29 +717,29 @@ inline CFX_WideString operator+(FX_WCHAR ch, const CFX_WideStringC& str2) { } inline CFX_WideString operator+(const CFX_WideString& str1, const CFX_WideString& str2) { - return CFX_WideString(str1, str2); + return CFX_WideString(str1.AsWideStringC(), str2.AsWideStringC()); } inline CFX_WideString operator+(const CFX_WideString& str1, FX_WCHAR ch) { - return CFX_WideString(str1, CFX_WideStringC(ch)); + return CFX_WideString(str1.AsWideStringC(), CFX_WideStringC(ch)); } inline CFX_WideString operator+(FX_WCHAR ch, const CFX_WideString& str2) { - return CFX_WideString(ch, str2); + return CFX_WideString(ch, str2.AsWideStringC()); } inline CFX_WideString operator+(const CFX_WideString& str1, const FX_WCHAR* str2) { - return CFX_WideString(str1, str2); + return CFX_WideString(str1.AsWideStringC(), str2); } inline CFX_WideString operator+(const FX_WCHAR* str1, const CFX_WideString& str2) { - return CFX_WideString(str1, str2); + return CFX_WideString(str1, str2.AsWideStringC()); } inline CFX_WideString operator+(const CFX_WideString& str1, const CFX_WideStringC& str2) { - return CFX_WideString(str1, str2); + return CFX_WideString(str1.AsWideStringC(), str2); } inline CFX_WideString operator+(const CFX_WideStringC& str1, const CFX_WideString& str2) { - return CFX_WideString(str1, str2); + return CFX_WideString(str1, str2.AsWideStringC()); } inline bool operator==(const wchar_t* lhs, const CFX_WideString& rhs) { return rhs == lhs; diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index fbc05bd9aa..bb8793f1a7 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -957,7 +957,7 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, ws.FromLocal("data"); CFX_ByteString content = "\r\n"; fileStream.WriteBlock((const FX_CHAR*)content, 0, content.GetLength()); - m_pXFADoc->SavePackage(ws, &fileStream); + m_pXFADoc->SavePackage(ws.AsWideStringC(), &fileStream); } else if (fileType == FXFA_SAVEAS_XDP) { if (flag == 0) flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS | @@ -1018,11 +1018,11 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, if (pPrePDFObj->GetString() == "form") { CFX_WideString ws; ws.FromLocal("form"); - m_pXFADoc->SavePackage(ws, &fileStream); + m_pXFADoc->SavePackage(ws.AsWideStringC(), &fileStream); } else if (pPrePDFObj->GetString() == "datasets") { CFX_WideString ws; ws.FromLocal("datasets"); - m_pXFADoc->SavePackage(ws, &fileStream); + m_pXFADoc->SavePackage(ws.AsWideStringC(), &fileStream); } else { // PDF,creator. } diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp index fe7c23932f..3dad62472f 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -64,7 +64,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const { } if (!sName.IsEmpty()) - m_hMixXFAWidget = pDocView->GetWidgetByName(sName); + m_hMixXFAWidget = pDocView->GetWidgetByName(sName.AsWideStringC()); } } return m_hMixXFAWidget; @@ -80,7 +80,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() { if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) { CFX_WideString sName = GetName(); if (!sName.IsEmpty()) - return pDocView->GetWidgetByName(sName); + return pDocView->GetWidgetByName(sName.AsWideStringC()); } } @@ -2448,7 +2448,7 @@ FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( bool bIncludeOrExclude, CFX_ByteTextBuf& textBuf) { std::unique_ptr pFDF(m_pInterForm->ExportToFDF( - m_pDocument->GetPath(), fields, bIncludeOrExclude)); + m_pDocument->GetPath().AsWideStringC(), fields, bIncludeOrExclude)); return pFDF ? pFDF->WriteBuf(textBuf) : FALSE; } @@ -2486,7 +2486,8 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); - CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); + CFDF_Document* pFDFDoc = + m_pInterForm->ExportToFDF(wsPDFFilePath.AsWideStringC()); if (!pFDFDoc) return FALSE; @@ -2515,7 +2516,8 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, } FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) { - CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath()); + CFDF_Document* pFDF = + m_pInterForm->ExportToFDF(m_pDocument->GetPath().AsWideStringC()); if (!pFDF) return FALSE; diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index b928aab31d..308163d454 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -1219,11 +1219,11 @@ double CJS_PublicMethods::MakeInterDate(CFX_WideString strValue) { else if (sTemp.Compare(L"Dec") == 0) nMonth = 12; - int nDay = FX_atof(wsArray[2]); - int nHour = FX_atof(wsArray[3]); - int nMin = FX_atof(wsArray[4]); - int nSec = FX_atof(wsArray[5]); - int nYear = FX_atof(wsArray[7]); + int nDay = FX_atof(wsArray[2].AsWideStringC()); + int nHour = FX_atof(wsArray[3].AsWideStringC()); + int nMin = FX_atof(wsArray[4].AsWideStringC()); + int nSec = FX_atof(wsArray[5].AsWideStringC()); + int nYear = FX_atof(wsArray[7].AsWideStringC()); double dRet = JS_MakeDate(JS_MakeDay(nYear, nMonth - 1, nDay), JS_MakeTime(nHour, nMin, nSec, 0)); if (JS_PortIsNan(dRet)) @@ -1726,7 +1726,7 @@ FX_BOOL CJS_PublicMethods::AFSimple_Calculate( CFX_WideString trimmed = pFormField->GetValue(); trimmed.TrimRight(); trimmed.TrimLeft(); - dTemp = FX_atof(trimmed); + dTemp = FX_atof(trimmed.AsWideStringC()); } break; case FIELDTYPE_PUSHBUTTON: { dTemp = 0.0; @@ -1740,7 +1740,7 @@ FX_BOOL CJS_PublicMethods::AFSimple_Calculate( CFX_WideString trimmed = pFormCtrl->GetExportValue(); trimmed.TrimRight(); trimmed.TrimLeft(); - dTemp = FX_atof(trimmed); + dTemp = FX_atof(trimmed.AsWideStringC()); break; } } @@ -1751,7 +1751,7 @@ FX_BOOL CJS_PublicMethods::AFSimple_Calculate( CFX_WideString trimmed = pFormField->GetValue(); trimmed.TrimRight(); trimmed.TrimLeft(); - dTemp = FX_atof(trimmed); + dTemp = FX_atof(trimmed.AsWideStringC()); } } break; default: diff --git a/testing/libfuzzer/pdf_fm2js_fuzzer.cc b/testing/libfuzzer/pdf_fm2js_fuzzer.cc index 569c1291af..0a5f6d64ae 100644 --- a/testing/libfuzzer/pdf_fm2js_fuzzer.cc +++ b/testing/libfuzzer/pdf_fm2js_fuzzer.cc @@ -16,7 +16,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { CFX_WideString input = CFX_WideString::FromUTF8( reinterpret_cast(data), static_cast(size)); CXFA_FMProgram program; - if (program.Init(input) || program.ParseProgram()) + if (program.Init(input.AsWideStringC()) || program.ParseProgram()) return 0; CFX_WideTextBuf js; diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 3733852388..2b403e8ee8 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -561,7 +561,8 @@ FX_POSITION CFX_FontSourceEnum_File::GetStartPosition(void* pUserData) { } IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos, void* pUserData) { - IFX_FileAccess* pAccess = FX_CreateDefaultFileAccess(m_wsNext); + IFX_FileAccess* pAccess = + FX_CreateDefaultFileAccess(m_wsNext.AsWideStringC()); m_wsNext = GetNextFile().UTF8Decode(); pos = 0 != m_wsNext.GetLength() ? pAccess : NULL; return (IFX_FileAccess*)pAccess; diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index d6243effee..878cbf6aeb 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -116,7 +116,7 @@ void CFX_Locale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, return; } wsNumSymbol = FX_GetXMLContent(bsSpace.AsByteStringC(), pNumberSymbols, - "numberSymbol", wsName); + "numberSymbol", wsName.AsWideStringC()); } void CFX_Locale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { if (!m_pElement) { @@ -237,7 +237,8 @@ static void FX_GetPattern(CXML_Element* pXmlElement, return; } wsPattern = FX_GetXMLContent(bsSpace.AsByteStringC(), pDatePatterns, - bsCategory.AsByteStringC(), wsSubCategory); + bsCategory.AsByteStringC(), + wsSubCategory.AsWideStringC()); } static void FX_GetDateTimePattern(CXML_Element* pXmlElement, const CFX_ByteString& bsCategory, @@ -692,7 +693,7 @@ IFX_Locale* CFX_FormatString::GetTextFormat(const CFX_WideString& wsPattern, while (ccf < iLenf && pStr[ccf] != ')') { wsLCID += pStr[ccf++]; } - pLocale = GetPatternLocale(wsLCID); + pLocale = GetPatternLocale(wsLCID.AsWideStringC()); } else if (pStr[ccf] == '{') { bBrackOpen = TRUE; break; @@ -751,7 +752,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, while (ccf < iLenf && pStr[ccf] != ')') { wsLCID += pStr[ccf++]; } - pLocale = GetPatternLocale(wsLCID); + pLocale = GetPatternLocale(wsLCID.AsWideStringC()); } else if (pStr[ccf] == '{') { bBrackOpen = TRUE; break; @@ -1738,13 +1739,13 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (!FX_IsDigit(str[cc])) { return FALSE; } - wsValue = CFX_WideStringC(str[cc]) + wsValue; + wsValue = str[cc] + wsValue; cc--; ccf--; break; case 'z': if (FX_IsDigit(str[cc])) { - wsValue = CFX_WideStringC(str[cc]) + wsValue; + wsValue = str[cc] + wsValue; cc--; } ccf--; @@ -1752,7 +1753,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, case 'Z': if (str[cc] != ' ') { if (FX_IsDigit(str[cc])) { - wsValue = CFX_WideStringC(str[cc]) + wsValue; + wsValue = str[cc] + wsValue; cc--; } } else { @@ -2156,7 +2157,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } } if (iExponent || bHavePercentSymbol) { - CFX_Decimal decimal = CFX_Decimal(wsValue); + CFX_Decimal decimal = CFX_Decimal(wsValue.AsWideStringC()); if (iExponent) { decimal = decimal * CFX_Decimal(FXSYS_pow(10, (FX_FLOAT)iExponent)); } @@ -2166,7 +2167,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, wsValue = decimal; } if (bNeg) { - wsValue = CFX_WideStringC('-') + wsValue; + wsValue = L'-' + wsValue; } return TRUE; } @@ -2228,7 +2229,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( while (ccf < iLenf && pStr[ccf] != ')') { wsLCID += pStr[ccf++]; } - pLocale = GetPatternLocale(wsLCID); + pLocale = GetPatternLocale(wsLCID.AsWideStringC()); } else if (pStr[ccf] == '{') { bBraceOpen = TRUE; break; @@ -2926,7 +2927,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, if (wsSrcNum.IsEmpty() || wsSrcNum[0] == '.') { wsSrcNum.Insert(0, '0'); } - CFX_Decimal decimal = CFX_Decimal(wsSrcNum); + CFX_Decimal decimal = CFX_Decimal(wsSrcNum.AsWideStringC()); if (dwNumStyle & FX_NUMSTYLE_Percent) { decimal = decimal * CFX_Decimal(100); wsSrcNum = decimal; @@ -3004,10 +3005,10 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, if (!FX_IsDigit(str[cc])) { return FALSE; } - wsOutput = CFX_WideStringC(str[cc]) + wsOutput; + wsOutput = str[cc] + wsOutput; cc--; } else { - wsOutput = CFX_WideStringC(L'0') + wsOutput; + wsOutput = L'0' + wsOutput; } ccf--; break; @@ -3017,7 +3018,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, return FALSE; } if (str[0] != '0') { - wsOutput = CFX_WideStringC(str[cc]) + wsOutput; + wsOutput = str[cc] + wsOutput; } cc--; } @@ -3029,13 +3030,13 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, return FALSE; } if (str[0] == '0') { - wsOutput = CFX_WideStringC(L' ') + wsOutput; + wsOutput = L' ' + wsOutput; } else { - wsOutput = CFX_WideStringC(str[cc]) + wsOutput; + wsOutput = str[cc] + wsOutput; } cc--; } else { - wsOutput = CFX_WideStringC(L' ') + wsOutput; + wsOutput = L' ' + wsOutput; } ccf--; break; @@ -3046,7 +3047,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsOutput = wsMinusSymbol + wsOutput; bAddNeg = TRUE; } else { - wsOutput = CFX_WideStringC(L' ') + wsOutput; + wsOutput = L' ' + wsOutput; } ccf--; break; @@ -3148,7 +3149,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, ccf--; break; default: - wsOutput = CFX_WideStringC(strf[ccf]) + wsOutput; + wsOutput = strf[ccf] + wsOutput; ccf--; } } @@ -3427,17 +3428,17 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, switch (strf[ccf]) { case '9': if (cc >= 0) { - wsOutput = CFX_WideStringC(str[cc]) + wsOutput; + wsOutput = str[cc] + wsOutput; cc--; } else { - wsOutput = CFX_WideStringC(L'0') + wsOutput; + wsOutput = L'0' + wsOutput; } ccf--; break; case 'z': if (cc >= 0) { if (lcNum.m_Integral != 0) { - wsOutput = CFX_WideStringC(str[cc]) + wsOutput; + wsOutput = str[cc] + wsOutput; } cc--; } @@ -3446,13 +3447,13 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, case 'Z': if (cc >= 0) { if (lcNum.m_Integral == 0) { - wsOutput = CFX_WideStringC(L' ') + wsOutput; + wsOutput = L' ' + wsOutput; } else { - wsOutput = CFX_WideStringC(str[cc]) + wsOutput; + wsOutput = str[cc] + wsOutput; } cc--; } else { - wsOutput = CFX_WideStringC(L' ') + wsOutput; + wsOutput = L' ' + wsOutput; } ccf--; break; @@ -3463,7 +3464,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsOutput = wsMinusSymbol + wsOutput; bAddNeg = TRUE; } else { - wsOutput = CFX_WideStringC(L' ') + wsOutput; + wsOutput = L' ' + wsOutput; } ccf--; break; @@ -3565,7 +3566,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, ccf--; break; default: - wsOutput = CFX_WideStringC(strf[ccf]) + wsOutput; + wsOutput = strf[ccf] + wsOutput; ccf--; } } @@ -3754,7 +3755,7 @@ FX_BOOL CFX_FormatString::FormatNum(const CFX_WideString& wsSrcNum, if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty()) { return FALSE; } - return FormatStrNum(wsSrcNum, wsPattern, wsOutput); + return FormatStrNum(wsSrcNum.AsWideStringC(), wsPattern, wsOutput); } FX_BOOL CFX_FormatString::FormatNum(FX_FLOAT fNum, const CFX_WideString& wsPattern, @@ -4256,12 +4257,13 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, if (eCategory == FX_DATETIMETYPE_Date) { FX_DateFromCanonical(wsSrcDateTime, dt); } else if (eCategory == FX_DATETIMETYPE_Time) { - FX_TimeFromCanonical(wsSrcDateTime, dt, pLocale); + FX_TimeFromCanonical(wsSrcDateTime.AsWideStringC(), dt, pLocale); } } else { FX_DateFromCanonical(wsSrcDateTime.Left(iT), dt); FX_TimeFromCanonical( - wsSrcDateTime.Right(wsSrcDateTime.GetLength() - iT - 1), dt, pLocale); + wsSrcDateTime.Right(wsSrcDateTime.GetLength() - iT - 1).AsWideStringC(), + dt, pLocale); } return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, eCategory != FX_DATETIMETYPE_TimeDate, pLocale, @@ -4299,7 +4301,8 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, TRUE, pLocale, wsOutput); } else if (eCategory == FX_DATETIMETYPE_Time && - FX_TimeFromCanonical(wsSrcDateTime, dt, pLocale)) { + FX_TimeFromCanonical(wsSrcDateTime.AsWideStringC(), dt, + pLocale)) { return FX_FormatDateTime(dt, wsDatePattern, wsTimePattern, TRUE, pLocale, wsOutput); } @@ -4736,7 +4739,7 @@ CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) { } CFX_Decimal::CFX_Decimal(const CFX_ByteStringC& strObj) { - *this = CFX_Decimal(CFX_WideString::FromLocal(strObj)); + *this = CFX_Decimal(CFX_WideString::FromLocal(strObj).AsWideStringC()); } CFX_Decimal::operator CFX_WideString() const { diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp index 9b6761bf8d..610233e84e 100644 --- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp +++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp @@ -170,7 +170,7 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() { m_pBarcodeEngine->SetTruncated(pData->GetTruncated()); } int32_t errorCode = 0; - m_dwStatus = m_pBarcodeEngine->Encode(wsText, TRUE, errorCode) + m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsWideStringC(), TRUE, errorCode) ? XFA_BCS_EncodeSuccess : 0; } diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index 008936c90e..fb25c1e0fc 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -423,7 +423,7 @@ FX_BOOL CFWL_EditImp::ReplaceSpellCheckWord(CFX_PointF pointf, pBuffer[i] = bsReplace[i]; } wsDest.ReleaseBuffer(nDestLen); - Replace(nWordStart, nWordCount, wsDest); + Replace(nWordStart, nWordCount, wsDest.AsWideStringC()); return TRUE; } void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index f7fc301d97..5a5cc5e59b 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -822,7 +822,7 @@ void CFWL_FormImp::UpdateCaption() { return; CFX_WideString text; pData->GetCaption(m_pInterface, text); - pWidgetMgr->SetWidgetCaption_Native(m_pInterface, text); + pWidgetMgr->SetWidgetCaption_Native(m_pInterface, text.AsWideStringC()); } void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft, FX_FLOAT& fWidth, diff --git a/xfa/fxbarcode/cbc_codabar.cpp b/xfa/fxbarcode/cbc_codabar.cpp index a7310ba1fc..d038904095 100644 --- a/xfa/fxbarcode/cbc_codabar.cpp +++ b/xfa/fxbarcode/cbc_codabar.cpp @@ -77,7 +77,8 @@ FX_BOOL CBC_Codabar::Encode(const CFX_WideStringC& contents, ->Encode(byteString, format, outWidth, outHeight, e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderResult(filtercontents, data, outWidth, isDevice, e); + ->RenderResult(filtercontents.AsWideStringC(), data, outWidth, isDevice, + e); FX_Free(data); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; @@ -87,18 +88,20 @@ FX_BOOL CBC_Codabar::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t& e) { CFX_WideString renderCon = - ((CBC_OnedCodaBarWriter*)m_pBCWriter)->encodedContents(m_renderContents); + ((CBC_OnedCodaBarWriter*)m_pBCWriter) + ->encodedContents(m_renderContents.AsWideStringC()); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderDeviceResult(device, matirx, renderCon, e); + ->RenderDeviceResult(device, matirx, renderCon.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } FX_BOOL CBC_Codabar::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { CFX_WideString renderCon = - ((CBC_OnedCodaBarWriter*)m_pBCWriter)->encodedContents(m_renderContents); + ((CBC_OnedCodaBarWriter*)m_pBCWriter) + ->encodedContents(m_renderContents.AsWideStringC()); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderBitmapResult(pOutBitmap, renderCon, e); + ->RenderBitmapResult(pOutBitmap, renderCon.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } diff --git a/xfa/fxbarcode/cbc_code128.cpp b/xfa/fxbarcode/cbc_code128.cpp index e585de302c..2f7be93140 100644 --- a/xfa/fxbarcode/cbc_code128.cpp +++ b/xfa/fxbarcode/cbc_code128.cpp @@ -58,15 +58,16 @@ FX_BOOL CBC_Code128::Encode(const CFX_WideStringC& contents, ((CBC_OnedCode128Writer*)m_pBCWriter)->GetType() == BC_CODE128_C) { content += '0'; } - CFX_WideString encodeContents = - ((CBC_OnedCode128Writer*)m_pBCWriter)->FilterContents(content); + CFX_WideString encodeContents = ((CBC_OnedCode128Writer*)m_pBCWriter) + ->FilterContents(content.AsWideStringC()); m_renderContents = encodeContents; CFX_ByteString byteString = encodeContents.UTF8Encode(); uint8_t* data = static_cast(m_pBCWriter) ->Encode(byteString, format, outWidth, outHeight, e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderResult(encodeContents, data, outWidth, isDevice, e); + ->RenderResult(encodeContents.AsWideStringC(), data, outWidth, isDevice, + e); FX_Free(data); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; @@ -76,14 +77,14 @@ FX_BOOL CBC_Code128::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t& e) { ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderDeviceResult(device, matirx, m_renderContents, e); + ->RenderDeviceResult(device, matirx, m_renderContents.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } FX_BOOL CBC_Code128::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderBitmapResult(pOutBitmap, m_renderContents, e); + ->RenderBitmapResult(pOutBitmap, m_renderContents.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } diff --git a/xfa/fxbarcode/cbc_code39.cpp b/xfa/fxbarcode/cbc_code39.cpp index a0e3d17fc1..a590f7e39a 100644 --- a/xfa/fxbarcode/cbc_code39.cpp +++ b/xfa/fxbarcode/cbc_code39.cpp @@ -68,7 +68,8 @@ FX_BOOL CBC_Code39::Encode(const CFX_WideStringC& contents, ->Encode(byteString, format, outWidth, outHeight, e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderResult(renderContents, data, outWidth, isDevice, e); + ->RenderResult(renderContents.AsWideStringC(), data, outWidth, isDevice, + e); FX_Free(data); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; @@ -77,19 +78,21 @@ FX_BOOL CBC_Code39::Encode(const CFX_WideStringC& contents, FX_BOOL CBC_Code39::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t& e) { - CFX_WideString renderCon = ((CBC_OnedCode39Writer*)m_pBCWriter) - ->encodedContents(m_renderContents, e); + CFX_WideString renderCon = + ((CBC_OnedCode39Writer*)m_pBCWriter) + ->encodedContents(m_renderContents.AsWideStringC(), e); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderDeviceResult(device, matirx, renderCon, e); + ->RenderDeviceResult(device, matirx, renderCon.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } FX_BOOL CBC_Code39::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { - CFX_WideString renderCon = ((CBC_OnedCode39Writer*)m_pBCWriter) - ->encodedContents(m_renderContents, e); + CFX_WideString renderCon = + ((CBC_OnedCode39Writer*)m_pBCWriter) + ->encodedContents(m_renderContents.AsWideStringC(), e); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderBitmapResult(pOutBitmap, renderCon, e); + ->RenderBitmapResult(pOutBitmap, renderCon.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } diff --git a/xfa/fxbarcode/cbc_ean13.cpp b/xfa/fxbarcode/cbc_ean13.cpp index e764122e3c..149c5a6a63 100644 --- a/xfa/fxbarcode/cbc_ean13.cpp +++ b/xfa/fxbarcode/cbc_ean13.cpp @@ -74,7 +74,8 @@ FX_BOOL CBC_EAN13::Encode(const CFX_WideStringC& contents, ->Encode(byteString, format, outWidth, outHeight, e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderResult(encodeContents, data, outWidth, isDevice, e); + ->RenderResult(encodeContents.AsWideStringC(), data, outWidth, isDevice, + e); FX_Free(data); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; @@ -84,14 +85,14 @@ FX_BOOL CBC_EAN13::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t& e) { ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderDeviceResult(device, matirx, m_renderContents, e); + ->RenderDeviceResult(device, matirx, m_renderContents.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } FX_BOOL CBC_EAN13::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderBitmapResult(pOutBitmap, m_renderContents, e); + ->RenderBitmapResult(pOutBitmap, m_renderContents.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } diff --git a/xfa/fxbarcode/cbc_ean8.cpp b/xfa/fxbarcode/cbc_ean8.cpp index bc983b8c47..12a821385b 100644 --- a/xfa/fxbarcode/cbc_ean8.cpp +++ b/xfa/fxbarcode/cbc_ean8.cpp @@ -73,7 +73,8 @@ FX_BOOL CBC_EAN8::Encode(const CFX_WideStringC& contents, ->Encode(byteString, format, outWidth, outHeight, e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderResult(encodeContents, data, outWidth, isDevice, e); + ->RenderResult(encodeContents.AsWideStringC(), data, outWidth, isDevice, + e); FX_Free(data); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; @@ -83,14 +84,14 @@ FX_BOOL CBC_EAN8::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t& e) { ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderDeviceResult(device, matirx, m_renderContents, e); + ->RenderDeviceResult(device, matirx, m_renderContents.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } FX_BOOL CBC_EAN8::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderBitmapResult(pOutBitmap, m_renderContents, e); + ->RenderBitmapResult(pOutBitmap, m_renderContents.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } diff --git a/xfa/fxbarcode/cbc_upca.cpp b/xfa/fxbarcode/cbc_upca.cpp index 220b8fa2d8..79aa922e46 100644 --- a/xfa/fxbarcode/cbc_upca.cpp +++ b/xfa/fxbarcode/cbc_upca.cpp @@ -76,7 +76,8 @@ FX_BOOL CBC_UPCA::Encode(const CFX_WideStringC& contents, ->Encode(byteString, format, outWidth, outHeight, e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderResult(encodeContents, data, outWidth, isDevice, e); + ->RenderResult(encodeContents.AsWideStringC(), data, outWidth, isDevice, + e); FX_Free(data); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; @@ -86,14 +87,14 @@ FX_BOOL CBC_UPCA::RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matirx, int32_t& e) { ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderDeviceResult(device, matirx, m_renderContents, e); + ->RenderDeviceResult(device, matirx, m_renderContents.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } FX_BOOL CBC_UPCA::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { ((CBC_OneDimWriter*)m_pBCWriter) - ->RenderBitmapResult(pOutBitmap, m_renderContents, e); + ->RenderBitmapResult(pOutBitmap, m_renderContents.AsWideStringC(), e); BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); return TRUE; } diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 81f0339aa8..3fbeb1c318 100644 --- a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -226,6 +226,6 @@ void CBC_OnedCodaBarWriter::RenderResult(const CFX_WideStringC& contents, int32_t codeLength, FX_BOOL isDevice, int32_t& e) { - CBC_OneDimWriter::RenderResult(encodedContents(contents), code, codeLength, - isDevice, e); + CBC_OneDimWriter::RenderResult(encodedContents(contents).AsWideStringC(), + code, codeLength, isDevice, e); } diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp index 31e75ca7df..0a69f04a4f 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -360,5 +360,6 @@ void CBC_OnedCode39Writer::RenderResult(const CFX_WideStringC& contents, int32_t& e) { CFX_WideString encodedCon = encodedContents(contents, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - CBC_OneDimWriter::RenderResult(encodedCon, code, codeLength, isDevice, e); + CBC_OneDimWriter::RenderResult(encodedCon.AsWideStringC(), code, codeLength, + isDevice, e); } diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index e5ace150ab..28dfa86066 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -167,7 +167,7 @@ void CXFA_FFBarcode::UpdateWidgetProperty() { CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; CFX_WideString wsType = GetDataAcc()->GetBarcodeType(); XFA_LPCBARCODETYPEENUMINFO pBarcodeTypeInfo = - XFA_GetBarcodeTypeByName(wsType); + XFA_GetBarcodeTypeByName(wsType.AsWideStringC()); pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType); CXFA_WidgetAcc* pAcc = GetDataAcc(); int32_t intVal; diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index 44ae14264d..645b8c88fa 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -44,7 +44,7 @@ FX_BOOL CXFA_FFListBox::LoadWidget() { m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); int32_t iItems = wsLabelArray.GetSize(); for (int32_t i = 0; i < iItems; i++) { - pListBox->AddString(wsLabelArray[i]); + pListBox->AddString(wsLabelArray[i].AsWideStringC()); } uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { @@ -166,7 +166,7 @@ void CXFA_FFListBox::SetItemState(int32_t nIndex, FX_BOOL bSelected) { void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex) { CFX_WideString wsTemp(wsLabel); - ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp); + ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsWideStringC()); m_pNormalWidget->Update(); AddInvalidateRect(); } @@ -240,7 +240,7 @@ FX_BOOL CXFA_FFComboBox::LoadWidget() { m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); int32_t iItems = wsLabelArray.GetSize(); for (int32_t i = 0; i < iItems; i++) { - pComboBox->AddString(wsLabelArray[i]); + pComboBox->AddString(wsLabelArray[i].AsWideStringC()); } CFX_Int32Array iSelArray; m_pDataAcc->GetSelectedItems(iSelArray); @@ -250,7 +250,7 @@ FX_BOOL CXFA_FFComboBox::LoadWidget() { } else { CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); - pComboBox->SetEditText(wsText); + pComboBox->SetEditText(wsText.AsWideStringC()); } UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); @@ -382,7 +382,7 @@ FX_BOOL CXFA_FFComboBox::UpdateFWLData() { CFX_WideString wsText; ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1); m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); - ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText); + ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText.AsWideStringC()); } m_pNormalWidget->Update(); return TRUE; diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 5e8813542d..c82fd53bc2 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -162,7 +162,8 @@ void CXFA_FFDocView::ShowNullTestMsg() { } CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); - pAppProvider->MsgBox(wsMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); + pAppProvider->MsgBox(wsMsg.AsWideStringC(), wsTitle.AsWideStringC(), + XFA_MBICON_Status, XFA_MB_OK); } m_arrNullTestMsg.RemoveAll(); } @@ -515,8 +516,8 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( wsExpression = L"$form." + wsName; } XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, - resoveNodeRS, dwStyle); + int32_t iRet = pScriptContext->ResolveObjects( + refNode, wsExpression.AsWideStringC(), resoveNodeRS, dwStyle); if (iRet < 1) { return NULL; } diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index a0f64e9bb0..229ed43733 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -731,7 +731,8 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { wsMessage += wsWarning; CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_CalcOverride, wsTitle); - pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Warning, + pAppProvider->MsgBox(wsMessage.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_OK); } } @@ -763,7 +764,8 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { wsMessage += wsWarning; CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_CalcOverride, wsTitle); - if (pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsMessage.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE); return 1; diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index ce69b1242b..d419fbd37d 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -108,7 +108,8 @@ FX_BOOL CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, CFX_WideString wsFilter; pAppProvider->LoadString(XFA_IDS_ImageFilter, wsFilter); CFX_WideStringArray wsPathArray; - pAppProvider->ShowFileDialog(wsTitle, wsFilter, wsPathArray); + pAppProvider->ShowFileDialog(wsTitle.AsWideStringC(), + wsFilter.AsWideStringC(), wsPathArray); int32_t iSize = wsPathArray.GetSize(); if (iSize < 1) { return TRUE; @@ -147,7 +148,8 @@ FX_BOOL CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, m_pDataAcc->SetImageEditImage(NULL); pFileRead->Release(); } - m_pDataAcc->SetImageEdit(wsContentType, CFX_WideStringC(), wsImage); + m_pDataAcc->SetImageEdit(wsContentType.AsWideStringC(), CFX_WideStringC(), + wsImage.AsWideStringC()); m_pDataAcc->LoadImageEditImage(); AddInvalidateRect(); m_pDocView->SetChangeMark(); diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index e22ddc0394..21eb8554da 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -270,7 +270,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( if (pTraverse) { CFX_WideString wsTraverseWidgetName; if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) { - return FindWidgetByName(wsTraverseWidgetName, pWidget); + return FindWidgetByName(wsTraverseWidgetName.AsWideStringC(), pWidget); } } } diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index fa530169e0..de93c031b5 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -201,7 +201,8 @@ void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) { pAcc->GetNode()->GetSOMExpression(wsSomField); wsMessage.Format(wsError, (const FX_WCHAR*)wsText, (const FX_WCHAR*)wsSomField); - pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Error, XFA_MB_OK); + pAppProvider->MsgBox(wsMessage.AsWideStringC(), wsTitle.AsWideStringC(), + XFA_MBICON_Error, XFA_MB_OK); } } } @@ -593,7 +594,7 @@ FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { m_pNormalWidget->LockUpdate(); CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); - pWidget->SetEditText(wsText); + pWidget->SetEditText(wsText.AsWideStringC()); if (CXFA_Value value = m_pDataAcc->GetFormValue()) { switch (value.GetChildValueClassID()) { case XFA_ELEMENT_Date: { @@ -693,7 +694,7 @@ FX_BOOL CXFA_FFDateTimeEdit::UpdateFWLData() { } CFX_WideString wsText; m_pDataAcc->GetValue(wsText, eType); - ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText); + ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText.AsWideStringC()); if (IsFocused() && !wsText.IsEmpty()) { CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); CFX_Unitime date = lcValue.GetDate(); @@ -776,7 +777,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget, date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(), XFA_VALUEPICTURE_Edit); CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget; - pDateTime->SetEditText(wsDate); + pDateTime->SetEditText(wsDate.AsWideStringC()); pDateTime->Update(); GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL); CXFA_EventParam eParam; diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 241bae0fdf..3a238ad0f3 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -944,7 +944,7 @@ FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { out[j] = '\0'; return out; } -FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideStringC& wsType) { +FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType) { CFX_WideString wsContentType(wsType); wsContentType.MakeLower(); if (wsContentType == FX_WSTRC(L"image/jpg")) { @@ -1003,7 +1003,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, if (wsURL.Left(7) != FX_WSTRC(L"http://") && wsURL.Left(6) != FX_WSTRC(L"ftp://")) { CFX_DIBitmap* pBitmap = - pDoc->GetPDFNamedImage(wsURL, iImageXDpi, iImageYDpi); + pDoc->GetPDFNamedImage(wsURL.AsWideStringC(), iImageXDpi, iImageYDpi); if (pBitmap) { bNameImage = TRUE; return pBitmap; diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 271f9261f0..fb2b0c3ffd 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -229,7 +229,8 @@ void CXFA_WidgetAcc::ResetData() { image.GetContentType(wsContentType); image.GetHref(wsHref); } - SetImageEdit(wsContentType, wsHref, wsValue); + SetImageEdit(wsContentType.AsWideStringC(), wsHref.AsWideStringC(), + wsValue.AsWideStringC()); } break; case XFA_ELEMENT_ExclGroup: { CXFA_Node* pNextChild = m_pNode->GetNodeItem( @@ -411,11 +412,13 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, GetValidateMessage(pAppProvider, wsScriptMsg, FALSE, bVersionFlag); } if (bVersionFlag) { - pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, + pAppProvider->MsgBox(wsScriptMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_OK); return; } - if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsScriptMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE); } @@ -423,7 +426,9 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, if (wsScriptMsg.IsEmpty()) { GetValidateMessage(pAppProvider, wsScriptMsg, TRUE, bVersionFlag); } - pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); + pAppProvider->MsgBox(wsScriptMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Error, + XFA_MB_OK); } } } @@ -456,7 +461,9 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, if (wsFormatMsg.IsEmpty()) { GetValidateMessage(pAppProvider, wsFormatMsg, TRUE, bVersionFlag); } - pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); + pAppProvider->MsgBox(wsFormatMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Error, + XFA_MB_OK); return XFA_EVENTERROR_Success; } if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { @@ -466,11 +473,13 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, GetValidateMessage(pAppProvider, wsFormatMsg, FALSE, bVersionFlag); } if (bVersionFlag) { - pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, + pAppProvider->MsgBox(wsFormatMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_OK); return XFA_EVENTERROR_Success; } - if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsFormatMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE); } @@ -526,7 +535,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); wsNullMsg.Format(wsError, (const FX_WCHAR*)wsCaptionName); } - pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); + pAppProvider->MsgBox(wsNullMsg.AsWideStringC(), wsTitle.AsWideStringC(), + XFA_MBICON_Status, XFA_MB_OK); return XFA_EVENTERROR_Error; } case XFA_ATTRIBUTEENUM_Warning: { @@ -540,7 +550,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, wsNullMsg.Format(wsWarning, (const FX_WCHAR*)wsCaptionName, (const FX_WCHAR*)wsCaptionName); } - if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsNullMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE); } @@ -671,8 +682,9 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script, } FXJSE_HVALUE hRetValue = FXJSE_Value_Create(pContext->GetRuntime()); ++m_nRecursionDepth; - FX_BOOL bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType, - wsExpression, hRetValue, m_pNode); + FX_BOOL bRet = + pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType, + wsExpression.AsWideStringC(), hRetValue, m_pNode); --m_nRecursionDepth; int32_t iRet = XFA_EVENTERROR_Error; if (bRet) { @@ -1700,11 +1712,12 @@ FX_BOOL CXFA_TextProvider::GetEmbbedObj(FX_BOOL bURI, CXFA_Node* pIDNode = NULL; CXFA_WidgetAcc* pEmbAcc = NULL; if (pParent) { - pIDNode = pDocument->GetNodeByID(pParent, wsAttr); + pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsWideStringC()); } if (!pIDNode) { pIDNode = pDocument->GetNodeByID( - ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), wsAttr); + ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), + wsAttr.AsWideStringC()); } if (pIDNode) { pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 1b87f95353..8ffb7ce578 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1765,7 +1765,8 @@ IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage); if (!pFont) { - const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName); + const XFA_FONTINFO* pCurFont = + XFA_GetFontINFOByFontName(wsFontName.AsWideStringC()); if (pCurFont && pCurFont->pReplaceFont) { uint32_t dwStyle = 0; if (dwFontStyles & FX_FONTSTYLE_Bold) { @@ -2029,7 +2030,8 @@ IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, CPDF_Font* pPDFFont = NULL; IFX_Font* pFont = NULL; if (pMgr) { - pFont = pMgr->GetFont(wsEnglishName, dwFontStyles, &pPDFFont); + pFont = + pMgr->GetFont(wsEnglishName.AsWideStringC(), dwFontStyles, &pPDFFont); if (pFont) return pFont; } @@ -2038,7 +2040,8 @@ IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, } if (!pFont && pMgr) { pPDFFont = NULL; - pFont = pMgr->GetFont(wsEnglishName, dwFontStyles, &pPDFFont, FALSE); + pFont = pMgr->GetFont(wsEnglishName.AsWideStringC(), dwFontStyles, + &pPDFFont, FALSE); if (pFont) return pFont; } diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 4cbdfd4f8e..cd323633c0 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -317,29 +317,26 @@ void CXFA_TextParser::ParseTagInfo(CFDE_XMLNode* pXMLNode, tagProvider.m_bContent = TRUE; } } + int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const { - int32_t iAlign = XFA_ATTRIBUTEENUM_Top; CXFA_Para para = pTextProvider->GetParaNode(); - if (para) { - iAlign = para.GetVerticalAlign(); - } - return iAlign; + return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top; } + FX_FLOAT CXFA_TextParser::GetTabInterval(IFDE_CSSComputedStyle* pStyle) const { CFX_WideString wsValue; - if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"tab-interval"), wsValue)) { - CXFA_Measurement ms(wsValue); - return ms.ToUnit(XFA_UNIT_Pt); - } + if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"tab-interval"), wsValue)) + return CXFA_Measurement(wsValue.AsWideStringC()).ToUnit(XFA_UNIT_Pt); return 36; } + int32_t CXFA_TextParser::CountTabs(IFDE_CSSComputedStyle* pStyle) const { CFX_WideString wsValue; - if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-tab-count"), wsValue)) { + if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-tab-count"), wsValue)) return wsValue.GetInteger(); - } return 0; } + FX_BOOL CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const { CFX_WideString wsValue; if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-spacerun"), wsValue)) { diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index 9b92e1796a..d92a2f4058 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -25,7 +25,9 @@ class CXFA_CSSTagProvider : public IFDE_CSSTagProvider { public: CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} virtual ~CXFA_CSSTagProvider(); - virtual CFX_WideStringC GetTagName() { return m_wsTagName; } + + // Note: |this| must outlive the use of GetTagName()'s result. + virtual CFX_WideStringC GetTagName() { return m_wsTagName.AsWideStringC(); } virtual FX_POSITION GetFirstAttribute() { return m_Attributes.GetStartPosition(); } diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index c016e2033a..518d233745 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -1589,7 +1589,8 @@ void CXFA_FM2JSContext::Time2Num(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(localString, localString.GetLength())); + CFX_WideString::FromUTF8(localString, localString.GetLength()) + .AsWideStringC()); } CFX_WideString wsFormat; if (formatString.IsEmpty()) { @@ -2039,7 +2040,8 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoDate(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()) + .AsWideStringC()); } if (!pLocale) { return FALSE; @@ -2077,7 +2079,8 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoTime(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()) + .AsWideStringC()); } if (!pLocale) { return FALSE; @@ -2118,7 +2121,8 @@ FX_BOOL CXFA_FM2JSContext::IsoDate2Local(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()) + .AsWideStringC()); } if (!pLocale) { return FALSE; @@ -2158,7 +2162,8 @@ FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()) + .AsWideStringC()); } if (!pLocale) { return FALSE; @@ -2200,7 +2205,8 @@ FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength()) + .AsWideStringC()); } if (!pLocale) { return FALSE; @@ -2383,7 +2389,8 @@ void CXFA_FM2JSContext::GetLocalDateFormat(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength())); + CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength()) + .AsWideStringC()); } if (!pLocale) { return; @@ -2438,7 +2445,8 @@ void CXFA_FM2JSContext::GetLocalTimeFormat(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength())); + CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength()) + .AsWideStringC()); } if (!pLocale) { return; @@ -3257,8 +3265,9 @@ void CXFA_FM2JSContext::Eval(FXJSE_HOBJECT hThis, CFX_WideTextBuf wsJavaScriptBuf; CFX_WideString javaScript; CFX_WideString wsError; - XFA_FM2JS_Translate(CFX_WideString::FromUTF8( - utf8ScriptString, utf8ScriptString.GetLength()), + XFA_FM2JS_Translate(CFX_WideString::FromUTF8(utf8ScriptString, + utf8ScriptString.GetLength()) + .AsWideStringC(), wsJavaScriptBuf, wsError); FXJSE_HCONTEXT hContext = FXJSE_Context_Create(hruntime); FXJSE_HVALUE returnValue = FXJSE_Value_Create(hruntime); @@ -5481,7 +5490,8 @@ void CXFA_FM2JSContext::Get(FXJSE_HOBJECT hThis, CFX_ByteString urlString; HValueToUTF8String(argOne, urlString); IFX_FileRead* pFile = pAppProvider->DownloadURL( - CFX_WideString::FromUTF8(urlString, urlString.GetLength())); + CFX_WideString::FromUTF8(urlString, urlString.GetLength()) + .AsWideStringC()); if (pFile) { int32_t size = pFile->GetSize(); uint8_t* pData = FX_Alloc(uint8_t, size); @@ -5541,11 +5551,14 @@ void CXFA_FM2JSContext::Post(FXJSE_HOBJECT hThis, } CFX_WideString decodedResponse; FX_BOOL bFlags = pAppProvider->PostRequestURL( - CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()), - CFX_WideString::FromUTF8(bsData, bsData.GetLength()), - CFX_WideString::FromUTF8(bsContentType, bsContentType.GetLength()), - CFX_WideString::FromUTF8(bsEncode, bsEncode.GetLength()), - CFX_WideString::FromUTF8(bsHeader, bsHeader.GetLength()), + CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()).AsWideStringC(), + CFX_WideString::FromUTF8(bsData, bsData.GetLength()).AsWideStringC(), + CFX_WideString::FromUTF8(bsContentType, bsContentType.GetLength()) + .AsWideStringC(), + CFX_WideString::FromUTF8(bsEncode, bsEncode.GetLength()) + .AsWideStringC(), + CFX_WideString::FromUTF8(bsHeader, bsHeader.GetLength()) + .AsWideStringC(), decodedResponse); FXJSE_Value_Release(argOne); FXJSE_Value_Release(argTwo); @@ -5602,9 +5615,10 @@ void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, HValueToUTF8String(argThree, bsEncode); } FX_BOOL bFlags = pAppProvider->PutRequestURL( - CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()), - CFX_WideString::FromUTF8(bsData, bsData.GetLength()), - CFX_WideString::FromUTF8(bsEncode, bsEncode.GetLength())); + CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()).AsWideStringC(), + CFX_WideString::FromUTF8(bsData, bsData.GetLength()).AsWideStringC(), + CFX_WideString::FromUTF8(bsEncode, bsEncode.GetLength()) + .AsWideStringC()); FXJSE_Value_Release(argOne); FXJSE_Value_Release(argTwo); if (argc > 2) { @@ -6410,7 +6424,8 @@ void CXFA_FM2JSContext::eval_translation(FXJSE_HOBJECT hThis, CFX_WideString::FromUTF8(argString, argString.GetLength()); CFX_WideTextBuf wsJavaScriptBuf; CFX_WideString wsError; - XFA_FM2JS_Translate(scriptString, wsJavaScriptBuf, wsError); + XFA_FM2JS_Translate(scriptString.AsWideStringC(), wsJavaScriptBuf, + wsError); if (wsError.IsEmpty()) { CFX_WideString javaScript = wsJavaScriptBuf.GetWideString(); FXJSE_Value_SetUTF8String( @@ -6879,7 +6894,8 @@ FX_BOOL CXFA_FM2JSContext::GetObjectByName( int32_t iRet = pScriptContext->ResolveObjects( pScriptContext->GetThisObject(), CFX_WideString::FromUTF8(szAccessorName.c_str(), - szAccessorName.GetLength()), + szAccessorName.GetLength()) + .AsWideStringC(), resoveNodeRS, dwFlags); if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( @@ -6936,8 +6952,8 @@ int32_t CXFA_FM2JSContext::ResolveObjects(FXJSE_HOBJECT hThis, pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue, NULL); dFlags = XFA_RESOLVENODE_AnyChild; } - iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression, resoveNodeRS, - dFlags); + iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsWideStringC(), + resoveNodeRS, dFlags); return iRet; } void CXFA_FM2JSContext::ParseResolveResult( diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index a5f021aacd..a28b4994ab 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -131,7 +131,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CFDE_XMLElement* pXMLDataElement = static_cast(pDataNode->GetXMLMappingNode()); FXSYS_assert(pXMLDataElement); - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); if (!wsHref.IsEmpty()) { @@ -160,7 +161,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); } } else if (!wsValue.IsEmpty()) { - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); } break; @@ -169,7 +171,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) { break; } - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); break; case XFA_ELEMENT_ExclGroup: { @@ -239,7 +242,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CFX_WideString wsOutput; pWidgetData->NormalizeNumStr(wsValue, wsOutput); wsValue = wsOutput; - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); CXFA_Node* pValue = pFormNode->GetProperty(0, XFA_ELEMENT_Value); XFA_DataMerge_FormValueNode_SetChildContent(pValue, wsValue, @@ -250,7 +254,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) { break; } - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); break; } @@ -258,7 +263,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CFX_WideString wsXMLValue; pDataNode->TryContent(wsXMLValue); CFX_WideString wsNormailizeValue; - pWidgetData->GetNormalizeDataValue(wsXMLValue, wsNormailizeValue); + pWidgetData->GetNormalizeDataValue(wsXMLValue.AsWideStringC(), + wsNormailizeValue); pDataNode->SetAttributeValue(wsNormailizeValue, wsXMLValue); switch (eUIType) { case XFA_ELEMENT_ImageEdit: { @@ -312,8 +318,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Text); break; case XFA_ELEMENT_ExclGroup: { - pWidgetData->SetSelectedMemberByValue(wsNormailizeValue, bNotify, FALSE, - FALSE); + pWidgetData->SetSelectedMemberByValue(wsNormailizeValue.AsWideStringC(), + bNotify, FALSE, FALSE); } break; case XFA_ELEMENT_DateTimeEdit: XFA_DataMerge_FormValueNode_SetChildContent( diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index 2ae82e3c35..39590f6e8f 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -297,7 +297,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( buf << FX_WSTRC(L" xmlns=\"\"\n>"); for (int32_t i = 0; i < wsSelTextArray.GetSize(); i++) { buf << FX_WSTRC(L""); - buf << XFA_ExportEncodeContent(wsSelTextArray[i]); + buf << XFA_ExportEncodeContent(wsSelTextArray[i].AsWideStringC()); buf << FX_WSTRC(L""); } buf << FX_WSTRC(L"GetNodeByID( ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)), - wsTargetExpr.Mid(1)); + wsTargetExpr.Mid(1).AsWideStringC()); if (pNode) { return pNode; } @@ -309,7 +309,7 @@ static CXFA_Node* XFA_ResolveBreakTarget(CXFA_Node* pPageSetRoot, } XFA_RESOLVENODE_RS rs; int32_t iCount = pDocument->GetScriptContext()->ResolveObjects( - pPageSetRoot, wsProcessedTarget, rs, + pPageSetRoot, wsProcessedTarget.AsWideStringC(), rs, XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent); diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index 141e295be9..c77dc2637d 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -79,7 +79,7 @@ void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, } GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols, bsSymbols.GetLength() - 1), - wsName, wsNumSymbol); + wsName.AsWideStringC(), wsNumSymbol); } void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { if (!m_pLocaleData) { @@ -162,7 +162,7 @@ void CXFA_XMLLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, wsName = L"long"; break; } - GetPattern(pElement, "datePattern", wsName, wsPattern); + GetPattern(pElement, "datePattern", wsName.AsWideStringC(), wsPattern); } void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, CFX_WideString& wsPattern) const { @@ -186,7 +186,7 @@ void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, wsName = L"long"; break; } - GetPattern(pElement, "timePattern", wsName, wsPattern); + GetPattern(pElement, "timePattern", wsName.AsWideStringC(), wsPattern); } void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, CFX_WideString& wsPattern) const { diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index 7ccf228177..0c09830094 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -1132,7 +1132,7 @@ CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid) pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); } } - m_pDefLocale = GetLocaleByName(wsDeflcid); + m_pDefLocale = GetLocaleByName(wsDeflcid.AsWideStringC()); } CXFA_LocaleMgr::~CXFA_LocaleMgr() { int32_t iCount = m_LocaleArray.GetSize(); @@ -1266,7 +1266,7 @@ CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { } m_dwLocaleFlags |= 0x01; } - return m_wsConfigLocale; + return m_wsConfigLocale.AsWideStringC(); } static CXFA_TimeZoneProvider* g_pProvider = NULL; diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index 3c85622b0d..99738c60ae 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -369,7 +369,8 @@ CFX_Unitime CXFA_LocaleValue::GetTime() const { if (m_bValid && m_dwType == XFA_VT_TIME) { CFX_Unitime dt(0); FXSYS_assert(m_pLocaleMgr); - FX_TimeFromCanonical(m_wsValue, dt, m_pLocaleMgr->GetDefLocale()); + FX_TimeFromCanonical(m_wsValue.AsWideStringC(), dt, + m_pLocaleMgr->GetDefLocale()); return dt; } return CFX_Unitime(); @@ -380,8 +381,9 @@ CFX_Unitime CXFA_LocaleValue::GetDateTime() const { CFX_Unitime dt; FX_DateFromCanonical(m_wsValue.Left(index), dt); FXSYS_assert(m_pLocaleMgr); - FX_TimeFromCanonical(m_wsValue.Right(m_wsValue.GetLength() - index - 1), dt, - m_pLocaleMgr->GetDefLocale()); + FX_TimeFromCanonical( + m_wsValue.Right(m_wsValue.GetLength() - index - 1).AsWideStringC(), dt, + m_pLocaleMgr->GetDefLocale()); return dt; } return CFX_Unitime(); diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 4c3ecd2976..1dd526571d 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -648,8 +648,8 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, - resoveNodeRS, dwFlag); + int32_t iRet = pScriptContext->ResolveObjects( + refNode, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet < 1) { return FXJSE_Value_SetNull(pArguments->GetReturnValue()); } @@ -708,7 +708,8 @@ void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, if (refNode == NULL) { refNode = this; } - pScriptContext->ResolveObjects(refNode, wsExpression, resoveNodeRS, dwFlag); + pScriptContext->ResolveObjects(refNode, wsExpression.AsWideStringC(), + resoveNodeRS, dwFlag); CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument); if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) { @@ -878,7 +879,7 @@ void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { wsExpression = CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); CFX_WideString wsValue; - GetAttribute(wsExpression, wsValue); + GetAttribute(wsExpression.AsWideStringC(), wsValue); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); @@ -900,7 +901,8 @@ void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { if (iLength >= 2) { iValue = pArguments->GetInt32(1); } - const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); + const XFA_ELEMENTINFO* pElementInfo = + XFA_GetElementByName(wsExpression.AsWideStringC()); CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName); FXJSE_Value_Set(pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); @@ -929,13 +931,14 @@ void CXFA_Node::Script_NodeClass_IsPropertySpecified( } FX_BOOL bHas = FALSE; const XFA_ATTRIBUTEINFO* pAttributeInfo = - XFA_GetAttributeByName(wsExpression); + XFA_GetAttributeByName(wsExpression.AsWideStringC()); CFX_WideString wsValue; if (pAttributeInfo) { bHas = HasAttribute(pAttributeInfo->eName); } if (!bHas) { - const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); + const XFA_ELEMENTINFO* pElementInfo = + XFA_GetElementByName(wsExpression.AsWideStringC()); bHas = (GetProperty(iIndex, pElementInfo->eName) != NULL); } FXJSE_HVALUE hValue = pArguments->GetReturnValue(); @@ -1158,7 +1161,8 @@ void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { wsAttributeValue = CFX_WideString::FromUTF8(bsAttributeValue, bsAttributeValue.GetLength()); wsAttribute = CFX_WideString::FromUTF8(bsAttribute, bsAttribute.GetLength()); - SetAttribute(wsAttribute, wsAttributeValue, TRUE); + SetAttribute(wsAttribute.AsWideStringC(), wsAttributeValue.AsWideStringC(), + TRUE); } void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); @@ -1483,7 +1487,7 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, FXJSE_Value_ToUTF8String(hValue, szValue); CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue, szValue.GetLength()); - SetAttribute(eAttribute, wsValue, TRUE); + SetAttribute(eAttribute, wsValue.AsWideStringC(), TRUE); if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { CFX_WideString wsUseVal = wsValue, wsID, wsSOM; CXFA_Node* pTemplateNode = @@ -1508,12 +1512,12 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( - pProtoRoot, wsSOM, resoveNodeRS, dwFlag); + pProtoRoot, wsSOM.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { pProtoNode = resoveNodeRS.nodes[0]->AsNode(); } } else if (!wsID.IsEmpty()) { - pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID); + pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsWideStringC()); } if (pProtoNode) { CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild); @@ -1701,7 +1705,8 @@ void CXFA_Node::Script_Som_DefaultValue(FXJSE_HVALUE hValue, pContainerWidgetData = GetContainerWidgetData(); } if (pContainerWidgetData) { - pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); + pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(), + wsFormatValue); } SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); } else { @@ -1712,7 +1717,7 @@ void CXFA_Node::Script_Som_DefaultValue(FXJSE_HVALUE hValue, } else if (classID == XFA_ELEMENT_Integer) { FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { - CFX_Decimal decimal(content); + CFX_Decimal decimal(content.AsWideStringC()); FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); } else { FXJSE_Value_SetUTF8String( @@ -1748,7 +1753,8 @@ void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, CFX_WideString wsFormatValue(wsNewValue); CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); if (pContainerWidgetData) { - pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); + pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(), + wsFormatValue); } SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); } else { @@ -1891,7 +1897,7 @@ void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue, wsThickness = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); for (int32_t i = 0; i < iSize; ++i) { CXFA_Edge edge = border.GetEdge(i); - CXFA_Measurement thickness(wsThickness); + CXFA_Measurement thickness(wsThickness.AsWideStringC()); edge.SetMSThickness(thickness); } } else { @@ -2008,7 +2014,8 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); CFX_WideString wsFormatText(wsNewText); if (pContainerWidgetData) { - pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); + pContainerWidgetData->GetFormatDataValue(wsNewText.AsWideStringC(), + wsFormatText); } SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE); } else { @@ -2027,7 +2034,7 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); } else { - CFX_Decimal decimal(content); + CFX_Decimal decimal(content.AsWideStringC()); FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); } } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { @@ -2035,7 +2042,7 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE); } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { - CFX_Decimal decimal(content); + CFX_Decimal decimal(content.AsWideStringC()); FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); } else { FXJSE_Value_SetUTF8String( @@ -2183,7 +2190,8 @@ void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { if (argc == 1) { CFX_ByteString eventString = pArguments->GetUTF8String(0); int32_t iRet = execSingleEventByName( - CFX_WideString::FromUTF8(eventString, eventString.GetLength()), + CFX_WideString::FromUTF8(eventString, eventString.GetLength()) + .AsWideStringC(), XFA_ELEMENT_Field); if (eventString == "validate") { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), @@ -2263,7 +2271,7 @@ void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { CFX_WideString wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); CFX_WideString wsBoundValue; - pWidgetData->GetItemValue(wsValue, wsBoundValue); + pWidgetData->GetItemValue(wsValue.AsWideStringC(), wsBoundValue); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, @@ -2407,7 +2415,8 @@ void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(FXJSE_HVALUE hValue, CFX_ByteString bsValue; FXJSE_Value_ToUTF8String(hValue, bsValue); pWidgetData->SetSelectedMemberByValue( - CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()), TRUE, TRUE); + CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()).AsWideStringC(), + TRUE, TRUE); } else { CFX_WideString wsValue = GetScriptContent(TRUE); XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); @@ -2426,7 +2435,8 @@ void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { if (argc == 1) { CFX_ByteString eventString = pArguments->GetUTF8String(0); execSingleEventByName( - CFX_WideString::FromUTF8(eventString, eventString.GetLength()), + CFX_WideString::FromUTF8(eventString, eventString.GetLength()) + .AsWideStringC(), XFA_ELEMENT_ExclGroup); } else { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); @@ -2446,7 +2456,8 @@ void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { CFX_ByteString szName; szName = pArguments->GetUTF8String(0); pReturnNode = pWidgetData->SetSelectedMember( - CFX_WideString::FromUTF8(szName, szName.GetLength())); + CFX_WideString::FromUTF8(szName, szName.GetLength()) + .AsWideStringC()); } if (pReturnNode) { FXJSE_Value_Set( @@ -2622,7 +2633,8 @@ void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { if (argc == 1) { CFX_ByteString eventString = pArguments->GetUTF8String(0); execSingleEventByName( - CFX_WideString::FromUTF8(eventString, eventString.GetLength()), + CFX_WideString::FromUTF8(eventString, eventString.GetLength()) + .AsWideStringC(), XFA_ELEMENT_Subform); } else { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); @@ -2738,7 +2750,8 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength()); } } - const XFA_ELEMENTINFO* pElement = XFA_GetElementByName(strTagName); + const XFA_ELEMENTINFO* pElement = + XFA_GetElementByName(strTagName.AsWideStringC()); CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName); if (!pNewNode) { FXJSE_Value_SetNull(pArguments->GetReturnValue()); @@ -2746,7 +2759,8 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { if (!strName.IsEmpty()) { if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, XFA_XDPPACKET_UNKNOWN)) { - pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName, TRUE); + pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsWideStringC(), + TRUE); if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) { pNewNode->CreateXMLMappingNode(); } @@ -3504,7 +3518,8 @@ void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue, CFX_ByteString bsChecksum; FXJSE_Value_ToUTF8String(hValue, bsChecksum); SetAttribute(XFA_ATTRIBUTE_Checksum, - CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength())); + CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength()) + .AsWideStringC()); } else { CFX_WideString wsChecksum; GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); @@ -3964,7 +3979,7 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, CFX_WideString* pClone = new CFX_WideString(wsValue); SetUserData(pKey, pClone, &deleteWideStringCallBack); } else { - SetMapModuleString(pKey, wsValue); + SetMapModuleString(pKey, wsValue.AsWideStringC()); if (eAttr == XFA_ATTRIBUTE_Name) UpdateNameHash(); } @@ -4321,7 +4336,8 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); if (wsContentType == FX_WSTRC(L"text/html")) { wsContentType = FX_WSTRC(L""); - SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType); + SetAttribute(XFA_ATTRIBUTE_ContentType, + wsContentType.AsWideStringC()); } } CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); @@ -5233,7 +5249,7 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { CFX_WideString wsFormatValue(wsValue); CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData(); if (pWidgetData) { - pWidgetData->GetFormatDataValue(wsValue, wsFormatValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), wsFormatValue); } pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE); } @@ -5332,8 +5348,8 @@ void CXFA_NodeList::Script_TreelistClass_NamedItem( int32_t argc = pArguments->GetLength(); if (argc == 1) { CFX_ByteString szName = pArguments->GetUTF8String(0); - CXFA_Node* pNode = - NamedItem(CFX_WideString::FromUTF8(szName, szName.GetLength())); + CXFA_Node* pNode = NamedItem( + CFX_WideString::FromUTF8(szName, szName.GetLength()).AsWideStringC()); if (!pNode) { return; } diff --git a/xfa/fxfa/parser/xfa_objectacc_imp.cpp b/xfa/fxfa/parser/xfa_objectacc_imp.cpp index 94657c6e50..22f8fc2b34 100644 --- a/xfa/fxfa/parser/xfa_objectacc_imp.cpp +++ b/xfa/fxfa/parser/xfa_objectacc_imp.cpp @@ -477,7 +477,7 @@ FX_BOOL CXFA_Image::SetHref(const CFX_WideString& wsHref) { if (m_bDefValue) { return m_pNode->SetCData(XFA_ATTRIBUTE_Href, wsHref); } - return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref); + return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref.AsWideStringC()); } FX_BOOL CXFA_Image::SetTransferEncoding(int32_t iTransferEncoding) { if (m_bDefValue) { @@ -510,7 +510,8 @@ int32_t CXFA_Validate::GetFormatTest() { FX_BOOL CXFA_Validate::SetTestValue(int32_t iType, CFX_WideString& wsValue, XFA_ATTRIBUTEENUM eName) { - const XFA_ATTRIBUTEENUMINFO* pInfo = XFA_GetAttributeEnumByName(wsValue); + const XFA_ATTRIBUTEENUMINFO* pInfo = + XFA_GetAttributeEnumByName(wsValue.AsWideStringC()); if (pInfo) { eName = pInfo->eName; } @@ -1590,7 +1591,7 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, if (iSel < 0) { CFX_WideString wsSaveText = wsSaveTextArray[nIndex]; CFX_WideString wsFormatText(wsSaveText); - GetFormatDataValue(wsSaveText, wsFormatText); + GetFormatDataValue(wsSaveText.AsWideStringC(), wsFormatText); m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify, bSyncData); } @@ -1619,7 +1620,7 @@ void CXFA_WidgetData::SetSelectdItems(CFX_Int32Array& iSelArray, } CFX_WideString wsFormat(wsValue); if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect) { - GetFormatDataValue(wsValue, wsFormat); + GetFormatDataValue(wsValue.AsWideStringC(), wsFormat); } m_pNode->SetContent(wsValue, wsFormat, bNotify, bScriptModify, bSyncData); } @@ -1656,19 +1657,19 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, if (iCount < 1) { CXFA_Node* pItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items); m_pNode->InsertChild(-1, pItems); - InsertListTextItem(pItems, wsLabel, nIndex); + InsertListTextItem(pItems, wsLabel.AsWideStringC(), nIndex); CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items); m_pNode->InsertChild(-1, pSaveItems); pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, TRUE); - InsertListTextItem(pSaveItems, wsNewValue, nIndex); + InsertListTextItem(pSaveItems, wsNewValue.AsWideStringC(), nIndex); } else if (iCount > 1) { for (int32_t i = 0; i < 2; i++) { CXFA_Node* pNode = listitems[i]; FX_BOOL bHasSave = pNode->GetBoolean(XFA_ATTRIBUTE_Save); if (bHasSave) { - InsertListTextItem(pNode, wsNewValue, nIndex); + InsertListTextItem(pNode, wsNewValue.AsWideStringC(), nIndex); } else { - InsertListTextItem(pNode, wsLabel, nIndex); + InsertListTextItem(pNode, wsLabel.AsWideStringC(), nIndex); } } } else { @@ -1685,12 +1686,12 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, while (pListNode) { CFX_WideString wsOldValue; pListNode->TryContent(wsOldValue); - InsertListTextItem(pSaveItems, wsOldValue, i); + InsertListTextItem(pSaveItems, wsOldValue.AsWideStringC(), i); i++; pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling); } - InsertListTextItem(pNode, wsLabel, nIndex); - InsertListTextItem(pSaveItems, wsNewValue, nIndex); + InsertListTextItem(pNode, wsLabel.AsWideStringC(), nIndex); + InsertListTextItem(pSaveItems, wsNewValue.AsWideStringC(), nIndex); } if (!bNotify) { return; @@ -2101,7 +2102,7 @@ CFX_WideString XFA_NumericLimit(const CFX_WideString& wsValue, iTread_++; if (iTread_ > iTread) { if (iTread != -1) { - CFX_Decimal wsDeci = CFX_Decimal(wsValue); + CFX_Decimal wsDeci = CFX_Decimal(wsValue.AsWideStringC()); wsDeci.SetScale(iTread); wsRet = wsDeci; } @@ -2276,8 +2277,8 @@ IFX_Locale* CXFA_WidgetData::GetLocal() { if (wsLocaleName == FX_WSTRC(L"ambient")) { pLocale = m_pNode->GetDocument()->GetLocalMgr()->GetDefLocale(); } else { - pLocale = - m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName(wsLocaleName); + pLocale = m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName( + wsLocaleName.AsWideStringC()); } } return pLocale; @@ -2332,7 +2333,7 @@ FX_BOOL CXFA_WidgetData::GetValue(CFX_WideString& wsValue, wsValue = m_pNode->GetContent(); if (eValueType == XFA_VALUEPICTURE_Display) - GetItemLabel(wsValue, wsValue); + GetItemLabel(wsValue.AsWideStringC(), wsValue); CFX_WideString wsPicture; GetPictureContent(wsPicture, eValueType); @@ -2575,7 +2576,8 @@ void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue, CFX_WideString wsFormatValue(wsValue); CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData(); if (pContainerWidgetData) { - pContainerWidgetData->GetFormatDataValue(wsValue, wsFormatValue); + pContainerWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatValue); } m_pNode->SetContent(wsValue, wsFormatValue, bNotify); } diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index f4a479d7c3..4c831d5b8f 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -225,8 +225,8 @@ static inline void XFA_FDEExtension_GetElementTagNamespaceURI( CFX_WideString& wsNamespaceURI) { CFX_WideString wsNodeStr; pElement->GetNamespacePrefix(wsNodeStr); - if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNodeStr, - wsNamespaceURI)) { + if (!XFA_FDEExtension_ResolveNamespaceQualifier( + pElement, wsNodeStr.AsWideStringC(), wsNamespaceURI)) { wsNamespaceURI.Empty(); } } @@ -283,8 +283,8 @@ static FX_BOOL XFA_FDEExtension_ResolveAttribute( wsNSPrefix == FX_WSTRC(L"xmlns") || wsNSPrefix == FX_WSTRC(L"xml")) { return FALSE; } - if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNSPrefix, - wsNamespaceURI)) { + if (!XFA_FDEExtension_ResolveNamespaceQualifier( + pElement, wsNSPrefix.AsWideStringC(), wsNamespaceURI)) { wsNamespaceURI.Empty(); return FALSE; } @@ -318,8 +318,8 @@ static FX_BOOL XFA_FDEExtension_FindAttributeWithNS( } wsNSPrefix = wsAttrName.Left(iFind); } - if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNSPrefix, - wsAttrNS)) { + if (!XFA_FDEExtension_ResolveNamespaceQualifier( + pElement, wsNSPrefix.AsWideStringC(), wsAttrNS)) { continue; } if (bMatchNSAsPrefix) { @@ -433,7 +433,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( reinterpret_cast(pChildItem); CFX_WideString wsPacketName; pElement->GetLocalTagName(wsPacketName); - const XFA_PACKETINFO* pPacketInfo = XFA_GetPacketByName(wsPacketName); + const XFA_PACKETINFO* pPacketInfo = + XFA_GetPacketByName(wsPacketName.AsWideStringC()); if (pPacketInfo && pPacketInfo->pURI) { if (!XFA_FDEExtension_MatchNodeName(pElement, pPacketInfo->pName, pPacketInfo->pURI, @@ -585,7 +586,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( } pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Form)->pName); - pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum); + pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsWideStringC()); CXFA_Node* pTemplateRoot = m_pRootNode->GetFirstChildByClass(XFA_ELEMENT_Template); CXFA_Node* pTemplateChosen = @@ -821,7 +822,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, CFDE_XMLElement* pXMLElement = static_cast(pXMLChild); CFX_WideString wsTagName; pXMLElement->GetLocalTagName(wsTagName); - const XFA_ELEMENTINFO* pElemInfo = XFA_GetElementByName(wsTagName); + const XFA_ELEMENTINFO* pElemInfo = + XFA_GetElementByName(wsTagName.AsWideStringC()); if (!pElemInfo) { continue; } @@ -841,7 +843,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, return NULL; } if (ePacketID == XFA_XDPPACKET_Config) { - pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName); + pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, + wsTagName.AsWideStringC()); } FX_BOOL IsNeedValue = TRUE; for (int32_t i = 0, count = pXMLElement->CountAttributes(); i < count; @@ -850,14 +853,14 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, CFX_WideString wsAttrName; CFX_WideString wsAttrValue; pXMLElement->GetAttribute(i, wsAttrQualifiedName, wsAttrValue); - XFA_FDEExtension_GetAttributeLocalName(wsAttrQualifiedName, - wsAttrName); + XFA_FDEExtension_GetAttributeLocalName( + wsAttrQualifiedName.AsWideStringC(), wsAttrName); if (wsAttrName == FX_WSTRC(L"nil") && wsAttrValue == FX_WSTRC(L"true")) { IsNeedValue = FALSE; } const XFA_ATTRIBUTEINFO* lpAttrInfo = - XFA_GetAttributeByName(wsAttrName); + XFA_GetAttributeByName(wsAttrName.AsWideStringC()); if (!lpAttrInfo) { continue; } @@ -865,7 +868,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, lpAttrInfo->eName != XFA_ATTRIBUTE_Save) { continue; } - pXFAChild->SetAttribute(lpAttrInfo->eName, wsAttrValue); + pXFAChild->SetAttribute(lpAttrInfo->eName, + wsAttrValue.AsWideStringC()); } pXFANode->InsertChild(pXFAChild); if (pElemInfo->eName == XFA_ELEMENT_Validate || @@ -1108,8 +1112,8 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, CFX_WideString wsAttrNamespaceURI; pXMLElement->GetAttribute(i, wsAttrQualifiedName, wsAttrValue); if (!XFA_FDEExtension_ResolveAttribute( - pXMLElement, wsAttrQualifiedName, wsAttrName, - wsAttrNamespaceURI)) { + pXMLElement, wsAttrQualifiedName.AsWideStringC(), + wsAttrName, wsAttrNamespaceURI)) { continue; } if (wsAttrName == FX_WSTRC(L"nil") && diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index b7e3bb380c..08e9cede92 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -164,7 +164,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Title( CFX_ByteString bsValue; FXJSE_Value_ToUTF8String(hValue, bsValue); pNotify->GetDocProvider()->SetTitle( - hDoc, CFX_WideString::FromUTF8(bsValue, bsValue.GetLength())); + hDoc, + CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()).AsWideStringC()); return; } CFX_WideString wsTitle; @@ -292,7 +293,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( CFX_ByteString bsURL = pArguments->GetUTF8String(0); wsURL = CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()); } - pNotify->GetDocProvider()->GotoURL(hDoc, wsURL); + pNotify->GetDocProvider()->GotoURL(hDoc, wsURL.AsWideStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( CFXJSE_Arguments* pArguments) { @@ -331,8 +332,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression, - resoveNodeRS, dwFlag); + int32_t iRet = pScriptContext->ResolveObjects( + pObject, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { FXJSE_Value_Release(hValue); return; @@ -385,8 +386,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; } CFX_WideString wsAnswer; - pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion, wsTitle, - wsDefaultAnswer, bMark); + pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion.AsWideStringC(), + wsTitle.AsWideStringC(), + wsDefaultAnswer.AsWideStringC(), bMark); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer).AsByteStringC()); @@ -454,7 +456,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( CXFA_Node* pNode = NULL; int32_t iExpLength = wsExpression.GetLength(); while (iStart < iExpLength) { - iStart = XFA_FilterName(wsExpression, iStart, wsName); + iStart = XFA_FilterName(wsExpression.AsWideStringC(), iStart, wsName); CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; @@ -466,8 +468,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = - pScriptContext->ResolveObjects(pObject, wsName, resoveNodeRS, dwFlag); + int32_t iRet = pScriptContext->ResolveObjects( + pObject, wsName.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { continue; } @@ -535,8 +537,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression, - resoveNodeRS, dwFlag); + int32_t iRet = pScriptContext->ResolveObjects( + pObject, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { FXJSE_Value_Release(hValue); return; @@ -601,7 +603,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( } } int32_t iValue = pNotify->GetAppProvider()->MsgBox( - wsMessage, bsTitle, dwMessageType, dwButtonType); + wsMessage.AsWideStringC(), bsTitle.AsWideStringC(), dwMessageType, + dwButtonType); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, iValue); @@ -733,7 +736,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength()); } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); + pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath.AsWideStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( CFXJSE_Arguments* pArguments) { @@ -756,7 +759,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( if (iLength >= 2) { bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; } - pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); + pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath.AsWideStringC(), bXDP); } void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( CFXJSE_Arguments* pArguments) { diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index b85e9b783f..fe6caa84bc 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -124,8 +124,8 @@ void CXFA_ScriptContext::GlobalPropertySetter(FXJSE_HOBJECT hObject, if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { pRefNode = ToNode(lpCurNode); } - if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, - TRUE)) { + if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsWideStringC(), + hValue, dwFlag, TRUE)) { return; } if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { @@ -198,13 +198,13 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject, if (pOrginalObject->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { pRefNode = ToNode(lpCurNode); } - if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, - FALSE)) { + if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsWideStringC(), + hValue, dwFlag, FALSE)) { return; } dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; - if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, - FALSE)) { + if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsWideStringC(), + hValue, dwFlag, FALSE)) { return; } CXFA_Object* pScriptObject = @@ -243,8 +243,8 @@ void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject, } uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes; - FX_BOOL bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName, - hValue, dwFlag, FALSE); + FX_BOOL bRet = lpScriptContext->QueryNodeByFlag( + ToNode(pObject), wsPropName.AsWideStringC(), hValue, dwFlag, FALSE); if (bRet) { return; } @@ -252,8 +252,8 @@ void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject, (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript && !lpScriptContext->IsStrictScopeInJavaScript())) { dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; - bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName, hValue, - dwFlag, FALSE); + bRet = lpScriptContext->QueryNodeByFlag( + ToNode(pObject), wsPropName.AsWideStringC(), hValue, dwFlag, FALSE); } if (bRet) { return; @@ -281,8 +281,8 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); CFX_WideString wsPropName = CFX_WideString::FromUTF8( (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); - const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = - XFA_GetScriptAttributeByName(pObject->GetClassID(), wsPropName); + const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName( + pObject->GetClassID(), wsPropName.AsWideStringC()); if (lpAttributeInfo) { (pObject->*(lpAttributeInfo->lpfnCallback))( hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); @@ -293,17 +293,18 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, } CXFA_Node* pNode = ToNode(pObject); CXFA_Node* pPropOrChild = NULL; - const XFA_ELEMENTINFO* lpElementInfo = XFA_GetElementByName(wsPropName); + const XFA_ELEMENTINFO* lpElementInfo = + XFA_GetElementByName(wsPropName.AsWideStringC()); if (lpElementInfo) { pPropOrChild = pNode->GetProperty(0, lpElementInfo->eName); } else { - pPropOrChild = pNode->GetFirstChildByName(wsPropName); + pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsWideStringC()); } if (pPropOrChild) { CFX_WideString wsDefaultName = FX_WSTRC(L"{default}"); const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), - wsDefaultName); + wsDefaultName.AsWideStringC()); if (lpAttributeInfo) { (pPropOrChild->*(lpAttributeInfo->lpfnCallback))( hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); @@ -333,10 +334,11 @@ int32_t CXFA_ScriptContext::NormalPropTypeGetter( XFA_ELEMENT objElement = pObject->GetClassID(); CFX_WideString wsPropName = CFX_WideString::FromUTF8( (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); - if (XFA_GetMethodByName(objElement, wsPropName)) { + if (XFA_GetMethodByName(objElement, wsPropName.AsWideStringC())) { return FXJSE_ClassPropType_Method; } - if (bQueryIn && !XFA_GetScriptAttributeByName(objElement, wsPropName)) { + if (bQueryIn && + !XFA_GetScriptAttributeByName(objElement, wsPropName.AsWideStringC())) { return FXJSE_ClassPropType_None; } return FXJSE_ClassPropType_Property; @@ -355,7 +357,7 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter( XFA_ELEMENT objElement = pObject->GetClassID(); CFX_WideString wsPropName = CFX_WideString::FromUTF8( (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); - if (XFA_GetMethodByName(objElement, wsPropName)) { + if (XFA_GetMethodByName(objElement, wsPropName.AsWideStringC())) { return FXJSE_ClassPropType_Method; } return FXJSE_ClassPropType_Property; @@ -373,7 +375,7 @@ void CXFA_ScriptContext::NormalMethodCall(FXJSE_HOBJECT hThis, CFX_WideString wsFunName = CFX_WideString::FromUTF8( (const FX_CHAR*)szFuncName.raw_str(), szFuncName.GetLength()); const XFA_METHODINFO* lpMethodInfo = - XFA_GetMethodByName(pObject->GetClassID(), wsFunName); + XFA_GetMethodByName(pObject->GetClassID(), wsFunName.AsWideStringC()); if (NULL == lpMethodInfo) { return; } diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index 922b0d6bb6..1b70dffb19 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -117,7 +117,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( measure.Set(rtRect.top, XFA_UNIT_Pt); break; } - XFA_UNIT unit = measure.GetUnit(wsUnit); + XFA_UNIT unit = measure.GetUnit(wsUnit.AsWideStringC()); FX_FLOAT fValue = measure.ToUnit(unit); fValue = FXSYS_round(fValue * 1000) / 1000.0f; if (hValue) { diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index d7a1e29d9d..9e8ff5191c 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -368,7 +368,8 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( XFA_CreateNode_ForCondition(wsCondition); } if (bIsClassName) { - const XFA_ELEMENTINFO* lpElement = XFA_GetElementByName(wsName); + const XFA_ELEMENTINFO* lpElement = + XFA_GetElementByName(wsName.AsWideStringC()); if (lpElement == NULL) { return FALSE; } @@ -391,7 +392,7 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) { CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eClassType); if (pNewNode) { - pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName); + pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName.AsWideStringC()); pNewNode->CreateXMLMappingNode(); m_pCreateParent->InsertChild(pNewNode); if (iIndex == m_iCreateCount - 1) { diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index a71270a332..8ad8b13176 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -35,7 +35,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { } if (!rnd.m_CurNode->IsNode()) { if (rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) { - return XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd, rnd.m_wsName); + return XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd, + rnd.m_wsName.AsWideStringC()); } return 0; } @@ -70,7 +71,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { rnd.m_Nodes.Add(rnd.m_CurNode); } else if ((rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) && XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd, - rnd.m_wsName)) { + rnd.m_wsName.AsWideStringC())) { return 1; } if (rnd.m_Nodes.GetSize() > 0) { @@ -168,7 +169,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_NumberSign( CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); CFX_WideString wsCondition = rnd.m_wsCondition; CXFA_Node* curNode = ToNode(rnd.m_CurNode); - if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName)) { + if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName.AsWideStringC())) { return 1; } CXFA_ResolveNodesData rndFind; @@ -331,7 +332,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( } } if (dwStyles & XFA_RESOLVENODE_Attributes) { - if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName)) { + if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName.AsWideStringC())) { return 1; } } @@ -365,7 +366,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( pProp = pInstanceManager->GetProperty(0, XFA_ELEMENT_Occur, TRUE); } } else { - const XFA_ELEMENTINFO* pElement = XFA_GetElementByName(wsName); + const XFA_ELEMENTINFO* pElement = + XFA_GetElementByName(wsName.AsWideStringC()); if (pElement) { pProp = curNode->AsNode()->GetProperty( 0, pElement->eName, pElement->eName != XFA_ELEMENT_PageSet); @@ -711,7 +713,8 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter( CXFA_Object* node = findNodes[i]; FX_BOOL bRet = FALSE; FXJSE_HVALUE pRetValue = FXJSE_Value_Create(rnd.m_pSC->GetRuntime()); - bRet = pContext->RunScript(eLangType, wsExpression, pRetValue, node); + bRet = pContext->RunScript(eLangType, wsExpression.AsWideStringC(), + pRetValue, node); if (!bRet || !FXJSE_Value_ToBoolean(pRetValue)) { findNodes.RemoveAt(i); } diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp index 2919664b52..f460cf764b 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp @@ -75,8 +75,9 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2); wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent, bsXMLIdent.GetLength()); } - FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList, wsExpression, - wsXMLIdent); + FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList, + wsExpression.AsWideStringC(), + wsXMLIdent.AsWideStringC()); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetBoolean(hValue, bSign); diff --git a/xfa/include/fxfa/xfa_ffwidget.h b/xfa/include/fxfa/xfa_ffwidget.h index 70ac91931a..f82bf2faf7 100644 --- a/xfa/include/fxfa/xfa_ffwidget.h +++ b/xfa/include/fxfa/xfa_ffwidget.h @@ -164,7 +164,7 @@ CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead, FXCODEC_IMAGE_TYPE type, int32_t& iImageXDpi, int32_t& iImageYDpi); -FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideStringC& wsType); +FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType); FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len); void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, -- cgit v1.2.3