diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-13 16:43:37 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-14 14:14:51 +0000 |
commit | 812e96c2b4c5908a1979da5e27cdcecda0d1dfc9 (patch) | |
tree | f0b0607f6b757eb22237527215094bd87b5d03ba /xfa/fde | |
parent | 893822aa5b6254591f8e80fbffcbb4fa6ad849aa (diff) | |
download | pdfium-812e96c2b4c5908a1979da5e27cdcecda0d1dfc9.tar.xz |
Replace FX_CHAR and FX_WCHAR with underlying types.
Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8
Reviewed-on: https://pdfium-review.googlesource.com/2967
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fde')
36 files changed, 330 insertions, 335 deletions
diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp index 1c2e0d1f3f..ba9f5cdca0 100644 --- a/xfa/fde/cfde_txtedtbuf.cpp +++ b/xfa/fde/cfde_txtedtbuf.cpp @@ -44,7 +44,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { m_chunks.push_back(NewChunk()); int32_t nTotalCount = m_chunks.size(); - const FX_WCHAR* lpSrcBuf = wsText.c_str(); + const wchar_t* lpSrcBuf = wsText.c_str(); int32_t nLeave = nTextLength; int32_t nCopyedLength = GetChunkSize(); for (i = 0; i < nTotalCount && nLeave > 0; i++) { @@ -54,7 +54,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { ChunkHeader* chunk = m_chunks[i].get(); FXSYS_memcpy(chunk->wChars.get(), lpSrcBuf, - nCopyedLength * sizeof(FX_WCHAR)); + nCopyedLength * sizeof(wchar_t)); nLeave -= nCopyedLength; lpSrcBuf += nCopyedLength; chunk->nUsed = nCopyedLength; @@ -66,7 +66,7 @@ CFX_WideString CFDE_TxtEdtBuf::GetText() const { return GetRange(0, m_nTotal); } -FX_WCHAR CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const { +wchar_t CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const { ASSERT(nIndex >= 0 && nIndex < GetTextLength()); ChunkHeader* pChunkHeader = nullptr; @@ -79,7 +79,7 @@ FX_WCHAR CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const { } ASSERT(pChunkHeader); - FX_WCHAR* buf = pChunkHeader->wChars.get(); + wchar_t* buf = pChunkHeader->wChars.get(); return buf[pChunkHeader->nUsed - (nTotal - nIndex)]; } @@ -98,17 +98,17 @@ CFX_WideString CFDE_TxtEdtBuf::GetRange(int32_t nBegin, int32_t nLength) const { int32_t nCount = m_chunks.size(); CFX_WideString wsText; - FX_WCHAR* lpDstBuf = wsText.GetBuffer(nLength); + wchar_t* lpDstBuf = wsText.GetBuffer(nLength); int32_t nChunkIndex = chunkIndex; ChunkHeader* chunkHeader = m_chunks[nChunkIndex].get(); int32_t nCopyLength = chunkHeader->nUsed - charIndex; - FX_WCHAR* lpSrcBuf = chunkHeader->wChars.get() + charIndex; + wchar_t* lpSrcBuf = chunkHeader->wChars.get() + charIndex; while (nLeave > 0) { if (nLeave <= nCopyLength) { nCopyLength = nLeave; } - FXSYS_memcpy(lpDstBuf, lpSrcBuf, nCopyLength * sizeof(FX_WCHAR)); + FXSYS_memcpy(lpDstBuf, lpSrcBuf, nCopyLength * sizeof(wchar_t)); nChunkIndex++; if (nChunkIndex >= nCount) { break; @@ -125,7 +125,7 @@ CFX_WideString CFDE_TxtEdtBuf::GetRange(int32_t nBegin, int32_t nLength) const { } void CFDE_TxtEdtBuf::Insert(int32_t nPos, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { ASSERT(nPos >= 0 && nPos <= m_nTotal); ASSERT(nLength > 0); @@ -142,7 +142,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos, int32_t nCopy = chunk->nUsed - charIndex; FXSYS_memcpy(newChunk->wChars.get(), chunk->wChars.get() + charIndex, - nCopy * sizeof(FX_WCHAR)); + nCopy * sizeof(wchar_t)); chunk->nUsed -= nCopy; chunkIndex++; @@ -158,7 +158,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos, int32_t nFree = GetChunkSize() - chunk->nUsed; int32_t nCopy = std::min(nLengthTemp, nFree); FXSYS_memcpy(chunk->wChars.get() + chunk->nUsed, lpText, - nCopy * sizeof(FX_WCHAR)); + nCopy * sizeof(wchar_t)); lpText += nCopy; nLengthTemp -= nCopy; chunk->nUsed += nCopy; @@ -170,7 +170,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos, auto chunk = NewChunk(); int32_t nCopy = std::min(nLengthTemp, GetChunkSize()); - FXSYS_memcpy(chunk->wChars.get(), lpText, nCopy * sizeof(FX_WCHAR)); + FXSYS_memcpy(chunk->wChars.get(), lpText, nCopy * sizeof(wchar_t)); lpText += nCopy; nLengthTemp -= nCopy; chunk->nUsed = nCopy; @@ -195,7 +195,7 @@ void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) { int32_t nDelete = std::min(nFirstPart, nLength); FXSYS_memmove(chunk->wChars.get() + nFirstPart - nDelete, chunk->wChars.get() + nFirstPart, - nMovePart * sizeof(FX_WCHAR)); + nMovePart * sizeof(wchar_t)); chunk->nUsed -= nDelete; nLength -= nDelete; endChunkIndex--; @@ -255,7 +255,7 @@ std::tuple<int32_t, int32_t> CFDE_TxtEdtBuf::Index2CP(int32_t nIndex) const { std::unique_ptr<CFDE_TxtEdtBuf::ChunkHeader> CFDE_TxtEdtBuf::NewChunk() { auto chunk = pdfium::MakeUnique<ChunkHeader>(); - chunk->wChars.reset(FX_Alloc(FX_WCHAR, GetChunkSize())); + chunk->wChars.reset(FX_Alloc(wchar_t, GetChunkSize())); chunk->nUsed = 0; return chunk; } @@ -264,7 +264,7 @@ CFDE_TxtEdtBuf::ChunkHeader::ChunkHeader() {} CFDE_TxtEdtBuf::ChunkHeader::~ChunkHeader() {} -CFDE_TxtEdtBuf::Iterator::Iterator(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias) +CFDE_TxtEdtBuf::Iterator::Iterator(CFDE_TxtEdtBuf* pBuf, wchar_t wcAlias) : m_pBuf(pBuf), m_nCurChunk(0), m_nCurIndex(0), @@ -332,10 +332,10 @@ int32_t CFDE_TxtEdtBuf::Iterator::GetAt() const { return m_nIndex; } -FX_WCHAR CFDE_TxtEdtBuf::Iterator::GetChar() { +wchar_t CFDE_TxtEdtBuf::Iterator::GetChar() { ASSERT(m_nIndex >= 0 && m_nIndex < m_pBuf->m_nTotal); if (m_Alias == 0 || m_nIndex == (m_pBuf->m_nTotal - 1)) { - FX_WCHAR* buf = m_pBuf->m_chunks[m_nCurChunk]->wChars.get(); + wchar_t* buf = m_pBuf->m_chunks[m_nCurChunk]->wChars.get(); return buf[m_nCurIndex]; } return m_Alias; diff --git a/xfa/fde/cfde_txtedtbuf.h b/xfa/fde/cfde_txtedtbuf.h index 9eeee5632e..6a20ae0de1 100644 --- a/xfa/fde/cfde_txtedtbuf.h +++ b/xfa/fde/cfde_txtedtbuf.h @@ -21,11 +21,11 @@ class CFDE_TxtEdtBuf { public: class Iterator : public IFX_CharIter { public: - explicit Iterator(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias = 0); + explicit Iterator(CFDE_TxtEdtBuf* pBuf, wchar_t wcAlias = 0); ~Iterator() override; bool Next(bool bPrev = false) override; - FX_WCHAR GetChar() override; + wchar_t GetChar() override; void SetAt(int32_t nIndex) override; int32_t GetAt() const override; @@ -38,7 +38,7 @@ class CFDE_TxtEdtBuf { int32_t m_nCurChunk; int32_t m_nCurIndex; int32_t m_nIndex; - FX_WCHAR m_Alias; + wchar_t m_Alias; }; CFDE_TxtEdtBuf(); @@ -50,10 +50,10 @@ class CFDE_TxtEdtBuf { void SetText(const CFX_WideString& wsText); CFX_WideString GetText() const; - FX_WCHAR GetCharByIndex(int32_t nIndex) const; + wchar_t GetCharByIndex(int32_t nIndex) const; CFX_WideString GetRange(int32_t nBegin, int32_t nCount) const; - void Insert(int32_t nPos, const FX_WCHAR* lpText, int32_t nLength); + void Insert(int32_t nPos, const wchar_t* lpText, int32_t nLength); void Delete(int32_t nIndex, int32_t nLength); void Clear(bool bRelease); @@ -67,7 +67,7 @@ class CFDE_TxtEdtBuf { ~ChunkHeader(); int32_t nUsed; - std::unique_ptr<FX_WCHAR, FxFreeDeleter> wChars; + std::unique_ptr<wchar_t, FxFreeDeleter> wChars; }; void SetChunkSizeForTesting(size_t size); diff --git a/xfa/fde/cfde_txtedtdorecord_insert.cpp b/xfa/fde/cfde_txtedtdorecord_insert.cpp index b80b15dff6..0e3f9218dd 100644 --- a/xfa/fde/cfde_txtedtdorecord_insert.cpp +++ b/xfa/fde/cfde_txtedtdorecord_insert.cpp @@ -12,12 +12,12 @@ CFDE_TxtEdtDoRecord_Insert::CFDE_TxtEdtDoRecord_Insert( CFDE_TxtEdtEngine* pEngine, int32_t nCaret, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) : m_pEngine(pEngine), m_nCaret(nCaret) { ASSERT(pEngine); - FX_WCHAR* lpBuffer = m_wsInsert.GetBuffer(nLength); - FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); + wchar_t* lpBuffer = m_wsInsert.GetBuffer(nLength); + FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(wchar_t)); m_wsInsert.ReleaseBuffer(); } diff --git a/xfa/fde/cfde_txtedtdorecord_insert.h b/xfa/fde/cfde_txtedtdorecord_insert.h index e80453e9e3..05922378d3 100644 --- a/xfa/fde/cfde_txtedtdorecord_insert.h +++ b/xfa/fde/cfde_txtedtdorecord_insert.h @@ -17,7 +17,7 @@ class CFDE_TxtEdtDoRecord_Insert : public IFDE_TxtEdtDoRecord { public: CFDE_TxtEdtDoRecord_Insert(CFDE_TxtEdtEngine* pEngine, int32_t nCaret, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength); ~CFDE_TxtEdtDoRecord_Insert() override; diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 0a955ff60f..33efa2ddf0 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -122,7 +122,7 @@ void CFDE_TxtEdtEngine::SetTextByStream( int32_t nPos = pStream->GetBOM(bom); pStream->Seek(FX_STREAMSEEK_Begin, nPos); int32_t nPlateSize = std::min(nStreamLength, m_pTxtBuf->GetChunkSize()); - FX_WCHAR* lpwstr = FX_Alloc(FX_WCHAR, nPlateSize); + wchar_t* lpwstr = FX_Alloc(wchar_t, nPlateSize); bool bEos = false; while (!bEos) { int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, bEos); @@ -142,8 +142,8 @@ void CFDE_TxtEdtEngine::SetText(const CFX_WideString& wsText) { int32_t nLength = wsText.GetLength(); if (nLength > 0) { CFX_WideString wsTemp; - FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); - FXSYS_memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(FX_WCHAR)); + wchar_t* lpBuffer = wsTemp.GetBuffer(nLength); + FXSYS_memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(wchar_t)); ReplaceParagEnd(lpBuffer, nLength, false); wsTemp.ReleaseBuffer(nLength); if (m_nLimit > 0 && nLength > m_nLimit) { @@ -315,14 +315,14 @@ bool CFDE_TxtEdtEngine::IsLocked() const { } int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { if (IsLocked()) { return FDE_TXTEDT_MODIFY_RET_F_Locked; } CFX_WideString wsTemp; - FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); - FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); + wchar_t* lpBuffer = wsTemp.GetBuffer(nLength); + FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(wchar_t)); ReplaceParagEnd(lpBuffer, nLength, false); wsTemp.ReleaseBuffer(nLength); bool bPart = false; @@ -349,7 +349,7 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, while (nLength > 0) { CFX_WideString wsText = GetPreInsertText(m_nCaret, lpBuffer, nLength); int32_t nTotal = wsText.GetLength(); - FX_WCHAR* lpBuf = wsText.GetBuffer(nTotal); + wchar_t* lpBuf = wsText.GetBuffer(nTotal); for (int32_t i = 0; i < nTotal; i++) { lpBuf[i] = m_wcAliasChar; } @@ -393,7 +393,7 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, m_ChangeInfo.wsInsert = CFX_WideString(lpBuffer, nLength); nStart = m_nCaret; nStart += nLength; - FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); + wchar_t wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); bool bBefore = true; if (wChar != L'\n' && wChar != L'\r') { nStart--; @@ -498,7 +498,7 @@ int32_t CFDE_TxtEdtEngine::Replace(int32_t nStart, m_ChangeInfo.wsInsert = CFX_WideString(wsReplace.c_str(), nTextLength); nStart += nTextLength; - FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); + wchar_t wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); bool bBefore = true; if (wChar != L'\n' && wChar != L'\r') { nStart--; @@ -515,7 +515,7 @@ void CFDE_TxtEdtEngine::SetLimit(int32_t nLimit) { m_nLimit = nLimit; } -void CFDE_TxtEdtEngine::SetAliasChar(FX_WCHAR wcAlias) { +void CFDE_TxtEdtEngine::SetAliasChar(wchar_t wcAlias) { m_wcAliasChar = wcAlias; } @@ -733,7 +733,7 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreDeleteText(int32_t nIndex, } CFX_WideString CFDE_TxtEdtEngine::GetPreInsertText(int32_t nIndex, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { CFX_WideString wsText = GetText(0, GetTextBufLength()); int32_t nSelIndex = 0; @@ -746,12 +746,12 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreInsertText(int32_t nIndex, } CFX_WideString wsTemp; int32_t nOldLength = wsText.GetLength(); - const FX_WCHAR* pOldBuffer = wsText.c_str(); - FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nOldLength + nLength); - FXSYS_memcpy(lpBuffer, pOldBuffer, (nIndex) * sizeof(FX_WCHAR)); - FXSYS_memcpy(lpBuffer + nIndex, lpText, nLength * sizeof(FX_WCHAR)); + const wchar_t* pOldBuffer = wsText.c_str(); + wchar_t* lpBuffer = wsTemp.GetBuffer(nOldLength + nLength); + FXSYS_memcpy(lpBuffer, pOldBuffer, (nIndex) * sizeof(wchar_t)); + FXSYS_memcpy(lpBuffer + nIndex, lpText, nLength * sizeof(wchar_t)); FXSYS_memcpy(lpBuffer + nIndex + nLength, pOldBuffer + nIndex, - (nOldLength - nIndex) * sizeof(FX_WCHAR)); + (nOldLength - nIndex) * sizeof(wchar_t)); wsTemp.ReleaseBuffer(nOldLength + nLength); wsText = wsTemp; return wsText; @@ -759,7 +759,7 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreInsertText(int32_t nIndex, CFX_WideString CFDE_TxtEdtEngine::GetPreReplaceText(int32_t nIndex, int32_t nOriginLength, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { CFX_WideString wsText = GetText(0, GetTextBufLength()); int32_t nSelIndex = 0; @@ -778,7 +778,7 @@ CFX_WideString CFDE_TxtEdtEngine::GetPreReplaceText(int32_t nIndex, } void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength) { ASSERT(nLength > 0); FDE_TXTEDTPARAGPOS ParagPos; @@ -795,8 +795,8 @@ void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart, int32_t nLeavePart = ParagPos.nCharIndex; int32_t nCutPart = pParag->GetTextLength() - ParagPos.nCharIndex; int32_t nTextStart = 0; - FX_WCHAR wCurChar = L' '; - const FX_WCHAR* lpPos = lpText; + wchar_t wCurChar = L' '; + const wchar_t* lpPos = lpText; bool bFirst = true; int32_t nParagIndex = ParagPos.nParagIndex; for (i = 0; i < nLength; i++, lpPos++) { @@ -926,7 +926,7 @@ void CFDE_TxtEdtEngine::ResetEngine() { void CFDE_TxtEdtEngine::RebuildParagraphs() { RemoveAllParags(); - FX_WCHAR wChar = L' '; + wchar_t wChar = L' '; int32_t nParagStart = 0; int32_t nIndex = 0; auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(m_pTxtBuf.get()); @@ -1045,11 +1045,11 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { m_pTextBreak->SetCharSpace(m_Param.fCharSpace); } -bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, +bool CFDE_TxtEdtEngine::ReplaceParagEnd(wchar_t*& lpText, int32_t& nLength, bool bPreIsCR) { for (int32_t i = 0; i < nLength; i++) { - FX_WCHAR wc = lpText[i]; + wchar_t wc = lpText[i]; switch (wc) { case L'\r': { lpText[i] = m_wLineEnd; @@ -1060,7 +1060,7 @@ bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, int32_t nNext = i + 1; if (nNext < nLength) { FXSYS_memmove(lpText + i, lpText + nNext, - (nLength - nNext) * sizeof(FX_WCHAR)); + (nLength - nNext) * sizeof(wchar_t)); } i--; nLength--; @@ -1090,29 +1090,29 @@ bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, } void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) const { - FX_WCHAR wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r'; + wchar_t wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r'; if (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CRLF) { CFX_ArrayTemplate<int32_t> PosArr; int32_t nLength = wsText.GetLength(); int32_t i = 0; - FX_WCHAR* lpPos = const_cast<FX_WCHAR*>(wsText.c_str()); + wchar_t* lpPos = const_cast<wchar_t*>(wsText.c_str()); for (i = 0; i < nLength; i++, lpPos++) { if (*lpPos == m_wLineEnd) { *lpPos = wc; PosArr.Add(i); } } - const FX_WCHAR* lpSrcBuf = wsText.c_str(); + const wchar_t* lpSrcBuf = wsText.c_str(); CFX_WideString wsTemp; int32_t nCount = PosArr.GetSize(); - FX_WCHAR* lpDstBuf = wsTemp.GetBuffer(nLength + nCount); + wchar_t* lpDstBuf = wsTemp.GetBuffer(nLength + nCount); int32_t nDstPos = 0; int32_t nSrcPos = 0; for (i = 0; i < nCount; i++) { int32_t nPos = PosArr[i]; int32_t nCopyLen = nPos - nSrcPos + 1; FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos, - nCopyLen * sizeof(FX_WCHAR)); + nCopyLen * sizeof(wchar_t)); nDstPos += nCopyLen; nSrcPos += nCopyLen; lpDstBuf[nDstPos] = L'\n'; @@ -1120,13 +1120,13 @@ void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) const { } if (nSrcPos < nLength) { FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos, - (nLength - nSrcPos) * sizeof(FX_WCHAR)); + (nLength - nSrcPos) * sizeof(wchar_t)); } wsTemp.ReleaseBuffer(nLength + nCount); wsText = wsTemp; } else { int32_t nLength = wsText.GetLength(); - FX_WCHAR* lpBuf = const_cast<FX_WCHAR*>(wsText.c_str()); + wchar_t* lpBuf = const_cast<wchar_t*>(wsText.c_str()); for (int32_t i = 0; i < nLength; i++, lpBuf++) { if (*lpBuf == m_wLineEnd) *lpBuf = wc; @@ -1305,7 +1305,7 @@ bool CFDE_TxtEdtEngine::MoveLineEnd() { } nIndex = nStart + nCount - 1; ASSERT(nIndex <= GetTextBufLength()); - FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); + wchar_t wChar = m_pTxtBuf->GetCharByIndex(nIndex); bool bBefore = false; if (nIndex <= GetTextBufLength()) { if (wChar == L'\r') { @@ -1339,7 +1339,7 @@ bool CFDE_TxtEdtEngine::MoveParagEnd() { TextPos2ParagPos(nIndex, ParagPos); CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; nIndex = pParag->GetStartIndex() + pParag->GetTextLength() - 1; - FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); + wchar_t wChar = m_pTxtBuf->GetCharByIndex(nIndex); if (wChar == L'\n' && nIndex > 0) { nIndex--; wChar = m_pTxtBuf->GetCharByIndex(nIndex); diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index ee1cc1015d..63d97d33a3 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -46,7 +46,7 @@ class CFDE_TxtEdtEngine { void Unlock(); bool IsLocked() const; - int32_t Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength); + int32_t Insert(int32_t nStart, const wchar_t* lpText, int32_t nLength); int32_t Delete(int32_t nStart, bool bBackspace = false); int32_t DeleteRange(int32_t nStart, int32_t nCount = -1); int32_t Replace(int32_t nStart, @@ -54,7 +54,7 @@ class CFDE_TxtEdtEngine { const CFX_WideString& wsReplace); void SetLimit(int32_t nLimit); - void SetAliasChar(FX_WCHAR wcAlias); + void SetAliasChar(wchar_t wcAlias); void RemoveSelRange(int32_t nStart, int32_t nCount); @@ -83,7 +83,7 @@ class CFDE_TxtEdtEngine { int32_t nStartLineofParag, int32_t nLineIndex, int32_t& nStartLine) const; - FX_WCHAR GetAliasChar() const { return m_wcAliasChar; } + wchar_t GetAliasChar() const { return m_wcAliasChar; } private: friend class CFDE_TxtEdtDoRecord_Insert; @@ -100,14 +100,14 @@ class CFDE_TxtEdtEngine { int32_t nCharIndex; }; - void Inner_Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength); + void Inner_Insert(int32_t nStart, const wchar_t* lpText, int32_t nLength); CFX_WideString GetPreDeleteText(int32_t nIndex, int32_t nLength); CFX_WideString GetPreInsertText(int32_t nIndex, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength); CFX_WideString GetPreReplaceText(int32_t nIndex, int32_t nOriginLength, - const FX_WCHAR* lpText, + const wchar_t* lpText, int32_t nLength); void Inner_DeleteRange(int32_t nStart, int32_t nCount = -1); @@ -120,7 +120,7 @@ class CFDE_TxtEdtEngine { void UpdatePages(); void UpdateTxtBreak(); - bool ReplaceParagEnd(FX_WCHAR*& lpText, + bool ReplaceParagEnd(wchar_t*& lpText, int32_t& nLength, bool bPreIsCR = false); void RecoverParagEnd(CFX_WideString& wsText) const; @@ -165,10 +165,10 @@ class CFDE_TxtEdtEngine { uint32_t m_dwFindFlags; bool m_bLock; int32_t m_nLimit; - FX_WCHAR m_wcAliasChar; + wchar_t m_wcAliasChar; int32_t m_nFirstLineEnd; bool m_bAutoLineEnd; - FX_WCHAR m_wLineEnd; + wchar_t m_wLineEnd; FDE_TXTEDT_TEXTCHANGE_INFO m_ChangeInfo; }; diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index f0a33d0516..f229a01fcb 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -109,7 +109,7 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) { bBefore = true; return m_pEditEngine->GetTextBufLength(); } - FX_WCHAR wChar = m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret); + wchar_t wChar = m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret); if (wChar == L'\n' || wChar == L'\r') { if (wChar == L'\n') { if (m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret - 1) == @@ -234,7 +234,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, } CFDE_TxtEdtBuf* pBuf = m_pEditEngine->GetTextBuf(); const FDE_TXTEDTPARAMS* pParams = m_pEditEngine->GetEditParams(); - FX_WCHAR wcAlias = 0; + wchar_t wcAlias = 0; if (pParams->dwMode & FDE_TEXTEDITMODE_Password) { wcAlias = m_pEditEngine->GetAliasChar(); } @@ -287,7 +287,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, if (bReload) { dwBreakStatus = pBreak->EndBreak(CFX_BreakType::Paragraph); } else { - FX_WCHAR wAppend = pIter->GetChar(); + wchar_t wAppend = pIter->GetChar(); dwBreakStatus = pBreak->AppendChar(wAppend); } if (pIter->GetAt() == nPageEnd && CFX_BreakTypeNoneOrPiece(dwBreakStatus)) @@ -308,11 +308,11 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, } FX_FLOAT fParaBreakWidth = 0.0f; if (!CFX_BreakTypeNoneOrPiece(pPiece->m_dwStatus)) { - FX_WCHAR wRtChar = pParams->wLineBreakChar; + wchar_t wRtChar = pParams->wLineBreakChar; if (TxtEdtPiece.nCount >= 2) { - FX_WCHAR wChar = pBuf->GetCharByIndex( + wchar_t wChar = pBuf->GetCharByIndex( m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 1); - FX_WCHAR wCharPre = pBuf->GetCharByIndex( + wchar_t wCharPre = pBuf->GetCharByIndex( m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 2); if (wChar == wRtChar) { fParaBreakWidth += fDefCharWidth; @@ -321,7 +321,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, fParaBreakWidth += fDefCharWidth; } } else if (TxtEdtPiece.nCount >= 1) { - FX_WCHAR wChar = pBuf->GetCharByIndex( + wchar_t wChar = pBuf->GetCharByIndex( m_nPageStart + TxtEdtPiece.nStart + TxtEdtPiece.nCount - 1); if (wChar == wRtChar) { fParaBreakWidth += fDefCharWidth; @@ -434,13 +434,13 @@ FDE_TEXTEDITPIECE* CFDE_TxtEdtPage::GetNext(FX_POSITION& pos, return &m_Pieces[nPos - 1]; } -FX_WCHAR CFDE_TxtEdtPage::GetChar(const FDE_TEXTEDITPIECE* pIdentity, - int32_t index) const { +wchar_t CFDE_TxtEdtPage::GetChar(const FDE_TEXTEDITPIECE* pIdentity, + int32_t index) const { int32_t nIndex = m_nPageStart + pIdentity->nStart + index; if (nIndex != m_pIter->GetAt()) m_pIter->SetAt(nIndex); - FX_WCHAR wChar = m_pIter->GetChar(); + wchar_t wChar = m_pIter->GetChar(); m_pIter->Next(); return wChar; } diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h index 6d700d202c..11c8050735 100644 --- a/xfa/fde/cfde_txtedtpage.h +++ b/xfa/fde/cfde_txtedtpage.h @@ -49,7 +49,7 @@ class CFDE_TxtEdtPage : public IFDE_VisualSet { FX_POSITION GetFirstPosition(); FDE_TEXTEDITPIECE* GetNext(FX_POSITION& pos, IFDE_VisualSet*& pVisualSet); - FX_WCHAR GetChar(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; + wchar_t GetChar(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; private: diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp index 79dcc2fbac..d22fa53c02 100644 --- a/xfa/fde/cfde_txtedtparag.cpp +++ b/xfa/fde/cfde_txtedtparag.cpp @@ -37,7 +37,7 @@ void CFDE_TxtEdtParag::LoadParag() { CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak(); CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf(); const FDE_TXTEDTPARAMS* pParam = m_pEngine->GetEditParams(); - FX_WCHAR wcAlias = 0; + wchar_t wcAlias = 0; if (pParam->dwMode & FDE_TEXTEDITMODE_Password) wcAlias = m_pEngine->GetAliasChar(); @@ -52,7 +52,7 @@ void CFDE_TxtEdtParag::LoadParag() { if (bReload) { dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph); } else { - FX_WCHAR wAppend = pIter->GetChar(); + wchar_t wAppend = pIter->GetChar(); dwBreakStatus = pTxtBreak->AppendChar(wAppend); } if (pIter->GetAt() + 1 == nEndIndex && @@ -117,7 +117,7 @@ void CFDE_TxtEdtParag::CalcLines() { if (bReload) { dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph); } else { - FX_WCHAR wAppend = pIter->GetChar(); + wchar_t wAppend = pIter->GetChar(); dwBreakStatus = pTxtBreak->AppendChar(wAppend); } if (pIter->GetAt() + 1 == nEndIndex && diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp index a6503f4022..78a7ec49d5 100644 --- a/xfa/fde/cfde_txtedttextset.cpp +++ b/xfa/fde/cfde_txtedttextset.cpp @@ -26,7 +26,7 @@ CFX_RectF CFDE_TxtEdtTextSet::GetRect(const FDE_TEXTEDITPIECE& pPiece) { int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText) { - FX_WCHAR* pBuffer = wsText.GetBuffer(pPiece->nCount); + wchar_t* pBuffer = wsText.GetBuffer(pPiece->nCount); for (int32_t i = 0; i < pPiece->nCount; i++) pBuffer[i] = m_pPage->GetChar(pPiece, i); diff --git a/xfa/fde/cfx_chariter.cpp b/xfa/fde/cfx_chariter.cpp index 568ecd6cf0..ff5b0d9c3a 100644 --- a/xfa/fde/cfx_chariter.cpp +++ b/xfa/fde/cfx_chariter.cpp @@ -26,7 +26,7 @@ bool CFX_CharIter::Next(bool bPrev) { return true; } -FX_WCHAR CFX_CharIter::GetChar() { +wchar_t CFX_CharIter::GetChar() { return m_wsText.GetAt(m_nIndex); } diff --git a/xfa/fde/cfx_chariter.h b/xfa/fde/cfx_chariter.h index d122af21f1..ab554b2716 100644 --- a/xfa/fde/cfx_chariter.h +++ b/xfa/fde/cfx_chariter.h @@ -17,7 +17,7 @@ class CFX_CharIter : public IFX_CharIter { ~CFX_CharIter() override; bool Next(bool bPrev = false) override; - FX_WCHAR GetChar() override; + wchar_t GetChar() override; void SetAt(int32_t nIndex) override; int32_t GetAt() const override; bool IsEOF(bool bTail = true) const override; diff --git a/xfa/fde/cfx_wordbreak.cpp b/xfa/fde/cfx_wordbreak.cpp index 2d37ba1707..9ab3a9230a 100644 --- a/xfa/fde/cfx_wordbreak.cpp +++ b/xfa/fde/cfx_wordbreak.cpp @@ -2770,7 +2770,7 @@ const uint8_t gs_FX_WordBreak_CodePointProperties[(0xFFFF - 1) / 2 + 1] = 0x00, 0x00, 0x00, 0x00, 0x05, 0x55, 0x00, 0x00, }; -FX_WordBreakProp GetWordBreakProperty(FX_WCHAR wcCodePoint) { +FX_WordBreakProp GetWordBreakProperty(wchar_t wcCodePoint) { uint32_t dwProperty = (uint32_t)gs_FX_WordBreak_CodePointProperties[wcCodePoint >> 1]; return (FX_WordBreakProp)(((wcCodePoint)&1) ? (dwProperty & 0x0F) @@ -2836,7 +2836,7 @@ void CFX_WordBreak::GetWord(CFX_WideString& wsWord) const { if (nWordLength <= 0) { return; } - FX_WCHAR* lpBuf = wsWord.GetBuffer(nWordLength); + wchar_t* lpBuf = wsWord.GetBuffer(nWordLength); std::unique_ptr<IFX_CharIter> pTempIter(m_pPreIter->Clone()); int32_t i = 0; while (pTempIter->GetAt() <= m_pCurIter->GetAt()) { diff --git a/xfa/fde/css/cfde_cssdeclaration.cpp b/xfa/fde/css/cfde_cssdeclaration.cpp index 3c776ca771..2d1e707caa 100644 --- a/xfa/fde/css/cfde_cssdeclaration.cpp +++ b/xfa/fde/css/cfde_cssdeclaration.cpp @@ -23,7 +23,7 @@ uint8_t Hex2Dec(uint8_t hexHigh, uint8_t hexLow) { return (FXSYS_toHexDigit(hexHigh) << 4) + FXSYS_toHexDigit(hexLow); } -bool ParseCSSNumber(const FX_WCHAR* pszValue, +bool ParseCSSNumber(const wchar_t* pszValue, int32_t iValueLen, FX_FLOAT& fValue, FDE_CSSNumberType& eUnit) { @@ -50,7 +50,7 @@ bool ParseCSSNumber(const FX_WCHAR* pszValue, } // namespace // static -bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue, +bool CFDE_CSSDeclaration::ParseCSSString(const wchar_t* pszValue, int32_t iValueLen, int32_t* iOffset, int32_t* iLength) { @@ -58,7 +58,7 @@ bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue, *iOffset = 0; *iLength = iValueLen; if (iValueLen >= 2) { - FX_WCHAR first = pszValue[0], last = pszValue[iValueLen - 1]; + wchar_t first = pszValue[0], last = pszValue[iValueLen - 1]; if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) { *iOffset = 1; *iLength -= 2; @@ -68,7 +68,7 @@ bool CFDE_CSSDeclaration::ParseCSSString(const FX_WCHAR* pszValue, } // static. -bool CFDE_CSSDeclaration::ParseCSSColor(const FX_WCHAR* pszValue, +bool CFDE_CSSDeclaration::ParseCSSColor(const wchar_t* pszValue, int32_t iValueLen, FX_ARGB* dwColor) { ASSERT(pszValue && iValueLen > 0); @@ -159,7 +159,7 @@ void CFDE_CSSDeclaration::AddProperty(const FDE_CSSPropertyTable* pTable, const CFX_WideStringC& value) { ASSERT(!value.IsEmpty()); - const FX_WCHAR* pszValue = value.c_str(); + const wchar_t* pszValue = value.c_str(); int32_t iValueLen = value.GetLength(); bool bImportant = false; @@ -277,7 +277,7 @@ void CFDE_CSSDeclaration::AddProperty(const CFX_WideString& prop, } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseNumber( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { FX_FLOAT fValue; FDE_CSSNumberType eUnit; @@ -287,7 +287,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseNumber( } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseEnum( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { const FDE_CSSPropertyValueTable* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); @@ -296,7 +296,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseEnum( } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseColor( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { FX_ARGB dwColor; if (!ParseCSSColor(pszValue, iValueLen, &dwColor)) @@ -305,7 +305,7 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseColor( } CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseString( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen) { int32_t iOffset; if (!ParseCSSString(pszValue, iValueLen, &iOffset, &iValueLen)) @@ -320,10 +320,10 @@ CFX_RetainPtr<CFDE_CSSValue> CFDE_CSSDeclaration::ParseString( void CFDE_CSSDeclaration::ParseValueListProperty( const FDE_CSSPropertyTable* pTable, - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen, bool bImportant) { - FX_WCHAR separator = + wchar_t separator = (pTable->eName == FDE_CSSProperty::FontFamily) ? ',' : ' '; CFDE_CSSValueListParser parser(pszValue, iValueLen, separator); @@ -444,7 +444,7 @@ void CFDE_CSSDeclaration::Add4ValuesProperty( } bool CFDE_CSSDeclaration::ParseBorderProperty( - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen, CFX_RetainPtr<CFDE_CSSValue>& pWidth) const { pWidth.Reset(nullptr); @@ -497,7 +497,7 @@ bool CFDE_CSSDeclaration::ParseBorderProperty( return true; } -void CFDE_CSSDeclaration::ParseFontProperty(const FX_WCHAR* pszValue, +void CFDE_CSSDeclaration::ParseFontProperty(const wchar_t* pszValue, int32_t iValueLen, bool bImportant) { CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); diff --git a/xfa/fde/css/cfde_cssdeclaration.h b/xfa/fde/css/cfde_cssdeclaration.h index eb287308f8..3c2e058a43 100644 --- a/xfa/fde/css/cfde_cssdeclaration.h +++ b/xfa/fde/css/cfde_cssdeclaration.h @@ -23,11 +23,11 @@ class CFDE_CSSDeclaration { using const_custom_iterator = std::vector<std::unique_ptr<CFDE_CSSCustomProperty>>::const_iterator; - static bool ParseCSSString(const FX_WCHAR* pszValue, + static bool ParseCSSString(const wchar_t* pszValue, int32_t iValueLen, int32_t* iOffset, int32_t* iLength); - static bool ParseCSSColor(const FX_WCHAR* pszValue, + static bool ParseCSSColor(const wchar_t* pszValue, int32_t iValueLen, FX_ARGB* dwColor); @@ -53,19 +53,19 @@ class CFDE_CSSDeclaration { size_t PropertyCountForTesting() const; - FX_ARGB ParseColorForTest(const FX_WCHAR* pszValue, + FX_ARGB ParseColorForTest(const wchar_t* pszValue, int32_t iValueLen, FX_ARGB* dwColor) const; private: - void ParseFontProperty(const FX_WCHAR* pszValue, + void ParseFontProperty(const wchar_t* pszValue, int32_t iValueLen, bool bImportant); - bool ParseBorderProperty(const FX_WCHAR* pszValue, + bool ParseBorderProperty(const wchar_t* pszValue, int32_t iValueLen, CFX_RetainPtr<CFDE_CSSValue>& pWidth) const; void ParseValueListProperty(const FDE_CSSPropertyTable* pTable, - const FX_WCHAR* pszValue, + const wchar_t* pszValue, int32_t iValueLen, bool bImportant); void Add4ValuesProperty(const std::vector<CFX_RetainPtr<CFDE_CSSValue>>& list, @@ -74,13 +74,13 @@ class CFDE_CSSDeclaration { FDE_CSSProperty eTop, FDE_CSSProperty eRight, FDE_CSSProperty eBottom); - CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseNumber(const wchar_t* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseEnum(const wchar_t* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseColor(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseColor(const wchar_t* pszValue, int32_t iValueLen); - CFX_RetainPtr<CFDE_CSSValue> ParseString(const FX_WCHAR* pszValue, + CFX_RetainPtr<CFDE_CSSValue> ParseString(const wchar_t* pszValue, int32_t iValueLen); void AddPropertyHolder(FDE_CSSProperty eProperty, CFX_RetainPtr<CFDE_CSSValue> pValue, diff --git a/xfa/fde/css/cfde_cssselector.cpp b/xfa/fde/css/cfde_cssselector.cpp index 03580236f5..6842d58738 100644 --- a/xfa/fde/css/cfde_cssselector.cpp +++ b/xfa/fde/css/cfde_cssselector.cpp @@ -12,14 +12,14 @@ namespace { -bool IsCSSChar(FX_WCHAR wch) { +bool IsCSSChar(wchar_t wch) { return (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } -int32_t GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { - const FX_WCHAR* pStart = psz; +int32_t GetCSSNameLen(const wchar_t* psz, const wchar_t* pEnd) { + const wchar_t* pStart = psz; while (psz < pEnd) { - FX_WCHAR wch = *psz; + wchar_t wch = *psz; if (IsCSSChar(wch) || (wch >= '0' && wch <= '9') || wch == '_' || wch == '-') { ++psz; @@ -33,7 +33,7 @@ int32_t GetCSSNameLen(const FX_WCHAR* psz, const FX_WCHAR* pEnd) { } // namespace CFDE_CSSSelector::CFDE_CSSSelector(FDE_CSSSelectorType eType, - const FX_WCHAR* psz, + const wchar_t* psz, int32_t iLen, bool bIgnoreCase) : m_eType(eType), @@ -58,9 +58,9 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString( const CFX_WideStringC& str) { ASSERT(!str.IsEmpty()); - const FX_WCHAR* psz = str.c_str(); - const FX_WCHAR* pStart = psz; - const FX_WCHAR* pEnd = psz + str.GetLength(); + const wchar_t* psz = str.c_str(); + const wchar_t* pStart = psz; + const wchar_t* pEnd = psz + str.GetLength(); for (; psz < pEnd; ++psz) { switch (*psz) { case '>': @@ -72,7 +72,7 @@ std::unique_ptr<CFDE_CSSSelector> CFDE_CSSSelector::FromString( std::unique_ptr<CFDE_CSSSelector> pFirst = nullptr; for (psz = pStart; psz < pEnd;) { - FX_WCHAR wch = *psz; + wchar_t wch = *psz; if (IsCSSChar(wch) || wch == '*') { int32_t iNameLen = wch == '*' ? 1 : GetCSSNameLen(psz, pEnd); auto p = pdfium::MakeUnique<CFDE_CSSSelector>( diff --git a/xfa/fde/css/cfde_cssselector.h b/xfa/fde/css/cfde_cssselector.h index d585b3f368..048c51339e 100644 --- a/xfa/fde/css/cfde_cssselector.h +++ b/xfa/fde/css/cfde_cssselector.h @@ -19,7 +19,7 @@ class CFDE_CSSSelector { const CFX_WideStringC& str); CFDE_CSSSelector(FDE_CSSSelectorType eType, - const FX_WCHAR* psz, + const wchar_t* psz, int32_t iLen, bool bIgnoreCase); ~CFDE_CSSSelector(); diff --git a/xfa/fde/css/cfde_cssstylesheet.cpp b/xfa/fde/css/cfde_cssstylesheet.cpp index e259e2f332..175289be11 100644 --- a/xfa/fde/css/cfde_cssstylesheet.cpp +++ b/xfa/fde/css/cfde_cssstylesheet.cpp @@ -34,7 +34,7 @@ CFDE_CSSStyleRule* CFDE_CSSStyleSheet::GetRule(int32_t index) const { return m_RuleArray[index].get(); } -bool CFDE_CSSStyleSheet::LoadBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize) { +bool CFDE_CSSStyleSheet::LoadBuffer(const wchar_t* pBuffer, int32_t iBufSize) { ASSERT(pBuffer && iBufSize > 0); auto pSyntax = pdfium::MakeUnique<CFDE_CSSSyntaxParser>(); diff --git a/xfa/fde/css/cfde_cssstylesheet.h b/xfa/fde/css/cfde_cssstylesheet.h index 4de377219c..fa73460634 100644 --- a/xfa/fde/css/cfde_cssstylesheet.h +++ b/xfa/fde/css/cfde_cssstylesheet.h @@ -21,7 +21,7 @@ class CFDE_CSSStyleSheet { CFDE_CSSStyleSheet(); ~CFDE_CSSStyleSheet(); - bool LoadBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize); + bool LoadBuffer(const wchar_t* pBuffer, int32_t iBufSize); int32_t CountRules() const; CFDE_CSSStyleRule* GetRule(int32_t index) const; @@ -34,7 +34,7 @@ class CFDE_CSSStyleSheet { void SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax); std::vector<std::unique_ptr<CFDE_CSSStyleRule>> m_RuleArray; - std::unordered_map<uint32_t, FX_WCHAR*> m_StringCache; + std::unordered_map<uint32_t, wchar_t*> m_StringCache; }; #endif // XFA_FDE_CSS_CFDE_CSSSTYLESHEET_H_ diff --git a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp index 9d8ecb9347..0f450e9c3a 100644 --- a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp +++ b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp @@ -27,7 +27,7 @@ class CFDE_CSSStyleSheetTest : public testing::Test { void TearDown() override { decl_ = nullptr; } - void LoadAndVerifyDecl(const FX_WCHAR* buf, + void LoadAndVerifyDecl(const wchar_t* buf, const std::vector<CFX_WideString>& selectors, size_t decl_count) { ASSERT(sheet_); @@ -87,7 +87,7 @@ class CFDE_CSSStyleSheetTest : public testing::Test { }; TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) { - const FX_WCHAR* buf = + const wchar_t* buf = L"a { border: 10px; }\nb { text-decoration: underline; }"; EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf))); EXPECT_EQ(2, sheet_->CountRules()); @@ -136,7 +136,7 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) { } TEST_F(CFDE_CSSStyleSheetTest, ParseChildSelectors) { - const FX_WCHAR* buf = L"a b c { border: 10px; }"; + const wchar_t* buf = L"a b c { border: 10px; }"; EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf))); EXPECT_EQ(1, sheet_->CountRules()); @@ -171,7 +171,7 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseChildSelectors) { } TEST_F(CFDE_CSSStyleSheetTest, ParseUnhandledSelectors) { - const FX_WCHAR* buf = L"a > b { padding: 0; }"; + const wchar_t* buf = L"a > b { padding: 0; }"; EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf))); EXPECT_EQ(0, sheet_->CountRules()); diff --git a/xfa/fde/css/cfde_csssyntaxparser.cpp b/xfa/fde/css/cfde_csssyntaxparser.cpp index 2f7bcce9d7..fada76b6b1 100644 --- a/xfa/fde/css/cfde_csssyntaxparser.cpp +++ b/xfa/fde/css/cfde_csssyntaxparser.cpp @@ -14,7 +14,7 @@ namespace { -bool IsSelectorStart(FX_WCHAR wch) { +bool IsSelectorStart(wchar_t wch) { return wch == '.' || wch == '#' || wch == '*' || (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } @@ -32,7 +32,7 @@ CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() { m_TextPlane.Reset(); } -bool CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer, +bool CFDE_CSSSyntaxParser::Init(const wchar_t* pBuffer, int32_t iBufferSize, int32_t iTextDatSize, bool bOnlyDeclaration) { @@ -65,7 +65,7 @@ FDE_CSSSyntaxStatus CFDE_CSSSyntaxParser::DoSyntaxParse() { m_eStatus = FDE_CSSSyntaxStatus::EOS; return m_eStatus; } - FX_WCHAR wch; + wchar_t wch; while (!m_TextPlane.IsEOF()) { wch = m_TextPlane.GetChar(); switch (m_eMode) { @@ -198,7 +198,7 @@ bool CFDE_CSSSyntaxParser::IsImportEnabled() const { return true; } -bool CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) { +bool CFDE_CSSSyntaxParser::AppendChar(wchar_t wch) { m_TextPlane.MoveNext(); if (m_TextData.GetLength() > 0 || wch > ' ') { m_TextData.AppendChar(wch); diff --git a/xfa/fde/css/cfde_csssyntaxparser.h b/xfa/fde/css/cfde_csssyntaxparser.h index b583b98b15..a5e79d50e5 100644 --- a/xfa/fde/css/cfde_csssyntaxparser.h +++ b/xfa/fde/css/cfde_csssyntaxparser.h @@ -40,7 +40,7 @@ class CFDE_CSSSyntaxParser { CFDE_CSSSyntaxParser(); ~CFDE_CSSSyntaxParser(); - bool Init(const FX_WCHAR* pBuffer, + bool Init(const wchar_t* pBuffer, int32_t iBufferSize, int32_t iTextDatSize = 32, bool bOnlyDeclaration = false); @@ -53,7 +53,7 @@ class CFDE_CSSSyntaxParser { int32_t SwitchToComment(); bool RestoreMode(); - bool AppendChar(FX_WCHAR wch); + bool AppendChar(wchar_t wch); int32_t SaveTextData(); bool IsCharsetEnabled() const { return (m_dwCheck & FDE_CSSSYNTAXCHECK_AllowCharset) != 0; diff --git a/xfa/fde/css/cfde_csstextbuf.cpp b/xfa/fde/css/cfde_csstextbuf.cpp index 83b2899f19..5df09f0936 100644 --- a/xfa/fde/css/cfde_csstextbuf.cpp +++ b/xfa/fde/css/cfde_csstextbuf.cpp @@ -27,9 +27,9 @@ void CFDE_CSSTextBuf::Reset() { m_iDatPos = m_iDatLen = m_iBufLen; } -bool CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen) { +bool CFDE_CSSTextBuf::AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen) { Reset(); - m_pBuffer = const_cast<FX_WCHAR*>(pBuffer); + m_pBuffer = const_cast<wchar_t*>(pBuffer); m_iDatLen = m_iBufLen = iBufLen; return m_bExtBuf = true; } @@ -63,9 +63,9 @@ bool CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) { if (m_bExtBuf) return false; if (!m_pBuffer) - m_pBuffer = FX_Alloc(FX_WCHAR, iDesiredSize); + m_pBuffer = FX_Alloc(wchar_t, iDesiredSize); else if (m_iBufLen != iDesiredSize) - m_pBuffer = FX_Realloc(FX_WCHAR, m_pBuffer, iDesiredSize); + m_pBuffer = FX_Realloc(wchar_t, m_pBuffer, iDesiredSize); else return true; @@ -81,6 +81,6 @@ void CFDE_CSSTextBuf::Subtract(int32_t iStart, int32_t iLength) { ASSERT(iStart >= 0 && iLength >= 0); iLength = std::max(std::min(iLength, m_iDatLen - iStart), 0); - FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(FX_WCHAR)); + FXSYS_memmove(m_pBuffer, m_pBuffer + iStart, iLength * sizeof(wchar_t)); m_iDatLen = iLength; } diff --git a/xfa/fde/css/cfde_csstextbuf.h b/xfa/fde/css/cfde_csstextbuf.h index df151e02d8..9ade44be8a 100644 --- a/xfa/fde/css/cfde_csstextbuf.h +++ b/xfa/fde/css/cfde_csstextbuf.h @@ -17,13 +17,13 @@ class CFDE_CSSTextBuf { CFDE_CSSTextBuf(); ~CFDE_CSSTextBuf(); - bool AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); + bool AttachBuffer(const wchar_t* pBuffer, int32_t iBufLen); bool EstimateSize(int32_t iAllocSize); int32_t LoadFromStream(const CFX_RetainPtr<IFGAS_Stream>& pTxtStream, int32_t iStreamOffset, int32_t iMaxChars, bool& bEOS); - bool AppendChar(FX_WCHAR wch) { + bool AppendChar(wchar_t wch) { if (m_iDatLen >= m_iBufLen && !ExpandBuf(m_iBufLen * 2)) return false; m_pBuffer[m_iDatLen++] = wch; @@ -43,21 +43,21 @@ class CFDE_CSSTextBuf { void Subtract(int32_t iStart, int32_t iLength); bool IsEOF() const { return m_iDatPos >= m_iDatLen; } - FX_WCHAR GetAt(int32_t index) const { return m_pBuffer[index]; } - FX_WCHAR GetChar() const { return m_pBuffer[m_iDatPos]; } - FX_WCHAR GetNextChar() const { + wchar_t GetAt(int32_t index) const { return m_pBuffer[index]; } + wchar_t GetChar() const { return m_pBuffer[m_iDatPos]; } + wchar_t GetNextChar() const { return (m_iDatPos + 1 >= m_iDatLen) ? 0 : m_pBuffer[m_iDatPos + 1]; } void MoveNext() { m_iDatPos++; } int32_t GetLength() const { return m_iDatLen; } - const FX_WCHAR* GetBuffer() const { return m_pBuffer; } + const wchar_t* GetBuffer() const { return m_pBuffer; } protected: bool ExpandBuf(int32_t iDesiredSize); bool m_bExtBuf; - FX_WCHAR* m_pBuffer; + wchar_t* m_pBuffer; int32_t m_iBufLen; int32_t m_iDatLen; int32_t m_iDatPos; diff --git a/xfa/fde/css/cfde_cssvaluelistparser.cpp b/xfa/fde/css/cfde_cssvaluelistparser.cpp index 42c3296865..36d5edc3c7 100644 --- a/xfa/fde/css/cfde_cssvaluelistparser.cpp +++ b/xfa/fde/css/cfde_cssvaluelistparser.cpp @@ -6,15 +6,15 @@ #include "xfa/fde/css/cfde_cssvaluelistparser.h" -CFDE_CSSValueListParser::CFDE_CSSValueListParser(const FX_WCHAR* psz, +CFDE_CSSValueListParser::CFDE_CSSValueListParser(const wchar_t* psz, int32_t iLen, - FX_WCHAR separator) + wchar_t separator) : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { ASSERT(psz && iLen > 0); } bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, - const FX_WCHAR*& pStart, + const wchar_t*& pStart, int32_t& iLength) { while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) ++m_pCur; @@ -25,7 +25,7 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, eType = FDE_CSSPrimitiveType::Unknown; pStart = m_pCur; iLength = 0; - FX_WCHAR wch = *m_pCur; + wchar_t wch = *m_pCur; if (wch == '#') { iLength = SkipTo(' ', false, false); if (iLength == 4 || iLength == 7) @@ -56,10 +56,10 @@ bool CFDE_CSSValueListParser::NextValue(FDE_CSSPrimitiveType& eType, return m_pCur <= m_pEnd && iLength > 0; } -int32_t CFDE_CSSValueListParser::SkipTo(FX_WCHAR wch, +int32_t CFDE_CSSValueListParser::SkipTo(wchar_t wch, bool breakOnSpace, bool matchBrackets) { - const FX_WCHAR* pStart = m_pCur; + const wchar_t* pStart = m_pCur; int32_t bracketCount = 0; while (m_pCur < m_pEnd && *m_pCur != wch) { if (breakOnSpace && *m_pCur <= ' ') diff --git a/xfa/fde/css/cfde_cssvaluelistparser.h b/xfa/fde/css/cfde_cssvaluelistparser.h index 734aed8a52..e41ee5c313 100644 --- a/xfa/fde/css/cfde_cssvaluelistparser.h +++ b/xfa/fde/css/cfde_cssvaluelistparser.h @@ -12,21 +12,19 @@ class CFDE_CSSValueListParser { public: - CFDE_CSSValueListParser(const FX_WCHAR* psz, - int32_t iLen, - FX_WCHAR separator); + CFDE_CSSValueListParser(const wchar_t* psz, int32_t iLen, wchar_t separator); bool NextValue(FDE_CSSPrimitiveType& eType, - const FX_WCHAR*& pStart, + const wchar_t*& pStart, int32_t& iLength); - FX_WCHAR m_Separator; + wchar_t m_Separator; private: - int32_t SkipTo(FX_WCHAR wch, bool breakOnSpace, bool matchBrackets); + int32_t SkipTo(wchar_t wch, bool breakOnSpace, bool matchBrackets); - const FX_WCHAR* m_pCur; - const FX_WCHAR* m_pEnd; + const wchar_t* m_pCur; + const wchar_t* m_pEnd; }; #endif // XFA_FDE_CSS_CFDE_CSSVALUELISTPARSER_H_ diff --git a/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp b/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp index 71bb807f3d..2864c842ad 100644 --- a/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp +++ b/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp @@ -11,7 +11,7 @@ TEST(CFDE_CSSValueListParser, rgb_short) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = pdfium::MakeUnique<CFDE_CSSValueListParser>(L"#abc", 4, L' '); @@ -42,7 +42,7 @@ TEST(CFDE_CSSValueListParser, rgb_short) { TEST(CFDE_CSSValueListParser, number_parsing) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = pdfium::MakeUnique<CFDE_CSSValueListParser>(L"1234", 4, L' '); @@ -84,7 +84,7 @@ TEST(CFDE_CSSValueListParser, number_parsing) { TEST(CFDE_CSSValueListParser, string_parsing) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = @@ -107,7 +107,7 @@ TEST(CFDE_CSSValueListParser, string_parsing) { TEST(CFDE_CSSValueListParser, multiparsing) { FDE_CSSPrimitiveType type; - const FX_WCHAR* start; + const wchar_t* start; int32_t len; auto parser = diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index afb0b8502d..d1745f5d50 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -20,14 +20,14 @@ struct FDE_CSSPropertyTable { FDE_CSSProperty eName; - const FX_WCHAR* pszName; + const wchar_t* pszName; uint32_t dwHash; uint32_t dwType; }; struct FDE_CSSPropertyValueTable { FDE_CSSPropertyValue eName; - const FX_WCHAR* pszName; + const wchar_t* pszName; uint32_t dwHash; }; diff --git a/xfa/fde/ifde_txtedtengine.h b/xfa/fde/ifde_txtedtengine.h index 67944e01f9..f803eff079 100644 --- a/xfa/fde/ifde_txtedtengine.h +++ b/xfa/fde/ifde_txtedtengine.h @@ -85,8 +85,8 @@ struct FDE_TXTEDTPARAMS { FX_FLOAT fLineSpace; FX_FLOAT fTabWidth; bool bTabEquidistant; - FX_WCHAR wDefChar; - FX_WCHAR wLineBreakChar; + wchar_t wDefChar; + wchar_t wLineBreakChar; int32_t nLineEnd; int32_t nHorzScale; FX_FLOAT fCharSpace; diff --git a/xfa/fde/ifx_chariter.h b/xfa/fde/ifx_chariter.h index c967efd4d6..0e4adc5d01 100644 --- a/xfa/fde/ifx_chariter.h +++ b/xfa/fde/ifx_chariter.h @@ -14,7 +14,7 @@ class IFX_CharIter { virtual ~IFX_CharIter() {} virtual bool Next(bool bPrev = false) = 0; - virtual FX_WCHAR GetChar() = 0; + virtual wchar_t GetChar() = 0; virtual void SetAt(int32_t nIndex) = 0; virtual int32_t GetAt() const = 0; virtual bool IsEOF(bool bTail = true) const = 0; diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index 02b1522823..36f341b39c 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -82,7 +82,7 @@ void CFDE_TextOut::SetEllipsisString(const CFX_WideString& wsEllipsis) { m_wsEllipsis = wsEllipsis; } -void CFDE_TextOut::SetParagraphBreakChar(FX_WCHAR wch) { +void CFDE_TextOut::SetParagraphBreakChar(wchar_t wch) { m_wParagraphBkChar = wch; m_pTxtBreak->SetParagraphBreakChar(wch); } @@ -151,7 +151,7 @@ int32_t CFDE_TextOut::GetTotalLines() { return m_iTotalLines; } -void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, +void CFDE_TextOut::CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_SizeF& size) { CFX_RectF rtText(0.0f, 0.0f, size.width, size.height); @@ -159,7 +159,7 @@ void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, size = rtText.Size(); } -void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, +void CFDE_TextOut::CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect) { if (!pwsStr || iLength < 1) { @@ -170,21 +170,21 @@ void CFDE_TextOut::CalcLogicSize(const FX_WCHAR* pwsStr, } } -void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr, +void CFDE_TextOut::CalcTextSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect) { ASSERT(m_pFont && m_fFontSize >= 1.0f); SetLineWidth(rect); m_iTotalLines = 0; - const FX_WCHAR* pStr = pwsStr; + const wchar_t* pStr = pwsStr; bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); FX_FLOAT fWidth = 0.0f; FX_FLOAT fHeight = 0.0f; FX_FLOAT fStartPos = rect.right(); CFX_BreakType dwBreakStatus = CFX_BreakType::None; - FX_WCHAR wPreChar = 0; - FX_WCHAR wch; - FX_WCHAR wBreak = 0; + wchar_t wPreChar = 0; + wchar_t wch; + wchar_t wBreak = 0; while (iLength-- > 0) { wch = *pStr++; if (wBreak == 0 && (wch == L'\n' || wch == L'\r')) { @@ -264,7 +264,7 @@ bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus, return true; } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, int32_t x, int32_t y) { @@ -273,7 +273,7 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, DrawText(pwsStr, iLength, rtText); } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y) { @@ -281,13 +281,13 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, CFX_RectF(x, y, m_fFontSize * 1000.0f, m_fFontSize * 1000.0f)); } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_Rect& rect) { DrawText(pwsStr, iLength, rect.As<FX_FLOAT>()); } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect) { CFX_RectF rtText(rect.left, rect.top, rect.width, rect.height); @@ -297,7 +297,7 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, DrawText(pwsStr, iLength, rtText, m_rtClip); } -void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawLogicText(const wchar_t* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y) { @@ -305,7 +305,7 @@ void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, DrawLogicText(pwsStr, iLength, rtText); } -void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawLogicText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect) { CFX_RectF rtClip(m_rtLogicClip.left, m_rtLogicClip.top, m_rtLogicClip.width, @@ -314,7 +314,7 @@ void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr, DrawText(pwsStr, iLength, rect, rtClip); } -void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect, const CFX_RectF& rtClip) { @@ -367,9 +367,9 @@ void CFDE_TextOut::LoadEllipsis() { return; } ExpandBuffer(iLength, 1); - const FX_WCHAR* pStr = m_wsEllipsis.c_str(); + const wchar_t* pStr = m_wsEllipsis.c_str(); CFX_BreakType dwBreakStatus; - FX_WCHAR wch; + wchar_t wch; while (iLength-- > 0) { wch = *pStr++; dwBreakStatus = m_pTxtBreak->AppendChar(wch); @@ -399,10 +399,10 @@ void CFDE_TextOut::RetrieveEllPieces(std::vector<int32_t>* pCharWidths) { m_pTxtBreak->ClearBreakPieces(); } -void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr, +void CFDE_TextOut::LoadText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect) { - FX_WCHAR* pStr = m_wsText.GetBuffer(iLength); + wchar_t* pStr = m_wsText.GetBuffer(iLength); int32_t iTxtLength = iLength; ExpandBuffer(iTxtLength, 0); bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); @@ -416,7 +416,7 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr, int32_t iChars = 0; int32_t iPieceWidths = 0; CFX_BreakType dwBreakStatus; - FX_WCHAR wch; + wchar_t wch; bool bRet = false; while (iTxtLength-- > 0) { wch = *pwsStr++; @@ -591,7 +591,7 @@ void CFDE_TextOut::Reload(const CFX_RectF& rect) { } void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { - const FX_WCHAR* pwsStr = m_wsText.c_str(); + const wchar_t* pwsStr = m_wsText.c_str(); int32_t iPieceWidths = 0; FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0); int32_t iStartChar = pPiece->iStartChar; @@ -599,7 +599,7 @@ void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { int32_t iPieceCount = pLine->GetSize(); int32_t iPieceIndex = 0; CFX_BreakType dwBreakStatus = CFX_BreakType::None; - FX_WCHAR wch; + wchar_t wch; while (iPieceIndex < iPieceCount) { int32_t iStar = iStartChar; int32_t iEnd = pPiece->iChars + iStar; diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index 1519a81e8f..224a584a4e 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -84,7 +84,7 @@ class CFDE_TextOut { void SetStyles(uint32_t dwStyles); void SetTabWidth(FX_FLOAT fTabWidth); void SetEllipsisString(const CFX_WideString& wsEllipsis); - void SetParagraphBreakChar(FX_WCHAR wch); + void SetParagraphBreakChar(wchar_t wch); void SetAlignment(int32_t iAlignment); void SetLineSpace(FX_FLOAT fLineSpace); void SetDIBitmap(CFX_DIBitmap* pDIB); @@ -94,38 +94,35 @@ class CFDE_TextOut { void SetMatrix(const CFX_Matrix& matrix); void SetLineBreakTolerance(FX_FLOAT fTolerance); - void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, int32_t x, int32_t y); - void DrawText(const FX_WCHAR* pwsStr, - int32_t iLength, - FX_FLOAT x, - FX_FLOAT y); - void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_Rect& rect); - void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect); + void DrawText(const wchar_t* pwsStr, int32_t iLength, int32_t x, int32_t y); + void DrawText(const wchar_t* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y); + void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_Rect& rect); + void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect); void SetLogicClipRect(const CFX_RectF& rtClip); - void CalcLogicSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_SizeF& size); - void CalcLogicSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect); - void DrawLogicText(const FX_WCHAR* pwsStr, + void CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_SizeF& size); + void CalcLogicSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect); + void DrawLogicText(const wchar_t* pwsStr, int32_t iLength, FX_FLOAT x, FX_FLOAT y); - void DrawLogicText(const FX_WCHAR* pwsStr, + void DrawLogicText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect); int32_t GetTotalLines(); protected: - void CalcTextSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect); + void CalcTextSize(const wchar_t* pwsStr, int32_t iLength, CFX_RectF& rect); bool RetrieveLineWidth(CFX_BreakType dwBreakStatus, FX_FLOAT& fStartPos, FX_FLOAT& fWidth, FX_FLOAT& fHeight); void SetLineWidth(CFX_RectF& rect); - void DrawText(const FX_WCHAR* pwsStr, + void DrawText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect, const CFX_RectF& rtClip); - void LoadText(const FX_WCHAR* pwsStr, int32_t iLength, const CFX_RectF& rect); + void LoadText(const wchar_t* pwsStr, int32_t iLength, const CFX_RectF& rect); void LoadEllipsis(); void ExpandBuffer(int32_t iSize, int32_t iType); void RetrieveEllPieces(std::vector<int32_t>* pCharWidths); @@ -157,7 +154,7 @@ class CFDE_TextOut { int32_t m_iTxtBkAlignment; std::vector<int32_t> m_CharWidths; std::vector<int32_t> m_EllCharWidths; - FX_WCHAR m_wParagraphBkChar; + wchar_t m_wParagraphBkChar; FX_ARGB m_TxtColor; uint32_t m_dwStyles; uint32_t m_dwTxtBkStyles; diff --git a/xfa/fde/xml/fde_xml.h b/xfa/fde/xml/fde_xml.h index e773b30851..399a930615 100644 --- a/xfa/fde/xml/fde_xml.h +++ b/xfa/fde/xml/fde_xml.h @@ -40,6 +40,6 @@ struct FDE_XMLNODE { FDE_XMLNODETYPE eNodeType; }; -bool FDE_IsXMLValidChar(FX_WCHAR ch); +bool FDE_IsXMLValidChar(wchar_t ch); #endif // XFA_FDE_XML_FDE_XML_H_ diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp index 3e5edaf459..541fd98a00 100644 --- a/xfa/fde/xml/fde_xml_imp.cpp +++ b/xfa/fde/xml/fde_xml_imp.cpp @@ -24,7 +24,7 @@ const uint16_t g_XMLValidCharRange[][2] = {{0x09, 0x09}, {0x20, 0xD7FF}, {0xE000, 0xFFFD}}; -bool FDE_IsXMLWhiteSpace(FX_WCHAR ch) { +bool FDE_IsXMLWhiteSpace(wchar_t ch) { return ch == L' ' || ch == 0x0A || ch == 0x0D || ch == 0x09; } @@ -44,7 +44,7 @@ const FDE_XMLNAMECHAR g_XMLNameChars[] = { {0xF900, 0xFDCF, true}, {0xFDF0, 0xFFFD, true}, }; -bool FDE_IsXMLNameChar(FX_WCHAR ch, bool bFirstChar) { +bool FDE_IsXMLNameChar(wchar_t ch, bool bFirstChar) { int32_t iStart = 0; int32_t iEnd = FX_ArraySize(g_XMLNameChars) - 1; while (iStart <= iEnd) { @@ -62,7 +62,7 @@ bool FDE_IsXMLNameChar(FX_WCHAR ch, bool bFirstChar) { } // namespace -bool FDE_IsXMLValidChar(FX_WCHAR ch) { +bool FDE_IsXMLValidChar(wchar_t ch) { int32_t iStart = 0; int32_t iEnd = FX_ArraySize(g_XMLValidCharRange) - 1; while (iStart <= iEnd) { @@ -137,7 +137,7 @@ int32_t CFDE_XMLNode::GetChildNodeIndex(CFDE_XMLNode* pNode) const { return -1; } -CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath, +CFDE_XMLNode* CFDE_XMLNode::GetPath(const wchar_t* pPath, int32_t iLength, bool bQualifiedName) const { ASSERT(pPath); @@ -148,9 +148,9 @@ CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath, return nullptr; } CFX_WideString csPath; - const FX_WCHAR* pStart = pPath; - const FX_WCHAR* pEnd = pPath + iLength; - FX_WCHAR ch; + const wchar_t* pStart = pPath; + const wchar_t* pEnd = pPath + iLength; + wchar_t ch; while (pStart < pEnd) { ch = *pStart++; if (ch == L'/') { @@ -562,7 +562,7 @@ bool CFDE_XMLInstruction::GetAttribute(int32_t index, return false; } -bool CFDE_XMLInstruction::HasAttribute(const FX_WCHAR* pwsAttriName) const { +bool CFDE_XMLInstruction::HasAttribute(const wchar_t* pwsAttriName) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -572,9 +572,9 @@ bool CFDE_XMLInstruction::HasAttribute(const FX_WCHAR* pwsAttriName) const { return false; } -void CFDE_XMLInstruction::GetString(const FX_WCHAR* pwsAttriName, +void CFDE_XMLInstruction::GetString(const wchar_t* pwsAttriName, CFX_WideString& wsAttriValue, - const FX_WCHAR* pwsDefValue) const { + const wchar_t* pwsDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -600,7 +600,7 @@ void CFDE_XMLInstruction::SetString(const CFX_WideString& wsAttriName, m_Attributes.push_back(wsAttriValue); } -int32_t CFDE_XMLInstruction::GetInteger(const FX_WCHAR* pwsAttriName, +int32_t CFDE_XMLInstruction::GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { @@ -611,14 +611,14 @@ int32_t CFDE_XMLInstruction::GetInteger(const FX_WCHAR* pwsAttriName, return iDefValue; } -void CFDE_XMLInstruction::SetInteger(const FX_WCHAR* pwsAttriName, +void CFDE_XMLInstruction::SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%d", iAttriValue); SetString(pwsAttriName, wsValue); } -FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName, +FX_FLOAT CFDE_XMLInstruction::GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { @@ -629,14 +629,14 @@ FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName, return fDefValue; } -void CFDE_XMLInstruction::SetFloat(const FX_WCHAR* pwsAttriName, +void CFDE_XMLInstruction::SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%f", fAttriValue); SetString(pwsAttriName, wsValue); } -void CFDE_XMLInstruction::RemoveAttribute(const FX_WCHAR* pwsAttriName) { +void CFDE_XMLInstruction::RemoveAttribute(const wchar_t* pwsAttriName) { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -774,7 +774,7 @@ bool CFDE_XMLElement::GetAttribute(int32_t index, return false; } -bool CFDE_XMLElement::HasAttribute(const FX_WCHAR* pwsAttriName) const { +bool CFDE_XMLElement::HasAttribute(const wchar_t* pwsAttriName) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) @@ -783,9 +783,9 @@ bool CFDE_XMLElement::HasAttribute(const FX_WCHAR* pwsAttriName) const { return false; } -void CFDE_XMLElement::GetString(const FX_WCHAR* pwsAttriName, +void CFDE_XMLElement::GetString(const wchar_t* pwsAttriName, CFX_WideString& wsAttriValue, - const FX_WCHAR* pwsDefValue) const { + const wchar_t* pwsDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -811,7 +811,7 @@ void CFDE_XMLElement::SetString(const CFX_WideString& wsAttriName, m_Attributes.push_back(wsAttriValue); } -int32_t CFDE_XMLElement::GetInteger(const FX_WCHAR* pwsAttriName, +int32_t CFDE_XMLElement::GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { @@ -822,14 +822,14 @@ int32_t CFDE_XMLElement::GetInteger(const FX_WCHAR* pwsAttriName, return iDefValue; } -void CFDE_XMLElement::SetInteger(const FX_WCHAR* pwsAttriName, +void CFDE_XMLElement::SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%d", iAttriValue); SetString(pwsAttriName, wsValue); } -FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName, +FX_FLOAT CFDE_XMLElement::GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue) const { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { @@ -840,14 +840,14 @@ FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName, return fDefValue; } -void CFDE_XMLElement::SetFloat(const FX_WCHAR* pwsAttriName, +void CFDE_XMLElement::SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue) { CFX_WideString wsValue; wsValue.Format(L"%f", fAttriValue); SetString(pwsAttriName, wsValue); } -void CFDE_XMLElement::RemoveAttribute(const FX_WCHAR* pwsAttriName) { +void CFDE_XMLElement::RemoveAttribute(const wchar_t* pwsAttriName) { int32_t iCount = pdfium::CollectionSize<int32_t>(m_Attributes); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { @@ -1112,14 +1112,14 @@ CFDE_BlockBuffer::~CFDE_BlockBuffer() { ClearBuffer(); } -FX_WCHAR* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) { +wchar_t* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) { iIndexInBlock = 0; if (!m_BlockArray.GetSize()) { return nullptr; } int32_t iRealIndex = m_iStartPosition + m_iDataLength; if (iRealIndex == m_iBufferSize) { - FX_WCHAR* pBlock = FX_Alloc(FX_WCHAR, m_iAllocStep); + wchar_t* pBlock = FX_Alloc(wchar_t, m_iAllocStep); m_BlockArray.Add(pBlock); m_iBufferSize += m_iAllocStep; return pBlock; @@ -1132,13 +1132,13 @@ bool CFDE_BlockBuffer::InitBuffer(int32_t iBufferSize) { ClearBuffer(); int32_t iNumOfBlock = (iBufferSize - 1) / m_iAllocStep + 1; for (int32_t i = 0; i < iNumOfBlock; i++) { - m_BlockArray.Add(FX_Alloc(FX_WCHAR, m_iAllocStep)); + m_BlockArray.Add(FX_Alloc(wchar_t, m_iAllocStep)); } m_iBufferSize = iNumOfBlock * m_iAllocStep; return true; } -void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, FX_WCHAR ch) { +void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, wchar_t ch) { if (iIndex < 0) { return; } @@ -1149,12 +1149,12 @@ void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, FX_WCHAR ch) { if (iBlockIndex >= iBlockSize) { int32_t iNewBlocks = iBlockIndex - iBlockSize + 1; do { - FX_WCHAR* pBlock = FX_Alloc(FX_WCHAR, m_iAllocStep); + wchar_t* pBlock = FX_Alloc(wchar_t, m_iAllocStep); m_BlockArray.Add(pBlock); m_iBufferSize += m_iAllocStep; } while (--iNewBlocks); } - FX_WCHAR* pTextData = m_BlockArray[iBlockIndex]; + wchar_t* pTextData = m_BlockArray[iBlockIndex]; *(pTextData + iInnerIndex) = ch; if (m_iDataLength <= iIndex) { m_iDataLength = iIndex + 1; @@ -1192,7 +1192,7 @@ void CFDE_BlockBuffer::GetTextData(CFX_WideString& wsTextData, if (iLength <= 0) { return; } - FX_WCHAR* pBuf = wsTextData.GetBuffer(iLength); + wchar_t* pBuf = wsTextData.GetBuffer(iLength); if (!pBuf) { return; } @@ -1213,9 +1213,9 @@ void CFDE_BlockBuffer::GetTextData(CFX_WideString& wsTextData, if (i == iEndBlockIndex) { iCopyLength -= ((m_iAllocStep - 1) - iEndInnerIndex); } - FX_WCHAR* pBlockBuf = m_BlockArray[i]; + wchar_t* pBlockBuf = m_BlockArray[i]; FXSYS_memcpy(pBuf + iPointer, pBlockBuf + iBufferPointer, - iCopyLength * sizeof(FX_WCHAR)); + iCopyLength * sizeof(wchar_t)); iPointer += iCopyLength; } wsTextData.ReleaseBuffer(iLength); @@ -1286,7 +1286,7 @@ void CFDE_XMLSyntaxParser::Init(const CFX_RetainPtr<IFGAS_Stream>& pStream, } m_pBuffer = FX_Alloc( - FX_WCHAR, pdfium::base::ValueOrDieForType<size_t>(alloc_size_safe)); + wchar_t, pdfium::base::ValueOrDieForType<size_t>(alloc_size_safe)); m_pStart = m_pEnd = m_pBuffer; ASSERT(!m_BlockBuffer.IsInitialized()); m_BlockBuffer.InitBuffer(); @@ -1330,7 +1330,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() { } while (m_pStart < m_pEnd) { - FX_WCHAR ch = *m_pStart; + wchar_t ch = *m_pStart; switch (m_syntaxParserState) { case FDE_XmlSyntaxState::Text: if (ch == L'<') { @@ -1778,7 +1778,7 @@ int32_t CFDE_XMLSyntaxParser::GetStatus() const { return m_iParsedBytes * 100 / iStreamLength; } -static int32_t FX_GetUTF8EncodeLength(const FX_WCHAR* pSrc, int32_t iSrcLen) { +static int32_t FX_GetUTF8EncodeLength(const wchar_t* pSrc, int32_t iSrcLen) { uint32_t unicode = 0; int32_t iDstNum = 0; while (iSrcLen-- > 0) { @@ -1811,7 +1811,7 @@ FX_FILESIZE CFDE_XMLSyntaxParser::GetCurrentBinaryPos() const { return m_iParsedBytes + nDstLen; } -void CFDE_XMLSyntaxParser::ParseTextChar(FX_WCHAR character) { +void CFDE_XMLSyntaxParser::ParseTextChar(wchar_t character) { if (m_iIndexInBlock == m_iAllocStep) { m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock); if (!m_pCurrentBlock) { @@ -1828,7 +1828,7 @@ void CFDE_XMLSyntaxParser::ParseTextChar(FX_WCHAR character) { if (iLen > 0) { if (csEntity[0] == L'#') { uint32_t ch = 0; - FX_WCHAR w; + wchar_t w; if (iLen > 1 && csEntity[1] == L'x') { for (int32_t i = 2; i < iLen; i++) { w = csEntity[i]; @@ -1853,7 +1853,7 @@ void CFDE_XMLSyntaxParser::ParseTextChar(FX_WCHAR character) { if (ch > kMaxCharRange) ch = ' '; - character = static_cast<FX_WCHAR>(ch); + character = static_cast<wchar_t>(ch); if (character != 0) { m_BlockBuffer.SetTextChar(m_iEntityStart, character); m_iEntityStart++; diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h index d9ccbea506..7ae05a4936 100644 --- a/xfa/fde/xml/fde_xml_imp.h +++ b/xfa/fde/xml/fde_xml_imp.h @@ -56,7 +56,7 @@ class CFDE_XMLNode { void DeleteChildren(); void CloneChildren(CFDE_XMLNode* pClone); - CFDE_XMLNode* GetPath(const FX_WCHAR* pPath, + CFDE_XMLNode* GetPath(const wchar_t* pPath, int32_t iLength = -1, bool bQualifiedName = true) const; @@ -87,17 +87,17 @@ class CFDE_XMLInstruction : public CFDE_XMLNode { bool GetAttribute(int32_t index, CFX_WideString& wsAttriName, CFX_WideString& wsAttriValue) const; - bool HasAttribute(const FX_WCHAR* pwsAttriName) const; - void GetString(const FX_WCHAR* pwsAttriName, + bool HasAttribute(const wchar_t* pwsAttriName) const; + void GetString(const wchar_t* pwsAttriName, CFX_WideString& wsAttriValue, - const FX_WCHAR* pwsDefValue = nullptr) const; + const wchar_t* pwsDefValue = nullptr) const; void SetString(const CFX_WideString& wsAttriName, const CFX_WideString& wsAttriValue); - int32_t GetInteger(const FX_WCHAR* pwsAttriName, int32_t iDefValue = 0) const; - void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue); - FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fDefValue = 0) const; - void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue); - void RemoveAttribute(const FX_WCHAR* pwsAttriName); + int32_t GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue = 0) const; + void SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue); + FX_FLOAT GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue = 0) const; + void SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue); + void RemoveAttribute(const wchar_t* pwsAttriName); int32_t CountData() const; bool GetData(int32_t index, CFX_WideString& wsData) const; void AppendData(const CFX_WideString& wsData); @@ -127,20 +127,20 @@ class CFDE_XMLElement : public CFDE_XMLNode { bool GetAttribute(int32_t index, CFX_WideString& wsAttriName, CFX_WideString& wsAttriValue) const; - bool HasAttribute(const FX_WCHAR* pwsAttriName) const; - void RemoveAttribute(const FX_WCHAR* pwsAttriName); + bool HasAttribute(const wchar_t* pwsAttriName) const; + void RemoveAttribute(const wchar_t* pwsAttriName); - void GetString(const FX_WCHAR* pwsAttriName, + void GetString(const wchar_t* pwsAttriName, CFX_WideString& wsAttriValue, - const FX_WCHAR* pwsDefValue = nullptr) const; + const wchar_t* pwsDefValue = nullptr) const; void SetString(const CFX_WideString& wsAttriName, const CFX_WideString& wsAttriValue); - int32_t GetInteger(const FX_WCHAR* pwsAttriName, int32_t iDefValue = 0) const; - void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue); + int32_t GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue = 0) const; + void SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue); - FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fDefValue = 0) const; - void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue); + FX_FLOAT GetFloat(const wchar_t* pwsAttriName, FX_FLOAT fDefValue = 0) const; + void SetFloat(const wchar_t* pwsAttriName, FX_FLOAT fAttriValue); void GetTextData(CFX_WideString& wsText) const; void SetTextData(const CFX_WideString& wsText); @@ -222,7 +222,7 @@ class CFDE_BlockBuffer { bool InitBuffer(int32_t iBufferSize = 1024 * 1024); bool IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; } - FX_WCHAR* GetAvailableBlock(int32_t& iIndexInBlock); + wchar_t* GetAvailableBlock(int32_t& iIndexInBlock); inline int32_t GetAllocStep() const { return m_iAllocStep; } inline int32_t& GetDataLengthRef() { return m_iDataLength; } inline void Reset(bool bReserveData = true) { @@ -231,7 +231,7 @@ class CFDE_BlockBuffer { } m_iDataLength = 0; } - void SetTextChar(int32_t iIndex, FX_WCHAR ch); + void SetTextChar(int32_t iIndex, wchar_t ch); int32_t DeleteTextChars(int32_t iCount, bool bDirection = true); void GetTextData(CFX_WideString& wsTextData, int32_t iStart = 0, @@ -243,7 +243,7 @@ class CFDE_BlockBuffer { int32_t& iInnerIndex) const; void ClearBuffer(); - CFX_ArrayTemplate<FX_WCHAR*> m_BlockArray; + CFX_ArrayTemplate<wchar_t*> m_BlockArray; int32_t m_iDataLength; int32_t m_iBufferSize; int32_t m_iAllocStep; @@ -312,7 +312,7 @@ class CFDE_XMLSyntaxParser { TargetData }; - void ParseTextChar(FX_WCHAR ch); + void ParseTextChar(wchar_t ch); CFX_RetainPtr<IFGAS_Stream> m_pStream; int32_t m_iXMLPlaneSize; @@ -321,25 +321,25 @@ class CFDE_XMLSyntaxParser { int32_t m_iLastNodeNum; int32_t m_iParsedChars; int32_t m_iParsedBytes; - FX_WCHAR* m_pBuffer; + wchar_t* m_pBuffer; int32_t m_iBufferChars; bool m_bEOS; - FX_WCHAR* m_pStart; - FX_WCHAR* m_pEnd; + wchar_t* m_pStart; + wchar_t* m_pEnd; FDE_XMLNODE m_CurNode; std::stack<FDE_XMLNODE> m_XMLNodeStack; CFDE_BlockBuffer m_BlockBuffer; int32_t m_iAllocStep; int32_t& m_iDataLength; - FX_WCHAR* m_pCurrentBlock; + wchar_t* m_pCurrentBlock; int32_t m_iIndexInBlock; int32_t m_iTextDataLength; FDE_XmlSyntaxResult m_syntaxParserResult; FDE_XmlSyntaxState m_syntaxParserState; - FX_WCHAR m_wQuotationMark; + wchar_t m_wQuotationMark; int32_t m_iEntityStart; - std::stack<FX_WCHAR> m_SkipStack; - FX_WCHAR m_SkipChar; + std::stack<wchar_t> m_SkipStack; + wchar_t m_SkipChar; }; #endif // XFA_FDE_XML_FDE_XML_IMP_H_ diff --git a/xfa/fde/xml/fde_xml_imp_unittest.cpp b/xfa/fde/xml/fde_xml_imp_unittest.cpp index 6db1b1905a..6191025fd2 100644 --- a/xfa/fde/xml/fde_xml_imp_unittest.cpp +++ b/xfa/fde/xml/fde_xml_imp_unittest.cpp @@ -10,7 +10,7 @@ #include "xfa/fgas/crt/fgas_stream.h" TEST(CFDE_XMLSyntaxParser, CData) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA[\n" L" if (a[1] < 3)\n" @@ -18,16 +18,16 @@ TEST(CFDE_XMLSyntaxParser, CData) { L" ]]>\n" L"</script>"; - const FX_WCHAR* cdata = + const wchar_t* cdata = L"\n" L" if (a[1] < 3)\n" L" app.alert(\"Tclams\");\n" L" "; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -65,7 +65,7 @@ TEST(CFDE_XMLSyntaxParser, CData) { } TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA[\n" L" if (a[1] < 3)\n" @@ -74,17 +74,17 @@ TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) { L" ]]>\n" L"</script>"; - const FX_WCHAR* cdata = + const wchar_t* cdata = L"\n" L" if (a[1] < 3)\n" L" app.alert(\"Tclams\");\n" L" </script>\n" L" "; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -122,15 +122,15 @@ TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) { } TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!>\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -164,15 +164,15 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) { } TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![>\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -200,15 +200,15 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) { } TEST(CFDE_XMLSyntaxParser, IncompleteCData) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA>\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -236,15 +236,15 @@ TEST(CFDE_XMLSyntaxParser, IncompleteCData) { } TEST(CFDE_XMLSyntaxParser, UnClosedCData) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA[\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -272,15 +272,15 @@ TEST(CFDE_XMLSyntaxParser, UnClosedCData) { } TEST(CFDE_XMLSyntaxParser, EmptyCData) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <![CDATA[]]>\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -318,15 +318,15 @@ TEST(CFDE_XMLSyntaxParser, EmptyCData) { } TEST(CFDE_XMLSyntaxParser, Comment) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!-- A Comment -->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -360,15 +360,15 @@ TEST(CFDE_XMLSyntaxParser, Comment) { } TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!- A Comment -->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -402,15 +402,15 @@ TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) { } TEST(CFDE_XMLSyntaxParser, CommentEmpty) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!---->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -444,15 +444,15 @@ TEST(CFDE_XMLSyntaxParser, CommentEmpty) { } TEST(CFDE_XMLSyntaxParser, CommentThreeDash) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!--->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -478,15 +478,15 @@ TEST(CFDE_XMLSyntaxParser, CommentThreeDash) { } TEST(CFDE_XMLSyntaxParser, CommentTwoDash) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">\n" L" <!-->\n" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -512,7 +512,7 @@ TEST(CFDE_XMLSyntaxParser, CommentTwoDash) { } TEST(CFDE_XMLSyntaxParser, Entities) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">" L"B" L"T" @@ -521,10 +521,10 @@ TEST(CFDE_XMLSyntaxParser, Entities) { L"�" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -554,16 +554,16 @@ TEST(CFDE_XMLSyntaxParser, Entities) { } TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">" L"�" L"�" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); @@ -593,16 +593,16 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) { } TEST(CFDE_XMLSyntaxParser, EntityOverflowDecimal) { - const FX_WCHAR* input = + const wchar_t* input = L"<script contentType=\"application/x-javascript\">" L"�" L"�" L"</script>"; - // We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR. - size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR); + // We * sizeof(wchar_t) because we pass in the uint8_t, not the wchar_t. + size_t len = FXSYS_wcslen(input) * sizeof(wchar_t); CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream( - reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0); + reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0); CFDE_XMLSyntaxParser parser; parser.Init(stream, 256); EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); |