summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-04-21 15:31:30 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-21 15:31:30 -0700
commit6f5325e538f31a37bb97a6a71f5c8cd64c6f7639 (patch)
tree9ce9cbc23b155de99496775c62b88bc0151d40d7
parent0d2dc680e36b8ba7608cb062efe8488abd388985 (diff)
downloadpdfium-6f5325e538f31a37bb97a6a71f5c8cd64c6f7639.tar.xz
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
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font_cid.cpp4
1 files changed, 3 insertions, 1 deletions
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) {