From bd9748d504555f100d34025d76a9e0119986bc3f Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 13 Apr 2016 21:40:19 -0700 Subject: Remove implicit cast from CFX_WideString to (const wchar_t*) BUG= Review URL: https://codereview.chromium.org/1882043004 --- xfa/fxfa/app/xfa_ffdoc.cpp | 5 +++-- xfa/fxfa/app/xfa_ffdocview.cpp | 6 +++--- xfa/fxfa/app/xfa_ffimageedit.cpp | 2 +- xfa/fxfa/app/xfa_fftextedit.cpp | 3 +-- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 18 +++++++++--------- xfa/fxfa/app/xfa_fontmgr.cpp | 9 +++++---- xfa/fxfa/app/xfa_fwltheme.cpp | 16 ++++++++-------- xfa/fxfa/app/xfa_textlayout.cpp | 10 +++++----- xfa/fxfa/app/xfa_textlayout.h | 3 +-- 9 files changed, 36 insertions(+), 36 deletions(-) (limited to 'xfa/fxfa/app') diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index c83895c25e..27e779510a 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -87,10 +87,11 @@ FX_BOOL XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement, } CFX_WideString wsPDFContent; pChunkElement->GetTextData(wsPDFContent); - iBufferSize = FX_Base64DecodeW(wsPDFContent, wsPDFContent.GetLength(), NULL); + iBufferSize = + FX_Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), NULL); pByteBuffer = FX_Alloc(uint8_t, iBufferSize + 1); pByteBuffer[iBufferSize] = '0'; // FIXME: I bet this is wrong. - FX_Base64DecodeW(wsPDFContent, wsPDFContent.GetLength(), pByteBuffer); + FX_Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), pByteBuffer); return TRUE; } void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) { diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 9c627ea3c1..daa5fd6277 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -157,7 +157,7 @@ void CXFA_FFDocView::ShowNullTestMsg() { pAppProvider->LoadString(XFA_IDS_ValidateLimit, wsLimit); if (!wsLimit.IsEmpty()) { CFX_WideString wsTemp; - wsTemp.Format((const FX_WCHAR*)wsLimit, iRemain); + wsTemp.Format(wsLimit.c_str(), iRemain); wsMsg += FX_WSTRC(L"\n") + wsTemp; } } @@ -792,8 +792,8 @@ void CXFA_FFDocView::RunBindItems() { const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == FX_WSTRC(L"$"); CFX_WideString wsValue, wsLabel; - uint32_t uValueHash = FX_HashCode_String_GetW(CFX_WideString(wsValueRef), - wsValueRef.GetLength()); + uint32_t uValueHash = + FX_HashCode_String_GetW(wsValueRef.c_str(), wsValueRef.GetLength()); for (int32_t i = 0; i < iCount; i++) { CXFA_Object* refObj = rs.nodes[i]; if (!refObj->IsNode()) { diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index 18af171677..b56f24d366 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -131,7 +131,7 @@ FX_BOOL CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, return TRUE; } CFX_WideString wsImage; - IFX_FileRead* pFileRead = FX_CreateFileRead(wsFilePath); + IFX_FileRead* pFileRead = FX_CreateFileRead(wsFilePath.c_str()); if (pFileRead) { int32_t nDataSize = pFileRead->GetSize(); if (nDataSize > 0) { diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 982ee00896..3232dbdac2 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -199,8 +199,7 @@ void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) { pAppProvider->LoadString(XFA_IDS_ValidateNumberError, wsError); CFX_WideString wsSomField; pAcc->GetNode()->GetSOMExpression(wsSomField); - wsMessage.Format(wsError, (const FX_WCHAR*)wsText, - (const FX_WCHAR*)wsSomField); + wsMessage.Format(wsError.c_str(), wsText.c_str(), wsSomField.c_str()); pAppProvider->MsgBox(wsMessage.AsStringC(), wsTitle.AsStringC(), XFA_MBICON_Error, XFA_MB_OK); } diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 4e7da92370..fba296cde7 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -200,7 +200,7 @@ FX_BOOL CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) { m_pNode->GetSOMExpression(wsName); if (iNameType == 2 && wsName.GetLength() >= 15) { CFX_WideStringC wsPre = FX_WSTRC(L"xfa[0].form[0]."); - if (wsPre == CFX_WideStringC(wsName, wsPre.GetLength())) { + if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength())) { wsName.Delete(0, wsPre.GetLength()); } } @@ -528,7 +528,7 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, GetValidateCaptionName(wsCaptionName, bVersionFlag); CFX_WideString wsError; pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); - wsNullMsg.Format(wsError, (const FX_WCHAR*)wsCaptionName); + wsNullMsg.Format(wsError.c_str(), wsCaptionName.c_str()); } pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), XFA_MBICON_Status, XFA_MB_OK); @@ -542,8 +542,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, GetValidateCaptionName(wsCaptionName, bVersionFlag); CFX_WideString wsWarning; pAppProvider->LoadString(XFA_IDS_ValidateNullWarning, wsWarning); - wsNullMsg.Format(wsWarning, (const FX_WCHAR*)wsCaptionName, - (const FX_WCHAR*)wsCaptionName); + wsNullMsg.Format(wsWarning.c_str(), wsCaptionName.c_str(), + wsCaptionName.c_str()); } if (pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { @@ -584,18 +584,18 @@ void CXFA_WidgetAcc::GetValidateMessage(IXFA_AppProvider* pAppProvider, CFX_WideString wsError; if (bVersionFlag) { pAppProvider->LoadString(XFA_IDS_ValidateFailed, wsError); - wsMessage.Format(wsError, (const FX_WCHAR*)wsCaptionName); + wsMessage.Format(wsError.c_str(), wsCaptionName.c_str()); return; } if (bError) { pAppProvider->LoadString(XFA_IDS_ValidateError, wsError); - wsMessage.Format(wsError, (const FX_WCHAR*)wsCaptionName); + wsMessage.Format(wsError.c_str(), wsCaptionName.c_str()); return; } CFX_WideString wsWarning; pAppProvider->LoadString(XFA_IDS_ValidateWarning, wsWarning); - wsMessage.Format(wsWarning, (const FX_WCHAR*)wsCaptionName, - (const FX_WCHAR*)wsCaptionName); + wsMessage.Format(wsWarning.c_str(), wsCaptionName.c_str(), + wsCaptionName.c_str()); } int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { if (GetClassID() == XFA_ELEMENT_Draw) { @@ -916,7 +916,7 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { pTextOut->SetStyles(dwStyles); } ((CXFA_FieldLayoutData*)m_pLayoutData) - ->m_pTextOut->CalcLogicSize(wsText, wsText.GetLength(), size); + ->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), size); } FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { if (size.x > 0) { diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 542fec57a3..72952a7bd9 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1725,8 +1725,8 @@ const XFA_FONTINFO* XFA_GetFontINFOByFontName( _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ CFX_WideString wsFontNameTemp = wsFontName; wsFontNameTemp.Remove(L' '); - uint32_t dwCurFontNameHash = - FX_HashCode_String_GetW(wsFontNameTemp, wsFontNameTemp.GetLength(), TRUE); + uint32_t dwCurFontNameHash = FX_HashCode_String_GetW( + wsFontNameTemp.c_str(), wsFontNameTemp.GetLength(), TRUE); int32_t iStart = 0; int32_t iEnd = sizeof(g_XFAFontsMap) / sizeof(XFA_FONTINFO) - 1; int32_t iMid = 0; @@ -1763,7 +1763,8 @@ IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, uint16_t wCodePage) { CFX_WideString wsFontName = wsFontFamily; IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); - IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage); + IFX_Font* pFont = + pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage); if (!pFont) { const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName.AsStringC()); @@ -1785,7 +1786,7 @@ IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, } CFX_WideString wsReplace = CFX_WideString(pReplace, pNameText - pReplace); - pFont = pFDEFontMgr->LoadFont(wsReplace, dwStyle, wCodePage); + pFont = pFDEFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage); if (pFont) { break; } diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 4d987b08b9..42d0835460 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -161,8 +161,8 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { mtPart.Concat(*pMatrix); } m_pTextOut->SetMatrix(mtPart); - m_pTextOut->DrawLogicText(pParams->m_wsText, pParams->m_wsText.GetLength(), - pParams->m_rtPart); + m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), + pParams->m_wsText.GetLength(), pParams->m_rtPart); return TRUE; } CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); @@ -186,8 +186,8 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { mtPart.Concat(*pMatrix); } m_pTextOut->SetMatrix(mtPart); - m_pTextOut->DrawLogicText(pParams->m_wsText, pParams->m_wsText.GetLength(), - pParams->m_rtPart); + m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), + pParams->m_wsText.GetLength(), pParams->m_rtPart); return TRUE; } void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, @@ -306,8 +306,8 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); m_pTextOut->SetAlignment(pParams->m_iTTOAlign); m_pTextOut->SetStyles(pParams->m_dwTTOStyles); - m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(), - rect); + m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), + pParams->m_wsText.GetLength(), rect); return TRUE; } CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); @@ -324,8 +324,8 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { return FALSE; m_pTextOut->SetAlignment(pParams->m_iTTOAlign); m_pTextOut->SetStyles(pParams->m_dwTTOStyles); - m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(), - rect); + m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), + pParams->m_wsText.GetLength(), rect); return TRUE; } CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 1ee0dbe6f3..ce1ce7021e 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -303,7 +303,7 @@ void CXFA_TextParser::ParseTagInfo(CFDE_XMLNode* pXMLNode, pXMLElement->GetLocalTagName(wsName); tagProvider.SetTagNameObj(wsName); uint32_t dwHashCode = - FX_HashCode_String_GetW(wsName, wsName.GetLength(), TRUE); + FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength(), TRUE); static const int32_t s_iCount = sizeof(s_XFATagName) / sizeof(uint32_t); CFX_DSPATemplate lookup; tagProvider.m_bTagAviliable = @@ -584,7 +584,7 @@ FX_BOOL CXFA_TextParser::GetTabstops( return FALSE; } int32_t iLength = wsValue.GetLength(); - const FX_WCHAR* pTabStops = wsValue; + const FX_WCHAR* pTabStops = wsValue.c_str(); int32_t iCur = 0; int32_t iLast = 0; CFX_WideString wsAlign; @@ -640,8 +640,8 @@ FX_BOOL CXFA_TextParser::GetTabstops( break; case XFA_TABSTOPSSTATUS_Location: if (ch == ' ') { - uint32_t dwHashCode = - FX_HashCode_String_GetW(wsAlign, wsAlign.GetLength(), TRUE); + uint32_t dwHashCode = FX_HashCode_String_GetW( + wsAlign.c_str(), wsAlign.GetLength(), TRUE); CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); @@ -656,7 +656,7 @@ FX_BOOL CXFA_TextParser::GetTabstops( } if (!wsAlign.IsEmpty()) { uint32_t dwHashCode = - FX_HashCode_String_GetW(wsAlign, wsAlign.GetLength(), TRUE); + FX_HashCode_String_GetW(wsAlign.c_str(), wsAlign.GetLength(), TRUE); CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index c80e4f6cca..88b29e2cd4 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -177,8 +177,7 @@ class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { } virtual uint32_t AddRef() { return ++m_dwRefCount; } - public: - const FX_WCHAR* GetLinkURL() { return m_pszURLContent; } + const FX_WCHAR* GetLinkURL() { return m_pszURLContent.c_str(); } protected: IFX_MEMAllocator* m_pAllocator; -- cgit v1.2.3