From 67454716002f2f5eae85cef4d382ecfc0e9b266d Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Thu, 7 Dec 2017 18:45:54 +0000 Subject: Add WARN_UNUSED_RESULT to ByteString::Format* methods. Change-Id: I0caba99cb8e99ea5af49d906b576f580275620bb Reviewed-on: https://pdfium-review.googlesource.com/20570 Reviewed-by: dsinclair Reviewed-by: Lei Zhang Commit-Queue: Henrique Nakashima --- core/fxcrt/bytestring.h | 9 +++++---- xfa/fgas/font/cfgas_fontmgr.cpp | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/fxcrt/bytestring.h b/core/fxcrt/bytestring.h index bd414fc76f..6b167802d5 100644 --- a/core/fxcrt/bytestring.h +++ b/core/fxcrt/bytestring.h @@ -32,10 +32,11 @@ class ByteString { using const_iterator = const CharType*; using const_reverse_iterator = std::reverse_iterator; - static ByteString FormatInteger(int i); - static ByteString FormatFloat(float f); - static ByteString Format(const char* lpszFormat, ...); - static ByteString FormatV(const char* lpszFormat, va_list argList); + static ByteString FormatInteger(int i) WARN_UNUSED_RESULT; + static ByteString FormatFloat(float f) WARN_UNUSED_RESULT; + static ByteString Format(const char* lpszFormat, ...) WARN_UNUSED_RESULT; + static ByteString FormatV(const char* lpszFormat, + va_list argList) WARN_UNUSED_RESULT; ByteString(); ByteString(const ByteString& other); diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index 2647eb52c7..862e9299b5 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -1010,11 +1010,12 @@ RetainPtr CFGAS_FontMgr::GetFontByUnicode( uint16_t wCodePage = x ? x->wCodePage : 0xFFFF; uint16_t wBitField = x ? x->wBitField : 0x03E7; ByteString bsHash; - if (wCodePage == 0xFFFF) + if (wCodePage == 0xFFFF) { bsHash = ByteString::Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles); - else + } else { bsHash = ByteString::Format("%d, %d", wCodePage, dwFontStyles); + } bsHash += FX_UTF8Encode(WideStringView(pszFontFamily)); uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false); std::vector>* pFonts = &m_Hash2Fonts[dwHash]; -- cgit v1.2.3