diff options
author | Albert Astals Cid <aacid@kde.org> | 2018-01-08 22:55:00 +0100 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2018-01-08 22:55:00 +0100 |
commit | e428033c2d7efbbbf89bb2f84c8998521ac7ef8e (patch) | |
tree | 546f48df418659224c4500adc01fcddb4d9384a9 /cpp/poppler-image.cpp | |
parent | 2e47887616155dee566083e1aac9adab69aa4386 (diff) |
Run clang-tidy with modernize nullptr
Also add two enum values in the qt5 frontend to representate no flags
Also mark glib/gtk/cairo system includes so that gcc doesn't report the issues in those headers
Diffstat (limited to 'cpp/poppler-image.cpp')
-rw-r--r-- | cpp/poppler-image.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cpp/poppler-image.cpp b/cpp/poppler-image.cpp index aab2bb48..9f7d8611 100644 --- a/cpp/poppler-image.cpp +++ b/cpp/poppler-image.cpp @@ -52,7 +52,7 @@ struct FileCloser { FileCloser(const FileCloser &) = delete; FileCloser& operator=(const FileCloser &) = delete; inline bool close() - { if (f) { const int c = fclose(f); f = 0; return c == 0; } return true; } + { if (f) { const int c = fclose(f); f = nullptr; return c == 0; } return true; } FILE *f; }; @@ -91,7 +91,7 @@ using namespace poppler; image_private::image_private(int iwidth, int iheight, image::format_enum iformat) : ref(1) - , data(0) + , data(nullptr) , width(iwidth) , height(iheight) , bytes_per_row(0) @@ -111,19 +111,19 @@ image_private::~image_private() image_private *image_private::create_data(int width, int height, image::format_enum format) { if (width <= 0 || height <= 0) { - return 0; + return nullptr; } int bpr = calc_bytes_per_row(width, format); if (bpr <= 0) { - return 0; + return nullptr; } std::unique_ptr<image_private> d(new image_private(width, height, format)); d->bytes_num = bpr * height; d->data = reinterpret_cast<char *>(std::malloc(d->bytes_num)); if (!d->data) { - return 0; + return nullptr; } d->own_data = true; d->bytes_per_row = bpr; @@ -134,12 +134,12 @@ image_private *image_private::create_data(int width, int height, image::format_e image_private *image_private::create_data(char *data, int width, int height, image::format_enum format) { if (width <= 0 || height <= 0 || !data) { - return 0; + return nullptr; } int bpr = calc_bytes_per_row(width, format); if (bpr <= 0) { - return 0; + return nullptr; } image_private *d = new image_private(width, height, format); @@ -175,7 +175,7 @@ image_private *image_private::create_data(char *data, int width, int height, ima Construct an invalid image. */ image::image() - : d(0) + : d(nullptr) { } @@ -283,7 +283,7 @@ int image::bytes_per_row() const char *image::data() { if (!d) { - return 0; + return nullptr; } detach(); @@ -299,7 +299,7 @@ char *image::data() */ const char *image::const_data() const { - return d ? d->data : 0; + return d ? d->data : nullptr; } /** |