From 6f5325e538f31a37bb97a6a71f5c8cd64c6f7639 Mon Sep 17 00:00:00 2001 From: weili Date: Thu, 21 Apr 2016 15:31:30 -0700 Subject: Remove one warning from PDFium compilation in Cros The original code caused an optimization warning when gcc tries to get rid of 'count > m_Length - index' in CFX_ByteStringC::Mid() while assuming there is no signed integer overflow. This could also be avoided once FX_STRSIZE is no longer a signed integer type. Review URL: https://codereview.chromium.org/1906213002 --- core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp index d5fe4dfd92..01a0f6cbdd 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -191,7 +191,9 @@ CIDSet CIDSetFromSizeT(size_t index) { } CFX_ByteStringC CMap_GetString(const CFX_ByteStringC& word) { - return word.Mid(1, word.GetLength() - 2); + if (word.GetLength() <= 2) + return CFX_ByteStringC(); + return CFX_ByteStringC(&word[1], word.GetLength() - 2); } int CompareDWORD(const void* data1, const void* data2) { -- cgit v1.2.3