From 722ca8e0839a21f9210903cfa66c062beddb279c Mon Sep 17 00:00:00 2001 From: m-holger Date: Tue, 19 Aug 2025 18:52:46 +0100 Subject: [PATCH] Add `operator==` to `BaseHandle` for object equality comparison --- include/qpdf/ObjectHandle.hh | 7 +++++++ libqpdf/QPDF_Array.cc | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/qpdf/ObjectHandle.hh b/include/qpdf/ObjectHandle.hh index a69f5ae..1966cd3 100644 --- a/include/qpdf/ObjectHandle.hh +++ b/include/qpdf/ObjectHandle.hh @@ -61,6 +61,13 @@ namespace qpdf // The rest of the header file is for qpdf internal use only. + // Return true if both object handles refer to the same underlying object. + bool + operator==(BaseHandle const& other) const + { + return obj == other.obj; + } + // For arrays, return the number of items in the array. // For null-like objects, return 0. // For all other objects, return 1. diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc index 37b2c60..44c7a6d 100644 --- a/libqpdf/QPDF_Array.cc +++ b/libqpdf/QPDF_Array.cc @@ -400,7 +400,6 @@ QPDFObjectHandle::getArrayItem(int n) const return newNull(); } objectWarning("returning null for out of bounds array access"); - } else { typeWarning("array", "returning null"); } -- libgit2 0.21.4