summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-25 18:49:32 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-25 18:49:32 +0000
commite08d2b1fee0db40bac9538ca8b7be0a951675bd6 (patch)
tree81ded468a54adb247f46d7824632f6c4a537619c /core/fpdfapi/parser
parenteb3ec8f29846a5df67269a53ca94d1d740c84513 (diff)
downloadpdfium-e08d2b1fee0db40bac9538ca8b7be0a951675bd6.tar.xz
Introduce ScopedFPDF types in public/cpp/fpdf_scopers.h
Applies std::remove_ptr to the public API types so that we can deduce a correct unique ptr type no matter how that API might change away from void* usage. Creates shorter names for std::unique_ptr<std::remove_pointer<>, ...> Change-Id: I04a0ff43cb7d5a4d3867939a53a54c9cef00db86 Reviewed-on: https://pdfium-review.googlesource.com/31292 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp3
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp7
2 files changed, 6 insertions, 4 deletions
diff --git a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
index 4937b3d8d1..95f1dd4977 100644
--- a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp
@@ -6,6 +6,7 @@
#include <string>
#include "core/fxcrt/fx_system.h"
+#include "public/cpp/fpdf_scopers.h"
#include "public/fpdf_edit.h"
#include "public/fpdf_save.h"
#include "public/fpdfview.h"
@@ -61,7 +62,7 @@ TEST_F(CPDFSecurityHandlerEmbeddertest, PasswordAfterGenerateSave) {
EXPECT_TRUE(FPDFPath_SetFillColor(red_rect, 255, 0, 0, 255));
EXPECT_TRUE(FPDFPath_SetDrawMode(red_rect, FPDF_FILLMODE_ALTERNATE, 0));
FPDFPage_InsertObject(page, red_rect);
- std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page);
+ ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
CompareBitmap(bitmap.get(), 612, 792, md5);
EXPECT_TRUE(FPDFPage_GenerateContent(page));
SetWholeFileAvailable();
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
index 0a7dde9b05..7054db99d7 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp
@@ -7,6 +7,7 @@
#include <string>
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
+#include "public/cpp/fpdf_scopers.h"
#include "testing/embedder_test.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/test_support.h"
@@ -94,7 +95,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_552046) {
EXPECT_TRUE(OpenDocument("bug_552046.pdf"));
FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
- std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page);
+ ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
CompareBitmap(bitmap.get(), 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3");
UnloadPage(page);
}
@@ -105,7 +106,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_555784) {
EXPECT_TRUE(OpenDocument("bug_555784.pdf"));
FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
- std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page);
+ ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
CompareBitmap(bitmap.get(), 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3");
UnloadPage(page);
}
@@ -116,7 +117,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_455199) {
EXPECT_TRUE(OpenDocument("bug_455199.pdf"));
FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
- std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page);
+ ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
const char kExpectedMd5sum[] = "b90475ca64d1348c3bf5e2b77ad9187a";
#elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_