summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrucedawson <brucedawson@chromium.org>2016-05-27 16:13:13 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-27 16:13:13 -0700
commit2f109ab836682cb465270ed303d27955db97d98f (patch)
tree6c2dff01fcad76ae7b1e50a2672e651cc57b29c7
parent24508dff1636d80be01497e30fccd21533fc0bde (diff)
downloadpdfium-2f109ab836682cb465270ed303d27955db97d98f.tar.xz
Avoid two C-style FX_WCHAR* casts in pdfium
FX_WCHAR* casts were hiding a number of misuses of narrow strings in pdfium, which /analyze identified. Now that those are fixed I did a search for other instances of (FX_WCHAR*) to see if any other bugs were lurking. No bugs were found but one unnecessary cast and one that should be a const_cast were identified. This change fixes those. No behavioral change. Review-Url: https://codereview.chromium.org/2024463002
-rw-r--r--xfa/fde/css/fde_csssyntax.cpp2
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/xfa/fde/css/fde_csssyntax.cpp b/xfa/fde/css/fde_csssyntax.cpp
index f948b58e71..4583595686 100644
--- a/xfa/fde/css/fde_csssyntax.cpp
+++ b/xfa/fde/css/fde_csssyntax.cpp
@@ -426,7 +426,7 @@ void CFDE_CSSTextBuf::Reset() {
FX_BOOL CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer,
int32_t iBufLen) {
Reset();
- m_pBuffer = (FX_WCHAR*)pBuffer;
+ m_pBuffer = const_cast<FX_WCHAR*>(pBuffer);
m_iDatLen = m_iBufLen = iBufLen;
return m_bExtBuf = TRUE;
}
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index 3506aa2df9..2f2f9a3ecb 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -445,7 +445,7 @@ static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts,
FXSYS_memset(&lfFind, 0, sizeof(lfFind));
lfFind.lfCharSet = DEFAULT_CHARSET;
if (pwsFaceName) {
- FXSYS_wcsncpy((FX_WCHAR*)lfFind.lfFaceName, pwsFaceName, 31);
+ FXSYS_wcsncpy(lfFind.lfFaceName, pwsFaceName, 31);
lfFind.lfFaceName[31] = 0;
}
EnumFontFamiliesExW(hDC, (LPLOGFONTW)&lfFind,