From 20ef31733600c6fbaaa9660297962aee4f940704 Mon Sep 17 00:00:00 2001 From: m-holger Date: Tue, 14 Oct 2025 17:43:46 +0100 Subject: [PATCH] Refactor `Integer` constructor: replace manual comparisons with `std::cmp_greater` for cleaner and more concise overflow checks. --- libqpdf/qpdf/QPDFObjectHandle_private.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libqpdf/qpdf/QPDFObjectHandle_private.hh b/libqpdf/qpdf/QPDFObjectHandle_private.hh index 6cf3424..3e82bca 100644 --- a/libqpdf/qpdf/QPDFObjectHandle_private.hh +++ b/libqpdf/qpdf/QPDFObjectHandle_private.hh @@ -305,10 +305,10 @@ namespace qpdf explicit Integer(std::integral auto value) : Integer(static_cast(value)) { - if constexpr ( - std::numeric_limits::max() > - std::numeric_limits::max()) { - if (value > std::numeric_limits::max()) { + if constexpr (std::cmp_greater( + std::numeric_limits::max(), + std::numeric_limits::max())) { + if (std::cmp_greater(value, std::numeric_limits::max())) { throw std::overflow_error("overflow constructing Integer"); } } -- libgit2 0.21.4