new cannot return nullptr
unless we are using std::nothrow Change-Id: I3bdd13c8ce18f4e977f18ee5196311bf4fc62de0 Reviewed-on: https://gerrit.libreoffice.org/38998 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -315,10 +315,6 @@ get_full_path(const NS_tchar *relpath)
|
|||||||
size_t lendestpath = NS_tstrlen(destpath);
|
size_t lendestpath = NS_tstrlen(destpath);
|
||||||
size_t lenrelpath = NS_tstrlen(relpath);
|
size_t lenrelpath = NS_tstrlen(relpath);
|
||||||
NS_tchar *s = new NS_tchar[lendestpath + lenrelpath + 2];
|
NS_tchar *s = new NS_tchar[lendestpath + lenrelpath + 2];
|
||||||
if (!s)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_tchar *c = s;
|
NS_tchar *c = s;
|
||||||
|
|
||||||
|
@@ -734,8 +734,6 @@ oslFileHandle osl::detail::createFileHandleFromFD( int fd )
|
|||||||
return nullptr; // EBADF
|
return nullptr; // EBADF
|
||||||
|
|
||||||
FileHandle_Impl * pImpl = new FileHandle_Impl (fd);
|
FileHandle_Impl * pImpl = new FileHandle_Impl (fd);
|
||||||
if (pImpl == nullptr)
|
|
||||||
return nullptr; // ENOMEM
|
|
||||||
|
|
||||||
// assume writeable
|
// assume writeable
|
||||||
pImpl->m_state |= FileHandle_Impl::STATE_WRITEABLE;
|
pImpl->m_state |= FileHandle_Impl::STATE_WRITEABLE;
|
||||||
@@ -809,11 +807,6 @@ openMemoryAsFile( void *address, size_t size, oslFileHandle *pHandle, const char
|
|||||||
{
|
{
|
||||||
oslFileError eRet;
|
oslFileError eRet;
|
||||||
FileHandle_Impl * pImpl = new FileHandle_Impl (-1, FileHandle_Impl::KIND_MEM, path);
|
FileHandle_Impl * pImpl = new FileHandle_Impl (-1, FileHandle_Impl::KIND_MEM, path);
|
||||||
if (!pImpl)
|
|
||||||
{
|
|
||||||
eRet = oslTranslateFileError (OSL_FET_ERROR, ENOMEM);
|
|
||||||
return eRet;
|
|
||||||
}
|
|
||||||
pImpl->m_size = sal::static_int_cast< sal_uInt64 >(size);
|
pImpl->m_size = sal::static_int_cast< sal_uInt64 >(size);
|
||||||
|
|
||||||
*pHandle = (oslFileHandle)(pImpl);
|
*pHandle = (oslFileHandle)(pImpl);
|
||||||
@@ -1015,12 +1008,6 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
|
|||||||
|
|
||||||
/* allocate memory for impl structure */
|
/* allocate memory for impl structure */
|
||||||
FileHandle_Impl * pImpl = new FileHandle_Impl (fd, FileHandle_Impl::KIND_FD, cpFilePath);
|
FileHandle_Impl * pImpl = new FileHandle_Impl (fd, FileHandle_Impl::KIND_FD, cpFilePath);
|
||||||
if (!pImpl)
|
|
||||||
{
|
|
||||||
eRet = oslTranslateFileError (OSL_FET_ERROR, ENOMEM);
|
|
||||||
(void) close(fd);
|
|
||||||
return eRet;
|
|
||||||
}
|
|
||||||
if (flags & O_RDWR)
|
if (flags & O_RDWR)
|
||||||
pImpl->m_state |= FileHandle_Impl::STATE_WRITEABLE;
|
pImpl->m_state |= FileHandle_Impl::STATE_WRITEABLE;
|
||||||
pImpl->m_size = sal::static_int_cast< sal_uInt64 >(aFileStat.st_size);
|
pImpl->m_size = sal::static_int_cast< sal_uInt64 >(aFileStat.st_size);
|
||||||
|
@@ -148,13 +148,10 @@ static void osl_thread_init_Impl()
|
|||||||
Thread_Impl* osl_thread_construct_Impl()
|
Thread_Impl* osl_thread_construct_Impl()
|
||||||
{
|
{
|
||||||
Thread_Impl* pImpl = new Thread_Impl;
|
Thread_Impl* pImpl = new Thread_Impl;
|
||||||
if (pImpl)
|
memset (pImpl, 0, sizeof(Thread_Impl));
|
||||||
{
|
|
||||||
memset (pImpl, 0, sizeof(Thread_Impl));
|
|
||||||
|
|
||||||
pthread_mutex_init (&(pImpl->m_Lock), PTHREAD_MUTEXATTR_DEFAULT);
|
pthread_mutex_init (&(pImpl->m_Lock), PTHREAD_MUTEXATTR_DEFAULT);
|
||||||
pthread_cond_init (&(pImpl->m_Cond), PTHREAD_CONDATTR_DEFAULT);
|
pthread_cond_init (&(pImpl->m_Cond), PTHREAD_CONDATTR_DEFAULT);
|
||||||
}
|
|
||||||
return pImpl;
|
return pImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -677,12 +677,6 @@ SAL_CALL osl_createFileHandleFromOSHandle (
|
|||||||
return nullptr; // EINVAL
|
return nullptr; // EINVAL
|
||||||
|
|
||||||
FileHandle_Impl * pImpl = new FileHandle_Impl(hFile);
|
FileHandle_Impl * pImpl = new FileHandle_Impl(hFile);
|
||||||
if (pImpl == nullptr)
|
|
||||||
{
|
|
||||||
// cleanup and fail
|
|
||||||
(void) ::CloseHandle(hFile);
|
|
||||||
return nullptr; // ENOMEM
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check for regular file */
|
/* check for regular file */
|
||||||
if (FILE_TYPE_DISK == GetFileType(hFile))
|
if (FILE_TYPE_DISK == GetFileType(hFile))
|
||||||
|
@@ -78,8 +78,6 @@ bool ScCollection::AtInsert(sal_uInt16 nIndex, ScDataObject* pScDataObject)
|
|||||||
if (nCount == nLimit)
|
if (nCount == nLimit)
|
||||||
{
|
{
|
||||||
ScDataObject** pNewItems = new ScDataObject*[nLimit + nDelta];
|
ScDataObject** pNewItems = new ScDataObject*[nLimit + nDelta];
|
||||||
if (!pNewItems)
|
|
||||||
return false;
|
|
||||||
nLimit = sal::static_int_cast<sal_uInt16>( nLimit + nDelta );
|
nLimit = sal::static_int_cast<sal_uInt16>( nLimit + nDelta );
|
||||||
memcpy(pNewItems, pItems, nCount * sizeof(ScDataObject*));
|
memcpy(pNewItems, pItems, nCount * sizeof(ScDataObject*));
|
||||||
delete[] pItems;
|
delete[] pItems;
|
||||||
|
@@ -1714,13 +1714,10 @@ namespace {
|
|||||||
CGPoint* makeCGptArray(sal_uInt32 nPoints, const SalPoint* pPtAry)
|
CGPoint* makeCGptArray(sal_uInt32 nPoints, const SalPoint* pPtAry)
|
||||||
{
|
{
|
||||||
CGPoint *CGpoints = new CGPoint[nPoints];
|
CGPoint *CGpoints = new CGPoint[nPoints];
|
||||||
if ( CGpoints )
|
for(sal_uLong i=0;i<nPoints;i++)
|
||||||
{
|
{
|
||||||
for(sal_uLong i=0;i<nPoints;i++)
|
CGpoints[i].x = pPtAry[i].mnX;
|
||||||
{
|
CGpoints[i].y = pPtAry[i].mnY;
|
||||||
CGpoints[i].x = pPtAry[i].mnX;
|
|
||||||
CGpoints[i].y = pPtAry[i].mnY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return CGpoints;
|
return CGpoints;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user