From 241e14a7625f53647b865fea61e039684251d411 Mon Sep 17 00:00:00 2001 From: Asad Tauqeer Date: Wed, 29 Apr 2026 20:41:28 +0500 Subject: [PATCH] tdf#153109 replace for loop in unmarshal.cxx Replaced a manual for-loop used for searching an array with std::any_of from the header. Change-Id: I0a3f6b46e22ef92449a637f4164a0e47f794b598 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204585 Tested-by: Jenkins Reviewed-by: Julien Nabet --- binaryurp/source/unmarshal.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx index 10eb4e780f3f..0bf97d34fdb5 100644 --- a/binaryurp/source/unmarshal.cxx +++ b/binaryurp/source/unmarshal.cxx @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -317,13 +318,9 @@ BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) { type.makeComplete(); typelib_EnumTypeDescription * etd = reinterpret_cast< typelib_EnumTypeDescription * >(type.get()); - bool bFound = false; - for (sal_Int32 i = 0; i != etd->nEnumValues; ++i) { - if (etd->pEnumValues[i] == v) { - bFound = true; - break; - } - } + bool bFound = std::any_of( + etd->pEnumValues, etd->pEnumValues + etd->nEnumValues, + [v](sal_Int32 nValue) { return nValue == v; }); if (!bFound) { throw css::io::IOException( u"binaryurp::Unmarshal: unknown enum value"_ustr);