diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-05 11:02:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-05 11:02:18 -0700 |
commit | 179bebb9a14dfd3ba91e9e068d4d436657a7c780 (patch) | |
tree | 895a59bfcf85a4730badfb2a6df71cf8679a2249 | |
parent | 4cd49e1c6076bd9ef2d18480d893038822668262 (diff) | |
download | pdfium-179bebb9a14dfd3ba91e9e068d4d436657a7c780.tar.xz |
Rename GetCStr and GetPtr to match CFX_ByteString.
This CL updates CFX_ByteStringC to use the more common c_str
and raw_str instead of GetCStr and GetPtr.
Review URL: https://codereview.chromium.org/1857713003
50 files changed, 220 insertions, 223 deletions
diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp index aff2b72960..9670aa8e7f 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp @@ -131,7 +131,7 @@ uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { // Static. uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { - const FX_CHAR* buf = str.GetCStr(); + const FX_CHAR* buf = str.c_str(); int len = str.GetLength(); if (len == 0) return 0; @@ -171,7 +171,7 @@ static CFX_WideString StringDataAdd(CFX_WideString str) { // Static. CFX_WideString CPDF_ToUnicodeMap::StringToWideString( const CFX_ByteStringC& str) { - const FX_CHAR* buf = str.GetCStr(); + const FX_CHAR* buf = str.c_str(); int len = str.GetLength(); if (len == 0) return CFX_WideString(); diff --git a/core/fpdfapi/fpdf_page/cpdf_generalstatedata.cpp b/core/fpdfapi/fpdf_page/cpdf_generalstatedata.cpp index 2e4b5e4dff..37ec63fb8b 100644 --- a/core/fpdfapi/fpdf_page/cpdf_generalstatedata.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_generalstatedata.cpp @@ -89,7 +89,7 @@ void CPDF_GeneralStateData::SetBlendMode(const CFX_ByteStringC& blend_mode) { if (blend_mode.GetLength() > 15) { return; } - FXSYS_memcpy(m_BlendMode, blend_mode.GetPtr(), blend_mode.GetLength()); + FXSYS_memcpy(m_BlendMode, blend_mode.raw_str(), blend_mode.GetLength()); m_BlendMode[blend_mode.GetLength()] = 0; m_BlendType = GetBlendTypeInternal(blend_mode); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp index 6c1738d5a6..17fd891d1b 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp @@ -34,7 +34,7 @@ void TestArrayAccessors(const CPDF_Array* arr, CPDF_Dictionary* dict_val, CPDF_Stream* stream_val) { EXPECT_STREQ(str_val, arr->GetStringAt(index).c_str()); - EXPECT_STREQ(const_str_val, arr->GetConstStringAt(index).GetCStr()); + EXPECT_STREQ(const_str_val, arr->GetConstStringAt(index).c_str()); EXPECT_EQ(int_val, arr->GetIntegerAt(index)); EXPECT_EQ(float_val, arr->GetNumberAt(index)); EXPECT_EQ(float_val, arr->GetFloatAt(index)); @@ -207,10 +207,10 @@ TEST_F(PDFObjectsTest, GetConstString) { for (size_t i = 0; i < m_DirectObjs.size(); ++i) { if (!direct_obj_results[i]) { EXPECT_EQ(direct_obj_results[i], - m_DirectObjs[i]->GetConstString().GetCStr()); + m_DirectObjs[i]->GetConstString().c_str()); } else { EXPECT_STREQ(direct_obj_results[i], - m_DirectObjs[i]->GetConstString().GetCStr()); + m_DirectObjs[i]->GetConstString().c_str()); } } // Check indirect references. @@ -218,10 +218,10 @@ TEST_F(PDFObjectsTest, GetConstString) { nullptr, nullptr, nullptr}; for (size_t i = 0; i < m_RefObjs.size(); ++i) { if (!indirect_obj_results[i]) { - EXPECT_EQ(nullptr, m_RefObjs[i]->GetConstString().GetCStr()); + EXPECT_EQ(nullptr, m_RefObjs[i]->GetConstString().c_str()); } else { EXPECT_STREQ(indirect_obj_results[i], - m_RefObjs[i]->GetConstString().GetCStr()); + m_RefObjs[i]->GetConstString().c_str()); } } } @@ -677,7 +677,7 @@ TEST(PDFArrayTest, GetTypeAt) { 0, 0, 0, 0, 0, 0, 0}; for (size_t i = 0; i < arr->GetCount(); ++i) { EXPECT_STREQ(expected_str[i], arr->GetStringAt(i).c_str()); - EXPECT_STREQ(expected_cstr[i], arr->GetConstStringAt(i).GetCStr()); + EXPECT_STREQ(expected_cstr[i], arr->GetConstStringAt(i).c_str()); EXPECT_EQ(expected_int[i], arr->GetIntegerAt(i)); EXPECT_EQ(expected_float[i], arr->GetNumberAt(i)); EXPECT_EQ(expected_float[i], arr->GetFloatAt(i)); diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp index e32021e25d..394004dfc4 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp @@ -12,7 +12,7 @@ CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize) : m_pData(pData), m_dwSize(dwSize), m_dwCurPos(0) {} CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str) - : m_pData(str.GetPtr()), m_dwSize(str.GetLength()), m_dwCurPos(0) {} + : m_pData(str.raw_str()), m_dwSize(str.GetLength()), m_dwCurPos(0) {} void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) { pStart = nullptr; diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp index 67287dfd5a..db3ccf5e3d 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp @@ -54,7 +54,7 @@ TEST(SimpleParserTest, GetWord) { CFX_ByteStringC word = parser.GetWord(); EXPECT_EQ(std::string(reinterpret_cast<const char*>(data.expected), data.expected_size), - std::string(word.GetCStr(), word.GetLength())) + std::string(word.c_str(), word.GetLength())) << " for case " << i; } } diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp index d04a682b77..3deecf54ff 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp @@ -662,7 +662,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, // Earlier version of PDF specification doesn't require EOL marker before // 'endstream' keyword. If keyword 'endstream' follows the bytes in // specified length, it signals the end of stream. - if (FXSYS_memcmp(m_WordBuffer, kEndStreamStr.GetPtr(), + if (FXSYS_memcmp(m_WordBuffer, kEndStreamStr.raw_str(), kEndStreamStr.GetLength()) == 0) { bSearchForKeyword = FALSE; } @@ -774,8 +774,8 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, int numMarkers = ReadEOLMarkers(m_Pos); if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) && numMarkers != 0 && - FXSYS_memcmp(m_WordBuffer, kEndObjStr.GetPtr(), kEndObjStr.GetLength()) == - 0) { + FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(), + kEndObjStr.GetLength()) == 0) { m_Pos = streamStartPos; } return pStream; @@ -849,7 +849,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag, if (!bForward) offset = taglen - 1; - const uint8_t* tag_data = tag.GetPtr(); + const uint8_t* tag_data = tag.raw_str(); uint8_t byte; while (1) { if (bForward) { @@ -921,7 +921,7 @@ int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags, if (tags[i] == 0) { uint32_t len = i - start; max_len = std::max(len, max_len); - patterns[itag].m_pTag = tags.GetCStr() + start; + patterns[itag].m_pTag = tags.c_str() + start; patterns[itag].m_Len = len; patterns[itag].m_Offset = 0; start = i + 1; diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index 8228c497e9..31e7388bd7 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -88,7 +88,7 @@ int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteStringC& key) { CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) { int size = bstr.GetLength(); - const FX_CHAR* pSrc = bstr.GetCStr(); + const FX_CHAR* pSrc = bstr.c_str(); if (!FXSYS_memchr(pSrc, '#', size)) { return bstr; } diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index 0c7f895405..ad21db815c 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -288,23 +288,23 @@ CFX_WideString CPDF_FileSpec::DecodeFileName(const CFX_WideStringC& filepath) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (filepath.Left(sizeof("/Mac") - 1) == CFX_WideStringC(L"/Mac")) - return ChangeSlashToPlatform(filepath.GetPtr() + 1); - return ChangeSlashToPlatform(filepath.GetPtr()); + return ChangeSlashToPlatform(filepath.raw_str() + 1); + return ChangeSlashToPlatform(filepath.raw_str()); #elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ if (filepath.GetAt(0) != '/') - return ChangeSlashToPlatform(filepath.GetPtr()); + return ChangeSlashToPlatform(filepath.raw_str()); if (filepath.GetAt(1) == '/') - return ChangeSlashToPlatform(filepath.GetPtr() + 1); + return ChangeSlashToPlatform(filepath.raw_str() + 1); if (filepath.GetAt(2) == '/') { CFX_WideString result; result += filepath.GetAt(1); result += ':'; - result += ChangeSlashToPlatform(filepath.GetPtr() + 2); + result += ChangeSlashToPlatform(filepath.raw_str() + 2); return result; } CFX_WideString result; result += '\\'; - result += ChangeSlashToPlatform(filepath.GetPtr()); + result += ChangeSlashToPlatform(filepath.raw_str()); return result; #else return filepath; @@ -356,27 +356,27 @@ CFX_WideString CPDF_FileSpec::EncodeFileName(const CFX_WideStringC& filepath) { if (filepath.GetAt(2) != '\\') { result += '/'; } - result += ChangeSlashToPDF(filepath.GetPtr() + 2); + result += ChangeSlashToPDF(filepath.raw_str() + 2); return result; } if (filepath.GetAt(0) == '\\' && filepath.GetAt(1) == '\\') { - return ChangeSlashToPDF(filepath.GetPtr() + 1); + return ChangeSlashToPDF(filepath.raw_str() + 1); } if (filepath.GetAt(0) == '\\') { CFX_WideString result; result = '/'; - result += ChangeSlashToPDF(filepath.GetPtr()); + result += ChangeSlashToPDF(filepath.raw_str()); return result; } - return ChangeSlashToPDF(filepath.GetPtr()); + return ChangeSlashToPDF(filepath.raw_str()); #elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (filepath.Left(sizeof("Mac") - 1) == FX_WSTRC(L"Mac")) { CFX_WideString result; result = '/'; - result += ChangeSlashToPDF(filepath.GetPtr()); + result += ChangeSlashToPDF(filepath.raw_str()); return result; } - return ChangeSlashToPDF(filepath.GetPtr()); + return ChangeSlashToPDF(filepath.raw_str()); #else return filepath; #endif @@ -513,5 +513,5 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const { return -1; } int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { - return GetPageByLabel(PDF_EncodeText(wsLabel.GetPtr()).AsByteStringC()); + return GetPageByLabel(PDF_EncodeText(wsLabel.raw_str()).AsByteStringC()); } diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index d7bfac690e..aa63edfdc1 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -137,8 +137,7 @@ CFX_ByteString::CFX_ByteString(char ch) { CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& stringSrc) { if (!stringSrc.IsEmpty()) { - m_pData.Reset( - StringData::Create(stringSrc.GetCStr(), stringSrc.GetLength())); + m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength())); } } @@ -149,8 +148,8 @@ CFX_ByteString::CFX_ByteString(const CFX_ByteStringC& str1, return; m_pData.Reset(StringData::Create(nNewLen)); - m_pData->CopyContents(str1.GetCStr(), str1.GetLength()); - m_pData->CopyContentsAt(str1.GetLength(), str2.GetCStr(), str2.GetLength()); + m_pData->CopyContents(str1.c_str(), str1.GetLength()); + m_pData->CopyContentsAt(str1.GetLength(), str2.c_str(), str2.GetLength()); } CFX_ByteString::~CFX_ByteString() {} @@ -168,7 +167,7 @@ const CFX_ByteString& CFX_ByteString::operator=(const CFX_ByteStringC& str) { if (str.IsEmpty()) clear(); else - AssignCopy(str.GetCStr(), str.GetLength()); + AssignCopy(str.c_str(), str.GetLength()); return *this; } @@ -216,7 +215,7 @@ const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteString& str) { const CFX_ByteString& CFX_ByteString::operator+=(const CFX_ByteStringC& str) { if (!str.IsEmpty()) - Concat(str.GetCStr(), str.GetLength()); + Concat(str.c_str(), str.GetLength()); return *this; } @@ -237,7 +236,7 @@ bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const { return str.IsEmpty(); return m_pData->m_nDataLength == str.GetLength() && - FXSYS_memcmp(m_pData->m_String, str.GetCStr(), str.GetLength()) == 0; + FXSYS_memcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0; } bool CFX_ByteString::operator==(const CFX_ByteString& other) const { @@ -261,7 +260,7 @@ bool CFX_ByteString::EqualNoCase(const CFX_ByteStringC& str) const { return false; const uint8_t* pThis = (const uint8_t*)m_pData->m_String; - const uint8_t* pThat = str.GetPtr(); + const uint8_t* pThat = str.raw_str(); for (FX_STRSIZE i = 0; i < len; i++) { if ((*pThis) != (*pThat)) { uint8_t bThis = *pThis; @@ -768,7 +767,7 @@ FX_STRSIZE CFX_ByteString::Find(const CFX_ByteStringC& pSub, const FX_CHAR* pStr = FX_strstr(m_pData->m_String + nStart, m_pData->m_nDataLength - nStart, - pSub.GetCStr(), pSub.GetLength()); + pSub.c_str(), pSub.GetLength()); return pStr ? (int)(pStr - m_pData->m_String) : -1; } @@ -821,7 +820,7 @@ FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld, FX_CHAR* pEnd = m_pData->m_String + m_pData->m_nDataLength; while (1) { const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), - pOld.GetCStr(), nSourceLen); + pOld.c_str(), nSourceLen); if (!pTarget) break; @@ -844,10 +843,10 @@ FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld, FX_CHAR* pDest = pNewData->m_String; for (FX_STRSIZE i = 0; i < nCount; i++) { const FX_CHAR* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart), - pOld.GetCStr(), nSourceLen); + pOld.c_str(), nSourceLen); FXSYS_memcpy(pDest, pStart, pTarget - pStart); pDest += pTarget - pStart; - FXSYS_memcpy(pDest, pNew.GetCStr(), pNew.GetLength()); + FXSYS_memcpy(pDest, pNew.c_str(), pNew.GetLength()); pDest += pNew.GetLength(); pStart = pTarget + nSourceLen; } diff --git a/core/fxcrt/fx_basic_bstring_unittest.cpp b/core/fxcrt/fx_basic_bstring_unittest.cpp index 1f9d515c38..73235ddf5f 100644 --- a/core/fxcrt/fx_basic_bstring_unittest.cpp +++ b/core/fxcrt/fx_basic_bstring_unittest.cpp @@ -251,7 +251,7 @@ TEST(fxcrt, ByteStringOperatorNE) { TEST(fxcrt, ByteStringCNull) { CFX_ByteStringC null_string; - EXPECT_EQ(null_string.GetPtr(), nullptr); + EXPECT_EQ(null_string.raw_str(), nullptr); EXPECT_EQ(null_string.GetLength(), 0); EXPECT_TRUE(null_string.IsEmpty()); @@ -259,27 +259,27 @@ TEST(fxcrt, ByteStringCNull) { EXPECT_EQ(null_string, another_null_string); CFX_ByteStringC copied_null_string(null_string); - EXPECT_EQ(copied_null_string.GetPtr(), nullptr); + EXPECT_EQ(copied_null_string.raw_str(), nullptr); EXPECT_EQ(copied_null_string.GetLength(), 0); EXPECT_TRUE(copied_null_string.IsEmpty()); EXPECT_EQ(null_string, copied_null_string); CFX_ByteStringC empty_string(""); // Pointer to NUL, not NULL pointer. - EXPECT_NE(empty_string.GetPtr(), nullptr); + EXPECT_NE(empty_string.raw_str(), nullptr); EXPECT_EQ(empty_string.GetLength(), 0); EXPECT_TRUE(empty_string.IsEmpty()); EXPECT_EQ(null_string, empty_string); CFX_ByteStringC assigned_null_string("initially not NULL"); assigned_null_string = null_string; - EXPECT_EQ(assigned_null_string.GetPtr(), nullptr); + EXPECT_EQ(assigned_null_string.raw_str(), nullptr); EXPECT_EQ(assigned_null_string.GetLength(), 0); EXPECT_TRUE(assigned_null_string.IsEmpty()); EXPECT_EQ(null_string, assigned_null_string); CFX_ByteStringC assigned_nullptr_string("initially not NULL"); assigned_nullptr_string = (const FX_CHAR*)nullptr; - EXPECT_EQ(assigned_nullptr_string.GetPtr(), nullptr); + EXPECT_EQ(assigned_nullptr_string.raw_str(), nullptr); EXPECT_EQ(assigned_nullptr_string.GetLength(), 0); EXPECT_TRUE(assigned_nullptr_string.IsEmpty()); EXPECT_EQ(null_string, assigned_nullptr_string); diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp index de7bff2401..9d0397efeb 100644 --- a/core/fxcrt/fx_basic_buffer.cpp +++ b/core/fxcrt/fx_basic_buffer.cpp @@ -105,7 +105,7 @@ CFX_ByteStringC CFX_ByteTextBuf::GetByteString() const { } CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(const CFX_ByteStringC& lpsz) { - AppendBlock(lpsz.GetPtr(), lpsz.GetLength()); + AppendBlock(lpsz.raw_str(), lpsz.GetLength()); return *this; } @@ -142,7 +142,7 @@ void CFX_WideTextBuf::AppendChar(FX_WCHAR ch) { } CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideStringC& str) { - AppendBlock(str.GetPtr(), str.GetLength() * sizeof(FX_WCHAR)); + AppendBlock(str.raw_str(), str.GetLength() * sizeof(FX_WCHAR)); return *this; } @@ -228,10 +228,10 @@ CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const CFX_ByteStringC& bstr) { int len = bstr.GetLength(); if (m_pStream) { m_pStream->WriteBlock(&len, sizeof(int)); - m_pStream->WriteBlock(bstr.GetPtr(), len); + m_pStream->WriteBlock(bstr.raw_str(), len); } else { m_SavingBuf.AppendBlock(&len, sizeof(int)); - m_SavingBuf.AppendBlock(bstr.GetPtr(), len); + m_SavingBuf.AppendBlock(bstr.raw_str(), len); } return *this; } @@ -419,7 +419,7 @@ int32_t CFX_FileBufferArchive::AppendDWord(uint32_t i) { } int32_t CFX_FileBufferArchive::AppendString(const CFX_ByteStringC& lpsz) { - return AppendBlock(lpsz.GetPtr(), lpsz.GetLength()); + return AppendBlock(lpsz.raw_str(), lpsz.GetLength()); } void CFX_FileBufferArchive::AttachFile(IFX_StreamWrite* pFile) { diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp index 3791862066..4374dec779 100644 --- a/core/fxcrt/fx_basic_util.cpp +++ b/core/fxcrt/fx_basic_util.cpp @@ -95,10 +95,10 @@ void CFX_PrivateData::ClearAll() { m_DataList.RemoveAll(); } void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData) { - if (!FXSYS_memchr(strc.GetPtr(), '.', strc.GetLength())) { + if (!FXSYS_memchr(strc.raw_str(), '.', strc.GetLength())) { bInteger = TRUE; int cc = 0, integer = 0; - const FX_CHAR* str = strc.GetCStr(); + const FX_CHAR* str = strc.c_str(); int len = strc.GetLength(); FX_BOOL bNegative = FALSE; if (str[0] == '+') { @@ -129,7 +129,7 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc) { } int cc = 0; FX_BOOL bNegative = FALSE; - const FX_CHAR* str = strc.GetCStr(); + const FX_CHAR* str = strc.c_str(); int len = strc.GetLength(); if (str[0] == '+') { cc++; diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp index 9c17948c34..8940c1a37f 100644 --- a/core/fxcrt/fx_basic_wstring.cpp +++ b/core/fxcrt/fx_basic_wstring.cpp @@ -103,7 +103,7 @@ CFX_WideString::CFX_WideString(const CFX_WideStringC& str) { } m_pData = StringData::Create(str.GetLength()); if (m_pData) { - FXSYS_memcpy(m_pData->m_String, str.GetPtr(), + FXSYS_memcpy(m_pData->m_String, str.raw_str(), str.GetLength() * sizeof(FX_WCHAR)); } } @@ -116,9 +116,9 @@ CFX_WideString::CFX_WideString(const CFX_WideStringC& str1, } m_pData = StringData::Create(nNewLen); if (m_pData) { - FXSYS_memcpy(m_pData->m_String, str1.GetPtr(), + FXSYS_memcpy(m_pData->m_String, str1.raw_str(), str1.GetLength() * sizeof(FX_WCHAR)); - FXSYS_memcpy(m_pData->m_String + str1.GetLength(), str2.GetPtr(), + FXSYS_memcpy(m_pData->m_String + str1.GetLength(), str2.raw_str(), str2.GetLength() * sizeof(FX_WCHAR)); } } @@ -151,7 +151,7 @@ const CFX_WideString& CFX_WideString::operator=( if (stringSrc.IsEmpty()) { Empty(); } else { - AssignCopy(stringSrc.GetLength(), stringSrc.GetPtr()); + AssignCopy(stringSrc.GetLength(), stringSrc.raw_str()); } return *this; } @@ -195,7 +195,7 @@ const CFX_WideString& CFX_WideString::operator+=(const CFX_WideStringC& str) { if (str.IsEmpty()) { return *this; } - ConcatInPlace(str.GetLength(), str.GetPtr()); + ConcatInPlace(str.GetLength(), str.raw_str()); return *this; } bool CFX_WideString::operator==(const wchar_t* ptr) const { @@ -213,7 +213,7 @@ bool CFX_WideString::operator==(const CFX_WideStringC& str) const { return str.IsEmpty(); return str.GetLength() == m_pData->m_nDataLength && - wmemcmp(str.GetPtr(), m_pData->m_String, m_pData->m_nDataLength) == 0; + wmemcmp(str.raw_str(), m_pData->m_String, m_pData->m_nDataLength) == 0; } bool CFX_WideString::operator==(const CFX_WideString& other) const { if (IsEmpty()) diff --git a/core/fxcrt/fx_xml_composer.cpp b/core/fxcrt/fx_xml_composer.cpp index 1af6952fdb..576ff95432 100644 --- a/core/fxcrt/fx_xml_composer.cpp +++ b/core/fxcrt/fx_xml_composer.cpp @@ -23,9 +23,9 @@ void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, if (iStart >= bsFullName.GetLength()) { bsName = bsFullName; } else { - bsSpace = CFX_ByteStringC(bsFullName.GetCStr(), iStart); + bsSpace = CFX_ByteStringC(bsFullName.c_str(), iStart); iStart++; - bsName = CFX_ByteStringC(bsFullName.GetCStr() + iStart, + bsName = CFX_ByteStringC(bsFullName.c_str() + iStart, bsFullName.GetLength() - iStart); } } diff --git a/core/fxcrt/fxcrt_platforms.cpp b/core/fxcrt/fxcrt_platforms.cpp index 16e1a0976d..8f134c751d 100644 --- a/core/fxcrt/fxcrt_platforms.cpp +++ b/core/fxcrt/fxcrt_platforms.cpp @@ -44,7 +44,7 @@ FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, } CFX_ByteString strMode; FXCRT_GetFileModeString(dwMode, strMode); - m_hFile = FXSYS_fopen(fileName.GetCStr(), strMode.c_str()); + m_hFile = FXSYS_fopen(fileName.c_str(), strMode.c_str()); return m_hFile != NULL; } FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_WideStringC& fileName, @@ -54,7 +54,7 @@ FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_WideStringC& fileName, } CFX_WideString strMode; FXCRT_GetFileModeString(dwMode, strMode); - m_hFile = FXSYS_wfopen(fileName.GetPtr(), strMode.c_str()); + m_hFile = FXSYS_wfopen(fileName.raw_str(), strMode.c_str()); return m_hFile != NULL; } void CFXCRT_FileAccess_CRT::Close() { diff --git a/core/fxcrt/fxcrt_posix.cpp b/core/fxcrt/fxcrt_posix.cpp index 0226313934..a18bb69c55 100644 --- a/core/fxcrt/fxcrt_posix.cpp +++ b/core/fxcrt/fxcrt_posix.cpp @@ -40,7 +40,7 @@ FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, } int32_t nFlags, nMasks; FXCRT_Posix_GetFileMode(dwMode, nFlags, nMasks); - m_nFD = open(fileName.GetCStr(), nFlags, nMasks); + m_nFD = open(fileName.c_str(), nFlags, nMasks); return m_nFD > -1; } FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName, diff --git a/core/fxcrt/fxcrt_windows.cpp b/core/fxcrt/fxcrt_windows.cpp index 340d22585f..8c7c0d8176 100644 --- a/core/fxcrt/fxcrt_windows.cpp +++ b/core/fxcrt/fxcrt_windows.cpp @@ -47,8 +47,8 @@ FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, } uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); - m_hFile = ::CreateFileA(fileName.GetCStr(), dwAccess, dwShare, NULL, - dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); + m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, NULL, dwCreation, + FILE_ATTRIBUTE_NORMAL, NULL); if (m_hFile == INVALID_HANDLE_VALUE) { m_hFile = NULL; } @@ -61,7 +61,7 @@ FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, } uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); - m_hFile = ::CreateFileW((LPCWSTR)fileName.GetPtr(), dwAccess, dwShare, NULL, + m_hFile = ::CreateFileW((LPCWSTR)fileName.raw_str(), dwAccess, dwShare, NULL, dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); if (m_hFile == INVALID_HANDLE_VALUE) { m_hFile = NULL; diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index cbf8c4de2f..d48b26c30f 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -90,8 +90,10 @@ class CFX_ByteStringC { uint32_t GetID(FX_STRSIZE start_pos = 0) const; - const uint8_t* GetPtr() const { return m_Ptr; } - const FX_CHAR* GetCStr() const { return (const FX_CHAR*)m_Ptr; } + const uint8_t* raw_str() const { return m_Ptr; } + const FX_CHAR* c_str() const { + return reinterpret_cast<const FX_CHAR*>(m_Ptr); + } FX_STRSIZE GetLength() const { return m_Length; } bool IsEmpty() const { return m_Length == 0; } @@ -178,7 +180,7 @@ class CFX_ByteString { : nullptr; } - // Implicit conversiont to uint8_t* -- deprecated. + // Implicit conversion to uint8_t* -- deprecated. operator const uint8_t*() const { return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String) : nullptr; @@ -454,7 +456,7 @@ class CFX_WideStringC { bool operator!=(const wchar_t* ptr) const { return !(*this == ptr); } bool operator!=(const CFX_WideStringC& str) const { return !(*this == str); } - const FX_WCHAR* GetPtr() const { return m_Ptr; } + const FX_WCHAR* raw_str() const { return m_Ptr; } FX_STRSIZE GetLength() const { return m_Length; } bool IsEmpty() const { return m_Length == 0; } @@ -752,7 +754,7 @@ inline bool operator!=(const CFX_WideStringC& lhs, const CFX_WideString& rhs) { CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len); inline CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr) { - return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()); + return FX_UTF8Encode(wsStr.raw_str(), wsStr.GetLength()); } inline CFX_ByteString FX_UTF8Encode(const CFX_WideString& wsStr) { return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength()); @@ -760,7 +762,7 @@ inline CFX_ByteString FX_UTF8Encode(const CFX_WideString& wsStr) { FX_FLOAT FX_atof(const CFX_ByteStringC& str); inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) { - return FX_atof(FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()).c_str()); + return FX_atof(FX_UTF8Encode(wsStr.raw_str(), wsStr.GetLength()).c_str()); } void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData); FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); diff --git a/core/fxge/android/fpf_skiafontmgr.cpp b/core/fxge/android/fpf_skiafontmgr.cpp index c9748da859..7d0d2de9e2 100644 --- a/core/fxge/android/fpf_skiafontmgr.cpp +++ b/core/fxge/android/fpf_skiafontmgr.cpp @@ -176,7 +176,7 @@ static uint32_t FPF_SkiaGetCharset(uint8_t uCharset) { static uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) { uint32_t dwHash = 0; int32_t iLength = bsfamily.GetLength(); - const FX_CHAR* pBuffer = bsfamily.GetCStr(); + const FX_CHAR* pBuffer = bsfamily.c_str(); for (int32_t i = 0; i < iLength; i++) { FX_CHAR ch = pBuffer[i]; if (ch == ' ' || ch == '-' || ch == ',') { @@ -372,7 +372,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile, } FXFT_Open_Args args; args.flags = FT_OPEN_PATHNAME; - args.pathname = (FT_String*)bsFile.GetCStr(); + args.pathname = static_cast<FT_String*>(bsFile.c_str()); FXFT_Face face; if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) { return FALSE; @@ -401,7 +401,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer, return face; } void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteStringC& path) { - void* handle = FX_OpenFolder(path.GetCStr()); + void* handle = FX_OpenFolder(path.c_str()); if (!handle) { return; } @@ -434,7 +434,7 @@ void CFPF_SkiaFontMgr::ScanFile(const CFX_ByteStringC& file) { FXFT_Face face = GetFontFace(file); if (face) { CFPF_SkiaPathFont* pFontDesc = new CFPF_SkiaPathFont; - pFontDesc->SetPath(file.GetCStr()); + pFontDesc->SetPath(file.c_str()); ReportFace(face, pFontDesc); m_FontFaces.push_back(pFontDesc); FXFT_Done_Face(face); diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp index 4e1b95ea64..46a3d53b30 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp @@ -169,7 +169,7 @@ int32_t CPDFXFA_App::MsgBox(const CFX_WideStringC& wsMessage, iButtonType |= 3; break; } - int32_t iRet = pEnv->JS_appAlert(wsMessage.GetPtr(), wsTitle.GetPtr(), + int32_t iRet = pEnv->JS_appAlert(wsMessage.raw_str(), wsTitle.raw_str(), iButtonType, iconType); switch (iRet) { case 1: @@ -193,9 +193,9 @@ void CPDFXFA_App::Response(CFX_WideString& wsAnswer, if (pEnv) { int nLength = 2048; char* pBuff = new char[nLength]; - nLength = pEnv->JS_appResponse(wsQuestion.GetPtr(), wsTitle.GetPtr(), - wsDefaultAnswer.GetPtr(), NULL, bMark, pBuff, - nLength); + nLength = pEnv->JS_appResponse(wsQuestion.raw_str(), wsTitle.raw_str(), + wsDefaultAnswer.raw_str(), NULL, bMark, + pBuff, nLength); if (nLength > 0) { nLength = nLength > 2046 ? 2046 : nLength; pBuff[nLength] = 0; @@ -228,7 +228,7 @@ int32_t CPDFXFA_App::GetDocumentCountInBatch() { IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideStringC& wsURL) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { - return pEnv->FFI_DownloadFromURL(wsURL.GetPtr()); + return pEnv->FFI_DownloadFromURL(wsURL.raw_str()); } return NULL; } @@ -241,9 +241,9 @@ FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideStringC& wsURL, CFX_WideString& wsResponse) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { - wsResponse = pEnv->FFI_PostRequestURL(wsURL.GetPtr(), wsData.GetPtr(), - wsContentType.GetPtr(), - wsEncode.GetPtr(), wsHeader.GetPtr()); + wsResponse = pEnv->FFI_PostRequestURL( + wsURL.raw_str(), wsData.raw_str(), wsContentType.raw_str(), + wsEncode.raw_str(), wsHeader.raw_str()); return TRUE; } return FALSE; @@ -254,8 +254,8 @@ FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideStringC& wsURL, const CFX_WideStringC& wsEncode) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { - return pEnv->FFI_PutRequestURL(wsURL.GetPtr(), wsData.GetPtr(), - wsEncode.GetPtr()); + return pEnv->FFI_PutRequestURL(wsURL.raw_str(), wsData.raw_str(), + wsEncode.raw_str()); } return FALSE; } diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index 79147b172e..fbc05bd9aa 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -738,7 +738,7 @@ void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc, if (pEnv == NULL) return; - CFX_WideStringC str(bsURL.GetPtr()); + CFX_WideStringC str(bsURL.raw_str()); pEnv->FFI_GotoURL(this, str, bAppend); } diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index 9c616e6c0e..8e01017467 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -263,7 +263,7 @@ CFX_WideString ChangeObjName(const CFX_WideString& str) { FX_BOOL CJS_Runtime::GetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue) { #ifdef PDF_ENABLE_XFA - const FX_CHAR* name = utf8Name.GetCStr(); + const FX_CHAR* name = utf8Name.c_str(); v8::Locker lock(GetIsolate()); v8::Isolate::Scope isolate_scope(GetIsolate()); @@ -300,7 +300,7 @@ FX_BOOL CJS_Runtime::SetHValueByName(const CFX_ByteStringC& utf8Name, #ifdef PDF_ENABLE_XFA if (utf8Name.IsEmpty() || hValue == NULL) return FALSE; - const FX_CHAR* name = utf8Name.GetCStr(); + const FX_CHAR* name = utf8Name.c_str(); v8::Isolate* pIsolate = GetIsolate(); v8::Locker lock(pIsolate); v8::Isolate::Scope isolate_scope(pIsolate); diff --git a/xfa/fde/css/fde_csscache.cpp b/xfa/fde/css/fde_csscache.cpp index 49934aee6d..d8fc1a1b19 100644 --- a/xfa/fde/css/fde_csscache.cpp +++ b/xfa/fde/css/fde_csscache.cpp @@ -108,21 +108,22 @@ FDE_CSSTagCache::FDE_CSSTagCache(FDE_CSSTagCache* parent, FXSYS_assert(pTag != NULL); CFX_WideStringC wsValue, wsName = pTag->GetTagName(); dwTagHash = - FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength(), TRUE); + FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength(), TRUE); FX_POSITION pos = pTag->GetFirstAttribute(); while (pos != NULL) { pTag->GetNextAttribute(pos, wsName, wsValue); uint32_t dwNameHash = - FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength(), TRUE); + FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength(), TRUE); static const uint32_t s_dwIDHash = FX_HashCode_String_GetW(L"id", 2, TRUE); static const uint32_t s_dwClassHash = FX_HashCode_String_GetW(L"class", 5, TRUE); if (dwNameHash == s_dwClassHash) { uint32_t dwHash = - FX_HashCode_String_GetW(wsValue.GetPtr(), wsValue.GetLength()); + FX_HashCode_String_GetW(wsValue.raw_str(), wsValue.GetLength()); dwClassHashs.Add(dwHash); } else if (dwNameHash == s_dwIDHash) { - dwIDHash = FX_HashCode_String_GetW(wsValue.GetPtr(), wsValue.GetLength()); + dwIDHash = + FX_HashCode_String_GetW(wsValue.raw_str(), wsValue.GetLength()); } } } diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index 39d0df04c7..1a27a7e5c9 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -437,7 +437,7 @@ void CFDE_CSSStyleSelector::ComputeStyle( do { pTag->GetNextAttribute(pos, wsAttri, wsValue); dwAttriHash = - FX_HashCode_String_GetW(wsAttri.GetPtr(), wsAttri.GetLength(), TRUE); + FX_HashCode_String_GetW(wsAttri.raw_str(), wsAttri.GetLength(), TRUE); static const uint32_t s_dwStyleHash = FX_HashCode_String_GetW(L"style", 5, TRUE); static const uint32_t s_dwAlignHash = @@ -446,7 +446,7 @@ void CFDE_CSSStyleSelector::ComputeStyle( if (pDecl == NULL) { pDecl = FXTARGET_NewWith(m_pInlineStyleStore) CFDE_CSSDeclaration; } - AppendInlineStyle(pDecl, wsValue.GetPtr(), wsValue.GetLength()); + AppendInlineStyle(pDecl, wsValue.raw_str(), wsValue.GetLength()); } else if (dwAttriHash == s_dwAlignHash) { if (pDecl == NULL) { pDecl = FXTARGET_NewWith(m_pInlineStyleStore) CFDE_CSSDeclaration; @@ -455,7 +455,7 @@ void CFDE_CSSStyleSelector::ComputeStyle( args.pStringCache = NULL; args.pStaticStore = m_pInlineStyleStore; args.pProperty = FDE_GetCSSPropertyByEnum(FDE_CSSPROPERTY_TextAlign); - pDecl->AddProperty(&args, wsValue.GetPtr(), wsValue.GetLength()); + pDecl->AddProperty(&args, wsValue.raw_str(), wsValue.GetLength()); } } while (pos != NULL); if (pDecl != NULL) { diff --git a/xfa/fee/fde_txtedtengine.cpp b/xfa/fee/fde_txtedtengine.cpp index 19b5b24311..5cdb55cfaf 100644 --- a/xfa/fee/fde_txtedtengine.cpp +++ b/xfa/fee/fde_txtedtengine.cpp @@ -1624,7 +1624,7 @@ void CFDE_TxtEdtEngine::DeleteSelect() { } IFDE_TxtEdtDoRecord* IFDE_TxtEdtDoRecord::Create( const CFX_ByteStringC& bsDoRecord) { - const FX_CHAR* lpBuf = bsDoRecord.GetCStr(); + const FX_CHAR* lpBuf = bsDoRecord.c_str(); int32_t nType = *((int32_t*)lpBuf); switch (nType) { case FDE_TXTEDT_DORECORD_INS: @@ -1690,8 +1690,9 @@ void CFDE_TxtEdtDoRecord_Insert::Serialize(CFX_ByteString& bsDoRecord) const { } void CFDE_TxtEdtDoRecord_Insert::Deserialize( const CFX_ByteStringC& bsDoRecord) { - CFX_ArchiveLoader ArchiveLoader((const uint8_t*)bsDoRecord.GetCStr(), - bsDoRecord.GetLength()); + CFX_ArchiveLoader ArchiveLoader( + reinterpret_cast<const uint8_t*>(bsDoRecord.c_str()), + bsDoRecord.GetLength()); int32_t nType = 0; ArchiveLoader >> nType; FXSYS_assert(nType == FDE_TXTEDT_DORECORD_INS); @@ -1766,8 +1767,9 @@ void CFDE_TxtEdtDoRecord_DeleteRange::Serialize( } void CFDE_TxtEdtDoRecord_DeleteRange::Deserialize( const CFX_ByteStringC& bsDoRecord) { - CFX_ArchiveLoader ArchiveLoader((const uint8_t*)bsDoRecord.GetCStr(), - bsDoRecord.GetLength()); + CFX_ArchiveLoader ArchiveLoader( + reinterpret_cast<const uint8_t*>(bsDoRecord.c_str()), + bsDoRecord.GetLength()); int32_t nType = 0; ArchiveLoader >> nType; FXSYS_assert(nType == FDE_TXTEDT_DORECORD_DEL); diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp index 94468e23da..02fa2109d1 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/fgas_stream.cpp @@ -1112,7 +1112,7 @@ int32_t CFX_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { encoder.Input(*pStr++); } CFX_ByteStringC bsResult = encoder.GetResult(); - m_pStreamImp->WriteData((const uint8_t*)bsResult.GetCStr(), + m_pStreamImp->WriteData((const uint8_t*)bsResult.c_str(), bsResult.GetLength()); } return iLength; diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index 8cf80ce4f1..d6243effee 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -68,8 +68,8 @@ static FX_STRSIZE FX_Local_Find(const CFX_WideStringC& wsSymbols, return -1; } const FX_WCHAR* lpsz = - (const FX_WCHAR*)FXSYS_wcschr(wsSymbols.GetPtr() + nStart, ch); - return (lpsz == NULL) ? -1 : (FX_STRSIZE)(lpsz - wsSymbols.GetPtr()); + (const FX_WCHAR*)FXSYS_wcschr(wsSymbols.raw_str() + nStart, ch); + return (lpsz == NULL) ? -1 : (FX_STRSIZE)(lpsz - wsSymbols.raw_str()); } static const FX_WCHAR* const gs_LocalNumberSymbols[] = { L"decimal", L"grouping", L"percent", L"minus", @@ -3855,7 +3855,7 @@ FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime, uint8_t second = 0; uint16_t millisecond = 0; int cc_start = 0, cc = cc_start; - const FX_WCHAR* str = (const FX_WCHAR*)wsTime.GetPtr(); + const FX_WCHAR* str = (const FX_WCHAR*)wsTime.raw_str(); int len = wsTime.GetLength(); while (cc < len && cc < 2) { if (!FX_IsDigit(str[cc])) { @@ -4699,7 +4699,7 @@ CFX_Decimal::CFX_Decimal(FX_FLOAT val, uint8_t scale) { m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(val < 0 && IsNotZero(), scale); } CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) { - const FX_WCHAR* str = strObj.GetPtr(); + const FX_WCHAR* str = strObj.raw_str(); const FX_WCHAR* strBound = str + strObj.GetLength(); FX_BOOL pointmet = 0; FX_BOOL negmet = 0; diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 7aaaf40454..eec5337052 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -736,7 +736,7 @@ FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, m_pFontMgr = IFX_FontMgr::Create(m_pFontSource); #endif } - m_pFont = IFX_Font::LoadFont(wsFontFamily.GetPtr(), dwFontStyles, dwCodePage, + m_pFont = IFX_Font::LoadFont(wsFontFamily.raw_str(), dwFontStyles, dwCodePage, m_pFontMgr); return m_pFont != NULL; } diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index c76ec505e9..318541f05a 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -183,6 +183,6 @@ void CXFA_ChecksumContext::GetChecksum(CFX_ByteString& bsChecksum) { } void CXFA_ChecksumContext::Update(const CFX_ByteStringC& bsText) { if (m_pByteContext) { - CRYPT_SHA1Update(m_pByteContext, bsText.GetPtr(), bsText.GetLength()); + CRYPT_SHA1Update(m_pByteContext, bsText.raw_str(), bsText.GetLength()); } } diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index b7178f0baa..e5ace150ab 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -98,7 +98,7 @@ XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName( if (iLength == 0) { return NULL; } - uint32_t uHash = FX_HashCode_String_GetW(wsName.GetPtr(), iLength, TRUE); + uint32_t uHash = FX_HashCode_String_GetW(wsName.raw_str(), iLength, TRUE); int32_t iStart = 0, iEnd = g_iXFABarcodeTypeCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index ce27428b40..58cf1a269a 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -327,7 +327,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, return nullptr; uint32_t dwHash = - FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength(), FALSE); + FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength(), FALSE); FX_IMAGEDIB_AND_DPI* imageDIBDpi = nullptr; if (m_mapNamedImages.Lookup((void*)(uintptr_t)dwHash, (void*&)imageDIBDpi)) { iImageXDpi = imageDIBDpi->iImageXDpi; @@ -348,7 +348,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, return nullptr; CPDF_NameTree nametree(pXFAImages); - CFX_ByteString bsName = PDF_EncodeText(wsName.GetPtr(), wsName.GetLength()); + CFX_ByteString bsName = PDF_EncodeText(wsName.raw_str(), wsName.GetLength()); CPDF_Object* pObject = nametree.LookupValue(bsName); if (!pObject) { int32_t iCount = nametree.GetCount(); @@ -386,7 +386,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, CFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) { uint32_t packetHash = - FX_HashCode_String_GetW(wsPackage.GetPtr(), wsPackage.GetLength()); + FX_HashCode_String_GetW(wsPackage.raw_str(), wsPackage.GetLength()); CXFA_Node* pNode = ToNode(m_pDocument->GetXFAObject(packetHash)); if (!pNode) { return NULL; @@ -401,7 +401,7 @@ FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, CXFA_ChecksumContext* pCSContext) { CXFA_DataExporter* pExport = new CXFA_DataExporter(m_pDocument); uint32_t packetHash = - FX_HashCode_String_GetW(wsPackage.GetPtr(), wsPackage.GetLength()); + FX_HashCode_String_GetW(wsPackage.raw_str(), wsPackage.GetLength()); CXFA_Node* pNode = NULL; if (packetHash == XFA_HASHCODE_Xfa) { pNode = m_pDocument->GetRoot(); diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index b9cfd6fb28..1b87f95353 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1699,7 +1699,7 @@ void XFA_LocalFontNameToEnglishName(const CFX_WideStringC& wsLocalName, _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ uint32_t dwLocalNameHash = FX_HashCode_String_GetW( - wsLocalName.GetPtr(), wsLocalName.GetLength(), TRUE); + wsLocalName.raw_str(), wsLocalName.GetLength(), TRUE); int32_t iStart = 0; int32_t iEnd = sizeof(g_XFAFontsMap) / sizeof(XFA_FONTINFO) - 1; int32_t iMid = 0; @@ -1890,7 +1890,7 @@ IFX_Font* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, CPDF_Font** pPDFFont, FX_BOOL bStrictMatch) { uint32_t dwHashCode = - FX_HashCode_String_GetW(wsFontFamily.GetPtr(), wsFontFamily.GetLength()); + FX_HashCode_String_GetW(wsFontFamily.raw_str(), wsFontFamily.GetLength()); CFX_ByteString strKey; strKey.Format("%u%u", dwHashCode, dwFontStyles); auto it = m_FontMap.find(strKey); @@ -2016,7 +2016,7 @@ IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, const CFX_WideStringC& wsFontFamily, uint32_t dwFontStyles, uint16_t wCodePage) { - uint32_t dwHash = FX_HashCode_String_GetW(wsFontFamily.GetPtr(), + uint32_t dwHash = FX_HashCode_String_GetW(wsFontFamily.raw_str(), wsFontFamily.GetLength(), FALSE); CFX_ByteString bsKey; bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage); diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 07a353e287..4cbdfd4f8e 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -308,7 +308,7 @@ void CXFA_TextParser::ParseTagInfo(CFDE_XMLNode* pXMLNode, tagProvider.m_bTagAviliable = lookup.Lookup(dwHashCode, s_XFATagName, s_iCount) > -1; CFX_WideString wsValue; - pXMLElement->GetString(FX_WSTRC(L"style").GetPtr(), wsValue); + pXMLElement->GetString(FX_WSTRC(L"style").raw_str(), wsValue); if (!wsValue.IsEmpty()) { tagProvider.SetAttribute(FX_WSTRC(L"style"), wsValue); } @@ -527,7 +527,7 @@ FX_BOOL CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, if (pXMLNode->GetType() == FDE_XMLNODE_Element) { CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode); CFX_WideString wsAttr; - pElement->GetString(FX_WSTRC(L"xfa:embed").GetPtr(), wsAttr); + pElement->GetString(FX_WSTRC(L"xfa:embed").raw_str(), wsAttr); if (wsAttr.IsEmpty()) { return FALSE; } @@ -535,7 +535,7 @@ FX_BOOL CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, wsAttr.Delete(0); } CFX_WideString ws; - pElement->GetString(FX_WSTRC(L"xfa:embedType").GetPtr(), ws); + pElement->GetString(FX_WSTRC(L"xfa:embedType").raw_str(), ws); if (ws.IsEmpty()) { ws = L"som"; } else { @@ -546,7 +546,7 @@ FX_BOOL CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, return FALSE; } ws.Empty(); - pElement->GetString(FX_WSTRC(L"xfa:embedMode").GetPtr(), ws); + pElement->GetString(FX_WSTRC(L"xfa:embedMode").raw_str(), ws); if (ws.IsEmpty()) { ws = L"formatted"; } else { @@ -1425,7 +1425,7 @@ FX_BOOL CXFA_TextLayout::LoadRichText(CFDE_XMLNode* pXMLNode, if (wsName == FX_WSTRC(L"a")) { CFX_WideString wsLinkContent; FXSYS_assert(pElement); - pElement->GetString(FX_WSTRC(L"href").GetPtr(), wsLinkContent); + pElement->GetString(FX_WSTRC(L"href").raw_str(), wsLinkContent); if (!wsLinkContent.IsEmpty()) { pLinkData = FXTARGET_NewWith(m_pAllocator) CXFA_LinkUserData( m_pAllocator, diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 97eadbd3d5..c016e2033a 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -2039,7 +2039,7 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoDate(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); } if (!pLocale) { return FALSE; @@ -2048,13 +2048,11 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoDate(FXJSE_HOBJECT hThis, if (szFormat.IsEmpty()) { pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); } else { - wsFormat = - CFX_WideString::FromUTF8(szFormat.GetCStr(), szFormat.GetLength()); + wsFormat = CFX_WideString::FromUTF8(szFormat.c_str(), szFormat.GetLength()); } CXFA_LocaleValue widgetValue( - XFA_VT_DATE, - CFX_WideString::FromUTF8(szDate.GetCStr(), szDate.GetLength()), wsFormat, - pLocale, (CXFA_LocaleMgr*)pMgr); + XFA_VT_DATE, CFX_WideString::FromUTF8(szDate.c_str(), szDate.GetLength()), + wsFormat, pLocale, (CXFA_LocaleMgr*)pMgr); CFX_Unitime dt = widgetValue.GetDate(); strIsoDate.Format("%4d-%02d-%02d", dt.GetYear(), dt.GetMonth(), dt.GetDay()); return TRUE; @@ -2079,7 +2077,7 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoTime(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); } if (!pLocale) { return FALSE; @@ -2088,15 +2086,13 @@ FX_BOOL CXFA_FM2JSContext::Local2IsoTime(FXJSE_HOBJECT hThis, if (szFormat.IsEmpty()) { pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); } else { - wsFormat = - CFX_WideString::FromUTF8(szFormat.GetCStr(), szFormat.GetLength()); + wsFormat = CFX_WideString::FromUTF8(szFormat.c_str(), szFormat.GetLength()); } wsFormat = FX_WSTRC(L"time{") + wsFormat; wsFormat += FX_WSTRC(L"}"); CXFA_LocaleValue widgetValue( - XFA_VT_TIME, - CFX_WideString::FromUTF8(szTime.GetCStr(), szTime.GetLength()), wsFormat, - pLocale, (CXFA_LocaleMgr*)pMgr); + XFA_VT_TIME, CFX_WideString::FromUTF8(szTime.c_str(), szTime.GetLength()), + wsFormat, pLocale, (CXFA_LocaleMgr*)pMgr); CFX_Unitime utime = widgetValue.GetTime(); strIsoTime.Format("%02d:%02d:%02d.%03d", utime.GetHour(), utime.GetMinute(), utime.GetSecond(), utime.GetMillisecond()); @@ -2122,7 +2118,7 @@ FX_BOOL CXFA_FM2JSContext::IsoDate2Local(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); } if (!pLocale) { return FALSE; @@ -2131,12 +2127,10 @@ FX_BOOL CXFA_FM2JSContext::IsoDate2Local(FXJSE_HOBJECT hThis, if (szFormat.IsEmpty()) { pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); } else { - wsFormat = - CFX_WideString::FromUTF8(szFormat.GetCStr(), szFormat.GetLength()); + wsFormat = CFX_WideString::FromUTF8(szFormat.c_str(), szFormat.GetLength()); } CXFA_LocaleValue widgetValue( - XFA_VT_DATE, - CFX_WideString::FromUTF8(szDate.GetCStr(), szDate.GetLength()), + XFA_VT_DATE, CFX_WideString::FromUTF8(szDate.c_str(), szDate.GetLength()), (CXFA_LocaleMgr*)pMgr); CFX_WideString wsRet; widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, @@ -2164,7 +2158,7 @@ FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); } if (!pLocale) { return FALSE; @@ -2173,14 +2167,12 @@ FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis, if (szFormat.IsEmpty()) { pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); } else { - wsFormat = - CFX_WideString::FromUTF8(szFormat.GetCStr(), szFormat.GetLength()); + wsFormat = CFX_WideString::FromUTF8(szFormat.c_str(), szFormat.GetLength()); } wsFormat = FX_WSTRC(L"time{") + wsFormat; wsFormat += FX_WSTRC(L"}"); CXFA_LocaleValue widgetValue( - XFA_VT_TIME, - CFX_WideString::FromUTF8(szTime.GetCStr(), szTime.GetLength()), + XFA_VT_TIME, CFX_WideString::FromUTF8(szTime.c_str(), szTime.GetLength()), (CXFA_LocaleMgr*)pMgr); CFX_WideString wsRet; widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, @@ -2208,7 +2200,7 @@ FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocale.GetCStr(), szLocale.GetLength())); + CFX_WideString::FromUTF8(szLocale.c_str(), szLocale.GetLength())); } if (!pLocale) { return FALSE; @@ -2217,14 +2209,12 @@ FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis, if (szFormat.IsEmpty()) { pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); } else { - wsFormat = - CFX_WideString::FromUTF8(szFormat.GetCStr(), szFormat.GetLength()); + wsFormat = CFX_WideString::FromUTF8(szFormat.c_str(), szFormat.GetLength()); } wsFormat = FX_WSTRC(L"time{") + wsFormat; wsFormat += FX_WSTRC(L"}"); CXFA_LocaleValue widgetValue( - XFA_VT_TIME, - CFX_WideString::FromUTF8(szTime.GetCStr(), szTime.GetLength()), + XFA_VT_TIME, CFX_WideString::FromUTF8(szTime.c_str(), szTime.GetLength()), (CXFA_LocaleMgr*)pMgr); CFX_WideString wsRet; widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, @@ -2247,10 +2237,10 @@ int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) { int32_t iZoneHour = 0; int32_t iZoneMinute = 0; if (iLength <= 10) { - iRet = IsIsoDateFormat(szDateString.GetCStr(), iLength, iStyle, iYear, - iMonth, iDay); + iRet = IsIsoDateFormat(szDateString.c_str(), iLength, iStyle, iYear, iMonth, + iDay); } else { - iRet = IsIsoDateTimeFormat(szDateString.GetCStr(), iLength, iYear, iMonth, + iRet = IsIsoDateTimeFormat(szDateString.c_str(), iLength, iYear, iMonth, iDay, iHour, iMinute, iSecond, iMillionSecond, iZoneHour, iZoneMinute); } @@ -2393,7 +2383,7 @@ void CXFA_FM2JSContext::GetLocalDateFormat(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocalStr.GetCStr(), szLocalStr.GetLength())); + CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength())); } if (!pLocale) { return; @@ -2448,7 +2438,7 @@ void CXFA_FM2JSContext::GetLocalTimeFormat(FXJSE_HOBJECT hThis, pLocale = widgetData.GetLocal(); } else { pLocale = pMgr->GetLocaleByName( - CFX_WideString::FromUTF8(szLocalStr.GetCStr(), szLocalStr.GetLength())); + CFX_WideString::FromUTF8(szLocalStr.c_str(), szLocalStr.GetLength())); } if (!pLocale) { return; @@ -3751,7 +3741,7 @@ void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis, void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, CFX_ByteTextBuf& szResultString) { CFX_WideString wsURLString = - CFX_WideString::FromUTF8(szURLString.GetCStr(), szURLString.GetLength()); + CFX_WideString::FromUTF8(szURLString.c_str(), szURLString.GetLength()); const FX_WCHAR* pData = wsURLString; int32_t iLen = wsURLString.GetLength(); int32_t i = 0; @@ -3806,8 +3796,8 @@ void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, } void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, CFX_ByteTextBuf& szResultString) { - CFX_WideString wsHTMLString = CFX_WideString::FromUTF8( - szHTMLString.GetCStr(), szHTMLString.GetLength()); + CFX_WideString wsHTMLString = + CFX_WideString::FromUTF8(szHTMLString.c_str(), szHTMLString.GetLength()); FX_WCHAR strString[9]; int32_t iStrIndex = 0; int32_t iLen = wsHTMLString.GetLength(); @@ -3882,7 +3872,7 @@ void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, CFX_ByteTextBuf& szResultString) { CFX_WideString wsXMLString = - CFX_WideString::FromUTF8(szXMLString.GetCStr(), szXMLString.GetLength()); + CFX_WideString::FromUTF8(szXMLString.c_str(), szXMLString.GetLength()); FX_WCHAR strString[9]; int32_t iStrIndex = 0; int32_t iLen = wsXMLString.GetLength(); @@ -4027,7 +4017,7 @@ void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis, void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, CFX_ByteTextBuf& szResultBuf) { CFX_WideString wsURLString = - CFX_WideString::FromUTF8(szURLString.GetCStr(), szURLString.GetLength()); + CFX_WideString::FromUTF8(szURLString.c_str(), szURLString.GetLength()); CFX_WideTextBuf wsResultBuf; FX_WCHAR ch = 0; int32_t iLength = wsURLString.GetLength(); @@ -4134,7 +4124,7 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, } void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, CFX_ByteTextBuf& szResultBuf) { - CFX_ByteString str = szHTMLString.GetCStr(); + CFX_ByteString str = szHTMLString.c_str(); CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(str, str.GetLength()); const FX_WCHAR* strCode = L"0123456789abcdef"; FX_WCHAR strEncode[9]; @@ -4189,7 +4179,7 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, CFX_ByteTextBuf& szResultBuf) { CFX_WideString wsXMLString = - CFX_WideString::FromUTF8(szXMLString.GetCStr(), szXMLString.GetLength()); + CFX_WideString::FromUTF8(szXMLString.c_str(), szXMLString.GetLength()); CFX_WideTextBuf wsResultBuf; enum { QUOT, @@ -4271,7 +4261,7 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, FX_BOOL CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData, uint32_t& iCode) { int32_t iLength = pData.GetLength(); - uint32_t uHash = FX_HashCode_String_GetW(pData.GetPtr(), iLength); + uint32_t uHash = FX_HashCode_String_GetW(pData.raw_str(), iLength); XFA_FMHtmlHashedReserveCode htmlhashedreservecode; int32_t iStart = 0, iEnd = (sizeof(reservesForDecode) / sizeof(reservesForDecode[0])) - 1; @@ -4313,7 +4303,7 @@ FX_BOOL CXFA_FM2JSContext::HTMLCode2STR(uint32_t iCode, static FX_BOOL XFA_PATTERN_STRING_Type(const CFX_ByteStringC& szPattern, uint32_t& patternType) { CFX_WideString wsPattern = - CFX_WideString::FromUTF8(szPattern.GetCStr(), szPattern.GetLength()); + CFX_WideString::FromUTF8(szPattern.c_str(), szPattern.GetLength()); if (FX_WSTRC(L"datetime") == wsPattern.Left(8)) { patternType = XFA_VT_DATETIME; return TRUE; @@ -5290,7 +5280,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, CFX_ByteStringC pComm[] = {" Hundred ", " Thousand ", " Million ", " Billion ", "Trillion"}; int32_t iComm = 0; - const FX_CHAR* pData = szData.GetCStr(); + const FX_CHAR* pData = szData.c_str(); int32_t iLength = szData.GetLength(); if (iLength > 12) { iComm = 4; @@ -5376,7 +5366,7 @@ void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, void CXFA_FM2JSContext::WordUS(const CFX_ByteStringC& szData, int32_t iStyle, CFX_ByteTextBuf& strBuf) { - const FX_CHAR* pData = szData.GetCStr(); + const FX_CHAR* pData = szData.c_str(); int32_t iLength = szData.GetLength(); switch (iStyle) { case 0: { @@ -6888,7 +6878,7 @@ FX_BOOL CXFA_FM2JSContext::GetObjectByName( XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; int32_t iRet = pScriptContext->ResolveObjects( pScriptContext->GetThisObject(), - CFX_WideString::FromUTF8(szAccessorName.GetCStr(), + CFX_WideString::FromUTF8(szAccessorName.c_str(), szAccessorName.GetLength()), resoveNodeRS, dwFlags); if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { @@ -6905,7 +6895,7 @@ int32_t CXFA_FM2JSContext::ResolveObjects(FXJSE_HOBJECT hThis, FX_BOOL bdotAccessor, FX_BOOL bHasNoResolveName) { CFX_WideString wsSomExpression = - CFX_WideString::FromUTF8(bsSomExp.GetCStr(), bsSomExp.GetLength()); + CFX_WideString::FromUTF8(bsSomExp.c_str(), bsSomExp.GetLength()); int32_t iRet = -1; CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); diff --git a/xfa/fxfa/fm2js/xfa_lexer.cpp b/xfa/fxfa/fm2js/xfa_lexer.cpp index 20b1320f70..b4c16eb8e4 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.cpp +++ b/xfa/fxfa/fm2js/xfa_lexer.cpp @@ -165,7 +165,9 @@ CXFA_FMToken::CXFA_FMToken(uint32_t uLineNum) CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc, CXFA_FMErrorInfo* pErrorInfo) - : m_ptr(wsFormCalc.GetPtr()), m_uCurrentLine(1), m_pErrorInfo(pErrorInfo) {} + : m_ptr(wsFormCalc.raw_str()), + m_uCurrentLine(1), + m_pErrorInfo(pErrorInfo) {} CXFA_FMToken* CXFA_FMLexer::NextToken() { m_pToken.reset(Scan()); @@ -517,7 +519,7 @@ void CXFA_FMLexer::Comment(const FX_WCHAR* p, const FX_WCHAR*& pEnd) { XFA_FM_TOKEN CXFA_FMLexer::IsKeyword(const CFX_WideStringC& str) { int32_t iLength = str.GetLength(); - uint32_t uHash = FX_HashCode_String_GetW(str.GetPtr(), iLength, TRUE); + uint32_t uHash = FX_HashCode_String_GetW(str.raw_str(), iLength, TRUE); int32_t iStart = KEYWORD_START, iEnd = KEYWORD_END; int32_t iMid = (iStart + iEnd) / 2; XFA_FMKeyword keyword; diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index 8ac80d7c08..d5936bc6c1 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -502,7 +502,7 @@ bool CXFA_FMCallExpression::IsBuildInFunc(CFX_WideTextBuf* funcName) { uint32_t CXFA_FMCallExpression::IsMethodWithObjParam( const CFX_WideStringC& methodName) { int32_t iLength = methodName.GetLength(); - uint32_t uHash = FX_HashCode_String_GetW(methodName.GetPtr(), iLength); + uint32_t uHash = FX_HashCode_String_GetW(methodName.raw_str(), iLength); XFA_FMSOMMethod somMethodWithObjPara; uint32_t parameters = 0x00; int32_t iStart = 0, diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp index a126cd6d1f..13c879a31e 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.cpp +++ b/xfa/fxfa/parser/xfa_basic_imp.cpp @@ -26,7 +26,7 @@ const XFA_PACKETINFO* XFA_GetPacketByName(const CFX_WideStringC& wsName) { if (iLength == 0) { return NULL; } - uint32_t uHash = FX_HashCode_String_GetW(wsName.GetPtr(), iLength); + uint32_t uHash = FX_HashCode_String_GetW(wsName.raw_str(), iLength); int32_t iStart = 0, iEnd = g_iXFAPacketCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; @@ -68,7 +68,7 @@ const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( if (iLength == 0) { return NULL; } - uint32_t uHash = FX_HashCode_String_GetW(wsName.GetPtr(), iLength); + uint32_t uHash = FX_HashCode_String_GetW(wsName.raw_str(), iLength); int32_t iStart = 0, iEnd = g_iXFAEnumCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; @@ -94,7 +94,7 @@ const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { if (iLength == 0) { return NULL; } - uint32_t uHash = FX_HashCode_String_GetW(wsName.GetPtr(), iLength); + uint32_t uHash = FX_HashCode_String_GetW(wsName.raw_str(), iLength); int32_t iStart = 0, iEnd = g_iXFAAttributeCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; @@ -195,7 +195,7 @@ const XFA_ELEMENTINFO* XFA_GetElementByName(const CFX_WideStringC& wsName) { if (iLength == 0) { return NULL; } - uint32_t uHash = FX_HashCode_String_GetW(wsName.GetPtr(), iLength); + uint32_t uHash = FX_HashCode_String_GetW(wsName.raw_str(), iLength); int32_t iStart = 0, iEnd = g_iXFAElementCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; @@ -380,7 +380,7 @@ const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement, iElementIndex = scriptIndex->wParentIndex; continue; } - uint32_t uHash = FX_HashCode_String_GetW(wsMethodName.GetPtr(), iLength); + uint32_t uHash = FX_HashCode_String_GetW(wsMethodName.raw_str(), iLength); int32_t iStart = scriptIndex->wMethodStart, iEnd = iStart + icount - 1; do { int32_t iMid = (iStart + iEnd) / 2; @@ -412,7 +412,8 @@ const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( iElementIndex = scriptIndex->wParentIndex; continue; } - uint32_t uHash = FX_HashCode_String_GetW(wsAttributeName.GetPtr(), iLength); + uint32_t uHash = + FX_HashCode_String_GetW(wsAttributeName.raw_str(), iLength); int32_t iStart = scriptIndex->wAttributeStart, iEnd = iStart + icount - 1; do { int32_t iMid = (iStart + iEnd) / 2; @@ -437,7 +438,7 @@ void CXFA_Measurement::Set(const CFX_WideStringC& wsMeasure) { } int32_t iUsedLen = 0; int32_t iOffset = (wsMeasure.GetAt(0) == L'=') ? 1 : 0; - FX_FLOAT fValue = FX_wcstof(wsMeasure.GetPtr() + iOffset, + FX_FLOAT fValue = FX_wcstof(wsMeasure.raw_str() + iOffset, wsMeasure.GetLength() - iOffset, &iUsedLen); XFA_UNIT eUnit = GetUnit(wsMeasure.Mid(iOffset + iUsedLen)); Set(fValue, eUnit); diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 5d371619e4..a5f021aacd 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -398,7 +398,7 @@ static CXFA_Node* XFA_DataMerge_FindGlobalDataNode(CXFA_Document* pDocument, CXFA_Node* pDataScope, XFA_ELEMENT eMatchNodeType) { uint32_t dwNameHash = - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), + wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength()); if (dwNameHash != 0) { CXFA_Node* pBounded = XFA_DataMerge_GetGlobalBinding(pDocument, dwNameHash); @@ -418,7 +418,7 @@ static CXFA_Node* XFA_DataMerge_FindOnceDataNode(CXFA_Document* pDocument, CXFA_Node* pDataScope, XFA_ELEMENT eMatchNodeType) { uint32_t dwNameHash = - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), + wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength()); if (dwNameHash != 0) { for (CXFA_Node *pCurDataScope = pDataScope, *pLastDataScope = NULL; diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index d56e57c99d..bb2001e803 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -96,7 +96,7 @@ CXFA_FFNotify* CXFA_Document::GetNotify() const { } CXFA_Object* CXFA_Document::GetXFAObject(const CFX_WideStringC& wsNodeName) { return GetXFAObject( - FX_HashCode_String_GetW(wsNodeName.GetPtr(), wsNodeName.GetLength())); + FX_HashCode_String_GetW(wsNodeName.raw_str(), wsNodeName.GetLength())); } CXFA_Object* CXFA_Document::GetXFAObject(uint32_t dwNodeNameHash) { switch (dwNodeNameHash) { @@ -367,7 +367,7 @@ void CXFA_Document::DoProtoMerge() { pNode = sIterator.MoveToNext()) { CFX_WideStringC wsIDVal; if (pNode->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && !wsIDVal.IsEmpty()) { - mIDMap[FX_HashCode_String_GetW(wsIDVal.GetPtr(), wsIDVal.GetLength())] = + mIDMap[FX_HashCode_String_GetW(wsIDVal.raw_str(), wsIDVal.GetLength())] = pNode; } CFX_WideStringC wsUseVal; @@ -429,7 +429,7 @@ void CXFA_Document::DoProtoMerge() { } } else if (!wsID.IsEmpty()) { if (!mIDMap.Lookup( - FX_HashCode_String_GetW(wsID.GetPtr(), wsID.GetLength()), + FX_HashCode_String_GetW(wsID.raw_str(), wsID.GetLength()), pProtoNode)) { continue; } diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index 448acbdd1d..2ae82e3c35 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -389,7 +389,7 @@ static void XFA_DataExporter_RegenerateFormFile_Container( CFX_WideStringC wsElement; pNode->GetClassName(wsElement); pStream->WriteString(L"<", 1); - pStream->WriteString(wsElement.GetPtr(), wsElement.GetLength()); + pStream->WriteString(wsElement.raw_str(), wsElement.GetLength()); CFX_WideString wsOutput; XFA_SaveAttribute(pNode, XFA_ATTRIBUTE_Name, FX_WSTRC(L"name"), TRUE, wsOutput); @@ -418,7 +418,7 @@ static void XFA_DataExporter_RegenerateFormFile_Container( pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); } pStream->WriteString(L"</", 2); - pStream->WriteString(wsElement.GetPtr(), wsElement.GetLength()); + pStream->WriteString(wsElement.raw_str(), wsElement.GetLength()); pStream->WriteString(L"\n>", 2); } else { pStream->WriteString(L"\n/>", 3); diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 0f22a27bd7..eb67b0f99d 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -1380,7 +1380,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { CFX_WideStringC wsColumnWidths; if (pLayoutNode->TryCData(XFA_ATTRIBUTE_ColumnWidths, wsColumnWidths)) { CFX_WideStringArray widths; - if (FX_SeparateStringW(wsColumnWidths.GetPtr(), wsColumnWidths.GetLength(), + if (FX_SeparateStringW(wsColumnWidths.raw_str(), wsColumnWidths.GetLength(), L' ', widths) > 0) { int32_t iCols = widths.GetSize(); CFX_WideString wsWidth; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index d245e33e29..4c3ecd2976 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -56,7 +56,7 @@ void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue, CFX_WideStringC className; GetClassName(className); FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(className.GetPtr(), className.GetLength()) + hValue, FX_UTF8Encode(className.raw_str(), className.GetLength()) .AsByteStringC()); } else { ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); @@ -1101,7 +1101,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { return; } pStream->SetCodePage(FX_CODEPAGE_UTF8); - pStream->WriteData(bsXMLHeader.GetPtr(), bsXMLHeader.GetLength()); + pStream->WriteData(bsXMLHeader.raw_str(), bsXMLHeader.GetLength()); XFA_DataExporter_RegenerateFormFile(this, pStream, NULL, TRUE); FXJSE_Value_SetUTF8String( pArguments->GetReturnValue(), @@ -1127,7 +1127,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append); if (pStream) { pStream->SetCodePage(FX_CODEPAGE_UTF8); - pStream->WriteData(bsXMLHeader.GetPtr(), bsXMLHeader.GetLength()); + pStream->WriteData(bsXMLHeader.raw_str(), bsXMLHeader.GetLength()); pElement->SaveXMLNode(pStream); FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), CFX_ByteStringC(pMemoryStream->GetBuffer(), @@ -1793,7 +1793,7 @@ static const XFA_ExecEventParaInfo gs_eventParaInfos[] = { const XFA_ExecEventParaInfo* GetEventParaInfoByName( const CFX_WideStringC& wsEventName) { int32_t iLength = wsEventName.GetLength(); - uint32_t uHash = FX_HashCode_String_GetW(wsEventName.GetPtr(), iLength); + uint32_t uHash = FX_HashCode_String_GetW(wsEventName.raw_str(), iLength); const XFA_ExecEventParaInfo* eventParaInfo = NULL; int32_t iStart = 0, iEnd = (sizeof(gs_eventParaInfos) / sizeof(gs_eventParaInfos[0])) - 1; @@ -3754,7 +3754,7 @@ enum XFA_KEYTYPE { XFA_KEYTYPE_Element, }; void* XFA_GetMapKey_Custom(const CFX_WideStringC& wsKey) { - uint32_t dwKey = FX_HashCode_String_GetW(wsKey.GetPtr(), wsKey.GetLength()); + uint32_t dwKey = FX_HashCode_String_GetW(wsKey.raw_str(), wsKey.GetLength()); return (void*)(uintptr_t)((dwKey << 1) | XFA_KEYTYPE_Custom); } void* XFA_GetMapKey_Element(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute) { @@ -3793,7 +3793,7 @@ FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, case XFA_ATTRIBUTETYPE_Integer: return SetInteger( pAttr->eName, - FXSYS_round(FX_wcstof(wsValue.GetPtr(), wsValue.GetLength())), + FXSYS_round(FX_wcstof(wsValue.raw_str(), wsValue.GetLength())), bNotify); case XFA_ATTRIBUTETYPE_Measure: return SetMeasure(pAttr->eName, CXFA_Measurement(wsValue), bNotify); @@ -4735,7 +4735,7 @@ FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify) { static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode); CFX_WideStringC wsAttributeName = pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); - pXMLElement->RemoveAttribute(wsAttributeName.GetPtr()); + pXMLElement->RemoveAttribute(wsAttributeName.raw_str()); } CFX_WideString wsName; pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); @@ -4755,7 +4755,7 @@ FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify) { } CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const { return GetFirstChildByName( - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), + wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength())); } CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { @@ -4789,7 +4789,7 @@ CXFA_Node* CXFA_Node::GetNextSameNameSibling( const CFX_WideStringC& wsNodeName) const { return GetNextSameNameSibling( wsNodeName.IsEmpty() ? 0 - : FX_HashCode_String_GetW(wsNodeName.GetPtr(), + : FX_HashCode_String_GetW(wsNodeName.raw_str(), wsNodeName.GetLength())); } CXFA_Node* CXFA_Node::GetNextSameClassSibling(XFA_ELEMENT eElement) const { @@ -4982,13 +4982,13 @@ void CXFA_Node::UpdateNameHash() { if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); m_dwNameHash = - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), + wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength()); } else if (pNotsure->eType == XFA_ATTRIBUTETYPE_Enum) { CFX_WideStringC wsName = XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; m_dwNameHash = - wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.GetPtr(), + wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength()); } } @@ -5034,7 +5034,7 @@ FX_BOOL CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) { return FALSE; } void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) { - SetMapModuleBuffer(pKey, (void*)wsValue.GetPtr(), + SetMapModuleBuffer(pKey, (void*)wsValue.raw_str(), wsValue.GetLength() * sizeof(FX_WCHAR)); } FX_BOOL CXFA_Node::GetMapModuleString(void* pKey, CFX_WideStringC& wsValue) { @@ -5263,7 +5263,7 @@ CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { int32_t iCount = GetLength(); uint32_t dwHashCode = - FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength()); + FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength()); for (int32_t i = 0; i < iCount; i++) { CXFA_Node* ret = Item(i); if (dwHashCode == ret->GetNameHash()) { diff --git a/xfa/fxfa/parser/xfa_objectacc_imp.cpp b/xfa/fxfa/parser/xfa_objectacc_imp.cpp index 8c438c5634..94657c6e50 100644 --- a/xfa/fxfa/parser/xfa_objectacc_imp.cpp +++ b/xfa/fxfa/parser/xfa_objectacc_imp.cpp @@ -24,7 +24,7 @@ static FX_ARGB XFA_WStringToColor(const CFX_WideStringC& wsValue) { return 0xff000000; } int cc = 0; - const FX_WCHAR* str = wsValue.GetPtr(); + const FX_WCHAR* str = wsValue.raw_str(); int len = wsValue.GetLength(); while (XFA_IsSpace(str[cc]) && cc < len) { cc++; @@ -1238,7 +1238,7 @@ CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName, FX_BOOL bNotify) { CXFA_Node* pSelectedMember = NULL; uint32_t nameHash = - FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength()); + FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength()); for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { if (pNode->GetNameHash() == nameHash) { diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index 74c6300e02..b7e3bb380c 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -414,7 +414,7 @@ static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, } FX_WCHAR* pBuf = wsFilter.GetBuffer(iLength - nStart); int32_t nCount = 0; - const FX_WCHAR* pSrc = wsExpression.GetPtr(); + const FX_WCHAR* pSrc = wsExpression.raw_str(); FX_WCHAR wCur; while (nStart < iLength) { wCur = pSrc[nStart++]; diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index ce3931149b..b85e9b783f 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -96,7 +96,7 @@ FX_BOOL CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, btScript = FX_UTF8Encode(wsJavaScript.GetBuffer(), wsJavaScript.GetLength()); } else { - btScript = FX_UTF8Encode(wsScript.GetPtr(), wsScript.GetLength()); + btScript = FX_UTF8Encode(wsScript.raw_str(), wsScript.GetLength()); } CXFA_Object* pOriginalObject = m_pThisObject; m_pThisObject = pThisObject; @@ -116,7 +116,7 @@ void CXFA_ScriptContext::GlobalPropertySetter(FXJSE_HOBJECT hObject, (CXFA_ScriptContext*)pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(lpOrginalNode); CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); + (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); uint32_t dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes; @@ -175,7 +175,7 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject, (CXFA_ScriptContext*)pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOrginalObject); CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); + (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) { if (szPropName == FOXIT_XFA_FM2JS_FORMCALC_RUNTIME) { XFA_FM2JS_GlobalPropertyGetter(lpScriptContext->m_hFM2JSContext, hValue); @@ -231,7 +231,7 @@ void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject, return; } CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); + (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); CXFA_ScriptContext* lpScriptContext = (CXFA_ScriptContext*)pOrginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); @@ -280,7 +280,7 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, (CXFA_ScriptContext*)pOrginalObject->GetDocument()->GetScriptContext(); CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); + (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(pObject->GetClassID(), wsPropName); if (lpAttributeInfo) { @@ -332,7 +332,7 @@ int32_t CXFA_ScriptContext::NormalPropTypeGetter( pObject = lpScriptContext->GetVariablesThis(pObject); XFA_ELEMENT objElement = pObject->GetClassID(); CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); + (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); if (XFA_GetMethodByName(objElement, wsPropName)) { return FXJSE_ClassPropType_Method; } @@ -354,7 +354,7 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter( pObject = lpScriptContext->GetVariablesThis(pObject); XFA_ELEMENT objElement = pObject->GetClassID(); CFX_WideString wsPropName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); + (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); if (XFA_GetMethodByName(objElement, wsPropName)) { return FXJSE_ClassPropType_Method; } @@ -371,7 +371,7 @@ void CXFA_ScriptContext::NormalMethodCall(FXJSE_HOBJECT hThis, (CXFA_ScriptContext*)pObject->GetDocument()->GetScriptContext(); pObject = lpScriptContext->GetVariablesThis(pObject); CFX_WideString wsFunName = CFX_WideString::FromUTF8( - (const FX_CHAR*)szFuncName.GetPtr(), szFuncName.GetLength()); + (const FX_CHAR*)szFuncName.raw_str(), szFuncName.GetLength()); const XFA_METHODINFO* lpMethodInfo = XFA_GetMethodByName(pObject->GetClassID(), wsFunName); if (NULL == lpMethodInfo) { @@ -464,7 +464,7 @@ FX_BOOL CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { return FALSE; } CFX_ByteString btScript = - FX_UTF8Encode(wsScript.GetPtr(), wsScript.GetLength()); + FX_UTF8Encode(wsScript.raw_str(), wsScript.GetLength()); FXJSE_HVALUE hRetValue = FXJSE_Value_Create(m_hJsRuntime); CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent); FXJSE_HCONTEXT hVariablesContext = diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index 6311314d82..a71270a332 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -536,7 +536,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_GetFilter( int32_t nConditionCount = 0; CFX_Int32Array stack; int32_t nType = -1; - const FX_WCHAR* pSrc = wsExpression.GetPtr(); + const FX_WCHAR* pSrc = wsExpression.raw_str(); FX_WCHAR wPrev = 0, wCur; FX_BOOL bIsCondition = FALSE; while (nStart < iLength) { diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index 6630d060d4..3d2e8bed4e 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -393,7 +393,7 @@ FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) { FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { CFX_WideString wsValue = - CFX_WideString::FromUTF8(szStringVal.GetCStr(), szStringVal.GetLength()); + CFX_WideString::FromUTF8(szStringVal.c_str(), szStringVal.GetLength()); return XFA_WideStringToDouble(wsValue); } diff --git a/xfa/fxjse/dynprop.cpp b/xfa/fxjse/dynprop.cpp index fc408ac000..498c6608cf 100644 --- a/xfa/fxjse/dynprop.cpp +++ b/xfa/fxjse/dynprop.cpp @@ -61,7 +61,7 @@ static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS* lpClass, 0, const_cast<FXJSE_CLASS*>(lpClass)); hCallBackInfo->SetInternalField( 1, v8::String::NewFromUtf8( - pIsolate, reinterpret_cast<const char*>(szPropName.GetPtr()), + pIsolate, reinterpret_cast<const char*>(szPropName.raw_str()), v8::String::kNormalString, szPropName.GetLength())); lpValue->ForceSetValue(v8::Function::New( lpValue->GetIsolate(), FXJSE_DynPropGetterAdapter_MethodCallback, diff --git a/xfa/fxjse/value.cpp b/xfa/fxjse/value.cpp index f9214813c2..cd3220a17a 100644 --- a/xfa/fxjse/value.cpp +++ b/xfa/fxjse/value.cpp @@ -249,7 +249,7 @@ void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); v8::Local<v8::String> hMessage = v8::String::NewFromUtf8( - pIsolate, utf8Message.GetCStr(), v8::String::kNormalString, + pIsolate, utf8Message.c_str(), v8::String::kNormalString, utf8Message.GetLength()); v8::Local<v8::Value> hError; @@ -266,7 +266,7 @@ void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, if (utf8Name != "Error" && !utf8Name.IsEmpty()) { hError.As<v8::Object>()->Set( v8::String::NewFromUtf8(pIsolate, "name"), - v8::String::NewFromUtf8(pIsolate, utf8Name.GetCStr(), + v8::String::NewFromUtf8(pIsolate, utf8Name.c_str(), v8::String::kNormalString, utf8Name.GetLength())); } @@ -378,7 +378,7 @@ FX_BOOL CFXJSE_Value::SetObjectProperty(const CFX_ByteStringC& szPropName, v8::Local<v8::Value> hPropValue = v8::Local<v8::Value>::New(m_pIsolate, lpPropValue->DirectGetValue()); return (FX_BOOL)hObject.As<v8::Object>()->Set( - v8::String::NewFromUtf8(m_pIsolate, szPropName.GetCStr(), + v8::String::NewFromUtf8(m_pIsolate, szPropName.c_str(), v8::String::kNormalString, szPropName.GetLength()), hPropValue); @@ -394,7 +394,7 @@ FX_BOOL CFXJSE_Value::GetObjectProperty(const CFX_ByteStringC& szPropName, v8::Local<v8::Value> hPropValue = hObject.As<v8::Object>()->Get(v8::String::NewFromUtf8( - m_pIsolate, szPropName.GetCStr(), v8::String::kNormalString, + m_pIsolate, szPropName.c_str(), v8::String::kNormalString, szPropName.GetLength())); lpPropValue->ForceSetValue(hPropValue); return TRUE; @@ -434,7 +434,7 @@ FX_BOOL CFXJSE_Value::DeleteObjectProperty(const CFX_ByteStringC& szPropName) { return FALSE; hObject.As<v8::Object>()->Delete(v8::String::NewFromUtf8( - m_pIsolate, szPropName.GetCStr(), v8::String::kNormalString, + m_pIsolate, szPropName.c_str(), v8::String::kNormalString, szPropName.GetLength())); return TRUE; } @@ -448,7 +448,7 @@ FX_BOOL CFXJSE_Value::HasObjectOwnProperty(const CFX_ByteStringC& szPropName, return FALSE; v8::Local<v8::String> hKey = v8::String::NewFromUtf8( - m_pIsolate, szPropName.GetCStr(), v8::String::kNormalString, + m_pIsolate, szPropName.c_str(), v8::String::kNormalString, szPropName.GetLength()); return hObject.As<v8::Object>()->HasRealNamedProperty(hKey) || (bUseTypeGetter && @@ -470,7 +470,7 @@ FX_BOOL CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName, return hObject.As<v8::Object>() ->DefineOwnProperty( m_pIsolate->GetCurrentContext(), - v8::String::NewFromUtf8(m_pIsolate, szPropName.GetCStr(), + v8::String::NewFromUtf8(m_pIsolate, szPropName.c_str(), v8::String::kNormalString, szPropName.GetLength()), hValue) diff --git a/xfa/fxjse/value.h b/xfa/fxjse/value.h index e728b8d857..2939ac34f7 100644 --- a/xfa/fxjse/value.h +++ b/xfa/fxjse/value.h @@ -180,7 +180,7 @@ class CFXJSE_Value { V8_INLINE void SetString(const CFX_ByteStringC& szString) { CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); v8::Local<v8::Value> hValue = v8::String::NewFromUtf8( - m_pIsolate, reinterpret_cast<const char*>(szString.GetPtr()), + m_pIsolate, reinterpret_cast<const char*>(szString.raw_str()), v8::String::kNormalString, szString.GetLength()); m_hValue.Reset(m_pIsolate, hValue); } |