diff options
author | Lei Zhang <thestig@chromium.org> | 2018-06-23 00:01:46 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-23 00:01:46 +0000 |
commit | 27d3aa2ed2346ebb8a19519c76c73aafd1f7fd72 (patch) | |
tree | 8680a78728fdb5e51939616c86d7b593779c43a5 /core/fpdfapi | |
parent | b59b36610e39975a31b257c6e3d628d1b81eb90a (diff) | |
download | pdfium-27d3aa2ed2346ebb8a19519c76c73aafd1f7fd72.tar.xz |
Fix some nits from commit 27cf78d8.chromium/3472chromium/3471
Change-Id: I52d7b9692c19af1aafab7d572d0a274726bd37f5
Reviewed-on: https://pdfium-review.googlesource.com/35911
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index ba31516f4a..88f14b2ce4 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -30,6 +30,7 @@ #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fpdfapi/parser/fpdf_parser_utility.h" +#include "third_party/base/stl_util.h" #include "third_party/skia_shared/SkFloatToDecimal.h" namespace { @@ -77,7 +78,7 @@ void CPDF_PageContentGenerator::GenerateContent() { std::map<int32_t, std::unique_ptr<std::ostringstream>> CPDF_PageContentGenerator::GenerateModifiedStreams() { // Make sure default graphics are created. - (void)GetOrCreateDefaultGraphics(); + GetOrCreateDefaultGraphics(); // Figure out which streams are dirty. std::set<int32_t> all_dirty_streams; @@ -92,7 +93,7 @@ CPDF_PageContentGenerator::GenerateModifiedStreams() { // Start regenerating dirty streams. std::map<int32_t, std::unique_ptr<std::ostringstream>> streams; - std::map<int32_t, bool> stream_is_empty; + std::set<int32_t> empty_streams; for (int32_t dirty_stream : all_dirty_streams) { std::unique_ptr<std::ostringstream> buf = @@ -106,7 +107,7 @@ CPDF_PageContentGenerator::GenerateModifiedStreams() { ProcessDefaultGraphics(buf.get()); streams[dirty_stream] = std::move(buf); - stream_is_empty[dirty_stream] = true; + empty_streams.insert(dirty_stream); } // Process the page objects, write into each dirty stream. @@ -117,14 +118,14 @@ CPDF_PageContentGenerator::GenerateModifiedStreams() { continue; std::ostringstream* buf = it->second.get(); - stream_is_empty[stream_index] = false; + empty_streams.erase(stream_index); ProcessPageObject(buf, pPageObj.Get()); } // Finish dirty streams. for (int32_t dirty_stream : all_dirty_streams) { std::ostringstream* buf = streams[dirty_stream].get(); - if (stream_is_empty[dirty_stream]) { + if (pdfium::ContainsKey(empty_streams, dirty_stream)) { // Clear to show that this stream needs to be deleted. buf->str(""); } else { |