From 812e96c2b4c5908a1979da5e27cdcecda0d1dfc9 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 13 Mar 2017 16:43:37 -0400 Subject: Replace FX_CHAR and FX_WCHAR with underlying types. Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8 Reviewed-on: https://pdfium-review.googlesource.com/2967 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/app/cxfa_linkuserdata.cpp | 2 +- xfa/fxfa/app/cxfa_linkuserdata.h | 4 ++-- xfa/fxfa/app/cxfa_textlayout.cpp | 6 +++--- xfa/fxfa/app/cxfa_textparser.cpp | 6 +++--- xfa/fxfa/app/xfa_checksum.cpp | 12 +++++------- xfa/fxfa/app/xfa_ffbarcode.cpp | 2 +- xfa/fxfa/app/xfa_ffbarcode.h | 2 +- xfa/fxfa/app/xfa_ffdoc.cpp | 20 ++++++++++---------- xfa/fxfa/app/xfa_ffnotify.cpp | 4 ++-- xfa/fxfa/app/xfa_ffnotify.h | 4 ++-- xfa/fxfa/app/xfa_fftext.cpp | 6 +++--- xfa/fxfa/app/xfa_fftext.h | 2 +- xfa/fxfa/app/xfa_ffwidget.cpp | 16 ++++++++-------- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 4 ++-- xfa/fxfa/app/xfa_fontmgr.cpp | 8 ++++---- xfa/fxfa/app/xfa_fwltheme.cpp | 2 +- 16 files changed, 49 insertions(+), 51 deletions(-) (limited to 'xfa/fxfa/app') diff --git a/xfa/fxfa/app/cxfa_linkuserdata.cpp b/xfa/fxfa/app/cxfa_linkuserdata.cpp index 4128cd8822..d657b28539 100644 --- a/xfa/fxfa/app/cxfa_linkuserdata.cpp +++ b/xfa/fxfa/app/cxfa_linkuserdata.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/app/cxfa_linkuserdata.h" -CXFA_LinkUserData::CXFA_LinkUserData(FX_WCHAR* pszText) +CXFA_LinkUserData::CXFA_LinkUserData(wchar_t* pszText) : m_wsURLContent(pszText) {} CXFA_LinkUserData::~CXFA_LinkUserData() {} diff --git a/xfa/fxfa/app/cxfa_linkuserdata.h b/xfa/fxfa/app/cxfa_linkuserdata.h index 852b467648..5f4675962d 100644 --- a/xfa/fxfa/app/cxfa_linkuserdata.h +++ b/xfa/fxfa/app/cxfa_linkuserdata.h @@ -17,10 +17,10 @@ class CXFA_LinkUserData : public CFX_Retainable { template friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); - const FX_WCHAR* GetLinkURL() const { return m_wsURLContent.c_str(); } + const wchar_t* GetLinkURL() const { return m_wsURLContent.c_str(); } protected: - explicit CXFA_LinkUserData(FX_WCHAR* pszText); + explicit CXFA_LinkUserData(wchar_t* pszText); ~CXFA_LinkUserData() override; CFX_WideString m_wsURLContent; diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index c2d2a9ef6d..3c0087de09 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -897,7 +897,7 @@ bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText, int32_t iLength = wsText.GetLength(); for (int32_t i = iChar; i < iLength; i++) { - FX_WCHAR wch = wsText.GetAt(i); + wchar_t wch = wsText.GetAt(i); if (wch == 0xA0) wch = 0x20; @@ -932,9 +932,9 @@ void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) { if (iLen == 0) return; - FX_WCHAR* psz = wsText.GetBuffer(iLen); + wchar_t* psz = wsText.GetBuffer(iLen); int32_t iTrimLeft = 0; - FX_WCHAR wch = 0, wPrev = 0; + wchar_t wch = 0, wPrev = 0; for (int32_t i = 0; i < iLen; i++) { wch = psz[i]; if (wch < 0x20) diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp index 9759cb219d..750a0baaff 100644 --- a/xfa/fxfa/app/cxfa_textparser.cpp +++ b/xfa/fxfa/app/cxfa_textparser.cpp @@ -85,7 +85,7 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { } std::unique_ptr CXFA_TextParser::LoadDefaultSheetStyle() { - static const FX_WCHAR s_pStyle[] = + static const wchar_t s_pStyle[] = L"html,body,ol,p,ul{display:block}" L"li{display:list-item}" L"ol,ul{padding-left:33px;margin:1.12em 0}" @@ -562,12 +562,12 @@ bool CXFA_TextParser::GetTabstops(CFDE_CSSComputedStyle* pStyle, } int32_t iLength = wsValue.GetLength(); - const FX_WCHAR* pTabStops = wsValue.c_str(); + const wchar_t* pTabStops = wsValue.c_str(); int32_t iCur = 0; int32_t iLast = 0; CFX_WideString wsAlign; TabStopStatus eStatus = TabStopStatus::None; - FX_WCHAR ch; + wchar_t ch; while (iCur < iLength) { ch = pTabStops[iCur]; switch (eStatus) { diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index 09c42719c1..a06fed870c 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -21,7 +21,7 @@ struct FX_BASE64DATA { uint32_t data7 : 8; }; -const FX_CHAR g_FXBase64EncoderMap[64] = { +const char g_FXBase64EncoderMap[64] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', @@ -29,9 +29,7 @@ const FX_CHAR g_FXBase64EncoderMap[64] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', }; -void Base64EncodePiece(const FX_BASE64DATA& src, - int32_t iBytes, - FX_CHAR dst[4]) { +void Base64EncodePiece(const FX_BASE64DATA& src, int32_t iBytes, char dst[4]) { dst[0] = g_FXBase64EncoderMap[src.data2]; uint32_t b = src.data1 << 4; if (iBytes > 1) { @@ -54,7 +52,7 @@ void Base64EncodePiece(const FX_BASE64DATA& src, } } -int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst) { +int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, char* pDst) { ASSERT(pSrc); if (iSrcLen < 1) { return 0; @@ -68,7 +66,7 @@ int32_t Base64EncodeA(const uint8_t* pSrc, int32_t iSrcLen, FX_CHAR* pDst) { } FX_BASE64DATA srcData; int32_t iBytes = 3; - FX_CHAR* pDstEnd = pDst; + char* pDstEnd = pDst; while (iSrcLen > 0) { if (iSrcLen > 2) { ((uint8_t*)&srcData)[0] = *pSrc++; @@ -252,7 +250,7 @@ void CXFA_ChecksumContext::FinishChecksum() { FXSYS_memset(digest, 0, 20); CRYPT_SHA1Finish(m_pByteContext.get(), digest); int32_t nLen = Base64EncodeA(digest, 20, nullptr); - FX_CHAR* pBuffer = m_bsChecksum.GetBuffer(nLen); + char* pBuffer = m_bsChecksum.GetBuffer(nLen); Base64EncodeA(digest, 20, pBuffer); m_bsChecksum.ReleaseBuffer(nLen); m_pByteContext.reset(); diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index b136b8da5a..3bbef30d06 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -174,7 +174,7 @@ void CXFA_FFBarcode::UpdateWidgetProperty() { pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType); CXFA_WidgetAcc* pAcc = GetDataAcc(); int32_t intVal; - FX_CHAR charVal; + char charVal; bool boolVal; FX_FLOAT floatVal; if (pAcc->GetBarcodeAttribute_CharEncoding(intVal)) { diff --git a/xfa/fxfa/app/xfa_ffbarcode.h b/xfa/fxfa/app/xfa_ffbarcode.h index c20feb5167..1f11be6da7 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.h +++ b/xfa/fxfa/app/xfa_ffbarcode.h @@ -93,7 +93,7 @@ enum XFA_BARCODETYPEENUM { struct XFA_BARCODETYPEENUMINFO { uint32_t uHash; - const FX_WCHAR* pName; + const wchar_t* pName; XFA_BARCODETYPEENUM eName; BC_TYPE eBCType; }; diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 911bdf8400..b6dba7f71a 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -59,7 +59,7 @@ uint8_t base64DecoderValue(uint8_t val) { return g_FXBase64DecoderMap[val - kStartValuesRemoved]; } -void Base64DecodePiece(const FX_CHAR src[4], +void Base64DecodePiece(const char src[4], int32_t iChars, FX_BASE64DATA& dst, int32_t& iBytes) { @@ -89,7 +89,7 @@ void Base64DecodePiece(const FX_CHAR src[4], } } -int32_t Base64DecodeW(const FX_WCHAR* pSrc, int32_t iSrcLen, uint8_t* pDst) { +int32_t Base64DecodeW(const wchar_t* pSrc, int32_t iSrcLen, uint8_t* pDst) { ASSERT(pSrc); if (iSrcLen < 1) { return 0; @@ -112,26 +112,26 @@ int32_t Base64DecodeW(const FX_WCHAR* pSrc, int32_t iSrcLen, uint8_t* pDst) { } return iDstLen; } - FX_CHAR srcData[4]; + char srcData[4]; FX_BASE64DATA dstData; int32_t iChars = 4, iBytes; uint8_t* pDstEnd = pDst; while (iSrcLen > 0) { if (iSrcLen > 3) { - srcData[0] = (FX_CHAR)*pSrc++; - srcData[1] = (FX_CHAR)*pSrc++; - srcData[2] = (FX_CHAR)*pSrc++; - srcData[3] = (FX_CHAR)*pSrc++; + srcData[0] = (char)*pSrc++; + srcData[1] = (char)*pSrc++; + srcData[2] = (char)*pSrc++; + srcData[3] = (char)*pSrc++; iSrcLen -= 4; } else { *((uint32_t*)&dstData) = 0; *((uint32_t*)srcData) = 0; - srcData[0] = (FX_CHAR)*pSrc++; + srcData[0] = (char)*pSrc++; if (iSrcLen > 1) { - srcData[1] = (FX_CHAR)*pSrc++; + srcData[1] = (char)*pSrc++; } if (iSrcLen > 2) { - srcData[2] = (FX_CHAR)*pSrc++; + srcData[2] = (char)*pSrc++; } iChars = iSrcLen; iSrcLen = 0; diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 951b4fd3f1..a0b834b96b 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -49,8 +49,8 @@ void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender, } void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender, - const FX_WCHAR* pLabel, - const FX_WCHAR* pValue, + const wchar_t* pLabel, + const wchar_t* pValue, int32_t iIndex) { CXFA_WidgetAcc* pWidgetAcc = static_cast(pSender); if (pWidgetAcc->GetUIType() != XFA_Element::ChoiceList) diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h index 1bfaffec89..f76d35b639 100644 --- a/xfa/fxfa/app/xfa_ffnotify.h +++ b/xfa/fxfa/app/xfa_ffnotify.h @@ -20,8 +20,8 @@ class CXFA_FFNotify { void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent); void OnWidgetListItemAdded(CXFA_WidgetData* pSender, - const FX_WCHAR* pLabel, - const FX_WCHAR* pValue, + const wchar_t* pLabel, + const wchar_t* pValue, int32_t iIndex); void OnWidgetListItemRemoved(CXFA_WidgetData* pSender, int32_t iIndex); diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index e8d7aa32d0..04de9d918a 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -111,7 +111,7 @@ bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { if (!GetRectWithoutRotate().Contains(point)) return false; - const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point); + const wchar_t* wsURLContent = GetLinkURLAtPoint(point); if (!wsURLContent) return false; @@ -128,7 +128,7 @@ bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; SetButtonDown(false); - const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point); + const wchar_t* wsURLContent = GetLinkURLAtPoint(point); if (!wsURLContent) return false; @@ -145,7 +145,7 @@ FWL_WidgetHit CXFA_FFText::OnHitTest(const CFX_PointF& point) { return FWL_WidgetHit::HyperLink; } -const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) { +const wchar_t* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) { CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); if (!pTextLayout) return nullptr; diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/xfa_fftext.h index c553821791..eddc1224ac 100644 --- a/xfa/fxfa/app/xfa_fftext.h +++ b/xfa/fxfa/app/xfa_fftext.h @@ -26,7 +26,7 @@ class CXFA_FFText : public CXFA_FFDraw { bool PerformLayout() override; private: - const FX_WCHAR* GetLinkURLAtPoint(const CFX_PointF& point); + const wchar_t* GetLinkURLAtPoint(const CFX_PointF& point); }; #endif // XFA_FXFA_APP_XFA_FFTEXT_H_ diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 9995fd11b2..ad175349f6 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -923,7 +923,7 @@ static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) { uint8_t* pCP; int32_t i = 0, j = 0; if (iLen == 0) { - iLen = FXSYS_strlen((FX_CHAR*)pStr); + iLen = FXSYS_strlen((char*)pStr); } pCP = FX_Alloc(uint8_t, iLen + 1); for (; i < iLen; i++) { @@ -936,16 +936,16 @@ static uint8_t* XFA_RemoveBase64Whitespace(const uint8_t* pStr, int32_t iLen) { pCP[j] = '\0'; return pCP; } -static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) { +static int32_t XFA_Base64Decode(const char* pStr, uint8_t* pOutBuffer) { if (!pStr) { return 0; } uint8_t* pBuffer = - XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr)); + XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((char*)pStr)); if (!pBuffer) { return 0; } - int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer); + int32_t iLen = FXSYS_strlen((char*)pBuffer); int32_t i = 0, j = 0; uint32_t dwLimb = 0; for (; i + 3 < iLen; i += 4) { @@ -982,14 +982,14 @@ static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) { return j; } -static const FX_CHAR g_base64_chars[] = +static const char g_base64_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { - FX_CHAR* out = nullptr; +char* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { + char* out = nullptr; int i, j; uint32_t limb; - out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5); + out = FX_Alloc(char, ((buf_len * 8 + 5) / 6) + 5); for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) { limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) | ((uint32_t)buf[i + 2]); diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 960771f9f8..655c9da511 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -838,8 +838,8 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { return; } - FX_WCHAR wcEnter = '\n'; - FX_WCHAR wsLast = wsText.GetAt(wsText.GetLength() - 1); + wchar_t wcEnter = '\n'; + wchar_t wsLast = wsText.GetAt(wsText.GetLength() - 1); if (wsLast == wcEnter) { wsText = wsText + wcEnter; } diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 5db389663a..d7e34fb944 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1762,10 +1762,10 @@ CFX_RetainPtr CXFA_DefFontMgr::GetFont( if (dwFontStyles & FX_FONTSTYLE_Italic) { dwStyle |= FX_FONTSTYLE_Italic; } - const FX_WCHAR* pReplace = pCurFont->pReplaceFont; + const wchar_t* pReplace = pCurFont->pReplaceFont; int32_t iLength = FXSYS_wcslen(pReplace); while (iLength > 0) { - const FX_WCHAR* pNameText = pReplace; + const wchar_t* pNameText = pReplace; while (*pNameText != L',' && iLength > 0) { pNameText++; iLength--; @@ -1796,7 +1796,7 @@ CFX_RetainPtr CXFA_DefFontMgr::GetDefaultFont( CFX_RetainPtr pFont = pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); if (!pFont) { - pFont = pFDEFontMgr->LoadFont(static_cast(nullptr), + pFont = pFDEFontMgr->LoadFont(static_cast(nullptr), dwFontStyles, wCodePage); } if (pFont) @@ -1969,7 +1969,7 @@ bool CXFA_PDFFontMgr::PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, } bool CXFA_PDFFontMgr::GetCharWidth(const CFX_RetainPtr& pFont, - FX_WCHAR wUnicode, + wchar_t wUnicode, bool bCharCode, int32_t* pWidth) { if (wUnicode != 0x20 || bCharCode) diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 73abaecbc8..5ea2a0c6c7 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -28,7 +28,7 @@ namespace { -const FX_WCHAR* const g_FWLTheme_CalFonts[] = { +const wchar_t* const g_FWLTheme_CalFonts[] = { L"Arial", L"Courier New", L"DejaVu Sans", }; -- cgit v1.2.3