Files
loongoffice/cppu/source/cppu/cppu_opt.cxx
Stephan Bergmann c8eaadb5d7 Remaining loplugin:bufferadd
...that had been missing because the plugin didn't implement postRun, so it
didn't report anything when run as part of the shared plugin.  (But did report
the expected warnings when run as a standalone plugin during
CompilerTest_compilerplugins_clang.)

Most fixes are straightforward.  A noteworthy one is PreparedStatement::setBytes
in connectivity/source/drivers/postgresql/pq_preparedstatement.cxx:  The old
preallocation of a 20 character OStringBuffer might have prevented

  buf.append( reinterpret_cast<char *>(escapedString), len -1 );

from potentially throwing std::bad_alloc, which would have caused escapedString
to be leaked.  Even though that 20-character preallocation was likely just
random junk and not meant to address the potential leak, lets address it now.

Change-Id: Ib506332d061684a22a74e5e39e591539fd2c4900
Reviewed-on: https://gerrit.libreoffice.org/80925
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-17 09:03:53 +02:00

67 lines
2.1 KiB
C++

/* -*- 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 .
*/
#include <sal/config.h>
#include <com/sun/star/uno/Any.hxx>
#include <typelib/typedescription.h>
#include <uno/any2.h>
#include <rtl/ustring.hxx>
using namespace ::rtl;
extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg(
typelib_TypeDescriptionReference * pType )
SAL_THROW_EXTERN_C()
{
OUString ret = "unsatisfied query for interface of type "
+ OUString::unacquired( &pType->pTypeName ) + "!";
rtl_uString_acquire( ret.pData );
return ret.pData;
}
extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg(
typelib_TypeDescriptionReference * pType )
SAL_THROW_EXTERN_C()
{
OUString ret = "invalid attempt to assign an empty interface of type "
+ OUString::unacquired( &pType->pTypeName ) + "!";
rtl_uString_acquire( ret.pData );
return ret.pData;
}
extern "C" rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
SAL_THROW_EXTERN_C()
{
OUString ret = "Cannot extract an Any(" +
OUString::unacquired(&pAny->pType->pTypeName) +
") to " +
OUString::unacquired(&pType->pTypeName) +
"!";
rtl_uString_acquire( ret.pData );
return ret.pData;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */