From dddfdad6ebb4e7172ff36f5a0db8a5cbf58d45f3 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 30 Nov 2017 15:42:00 +0000 Subject: Run clang-tidy modernize-use-auto on //third_party/pdfium See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md Bug: chromium:776257 Change-Id: I1f6637cde8b3e41825993a736bed6763dd7beacb Reviewed-on: https://pdfium-review.googlesource.com/19971 Reviewed-by: Lei Zhang Commit-Queue: dsinclair --- samples/pdfium_test.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'samples') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index bc0ad86297..97090cfadf 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -154,7 +154,7 @@ std::string WritePpm(const char* pdf_name, int stride, int width, int height) { - const char* buffer = reinterpret_cast(buffer_void); + const auto* buffer = reinterpret_cast(buffer_void); if (!CheckDimensions(stride, width, height)) return ""; @@ -451,7 +451,7 @@ std::string WritePng(const char* pdf_name, return ""; std::vector png_encoding; - const unsigned char* buffer = static_cast(buffer_void); + const auto* buffer = static_cast(buffer_void); if (!image_diff_png::EncodeBGRAPNG( buffer, width, height, stride, false, &png_encoding)) { fprintf(stderr, "Failed to convert bitmap to PNG\n"); @@ -644,7 +644,7 @@ int ExampleAppResponse(IPDF_JSPLATFORM*, GetPlatformWString(label).c_str(), is_password, length); // UTF-16, always LE regardless of platform. - uint8_t* ptr = static_cast(response); + auto* ptr = static_cast(response); ptr[0] = 'N'; ptr[1] = 0; ptr[2] = 'o'; @@ -1249,8 +1249,8 @@ bool RenderPage(const std::string& name, if (!options.scale_factor_as_string.empty()) std::stringstream(options.scale_factor_as_string) >> scale; - int width = static_cast(FPDF_GetPageWidth(page) * scale); - int height = static_cast(FPDF_GetPageHeight(page) * scale); + auto width = static_cast(FPDF_GetPageWidth(page) * scale); + auto height = static_cast(FPDF_GetPageHeight(page) * scale); int alpha = FPDFPage_HasTransparency(page) ? 1 : 0; std::unique_ptr bitmap( FPDFBitmap_Create(width, height, alpha)); -- cgit v1.2.3