diff options
author | Jay Berkenbilt <ejb@ql.org> | 2018-02-04 19:51:54 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2018-02-04 20:19:00 +0100 |
commit | d5bfd49cb2c9e62557a06dee3c4e33fc0c091170 (patch) | |
tree | 5719f9eda7f503dcff1a237c6861216b56d20618 /libqpdf | |
parent | 34a9b835b0b7d96af50978e64ec24b749dab5233 (diff) | |
download | qpdf-d5bfd49cb2c9e62557a06dee3c4e33fc0c091170.tar.zst |
Remove use of std::abs (fixes #172)
Different compilers want different choices of headers for std::abs.
It's easier to just to not use it.
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/Pl_PNGFilter.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libqpdf/Pl_PNGFilter.cc b/libqpdf/Pl_PNGFilter.cc index 174e0b51..217a14fa 100644 --- a/libqpdf/Pl_PNGFilter.cc +++ b/libqpdf/Pl_PNGFilter.cc @@ -3,7 +3,11 @@ #include <stdexcept> #include <string.h> #include <limits.h> -#include <algorithm> + +static int abs_diff(int a, int b) +{ + return a > b ? a - b : b - a; +} Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next, action_e action, unsigned int columns, @@ -218,9 +222,9 @@ int Pl_PNGFilter::PaethPredictor(int a, int b, int c) { int p = a + b - c; - int pa = std::abs(p - a); - int pb = std::abs(p - b); - int pc = std::abs(p - c); + int pa = abs_diff(p, a); + int pb = abs_diff(p, b); + int pc = abs_diff(p, c); if (pa <= pb && pa <= pc) { |