hwpfilter/inc/pch/precompiled_hwp.hxx | 1 hwpfilter/source/drawing.h | 5 ---- hwpfilter/source/hpara.cxx | 5 ---- hwpfilter/source/hstyle.cxx | 4 --- hwpfilter/source/hwpread.cxx | 3 -- include/comphelper/newarray.hxx | 42 ---------------------------------- solenv/clang-format/excludelist | 1 7 files changed, 4 insertions(+), 57 deletions(-)
New commits: commit fa0efd28998e35721cc750b35d9fd30697ba38fa Author: Mike Kaganski <[email protected]> AuthorDate: Fri Nov 28 00:40:19 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Fri Nov 28 06:46:41 2025 +0100 Drop comphelper::newArray_null, and use new (std::nothrow) directly That is clearer, and even shorter. Change-Id: I293e588e91be0265a9898038318f3b0a99bc3767 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194738 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/hwpfilter/inc/pch/precompiled_hwp.hxx b/hwpfilter/inc/pch/precompiled_hwp.hxx index 3eb456b58dca..dd0815c5bca4 100644 --- a/hwpfilter/inc/pch/precompiled_hwp.hxx +++ b/hwpfilter/inc/pch/precompiled_hwp.hxx @@ -71,7 +71,6 @@ #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/uno/genfunc.h> #include <com/sun/star/uno/genfunc.hxx> -#include <comphelper/newarray.hxx> #include <cppu/cppudllapi.h> #include <cppu/unotype.hxx> #include <o3tl/underlyingenumvalue.hxx> diff --git a/hwpfilter/source/drawing.h b/hwpfilter/source/drawing.h index 29ec90b8f49a..ce68499e97c6 100644 --- a/hwpfilter/source/drawing.h +++ b/hwpfilter/source/drawing.h @@ -26,8 +26,6 @@ #include <osl/diagnose.h> -#include <comphelper/newarray.hxx> - #include "hwplib.h" #include "hwpfile.h" #include "hiodev.h" @@ -583,8 +581,7 @@ int cmd, void * /*argp*/, int /*argv*/) return OBJRET_FILE_ERROR; if (hdo->u.freeform.npt) { - hdo->u.freeform.pt = - ::comphelper::newArray_null<ZZPoint>(hdo->u.freeform.npt); + hdo->u.freeform.pt = new (std::nothrow) ZZPoint[hdo->u.freeform.npt]; if (hdo->u.freeform.pt == nullptr) { hdo->u.freeform.npt = 0; diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx index 4cddf7d76ad7..d8719d81efb3 100644 --- a/hwpfilter/source/hpara.cxx +++ b/hwpfilter/source/hpara.cxx @@ -20,9 +20,6 @@ #include <memory> #include "precompile.h" - -#include <comphelper/newarray.hxx> - #include "hwplib.h" #include "hwpfile.h" #include "hpara.h" @@ -113,7 +110,7 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag) pshape->pagebreak = etcflag; } - linfo.reset(::comphelper::newArray_null<LineInfo>(nline)); + linfo.reset(new (std::nothrow) LineInfo[nline]); for (ii = 0; ii < nline; ii++) { linfo[ii].Read(hwpf, this); diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx index e155a86e9728..581c5320acd3 100644 --- a/hwpfilter/source/hstyle.cxx +++ b/hwpfilter/source/hstyle.cxx @@ -19,8 +19,6 @@ #include "precompile.h" -#include <comphelper/newarray.hxx> - #include "hwplib.h" #include "hwpfile.h" #include "hstyle.h" @@ -125,7 +123,7 @@ void HWPStyle::Read(HWPFile& hwpf) ParaShape pshape; hwpf.Read2b(&nstyles, 1); - style = ::comphelper::newArray_null<hwpfilter::StyleData>(nstyles); + style = new (std::nothrow) hwpfilter::StyleData[nstyles]; if (!style) return; diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 671834e37d9d..e541eeace41d 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -19,7 +19,6 @@ #include "precompile.h" -#include <comphelper/newarray.hxx> #include <comphelper/configuration.hxx> #include <sal/log.hxx> #include <tools/long.hxx> @@ -296,7 +295,7 @@ bool TxtBox::Read(HWPFile & hwpf) return hwpf.SetState(HWP_InvalidFileFormat); } - cell.reset( ::comphelper::newArray_null<Cell>(ncell) ); + cell.reset(new (std::nothrow) Cell[ncell]); if (!cell) { return hwpf.SetState(HWP_InvalidFileFormat); } diff --git a/include/comphelper/newarray.hxx b/include/comphelper/newarray.hxx deleted file mode 100644 index d3eaccd77ee5..000000000000 --- a/include/comphelper/newarray.hxx +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_COMPHELPER_NEWARRAY_HXX -#define INCLUDED_COMPHELPER_NEWARRAY_HXX - -#include <limits> -#include <new> -#include <stddef.h> - -namespace comphelper { - -template<typename T> T * -newArray_null(size_t const n) noexcept -{ - if ((::std::numeric_limits<size_t>::max() / sizeof(T)) <= n) { - return nullptr; - } - return new (::std::nothrow) T[n]; -} - -} // namespace comphelper - -#endif // INCLUDED_COMPHELPER_NEWARRAY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index c4c327578abb..9a003aa914cd 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -4693,7 +4693,6 @@ include/comphelper/interfacecontainer2.hxx include/comphelper/logging.hxx include/comphelper/mimeconfighelper.hxx include/comphelper/namedvaluecollection.hxx -include/comphelper/newarray.hxx include/comphelper/numberedcollection.hxx include/comphelper/numbers.hxx include/comphelper/ofopxmlhelper.hxx
