From fe2cd4d914205f2da91286e7270209e2016d51a1 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 22 Nov 2017 20:04:12 +0000 Subject: Remove some pointless assignments to "". Or change them to clear(). Change-Id: Ia9e3e1f0d74b948cec3f8df85d205f830ac9216c Reviewed-on: https://pdfium-review.googlesource.com/19172 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- core/fpdfapi/parser/fpdf_parser_decode.cpp | 2 +- core/fpdfdoc/cpdf_interform.cpp | 2 +- core/fxge/win32/fx_win32_gdipext.cpp | 2 +- fpdfsdk/formfiller/cba_fontmap.cpp | 2 +- fxjs/cjs_global.cpp | 2 +- samples/pdfium_test.cc | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index 7ad6c0176f..8a31643632 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -411,7 +411,7 @@ bool PDF_DataDecode(const uint8_t* src_buf, last_buf = new_buf; last_size = new_size; } - *ImageEncoding = ""; + ImageEncoding->clear(); *pImageParms = nullptr; *dest_buf = last_buf; *dest_size = last_size; diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index e42095c048..e71e16cddd 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -691,7 +691,7 @@ ByteString CPDF_InterForm::GenerateNewResourceName( int iCount = csStr.GetLength(); int m = 0; if (iMinLen > 0) { - csTmp = ""; + csTmp.clear(); while (m < iMinLen && m < iCount) csTmp += csStr[m++]; while (m < iMinLen) { diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 70da194be4..1a7e132c64 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -682,7 +682,7 @@ CGdiplusExt::CGdiplusExt() { m_pGdiRemoveFontMemResourseEx = nullptr; } void CGdiplusExt::Load() { - ByteString strPlusPath = ""; + ByteString strPlusPath; char buf[MAX_PATH]; GetSystemDirectoryA(buf, MAX_PATH); strPlusPath += buf; diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index 625ce469c7..d675676616 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -38,7 +38,7 @@ CBA_FontMap::~CBA_FontMap() {} void CBA_FontMap::Reset() { Empty(); m_pDefaultFont = nullptr; - m_sDefaultFontName = ""; + m_sDefaultFontName.clear(); } void CBA_FontMap::Initialize() { diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp index 0fef8d5334..db63a4b8b9 100644 --- a/fxjs/cjs_global.cpp +++ b/fxjs/cjs_global.cpp @@ -555,7 +555,7 @@ CJS_Return JSGlobalAlternate::SetGlobalVariables(const ByteString& propname, if (pTemp->bDeleted || pTemp->nType != nType) { pTemp->dData = 0; pTemp->bData = 0; - pTemp->sData = ""; + pTemp->sData.clear(); pTemp->nType = nType; } pTemp->bDeleted = false; diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index 644aee7819..bc0ad86297 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -1285,7 +1285,7 @@ bool RenderPage(const std::string& name, const char* buffer = reinterpret_cast(FPDFBitmap_GetBuffer(bitmap.get())); - std::string&& image_file_name = ""; + std::string image_file_name; switch (options.output_format) { #ifdef _WIN32 case OUTPUT_BMP: @@ -1335,7 +1335,7 @@ bool RenderPage(const std::string& name, // Write the filename and the MD5 of the buffer to stdout if we wrote a // file. - if (options.md5 && image_file_name != "") + if (options.md5 && !image_file_name.empty()) OutputMD5Hash(image_file_name.c_str(), buffer, stride * height); } else { fprintf(stderr, "Page was too large to be rendered.\n"); -- cgit v1.2.3