Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Unified Diff: core/fxcrt/fx_basic_wstring.cpp

Issue 1801383002: Re-enable several MSVC warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address more comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/fxcrt/fx_basic_wstring.cpp
diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp
index 95b761bd09e67a55b38ae5216ab5e555b8872a96..b1aa05d1c89606ff3710041f755748f95dd7e5b7 100644
--- a/core/fxcrt/fx_basic_wstring.cpp
+++ b/core/fxcrt/fx_basic_wstring.cpp
@@ -641,12 +641,10 @@ FX_STRSIZE CFX_WideString::Replace(const FX_WCHAR* lpszOld,
FX_WCHAR* lpszStart = m_pData->m_String;
FX_WCHAR* lpszEnd = m_pData->m_String + m_pData->m_nDataLength;
FX_WCHAR* lpszTarget;
- {
- while ((lpszTarget = (FX_WCHAR*)FXSYS_wcsstr(lpszStart, lpszOld)) &&
- lpszStart < lpszEnd) {
- nCount++;
- lpszStart = lpszTarget + nSourceLen;
- }
+ while ((lpszTarget = FXSYS_wcsstr(lpszStart, lpszOld)) != nullptr &&
Tom Sepez 2016/03/17 16:40:05 nit: again, I think this reads cleaner as a while
Wei Li 2016/03/18 17:42:39 Absolutely agree with you. I originally planned to
+ lpszStart < lpszEnd) {
+ nCount++;
+ lpszStart = lpszTarget + nSourceLen;
}
if (nCount > 0) {
CopyBeforeWrite();
@@ -667,8 +665,7 @@ FX_STRSIZE CFX_WideString::Replace(const FX_WCHAR* lpszOld,
lpszStart = m_pData->m_String;
lpszEnd = m_pData->m_String + std::max(m_pData->m_nDataLength, nNewLength);
{
Tom Sepez 2016/03/17 16:40:05 nit: braces?
Wei Li 2016/03/18 17:42:39 Done.
- while ((lpszTarget = (FX_WCHAR*)FXSYS_wcsstr(lpszStart, lpszOld)) !=
- NULL &&
+ while ((lpszTarget = FXSYS_wcsstr(lpszStart, lpszOld)) != nullptr &&
Tom Sepez 2016/03/17 16:40:05 nit: re-write as discussed above.
Wei Li 2016/03/18 17:42:39 Done.
lpszStart < lpszEnd) {
FX_STRSIZE nBalance =
nOldLength -

Powered by Google App Engine
This is Rietveld 408576698