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 <mike.kaganski@collabora.com>
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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: */
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user