diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-03-11 09:06:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-03-11 09:58:36 +0000 |
commit | 556373c41fddbac6cbee1c89e7707631270a1852 (patch) | |
tree | 026862690693419beb8810fdc6671ae30c72a026 | |
parent | 62b124b2704adf11a63681164d05a8eb49dfb105 (diff) |
V668 no sense in testing the result of new against null
Change-Id: I4a33bd92fc8448638a4bfe1eab7e5041a4c5cc39
44 files changed, 659 insertions, 853 deletions
diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx index 829ae6bb12ee..7c8e5e0e67e7 100644 --- a/UnoControls/source/base/basecontainercontrol.cxx +++ b/UnoControls/source/base/basecontainercontrol.cxx @@ -225,49 +225,46 @@ void SAL_CALL BaseContainerControl::addControl ( const OUString& rName, const Re // take memory for new item IMPL_ControlInfo* pNewControl = new IMPL_ControlInfo; - if (pNewControl!=(IMPL_ControlInfo*)0) - { - // Ready for multithreading - MutexGuard aGuard (m_aMutex); + // Ready for multithreading + MutexGuard aGuard (m_aMutex); - // set control - pNewControl->sName = rName; - pNewControl->xControl = rControl; + // set control + pNewControl->sName = rName; + pNewControl->xControl = rControl; - // and insert in list - maControlInfoList.push_back( pNewControl ); + // and insert in list + maControlInfoList.push_back( pNewControl ); - // initialize new control - pNewControl->xControl->setContext ( (OWeakObject*)this ); - pNewControl->xControl->addEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) ); + // initialize new control + pNewControl->xControl->setContext ( (OWeakObject*)this ); + pNewControl->xControl->addEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) ); - // when container has a peer ... - if (getPeer().is()) - { - // .. then create a peer on child - pNewControl->xControl->createPeer ( getPeer()->getToolkit(), getPeer() ); - impl_activateTabControllers (); - } + // when container has a peer ... + if (getPeer().is()) + { + // .. then create a peer on child + pNewControl->xControl->createPeer ( getPeer()->getToolkit(), getPeer() ); + impl_activateTabControllers (); + } - // Send message to all listener - OInterfaceContainerHelper* pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get()); + // Send message to all listener + OInterfaceContainerHelper* pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get()); - if (pInterfaceContainer) - { - // Build event - ContainerEvent aEvent; + if (pInterfaceContainer) + { + // Build event + ContainerEvent aEvent; - aEvent.Source = *this; - aEvent.Element <<= rControl; + aEvent.Source = *this; + aEvent.Element <<= rControl; - // Get all listener - OInterfaceIteratorHelper aIterator (*pInterfaceContainer); + // Get all listener + OInterfaceIteratorHelper aIterator (*pInterfaceContainer); - // Send event - while ( aIterator.hasMoreElements() ) - { - static_cast<XContainerListener*>(aIterator.next())->elementInserted (aEvent); - } + // Send event + while ( aIterator.hasMoreElements() ) + { + static_cast<XContainerListener*>(aIterator.next())->elementInserted (aEvent); } } } diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx index a2f19c350da3..e752b006031e 100644 --- a/UnoControls/source/controls/progressmonitor.cxx +++ b/UnoControls/source/controls/progressmonitor.cxx @@ -217,24 +217,21 @@ void SAL_CALL ProgressMonitor::addText( // Else ... take memory for new item ... IMPL_TextlistItem* pTextItem = new IMPL_TextlistItem; - if ( pTextItem != NULL ) - { - // Set values ... - pTextItem->sTopic = rTopic; - pTextItem->sText = rText; + // Set values ... + pTextItem->sTopic = rTopic; + pTextItem->sText = rText; - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ); + // Ready for multithreading + MutexGuard aGuard ( m_aMutex ); - // ... and insert it in right list. - if ( bbeforeProgress ) - { - maTextlist_Top.push_back( pTextItem ); - } - else - { - maTextlist_Bottom.push_back( pTextItem ); - } + // ... and insert it in right list. + if ( bbeforeProgress ) + { + maTextlist_Top.push_back( pTextItem ); + } + else + { + maTextlist_Bottom.push_back( pTextItem ); } // ... update window diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 338ed0218ec3..d99259b0082c 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -383,16 +383,9 @@ void SbiImage::MakeStrings( short nSize ) nStringSize = 1024; pStrings = new sal_Unicode[ nStringSize ]; pStringOff = new sal_uInt32[ nSize ]; - if( pStrings && pStringOff ) - { - nStrings = nSize; - memset( pStringOff, 0, nSize * sizeof( sal_uInt32 ) ); - memset( pStrings, 0, nStringSize * sizeof( sal_Unicode ) ); - } - else - { - bError = true; - } + nStrings = nSize; + memset( pStringOff, 0, nSize * sizeof( sal_uInt32 ) ); + memset( pStrings, 0, nStringSize * sizeof( sal_Unicode ) ); } // Add a string to StringPool. The String buffer is dynamically @@ -415,18 +408,11 @@ void SbiImage::AddString( const OUString& r ) { sal_uInt32 nNewLen = needed + 1024; nNewLen &= 0xFFFFFC00; // trim to 1K border - sal_Unicode* p = NULL; - if( (p = new sal_Unicode[ nNewLen ]) != NULL ) - { - memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) ); - delete[] pStrings; - pStrings = p; - nStringSize = sal::static_int_cast< sal_uInt16 >(nNewLen); - } - else - { - bError = true; - } + sal_Unicode* p = new sal_Unicode[nNewLen]; + memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) ); + delete[] pStrings; + pStrings = p; + nStringSize = sal::static_int_cast< sal_uInt16 >(nNewLen); } if( !bError ) { diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx index 4b112285791f..3f38dc3d4d10 100644 --- a/canvas/source/directx/dx_impltools.cxx +++ b/canvas/source/directx/dx_impltools.cxx @@ -135,8 +135,7 @@ namespace dxcanvas Gdiplus::Graphics* createGraphicsFromHDC(HDC aHDC) { Gdiplus::Graphics* pRet = new Gdiplus::Graphics(aHDC); - if( pRet ) - setupGraphics( *pRet ); + setupGraphics( *pRet ); return pRet; } diff --git a/configmgr/source/winreg.cxx b/configmgr/source/winreg.cxx index 99886d6ff9ed..7d4e9e9c7e2f 100644 --- a/configmgr/source/winreg.cxx +++ b/configmgr/source/winreg.cxx @@ -108,82 +108,79 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString aKeyName, oslFileHandle aFileHan wchar_t* pValueName = new wchar_t[nLongestValueNameLen + 1]; wchar_t* pValue = new wchar_t[nLongestValueLen + 1]; - if(pValueName && pValue) + bool bFinal = false; + OUString aValue; + + for(DWORD i = 0; i < nValues; ++i) { - bool bFinal = false; - OUString aValue; + DWORD nValueNameLen = nLongestValueNameLen + 1; + DWORD nValueLen = nLongestValueLen + 1; - for(DWORD i = 0; i < nValues; ++i) - { - DWORD nValueNameLen = nLongestValueNameLen + 1; - DWORD nValueLen = nLongestValueLen + 1; + RegEnumValueW(hCurKey, i, pValueName, &nValueNameLen, NULL, NULL, (LPBYTE)pValue, &nValueLen); + const wchar_t wsValue[] = L"Value"; + const wchar_t wsFinal[] = L"Final"; - RegEnumValueW(hCurKey, i, pValueName, &nValueNameLen, NULL, NULL, (LPBYTE)pValue, &nValueLen); - const wchar_t wsValue[] = L"Value"; - const wchar_t wsFinal[] = L"Final"; + if(!wcscmp(pValueName, wsValue)) + aValue = OUString(pValue); + if(!wcscmp(pValueName, wsFinal) && *(DWORD*)pValue == 1) + bFinal = true; + } + sal_Int32 aLastSeparator = aKeyName.lastIndexOf('\\'); + OUString aPathAndNodes = aKeyName.copy(0, aLastSeparator); + OUString aProp = aKeyName.copy(aLastSeparator + 1); + bool bHasNode = false; + sal_Int32 nCloseNode = 0; + + writeData(aFileHandle, "<item oor:path=\""); + for(sal_Int32 nIndex = 0;; ++nIndex) + { + OUString aNextPathPart = aPathAndNodes.getToken(nIndex, '\\'); - if(!wcscmp(pValueName, wsValue)) - aValue = OUString(pValue); - if(!wcscmp(pValueName, wsFinal) && *(DWORD*)pValue == 1) - bFinal = true; - } - sal_Int32 aLastSeparator = aKeyName.lastIndexOf('\\'); - OUString aPathAndNodes = aKeyName.copy(0, aLastSeparator); - OUString aProp = aKeyName.copy(aLastSeparator + 1); - bool bHasNode = false; - sal_Int32 nCloseNode = 0; - - writeData(aFileHandle, "<item oor:path=\""); - for(sal_Int32 nIndex = 0;; ++nIndex) + if(!aNextPathPart.isEmpty()) { - OUString aNextPathPart = aPathAndNodes.getToken(nIndex, '\\'); - - if(!aNextPathPart.isEmpty()) + if((aNextPathPart.lastIndexOf("/#") != -1) || bHasNode) { - if((aNextPathPart.lastIndexOf("/#") != -1) || bHasNode) + bHasNode = true; + nCloseNode++; + writeData(aFileHandle, "\"><node oor:name=\""); + sal_Int32 nCommandSeparator = aNextPathPart.lastIndexOf('#'); + if(nCommandSeparator != -1) { - bHasNode = true; - nCloseNode++; - writeData(aFileHandle, "\"><node oor:name=\""); - sal_Int32 nCommandSeparator = aNextPathPart.lastIndexOf('#'); - if(nCommandSeparator != -1) - { - OUString aNodeOp = aNextPathPart.copy(nCommandSeparator + 1); - writeAttributeValue(aFileHandle, aNextPathPart.copy(0, nCommandSeparator - 1)); - writeData(aFileHandle, "\" oor:op=\""); - writeAttributeValue(aFileHandle, aNodeOp); - } - else - { - writeAttributeValue(aFileHandle, aNextPathPart); - } + OUString aNodeOp = aNextPathPart.copy(nCommandSeparator + 1); + writeAttributeValue(aFileHandle, aNextPathPart.copy(0, nCommandSeparator - 1)); + writeData(aFileHandle, "\" oor:op=\""); + writeAttributeValue(aFileHandle, aNodeOp); } else { - writeAttributeValue(aFileHandle, "/" + aNextPathPart); + writeAttributeValue(aFileHandle, aNextPathPart); } } else { - writeData(aFileHandle, "\">"); - break; + writeAttributeValue(aFileHandle, "/" + aNextPathPart); } } - - writeData(aFileHandle, "<prop oor:name=\""); - writeAttributeValue(aFileHandle, aProp); - writeData(aFileHandle, "\""); - if(bFinal) - writeData(aFileHandle, " oor:finalized=\"true\""); - writeData(aFileHandle, "><value>"); - writeValueContent(aFileHandle, aValue); - writeData(aFileHandle, "</value></prop>"); - for(; nCloseNode > 0; nCloseNode--) - writeData(aFileHandle, "</node>"); - writeData(aFileHandle, "</item>\n"); - delete[] pValueName; - delete[] pValue; + else + { + writeData(aFileHandle, "\">"); + break; + } } + + writeData(aFileHandle, "<prop oor:name=\""); + writeAttributeValue(aFileHandle, aProp); + writeData(aFileHandle, "\""); + if(bFinal) + writeData(aFileHandle, " oor:finalized=\"true\""); + writeData(aFileHandle, "><value>"); + writeValueContent(aFileHandle, aValue); + writeData(aFileHandle, "</value></prop>"); + for(; nCloseNode > 0; nCloseNode--) + writeData(aFileHandle, "</node>"); + writeData(aFileHandle, "</item>\n"); + delete[] pValueName; + delete[] pValue; } RegCloseKey(hCurKey); } diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx index 0fb932c24e08..bd364892b890 100644 --- a/editeng/source/accessibility/AccessibleContextBase.cxx +++ b/editeng/source/accessibility/AccessibleContextBase.cxx @@ -69,31 +69,22 @@ AccessibleContextBase::AccessibleContextBase ( // Set some states. Don't use the SetState method because no events // shall be broadcastet (that is not yet initialized anyway). - if (pStateSet != NULL) - { - pStateSet->AddState (AccessibleStateType::ENABLED); - pStateSet->AddState (AccessibleStateType::SENSITIVE); - pStateSet->AddState (AccessibleStateType::SHOWING); - pStateSet->AddState (AccessibleStateType::VISIBLE); - pStateSet->AddState (AccessibleStateType::FOCUSABLE); - pStateSet->AddState (AccessibleStateType::SELECTABLE); - } + pStateSet->AddState (AccessibleStateType::ENABLED); + pStateSet->AddState (AccessibleStateType::SENSITIVE); + pStateSet->AddState (AccessibleStateType::SHOWING); + pStateSet->AddState (AccessibleStateType::VISIBLE); + pStateSet->AddState (AccessibleStateType::FOCUSABLE); + pStateSet->AddState (AccessibleStateType::SELECTABLE); // Create the relation set. ::utl::AccessibleRelationSetHelper* pRelationSet = new ::utl::AccessibleRelationSetHelper (); mxRelationSet = pRelationSet; } - - - AccessibleContextBase::~AccessibleContextBase(void) { } - - - bool AccessibleContextBase::SetState (sal_Int16 aState) { ::osl::ClearableMutexGuard aGuard (maMutex); @@ -368,8 +359,7 @@ uno::Reference<XAccessibleStateSet> SAL_CALL // We are already disposed! // Create a new state set that has only set the DEFUNC state. pStateSet = new ::utl::AccessibleStateSetHelper (); - if (pStateSet != NULL) - pStateSet->AddState (AccessibleStateType::DEFUNC); + pStateSet->AddState (AccessibleStateType::DEFUNC); } else { diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index ad198b55bbbf..9de8512a70a5 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -320,12 +320,8 @@ SvxEditSource* SvxEditSourceAdapter::Clone() const if( pClonedAdaptee.get() ) { SvxEditSourceAdapter* pClone = new SvxEditSourceAdapter(); - - if( pClone ) - { - pClone->SetEditSource( std::move(pClonedAdaptee) ); - return pClone; - } + pClone->SetEditSource( std::move(pClonedAdaptee) ); + return pClone; } } diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index 9d79da168c1b..eebfcf0c6cf6 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -296,13 +296,9 @@ EventAttacherImpl::~EventAttacherImpl() Reference< XInterface > SAL_CALL EventAttacherImpl_CreateInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( Exception ) { - Reference< XInterface > xRet; XEventAttacher *pEventAttacher = (XEventAttacher*) new EventAttacherImpl( comphelper::getComponentContext(rSMgr) ); - if (pEventAttacher) - { - xRet = Reference<XInterface>::query(pEventAttacher); - } + Reference< XInterface > xRet = Reference<XInterface>::query(pEventAttacher); return xRet; } diff --git a/extensions/source/plugin/win/winmgr.cxx b/extensions/source/plugin/win/winmgr.cxx index 881ec270b0e3..b84315e1873f 100644 --- a/extensions/source/plugin/win/winmgr.cxx +++ b/extensions/source/plugin/win/winmgr.cxx @@ -332,7 +332,7 @@ Sequence< PluginDescription > XPluginManager_Impl::impl_getPluginDescriptions() continue; char * pVersionData = new char[dwSize]; - if (pVersionData && ::GetFileVersionInfo( arFileName, 0, dwSize, pVersionData )) + if (::GetFileVersionInfo( arFileName, 0, dwSize, pVersionData)) { // optional comment OUString aComment; @@ -433,8 +433,7 @@ Sequence< PluginDescription > XPluginManager_Impl::impl_getPluginDescriptions() OSL_FAIL( "### cannot get MIME type or extensions!" ); #endif } - if (pVersionData) - delete[] pVersionData; + delete[] pVersionData; } s_bInit = TRUE; diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx index b0b844ff106a..a7fcbe514313 100644 --- a/filter/source/graphicfilter/icgm/bitmap.cxx +++ b/filter/source/graphicfilter/icgm/bitmap.cxx @@ -44,160 +44,156 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc ) if ( ImplGetDimensions( rDesc ) && rDesc.mpBuf ) { - if ( ( rDesc.mpBitmap = new Bitmap( Size( rDesc.mnX, rDesc.mnY ), (sal_uInt16)rDesc.mnDstBitsPerPixel ) ) != NULL ) + rDesc.mpBitmap = new Bitmap( Size( rDesc.mnX, rDesc.mnY ), (sal_uInt16)rDesc.mnDstBitsPerPixel ); + if ( ( rDesc.mpAcc = rDesc.mpBitmap->AcquireWriteAccess() ) != NULL ) { - if ( ( rDesc.mpAcc = rDesc.mpBitmap->AcquireWriteAccess() ) != NULL ) - { - // the picture may either be read from left to right or right to left, from top to bottom ... + // the picture may either be read from left to right or right to left, from top to bottom ... - long nxCount = rDesc.mnX + 1; // +1 because we are using prefix decreasing - long nyCount = rDesc.mnY + 1; - long nx, ny, nxC; + long nxCount = rDesc.mnX + 1; // +1 because we are using prefix decreasing + long nyCount = rDesc.mnY + 1; + long nx, ny, nxC; - switch ( rDesc.mnDstBitsPerPixel ) + switch ( rDesc.mnDstBitsPerPixel ) + { + case 1 : { - case 1 : + if ( rDesc.mnLocalColorPrecision == 1 ) + ImplSetCurrentPalette( rDesc ); + else { - if ( rDesc.mnLocalColorPrecision == 1 ) - ImplSetCurrentPalette( rDesc ); - else - { - rDesc.mpAcc->SetPaletteEntryCount( 2 ); - rDesc.mpAcc->SetPaletteColor( 0, BMCOL( mpCGM->pElement->nBackGroundColor ) ); - rDesc.mpAcc->SetPaletteColor( 1, - ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLINTERIORSTYLE ) - ? BMCOL( mpCGM->pElement->pFillBundle->GetColor() ) - : BMCOL( mpCGM->pElement->aFillBundle.GetColor() ) ) ; - } - for ( ny = 0; --nyCount ; ny++, rDesc.mpBuf += rDesc.mnScanSize ) - { - nxC = nxCount; - for ( nx = 0; --nxC; nx++ ) - { // this is not fast, but a one bit/pixel format is rarely used - rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>( (*( rDesc.mpBuf + (nx >> 3)) >> ((nx & 7)^7))) & 1 ); - } + rDesc.mpAcc->SetPaletteEntryCount( 2 ); + rDesc.mpAcc->SetPaletteColor( 0, BMCOL( mpCGM->pElement->nBackGroundColor ) ); + rDesc.mpAcc->SetPaletteColor( 1, + ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLINTERIORSTYLE ) + ? BMCOL( mpCGM->pElement->pFillBundle->GetColor() ) + : BMCOL( mpCGM->pElement->aFillBundle.GetColor() ) ) ; + } + for ( ny = 0; --nyCount ; ny++, rDesc.mpBuf += rDesc.mnScanSize ) + { + nxC = nxCount; + for ( nx = 0; --nxC; nx++ ) + { // this is not fast, but a one bit/pixel format is rarely used + rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>( (*( rDesc.mpBuf + (nx >> 3)) >> ((nx & 7)^7))) & 1 ); } } - break; + } + break; - case 2 : + case 2 : + { + ImplSetCurrentPalette( rDesc ); + for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { - ImplSetCurrentPalette( rDesc ); - for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) - { - nxC = nxCount; - for ( nx = 0; --nxC; nx++ ) - { // this is not fast, but a two bits/pixel format is rarely used - rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>( (*(rDesc.mpBuf + (nx >> 2)) >> (((nx & 3)^3) << 1))) & 3 ); - } + nxC = nxCount; + for ( nx = 0; --nxC; nx++ ) + { // this is not fast, but a two bits/pixel format is rarely used + rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>( (*(rDesc.mpBuf + (nx >> 2)) >> (((nx & 3)^3) << 1))) & 3 ); } } - break; + } + break; - case 4 : + case 4 : + { + ImplSetCurrentPalette( rDesc ); + for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { - ImplSetCurrentPalette( rDesc ); - for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) + nxC = nxCount; + sal_Int8 nDat; + sal_uInt8* pTemp = rDesc.mpBuf; + for ( nx = 0; --nxC; nx++ ) { - nxC = nxCount; - sal_Int8 nDat; - sal_uInt8* pTemp = rDesc.mpBuf; - for ( nx = 0; --nxC; nx++ ) + nDat = *pTemp++; + rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>(nDat >> 4) ); + if ( --nxC ) { - nDat = *pTemp++; - rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>(nDat >> 4) ); - if ( --nxC ) - { - nx ++; - rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>(nDat & 15) ); - } - else - break; + nx ++; + rDesc.mpAcc->SetPixelIndex( ny, nx, static_cast<sal_uInt8>(nDat & 15) ); } + else + break; } } - break; + } + break; - case 8 : + case 8 : + { + ImplSetCurrentPalette( rDesc ); + for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { - ImplSetCurrentPalette( rDesc ); - for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) + sal_uInt8* pTemp = rDesc.mpBuf; + nxC = nxCount; + for ( nx = 0; --nxC; nx++ ) { - sal_uInt8* pTemp = rDesc.mpBuf; - nxC = nxCount; - for ( nx = 0; --nxC; nx++ ) - { - rDesc.mpAcc->SetPixelIndex( ny, nx, *(pTemp++) ); - } + rDesc.mpAcc->SetPixelIndex( ny, nx, *(pTemp++) ); } } - break; + } + break; - case 24 : + case 24 : + { { + BitmapColor aBitmapColor; + for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) { - BitmapColor aBitmapColor; - for ( ny = 0; --nyCount; ny++, rDesc.mpBuf += rDesc.mnScanSize ) + sal_uInt8* pTemp = rDesc.mpBuf; + nxC = nxCount; + for ( nx = 0; --nxC; nx++ ) { - sal_uInt8* pTemp = rDesc.mpBuf; - nxC = nxCount; - for ( nx = 0; --nxC; nx++ ) - { - aBitmapColor.SetRed( *pTemp++ ); - aBitmapColor.SetGreen( *pTemp++ ); - aBitmapColor.SetBlue( *pTemp++ ); - rDesc.mpAcc->SetPixel( ny, nx, aBitmapColor ); - } + aBitmapColor.SetRed( *pTemp++ ); + aBitmapColor.SetGreen( *pTemp++ ); + aBitmapColor.SetBlue( *pTemp++ ); + rDesc.mpAcc->SetPixel( ny, nx, aBitmapColor ); } } } - break; } - double nX = rDesc.mnR.X - rDesc.mnQ.X; - double nY = rDesc.mnR.Y - rDesc.mnQ.Y; + break; + } + double nX = rDesc.mnR.X - rDesc.mnQ.X; + double nY = rDesc.mnR.Y - rDesc.mnQ.Y; - rDesc.mndy = sqrt( nX * nX + nY * nY ); + rDesc.mndy = sqrt( nX * nX + nY * nY ); - nX = rDesc.mnR.X - rDesc.mnP.X; - nY = rDesc.mnR.Y - rDesc.mnP.Y; + nX = rDesc.mnR.X - rDesc.mnP.X; + nY = rDesc.mnR.Y - rDesc.mnP.Y; - rDesc.mndx = sqrt( nX * nX + nY * nY ); + rDesc.mndx = sqrt( nX * nX + nY * nY ); - nX = rDesc.mnR.X - rDesc.mnP.X; - nY = rDesc.mnR.Y - rDesc.mnP.Y; + nX = rDesc.mnR.X - rDesc.mnP.X; + nY = rDesc.mnR.Y - rDesc.mnP.Y; - rDesc.mnOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308; - if ( nY > 0 ) - rDesc.mnOrientation = 360 - rDesc.mnOrientation; + rDesc.mnOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308; + if ( nY > 0 ) + rDesc.mnOrientation = 360 - rDesc.mnOrientation; - nX = rDesc.mnQ.X - rDesc.mnR.X; - nY = rDesc.mnQ.Y - rDesc.mnR.Y; + nX = rDesc.mnQ.X - rDesc.mnR.X; + nY = rDesc.mnQ.Y - rDesc.mnR.Y; - double fAngle = 0.01745329251994 * ( 360 - rDesc.mnOrientation ); - double fSin = sin(fAngle); - double fCos = cos(fAngle); - nX = fCos * nX + fSin * nY; - nY = -( fSin * nX - fCos * nY ); + double fAngle = 0.01745329251994 * ( 360 - rDesc.mnOrientation ); + double fSin = sin(fAngle); + double fCos = cos(fAngle); + nX = fCos * nX + fSin * nY; + nY = -( fSin * nX - fCos * nY ); - fAngle = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308; - if ( nY > 0 ) - fAngle = 360 - fAngle; + fAngle = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308; + if ( nY > 0 ) + fAngle = 360 - fAngle; - if ( fAngle > 180 ) // is the picture build upwards or downwards ? - { - rDesc.mnOrigin = rDesc.mnP; - } - else - { - rDesc.mbVMirror = true; - rDesc.mnOrigin = rDesc.mnP; - rDesc.mnOrigin.X += rDesc.mnQ.X - rDesc.mnR.X; - rDesc.mnOrigin.Y += rDesc.mnQ.Y - rDesc.mnR.Y; - } + if ( fAngle > 180 ) // is the picture build upwards or downwards ? + { + rDesc.mnOrigin = rDesc.mnP; } else - rDesc.mbStatus = false; + { + rDesc.mbVMirror = true; + rDesc.mnOrigin = rDesc.mnP; + rDesc.mnOrigin.X += rDesc.mnQ.X - rDesc.mnR.X; + rDesc.mnOrigin.Y += rDesc.mnQ.Y - rDesc.mnR.Y; + } } else rDesc.mbStatus = false; @@ -358,40 +354,29 @@ void CGMBitmap::ImplInsert( CGMBitmapDescriptor& rSource, CGMBitmapDescriptor& r rDest.mndy += rSource.mndy; }; - - CGMBitmap* CGMBitmap::GetNext() { if ( pCGMBitmapDescriptor->mpBitmap && pCGMBitmapDescriptor->mbStatus ) { CGMBitmap* pCGMTempBitmap = new CGMBitmap( *mpCGM ); - if ( pCGMTempBitmap ) + if ( ( (long)pCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation == (long)pCGMBitmapDescriptor->mnOrientation ) && + ( ( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.X == pCGMBitmapDescriptor->mnQ.X ) && + ( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.Y == pCGMBitmapDescriptor->mnQ.Y ) ) || + ( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.X == pCGMBitmapDescriptor->mnR.X ) && + ( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.Y == pCGMBitmapDescriptor->mnR.Y ) ) ) ) { - if ( ( (long)pCGMTempBitmap->pCGMBitmapDescriptor->mnOrientation == (long)pCGMBitmapDescriptor->mnOrientation ) && - ( ( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.X == pCGMBitmapDescriptor->mnQ.X ) && - ( pCGMTempBitmap->pCGMBitmapDescriptor->mnR.Y == pCGMBitmapDescriptor->mnQ.Y ) ) || - ( ( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.X == pCGMBitmapDescriptor->mnR.X ) && - ( pCGMTempBitmap->pCGMBitmapDescriptor->mnQ.Y == pCGMBitmapDescriptor->mnR.Y ) ) ) ) - { - ImplInsert( *(pCGMTempBitmap->pCGMBitmapDescriptor), *(pCGMBitmapDescriptor) ); - delete pCGMTempBitmap; - return NULL; - } - else // we'll replace the pointers and return the old one - { - CGMBitmapDescriptor* pTempBD = pCGMBitmapDescriptor; - pCGMBitmapDescriptor = pCGMTempBitmap->pCGMBitmapDescriptor; - pCGMTempBitmap->pCGMBitmapDescriptor = pTempBD; - return pCGMTempBitmap; - } + ImplInsert( *(pCGMTempBitmap->pCGMBitmapDescriptor), *(pCGMBitmapDescriptor) ); + delete pCGMTempBitmap; + return NULL; } - return NULL; + + CGMBitmapDescriptor* pTempBD = pCGMBitmapDescriptor; + pCGMBitmapDescriptor = pCGMTempBitmap->pCGMBitmapDescriptor; + pCGMTempBitmap->pCGMBitmapDescriptor = pTempBD; + return pCGMTempBitmap; } else return NULL; } - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/graphicfilter/icgm/class1.cxx b/filter/source/graphicfilter/icgm/class1.cxx index 1eae8c54e3e6..b43238f5a140 100644 --- a/filter/source/graphicfilter/icgm/class1.cxx +++ b/filter/source/graphicfilter/icgm/class1.cxx @@ -166,12 +166,9 @@ void CGM::ImplDoClass1() if ( mnElementSize > 1 ) { sal_uInt8* pBuf = new sal_uInt8[ mnElementSize ]; - if ( pBuf ) - { - memcpy( pBuf, mpSource, mnElementSize ); - maDefRepList.push_back( pBuf ); - maDefRepSizeList.push_back( mnElementSize ); - } + memcpy( pBuf, mpSource, mnElementSize ); + maDefRepList.push_back( pBuf ); + maDefRepSizeList.push_back( mnElementSize ); } mnParaSize = mnElementSize; } diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index 2e5f9a141fa4..3ca015eca050 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -596,161 +596,160 @@ GraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* ) rStream.Seek( nPSStreamPos ); sal_uInt8* pBuf = new sal_uInt8[ nPSSize ]; - if ( pBuf ) + + sal_uInt32 nBufStartPos = rStream.Tell(); + sal_uInt32 nBytesRead = rStream.Read( pBuf, nPSSize ); + if ( nBytesRead == nPSSize ) { - sal_uInt32 nBufStartPos = rStream.Tell(); - sal_uInt32 nBytesRead = rStream.Read( pBuf, nPSSize ); - if ( nBytesRead == nPSSize ) + int nSecurityCount = 32; + if ( !bHasPreview ) // if there is no tiff/wmf preview, we will parse for an preview in the eps prolog { - int nSecurityCount = 32; - if ( !bHasPreview ) // if there is no tiff/wmf preview, we will parse for an preview in the eps prolog + sal_uInt8* pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%BeginPreview:"), nBytesRead - 32, 15 ); + if ( pDest ) { - sal_uInt8* pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%BeginPreview:"), nBytesRead - 32, 15 ); - if ( pDest ) + pDest += 15; + long nWidth = ImplGetNumber( &pDest, nSecurityCount ); + long nHeight = ImplGetNumber( &pDest, nSecurityCount ); + long nBitDepth = ImplGetNumber( &pDest, nSecurityCount ); + long nScanLines = ImplGetNumber( &pDest, nSecurityCount ); + pDest = ImplSearchEntry( pDest, reinterpret_cast<sal_uInt8 const *>("%"), 16, 1 ); // go to the first Scanline + if ( nSecurityCount && pDest && nWidth && nHeight && ( ( nBitDepth == 1 ) || ( nBitDepth == 8 ) ) && nScanLines ) { - pDest += 15; - long nWidth = ImplGetNumber( &pDest, nSecurityCount ); - long nHeight = ImplGetNumber( &pDest, nSecurityCount ); - long nBitDepth = ImplGetNumber( &pDest, nSecurityCount ); - long nScanLines = ImplGetNumber( &pDest, nSecurityCount ); - pDest = ImplSearchEntry( pDest, reinterpret_cast<sal_uInt8 const *>("%"), 16, 1 ); // go to the first Scanline - if ( nSecurityCount && pDest && nWidth && nHeight && ( ( nBitDepth == 1 ) || ( nBitDepth == 8 ) ) && nScanLines ) - { - rStream.Seek( nBufStartPos + ( pDest - pBuf ) ); + rStream.Seek( nBufStartPos + ( pDest - pBuf ) ); - Bitmap aBitmap( Size( nWidth, nHeight ), 1 ); - BitmapWriteAccess* pAcc = aBitmap.AcquireWriteAccess(); - if ( pAcc ) + Bitmap aBitmap( Size( nWidth, nHeight ), 1 ); + BitmapWriteAccess* pAcc = aBitmap.AcquireWriteAccess(); + if ( pAcc ) + { + bool bIsValid = true; + sal_uInt8 nDat = 0; + char nByte; + for ( long y = 0; bIsValid && ( y < nHeight ); y++ ) { - bool bIsValid = true; - sal_uInt8 nDat = 0; - char nByte; - for ( long y = 0; bIsValid && ( y < nHeight ); y++ ) + int nBitsLeft = 0; + for ( long x = 0; x < nWidth; x++ ) { - int nBitsLeft = 0; - for ( long x = 0; x < nWidth; x++ ) + if ( --nBitsLeft < 0 ) { - if ( --nBitsLeft < 0 ) + while ( bIsValid && ( nBitsLeft != 7 ) ) { - while ( bIsValid && ( nBitsLeft != 7 ) ) + rStream.ReadChar( nByte ); + switch ( nByte ) { - rStream.ReadChar( nByte ); - switch ( nByte ) + case 0x0a : + if ( --nScanLines < 0 ) + bIsValid = false; + case 0x09 : + case 0x0d : + case 0x20 : + case 0x25 : + break; + default: { - case 0x0a : - if ( --nScanLines < 0 ) - bIsValid = false; - case 0x09 : - case 0x0d : - case 0x20 : - case 0x25 : - break; - default: + if ( nByte >= '0' ) { - if ( nByte >= '0' ) + if ( nByte > '9' ) { - if ( nByte > '9' ) - { - nByte &=~0x20; // case none sensitive for hexadecimal values - nByte -= ( 'A' - 10 ); - if ( nByte > 15 ) - bIsValid = false; - } - else - nByte -= '0'; - nBitsLeft += 4; - nDat <<= 4; - nDat |= ( nByte ^ 0xf ); // in epsi a zero bit represents white color + nByte &=~0x20; // case none sensitive for hexadecimal values + nByte -= ( 'A' - 10 ); + if ( nByte > 15 ) + bIsValid = false; } else - bIsValid = false; + nByte -= '0'; + nBitsLeft += 4; + nDat <<= 4; + nDat |= ( nByte ^ 0xf ); // in epsi a zero bit represents white color } - break; + else + bIsValid = false; } + break; } } - if ( nBitDepth == 1 ) - pAcc->SetPixelIndex( y, x, static_cast<sal_uInt8>(nDat >> nBitsLeft) & 1 ); - else - { - pAcc->SetPixelIndex( y, x, nDat ? 1 : 0 ); // nBitDepth == 8 - nBitsLeft = 0; - } } - } - if ( bIsValid ) - { - VirtualDevice aVDev; - GDIMetaFile aMtf; - Size aSize; - aVDev.EnableOutput( false ); - aMtf.Record( &aVDev ); - aSize = aBitmap.GetPrefSize(); - if( !aSize.Width() || !aSize.Height() ) - aSize = Application::GetDefaultDevice()->PixelToLogic( aBitmap.GetSizePixel(), MAP_100TH_MM ); + if ( nBitDepth == 1 ) + pAcc->SetPixelIndex( y, x, static_cast<sal_uInt8>(nDat >> nBitsLeft) & 1 ); else - aSize = OutputDevice::LogicToLogic( aSize, aBitmap.GetPrefMapMode(), MAP_100TH_MM ); - aVDev.DrawBitmap( Point(), aSize, aBitmap ); - aMtf.Stop(); - aMtf.WindStart(); - aMtf.SetPrefMapMode( MAP_100TH_MM ); - aMtf.SetPrefSize( aSize ); - aGraphic = aMtf; - bHasPreview = bRetValue = true; + { + pAcc->SetPixelIndex( y, x, nDat ? 1 : 0 ); // nBitDepth == 8 + nBitsLeft = 0; + } } - aBitmap.ReleaseAccess( pAcc ); } + if ( bIsValid ) + { + VirtualDevice aVDev; + GDIMetaFile aMtf; + Size aSize; + aVDev.EnableOutput( false ); + aMtf.Record( &aVDev ); + aSize = aBitmap.GetPrefSize(); + if( !aSize.Width() || !aSize.Height() ) + aSize = Application::GetDefaultDevice()->PixelToLogic( aBitmap.GetSizePixel(), MAP_100TH_MM ); + else + aSize = OutputDevice::LogicToLogic( aSize, aBitmap.GetPrefMapMode(), MAP_100TH_MM ); + aVDev.DrawBitmap( Point(), aSize, aBitmap ); + aMtf.Stop(); + aMtf.WindStart(); + aMtf.SetPrefMapMode( MAP_100TH_MM ); + aMtf.SetPrefSize( aSize ); + aGraphic = aMtf; + bHasPreview = bRetValue = true; + } + aBitmap.ReleaseAccess( pAcc ); } } } + } - sal_uInt8* pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%BoundingBox:"), nBytesRead, 14 ); - if ( pDest ) + sal_uInt8* pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%BoundingBox:"), nBytesRead, 14 ); + if ( pDest ) + { + nSecurityCount = 100; + long nNumb[4]; + nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0; + pDest += 14; + for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ ) { - nSecurityCount = 100; - long nNumb[4]; - nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0; - pDest += 14; - for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ ) - { - nNumb[ i ] = ImplGetNumber( &pDest, nSecurityCount ); - } - if ( nSecurityCount) - { - bGraphicLinkCreated = true; - GfxLink aGfxLink( pBuf, nPSSize, GFX_LINK_TYPE_EPS_BUFFER, true ) ; - GDIMetaFile aMtf; - - long nWidth = nNumb[2] - nNumb[0] + 1; - long nHeight = nNumb[3] - nNumb[1] + 1; + nNumb[ i ] = ImplGetNumber( &pDest, nSecurityCount ); + } + if ( nSecurityCount) + { + bGraphicLinkCreated = true; + GfxLink aGfxLink( pBuf, nPSSize, GFX_LINK_TYPE_EPS_BUFFER, true ) ; + GDIMetaFile aMtf; - // if there is no preview -> try with gs to make one - if( !bHasPreview ) - { - bHasPreview = RenderAsEMF(pBuf, nBytesRead, aGraphic); - if (!bHasPreview) - bHasPreview = RenderAsBMP(pBuf, nBytesRead, aGraphic); - } + long nWidth = nNumb[2] - nNumb[0] + 1; + long nHeight = nNumb[3] - nNumb[1] + 1; - // if there is no preview -> make a red box - if( !bHasPreview ) - { - MakePreview(pBuf, nBytesRead, nWidth, nHeight, - aGraphic); - } + // if there is no preview -> try with gs to make one + if( !bHasPreview ) + { + bHasPreview = RenderAsEMF(pBuf, nBytesRead, aGraphic); + if (!bHasPreview) + bHasPreview = RenderAsBMP(pBuf, nBytesRead, aGraphic); + } - aMtf.AddAction( (MetaAction*)( new MetaEPSAction( Point(), Size( nWidth, nHeight ), - aGfxLink, aGraphic.GetGDIMetaFile() ) ) ); - CreateMtfReplacementAction( aMtf, rStream, nOrigPos, nPSSize, nPosWMF, nSizeWMF, nPosTIFF, nSizeTIFF ); - aMtf.WindStart(); - aMtf.SetPrefMapMode( MAP_POINT ); - aMtf.SetPrefSize( Size( nWidth, nHeight ) ); - rGraphic = aMtf; - bRetValue = true; + // if there is no preview -> make a red box + if( !bHasPreview ) + { + MakePreview(pBuf, nBytesRead, nWidth, nHeight, + aGraphic); } + + aMtf.AddAction( (MetaAction*)( new MetaEPSAction( Point(), Size( nWidth, nHeight ), + aGfxLink, aGraphic.GetGDIMetaFile() ) ) ); + CreateMtfReplacementAction( aMtf, rStream, nOrigPos, nPSSize, nPosWMF, nSizeWMF, nPosTIFF, nSizeTIFF ); + aMtf.WindStart(); + aMtf.SetPrefMapMode( MAP_POINT ); + aMtf.SetPrefSize( Size( nWidth, nHeight ) ); + rGraphic = aMtf; + bRetValue = true; } } } + if ( !bGraphicLinkCreated ) delete[] pBuf; } diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx index 64b7233a9384..c3c767cf0e45 100644 --- a/filter/source/graphicfilter/ipsd/ipsd.cxx +++ b/filter/source/graphicfilter/ipsd/ipsd.cxx @@ -177,9 +177,6 @@ bool PSDReader::ImplReadHeader() mpFileHeader = new PSDFileHeader; - if ( !mpFileHeader ) - return false; - m_rPSD.ReadUInt32( mpFileHeader->nSignature ).ReadUInt16( mpFileHeader->nVersion ).ReadUInt32( mpFileHeader->nPad1 ). ReadUInt16( mpFileHeader->nPad2 ).ReadUInt16( mpFileHeader->nChannels ).ReadUInt32( mpFileHeader->nRows ). ReadUInt32( mpFileHeader->nColumns ).ReadUInt16( mpFileHeader->nDepth ).ReadUInt16( mpFileHeader->nMode ); if ( ( mpFileHeader->nSignature != 0x38425053 ) || ( mpFileHeader->nVersion != 1 ) ) @@ -240,8 +237,6 @@ bool PSDReader::ImplReadHeader() if ( nColorLength != 768 ) // we need the color map return false; mpPalette = new sal_uInt8[ 768 ]; - if ( mpPalette == NULL ) - return false; m_rPSD.Read( mpPalette, 768 ); } break; @@ -255,8 +250,6 @@ bool PSDReader::ImplReadHeader() if ( nColorLength ) return false; mpPalette = new sal_uInt8[ 768 ]; - if ( mpPalette == NULL ) - return false; for ( sal_uInt16 i = 0; i < 256; i++ ) { mpPalette[ i ] = mpPalette[ i + 256 ] = mpPalette[ i + 512 ] = (sal_uInt8)i; diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx index 23f9163873d5..29dc073303dc 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -175,8 +175,6 @@ bool TGAReader::ReadTGA(Graphic & rGraphic) bool TGAReader::ImplReadHeader() { mpFileHeader = new TGAFileHeader; - if ( mpFileHeader == NULL ) - return false; m_rTGA.ReadUChar( mpFileHeader->nImageIDLength ).ReadUChar( mpFileHeader->nColorMapType ).ReadUChar( mpFileHeader->nImageType ). ReadUInt16( mpFileHeader->nColorMapFirstEntryIndex ).ReadUInt16( mpFileHeader->nColorMapLength ).ReadUChar( mpFileHeader->nColorMapEntrySize ). ReadUInt16( mpFileHeader->nColorMapXOrigin ).ReadUInt16( mpFileHeader->nColorMapYOrigin ).ReadUInt16( mpFileHeader->nImageWidth ). ReadUInt16( mpFileHeader->nImageHeight ).ReadUChar( mpFileHeader->nPixelDepth ).ReadUChar( mpFileHeader->nImageDescriptor ); @@ -190,56 +188,53 @@ bool TGAReader::ImplReadHeader() // first we want to get the version mpFileFooter = new TGAFileFooter; // read the TGA-File-Footer to determine whether - if ( mpFileFooter ) // we got an old TGA format or the new one - { - sal_uLong nCurStreamPos = m_rTGA.Tell(); - m_rTGA.Seek( STREAM_SEEK_TO_END ); - sal_uLong nTemp = m_rTGA.Tell(); - m_rTGA.Seek( nTemp - SizeOfTGAFileFooter ); + // we got an old TGA format or the new one + + sal_uLong nCurStreamPos = m_rTGA.Tell(); + m_rTGA.Seek( STREAM_SEEK_TO_END ); + sal_uLong nTemp = m_rTGA.Tell(); + m_rTGA.Seek( nTemp - SizeOfTGAFileFooter ); + + m_rTGA.ReadUInt32( mpFileFooter->nExtensionFileOffset ).ReadUInt32( mpFileFooter->nDeveloperDirectoryOffset ). ReadUInt32( mpFileFooter->nSignature[0] ).ReadUInt32( mpFileFooter->nSignature[1] ).ReadUInt32( mpFileFooter->nSignature[2] ). ReadUInt32( mpFileFooter->nSignature[3] ).ReadUChar( mpFileFooter->nPadByte ).ReadUChar( mpFileFooter->nStringTerminator ); - m_rTGA.ReadUInt32( mpFileFooter->nExtensionFileOffset ).ReadUInt32( mpFileFooter->nDeveloperDirectoryOffset ). ReadUInt32( mpFileFooter->nSignature[0] ).ReadUInt32( mpFileFooter->nSignature[1] ).ReadUInt32( mpFileFooter->nSignature[2] ). ReadUInt32( mpFileFooter->nSignature[3] ).ReadUChar( mpFileFooter->nPadByte ).ReadUChar( mpFileFooter->nStringTerminator ); + if ( !m_rTGA.good()) + return false; + + // check for sal_True, VISI, ON-X, FILE in the signatures + if ( mpFileFooter->nSignature[ 0 ] == (('T'<<24)|('R'<<16)|('U'<<8)|'E') && + mpFileFooter->nSignature[ 1 ] == (('V'<<24)|('I'<<16)|('S'<<8)|'I') && + mpFileFooter->nSignature[ 2 ] == (('O'<<24)|('N'<<16)|('-'<<8)|'X') && + mpFileFooter->nSignature[ 3 ] == (('F'<<24)|('I'<<16)|('L'<<8)|'E') ) + { + mpExtension = new TGAExtension; + m_rTGA.Seek( mpFileFooter->nExtensionFileOffset ); + m_rTGA.ReadUInt16( mpExtension->nExtensionSize ); if ( !m_rTGA.good()) return false; - - // check for sal_True, VISI, ON-X, FILE in the signatures - if ( mpFileFooter->nSignature[ 0 ] == (('T'<<24)|('R'<<16)|('U'<<8)|'E') && - mpFileFooter->nSignature[ 1 ] == (('V'<<24)|('I'<<16)|('S'<<8)|'I') && - mpFileFooter->nSignature[ 2 ] == (('O'<<24)|('N'<<16)|('-'<<8)|'X') && - mpFileFooter->nSignature[ 3 ] == (('F'<<24)|('I'<<16)|('L'<<8)|'E') ) + if ( mpExtension->nExtensionSize >= SizeOfTGAExtension ) { - mpExtension = new TGAExtension; - if ( mpExtension ) - { - m_rTGA.Seek( mpFileFooter->nExtensionFileOffset ); - m_rTGA.ReadUInt16( mpExtension->nExtensionSize ); - if ( !m_rTGA.good()) - return false; - if ( mpExtension->nExtensionSize >= SizeOfTGAExtension ) - { - mnTGAVersion = 2; - - m_rTGA.Read( mpExtension->sAuthorName, 41 ); - m_rTGA.Read( mpExtension->sAuthorComment, 324 ); - m_rTGA.Read( mpExtension->sDateTimeStamp, 12 ); - m_rTGA.Read( mpExtension->sJobNameID, 12 ); - m_rTGA.ReadChar( mpExtension->sJobNameID[ 0 ] ).ReadChar( mpExtension->sJobNameID[ 1 ] ).ReadChar( mpExtension->sJobNameID[ 2 ] ); - m_rTGA.Read( mpExtension->sSoftwareID, 41 ); - m_rTGA.ReadUInt16( mpExtension->nSoftwareVersionNumber ).ReadUChar( mpExtension->nSoftwareVersionLetter ) - .ReadUInt32( mpExtension->nKeyColor ).ReadUInt16( mpExtension->nPixelAspectRatioNumerator ) - .ReadUInt16( mpExtension->nPixelAspectRatioDeNumerator ).ReadUInt16( mpExtension->nGammaValueNumerator ) - .ReadUInt16( mpExtension->nGammaValueDeNumerator ).ReadUInt32( mpExtension->nColorCorrectionOffset ) - .ReadUInt32( mpExtension->nPostageStampOffset ).ReadUInt32( mpExtension->nScanLineOffset ) - .ReadUChar( mpExtension->nAttributesType ); - - if ( !m_rTGA.good()) - return false; - } - } + mnTGAVersion = 2; + + m_rTGA.Read( mpExtension->sAuthorName, 41 ); + m_rTGA.Read( mpExtension->sAuthorComment, 324 ); + m_rTGA.Read( mpExtension->sDateTimeStamp, 12 ); + m_rTGA.Read( mpExtension->sJobNameID, 12 ); + m_rTGA.ReadChar( mpExtension->sJobNameID[ 0 ] ).ReadChar( mpExtension->sJobNameID[ 1 ] ).ReadChar( mpExtension->sJobNameID[ 2 ] ); + m_rTGA.Read( mpExtension->sSoftwareID, 41 ); + m_rTGA.ReadUInt16( mpExtension->nSoftwareVersionNumber ).ReadUChar( mpExtension->nSoftwareVersionLetter ) + .ReadUInt32( mpExtension->nKeyColor ).ReadUInt16( mpExtension->nPixelAspectRatioNumerator ) + .ReadUInt16( mpExtension->nPixelAspectRatioDeNumerator ).ReadUInt16( mpExtension->nGammaValueNumerator ) + .ReadUInt16( mpExtension->nGammaValueDeNumerator ).ReadUInt32( mpExtension->nColorCorrectionOffset ) + .ReadUInt32( mpExtension->nPostageStampOffset ).ReadUInt32( mpExtension->nScanLineOffset ) + .ReadUChar( mpExtension->nAttributesType ); + + if ( !m_rTGA.good()) + return false; } - m_rTGA.Seek( nCurStreamPos ); } + m_rTGA.Seek( nCurStreamPos ); // using the TGA file specification this was the correct form but adobe photoshop sets nImageDescriptor // equal to nPixelDepth diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index efe3e8ccef83..d21260ba4510 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -570,73 +570,70 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) // mpSVGExport = new SVGExport( xDocHandler ); mpSVGExport = new SVGExport( xContext, xDocHandler, maFilterData ); - if( mpSVGExport != NULL ) - { - // xSVGExport is set up only to manage the life-time of the object pointed by mpSVGExport, - // and in order to prevent that it is destroyed when passed to AnimationExporter. - Reference< XInterface > xSVGExport = static_cast< ::com::sun::star::document::XFilter* >( mpSVGExport ); + // xSVGExport is set up only to manage the life-time of the object pointed by mpSVGExport, + // and in order to prevent that it is destroyed when passed to AnimationExporter. + Reference< XInterface > xSVGExport = static_cast< ::com::sun::star::document::XFilter* >( mpSVGExport ); + + // create an id for each draw page + for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i ) + implRegisterInterface( mSelectedPages[i] ); - // create an id for each draw page - for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i ) - implRegisterInterface( mSelectedPages[i] ); + // create an id for each master page + for( sal_Int32 i = 0; i < mMasterPageTargets.getLength(); ++i ) + implRegisterInterface( mMasterPageTargets[i] ); - // create an id for each master page - for( sal_Int32 i = 0; i < mMasterPageTargets.getLength(); ++i ) - implRegisterInterface( mMasterPageTargets[i] ); + try + { + mxDefaultPage = mSelectedPages[0]; - try + if( mxDefaultPage.is() ) { - mxDefaultPage = mSelectedPages[0]; + SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mxDefaultPage ); - if( mxDefaultPage.is() ) + if( pSvxDrawPage ) { - SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mxDefaultPage ); + mpDefaultSdrPage = pSvxDrawPage->GetSdrPage(); + mpSdrModel = mpDefaultSdrPage->GetModel(); - if( pSvxDrawPage ) + if( mpSdrModel ) { - mpDefaultSdrPage = pSvxDrawPage->GetSdrPage(); - mpSdrModel = mpDefaultSdrPage->GetModel(); - - if( mpSdrModel ) - { - SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner(NULL); + SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner(NULL); - maOldFieldHdl = rOutl.GetCalcFieldValueHdl(); - maNewFieldHdl = LINK(this, SVGFilter, CalcFieldHdl); - rOutl.SetCalcFieldValueHdl(maNewFieldHdl); - } + maOldFieldHdl = rOutl.GetCalcFieldValueHdl(); + maNewFieldHdl = LINK(this, SVGFilter, CalcFieldHdl); + rOutl.SetCalcFieldValueHdl(maNewFieldHdl); } - bRet = implExportDocument(); } + bRet = implExportDocument(); } - catch( ... ) - { - delete mpSVGDoc, mpSVGDoc = NULL; - OSL_FAIL( "Exception caught" ); - } + } + catch( ... ) + { + delete mpSVGDoc, mpSVGDoc = NULL; + OSL_FAIL( "Exception caught" ); + } - if( mpSdrModel ) + if( mpSdrModel ) + { + //fdo#62682 The maNewFieldHdl can end up getting copied + //into various other outliners which live past this + //method, so get the full list of outliners and restore + //the maOldFieldHdl for all that have ended up using + //maNewFieldHdl + std::vector<SdrOutliner*> aOutliners(mpSdrModel->GetActiveOutliners()); + for (auto aIter = aOutliners.begin(); aIter != aOutliners.end(); ++aIter) { - //fdo#62682 The maNewFieldHdl can end up getting copied - //into various other outliners which live past this - //method, so get the full list of outliners and restore - //the maOldFieldHdl for all that have ended up using - //maNewFieldHdl - std::vector<SdrOutliner*> aOutliners(mpSdrModel->GetActiveOutliners()); - for (auto aIter = aOutliners.begin(); aIter != aOutliners.end(); ++aIter) - { - SdrOutliner* pOutliner = *aIter; - if (maNewFieldHdl == pOutliner->GetCalcFieldValueHdl()) - pOutliner->SetCalcFieldValueHdl(maOldFieldHdl); - } + SdrOutliner* pOutliner = *aIter; + if (maNewFieldHdl == pOutliner->GetCalcFieldValueHdl()) + pOutliner->SetCalcFieldValueHdl(maOldFieldHdl); } - - delete mpSVGWriter, mpSVGWriter = NULL; - mpSVGExport = NULL; // pointed object is released by xSVGExport dtor at the end of this scope - delete mpSVGFontExport, mpSVGFontExport = NULL; - delete mpObjects, mpObjects = NULL; - mbPresentation = false; } + + delete mpSVGWriter, mpSVGWriter = NULL; + mpSVGExport = NULL; // pointed object is released by xSVGExport dtor at the end of this scope + delete mpSVGFontExport, mpSVGFontExport = NULL; + delete mpObjects, mpObjects = NULL; + mbPresentation = false; } } } diff --git a/hwpfilter/source/drawing.h b/hwpfilter/source/drawing.h index 66b111a1cca1..9a9e7b4b5fc1 100644 --- a/hwpfilter/source/drawing.h +++ b/hwpfilter/source/drawing.h @@ -363,10 +363,7 @@ static HWPDrawingObject *LoadDrawingObject(void) head = prev = NULL; do { - if ((hdo = new HWPDrawingObject) == NULL) - { - goto error; - } + hdo = new HWPDrawingObject; if (!LoadCommonHeader(hdo, &link_info)) { goto error; diff --git a/hwpfilter/source/hinfo.cxx b/hwpfilter/source/hinfo.cxx index 3a5bb21d7429..0c2afb67a718 100644 --- a/hwpfilter/source/hinfo.cxx +++ b/hwpfilter/source/hinfo.cxx @@ -165,8 +165,7 @@ bool HWPInfo::Read(HWPFile & hwpf) { info_block = new unsigned char[info_block_len + 1]; - if (0 == info_block || - !HWPReadInfoBlock(info_block, info_block_len, hwpf)) + if (!HWPReadInfoBlock(info_block, info_block_len, hwpf)) return false; } diff --git a/hwpfilter/source/htags.cxx b/hwpfilter/source/htags.cxx index 6283e77ac479..2629479f702b 100644 --- a/hwpfilter/source/htags.cxx +++ b/hwpfilter/source/htags.cxx @@ -112,7 +112,7 @@ bool OlePicture::Read(HWPFile & hwpf) return false; #ifdef WIN32 char *data = new char[size]; - if( data == 0 || hwpf.ReadBlock(data,size) == 0 ) + if (hwpf.ReadBlock(data,size) == 0) { delete [] data; return false; diff --git a/i18npool/source/collator/gencoll_rule.cxx b/i18npool/source/collator/gencoll_rule.cxx index 8f71b7e14abe..201170a2e80c 100644 --- a/i18npool/source/collator/gencoll_rule.cxx +++ b/i18npool/source/collator/gencoll_rule.cxx @@ -131,8 +131,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) printf("\nRule parsering error\n"); } - if (coll) - delete coll; + delete coll; return U_SUCCESS(status) ? 0 : 1; } // End of main diff --git a/idlc/source/parser.y b/idlc/source/parser.y index af911c655d68..e041de7b8eb5 100644 --- a/idlc/source/parser.y +++ b/idlc/source/parser.y @@ -566,8 +566,7 @@ interface_dcl : pInterface = new AstInterface( *$1->getName(), static_cast< AstInterface const * >(resolveTypedefs($1->getInherits())), pScope); - if ( pInterface && - (pDecl = pScope->lookupByName(pInterface->getScopedName())) ) + if ( (pDecl = pScope->lookupByName(pInterface->getScopedName())) ) { /* * See if we're defining a forward declared interface. diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx index 0e8bb6c6ff0b..6944d932c666 100644 --- a/pyuno/zipcore/python.cxx +++ b/pyuno/zipcore/python.cxx @@ -144,9 +144,6 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { MY_LENGTH(L"\""); //TODO: overflow } wchar_t * cl = new wchar_t[clSize]; - if (cl == NULL) { - exit(EXIT_FAILURE); - } wchar_t * cp = encode(cl, pythonhome); for (int i = 1; i < argc; ++i) { *cp++ = L' '; @@ -171,8 +168,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { orig = (wchar_t *)L""; } else { orig = new wchar_t[n]; - if (orig == NULL || - GetEnvironmentVariableW(L"PATH", orig, n) != n - 1) + if (GetEnvironmentVariableW(L"PATH", orig, n) != n - 1) { exit(EXIT_FAILURE); } @@ -198,8 +194,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { orig = (wchar_t *)L""; } else { orig = new wchar_t[n]; - if (orig == NULL || - GetEnvironmentVariableW(L"PYTHONPATH", orig, n) != n - 1) + if (GetEnvironmentVariableW(L"PYTHONPATH", orig, n) != n - 1) { exit(EXIT_FAILURE); } diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index 27411314f978..084bb1093c5e 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -61,14 +61,11 @@ SvMemoryStream* GraphicHelper::getFormatStrFromGDI_Impl( const GDIMetaFile* pGDI if ( pGDIMeta ) { SvMemoryStream* pStream = new SvMemoryStream( 65535, 65535 ); - if ( pStream ) - { - Graphic aGraph( *pGDIMeta ); - if ( GraphicConverter::Export( *pStream, aGraph, nFormat ) == 0 ) - pResult = pStream; - else - delete pStream; - } + Graphic aGraph( *pGDIMeta ); + if ( GraphicConverter::Export( *pStream, aGraph, nFormat ) == 0 ) + pResult = pStream; + else + delete pStream; } return pResult; @@ -120,60 +117,56 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co if ( pGDIMeta ) { SvMemoryStream* pStream = new SvMemoryStream( 65535, 65535 ); - if ( pStream ) + Graphic aGraph( *pGDIMeta ); + sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, CVT_WMF ); + pStream->Flush(); + if ( !bFailed ) { - Graphic aGraph( *pGDIMeta ); - sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, CVT_WMF ); - pStream->Flush(); - if ( !bFailed ) + sal_Int32 nLength = pStream->Seek( STREAM_SEEK_TO_END ); + if ( nLength > 22 ) { - sal_Int32 nLength = pStream->Seek( STREAM_SEEK_TO_END ); - if ( nLength > 22 ) + HMETAFILE hMeta = SetMetaFileBitsEx( nLength - 22, + ( reinterpret_cast< const unsigned char*>( pStream->GetData() ) ) + 22 ); + + if ( hMeta ) { - HMETAFILE hMeta = SetMetaFileBitsEx( nLength - 22, - ( reinterpret_cast< const unsigned char*>( pStream->GetData() ) ) + 22 ); + HGLOBAL hMemory = GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE, sizeof( METAFILEPICT ) ); - if ( hMeta ) + if ( hMemory ) { - HGLOBAL hMemory = GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE, sizeof( METAFILEPICT ) ); + METAFILEPICT* pMF = (METAFILEPICT*)GlobalLock( hMemory ); - if ( hMemory ) + pMF->hMF = hMeta; + pMF->mm = MM_ANISOTROPIC; + + MapMode aMetaMode = pGDIMeta->GetPrefMapMode(); + MapMode aWinMode( MAP_100TH_MM ); + + if ( aWinMode == pGDIMeta->GetPrefMapMode() ) { - METAFILEPICT* pMF = (METAFILEPICT*)GlobalLock( hMemory ); - - pMF->hMF = hMeta; - pMF->mm = MM_ANISOTROPIC; - - MapMode aMetaMode = pGDIMeta->GetPrefMapMode(); - MapMode aWinMode( MAP_100TH_MM ); - - if ( aWinMode == pGDIMeta->GetPrefMapMode() ) - { - pMF->xExt = aMetaSize.Width(); - pMF->yExt = aMetaSize.Height(); - } - else - { - Size aWinSize = OutputDevice::LogicToLogic( Size( aMetaSize.Width(), aMetaSize.Height() ), - pGDIMeta->GetPrefMapMode(), - aWinMode ); - pMF->xExt = aWinSize.Width(); - pMF->yExt = aWinSize.Height(); - } - - GlobalUnlock( hMemory ); - pResult = (void*)hMemory; + pMF->xExt = aMetaSize.Width(); + pMF->yExt = aMetaSize.Height(); } else - DeleteMetaFile( hMeta ); + { + Size aWinSize = OutputDevice::LogicToLogic( Size( aMetaSize.Width(), aMetaSize.Height() ), + pGDIMeta->GetPrefMapMode(), + aWinMode ); + pMF->xExt = aWinSize.Width(); + pMF->yExt = aWinSize.Height(); + } + + GlobalUnlock( hMemory ); + pResult = (void*)hMemory; } + else + DeleteMetaFile( hMeta ); } } - - delete pStream; } - } + delete pStream; + } #endif diff --git a/shell/source/win32/zipfile/zipfile.cxx b/shell/source/win32/zipfile/zipfile.cxx index ca4381241231..ac9f9a0cec30 100644 --- a/shell/source/win32/zipfile/zipfile.cxx +++ b/shell/source/win32/zipfile/zipfile.cxx @@ -134,8 +134,6 @@ static std::string readString(StreamInterface *stream, unsigned long size) if (!stream || stream->stell() == -1) throw IOException(-1); unsigned char *tmp = new unsigned char[size]; - if (!tmp) - throw IOException(-1); unsigned long numBytesRead = stream->sread(tmp, size); if (numBytesRead != size) throw IOException(-1); diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx index 1b0f35cad942..5221e46a94a3 100644 --- a/svl/source/items/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -60,9 +60,7 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, const std::vector<OUStri if( pList /*!!! && pList->Count() */ ) { pImp = new SfxImpStringList; - - if (pImp) - pImp->aList = *pList; + pImp->aList = *pList; } } @@ -255,12 +253,9 @@ void SfxStringListItem::SetStringList( const com::sun::star::uno::Sequence< OUSt pImp->nRefCount--; pImp = new SfxImpStringList; - if (pImp) - { - // String belongs to the list - for ( sal_Int32 n = 0; n < rList.getLength(); n++ ) - pImp->aList.push_back(rList[n]); - } + // String belongs to the list + for ( sal_Int32 n = 0; n < rList.getLength(); n++ ) + pImp->aList.push_back(rList[n]); } void SfxStringListItem::GetStringList( com::sun::star::uno::Sequence< OUString >& rList ) const diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index e18281254f07..218fdb16e458 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -1680,7 +1680,7 @@ SvNumberformat* SvNumberFormatter::ImpInsertFormat( const ::com::sun::star::i18n pStringScanner, nCheckPos, ActLnge); - if ( !pFormat || !(nCheckPos == 0) ) + if (nCheckPos != 0) { if (LocaleDataWrapper::areChecksEnabled()) { diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 779cc64af4ed..889ed3074ff3 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -399,9 +399,8 @@ PasswordContainer::PasswordContainer( const Reference<XMultiServiceFactory>& xSe mComponent->addEventListener( this ); m_pStorageFile = new StorageItem( this, OUString("Office.Common/Passwords") ); - if( m_pStorageFile ) - if( m_pStorageFile->useStorage() ) - m_aContainer = m_pStorageFile->getInfo(); + if( m_pStorageFile->useStorage() ) + m_aContainer = m_pStorageFile->getInfo(); } diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 1dd711083377..952dfe9fb6b5 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -113,8 +113,6 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback( return (HDDEDATA)NULL; HSZPAIR* pPairs = new HSZPAIR [nTopics + 1]; - if ( !pPairs ) - return (HDDEDATA)NULL; HSZPAIR* q = pPairs; for (DdeServices::iterator aI = rAll.begin(); aI != rAll.end(); ++aI) diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx index 594fd5c06626..b4cfbe2e6d0d 100644 --- a/svx/source/engine3d/extrud3d.cxx +++ b/svx/source/engine3d/extrud3d.cxx @@ -200,12 +200,9 @@ SdrAttrObj* E3dExtrudeObj::GetBreakObj() basegfx::B2DPolyPolygon aPoly = TransformToScreenCoor(aBackSide); SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aPoly); - if(pPathObj) - { - SfxItemSet aSet(GetObjectItemSet()); - aSet.Put(XLineStyleItem(com::sun::star::drawing::LineStyle_SOLID)); - pPathObj->SetMergedItemSet(aSet); - } + SfxItemSet aSet(GetObjectItemSet()); + aSet.Put(XLineStyleItem(com::sun::star::drawing::LineStyle_SOLID)); + pPathObj->SetMergedItemSet(aSet); return pPathObj; } diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx index 7869e63a988f..9d2c60c57260 100644 --- a/svx/source/engine3d/lathe3d.cxx +++ b/svx/source/engine3d/lathe3d.cxx @@ -182,16 +182,13 @@ SdrAttrObj* E3dLatheObj::GetBreakObj() basegfx::B2DPolyPolygon aTransPoly(TransformToScreenCoor(aLathePoly3D)); SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aTransPoly); - if(pPathObj) - { - // Set Attribute - SfxItemSet aSet(GetObjectItemSet()); + // Set Attribute + SfxItemSet aSet(GetObjectItemSet()); - // Enable lines to guarantee that the object becomes visible - aSet.Put(XLineStyleItem(com::sun::star::drawing::LineStyle_SOLID)); + // Enable lines to guarantee that the object becomes visible + aSet.Put(XLineStyleItem(com::sun::star::drawing::LineStyle_SOLID)); - pPathObj->SetMergedItemSet(aSet); - } + pPathObj->SetMergedItemSet(aSet); return pPathObj; } diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 8cf6c022f701..f7c67d36d284 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -1515,10 +1515,7 @@ SvStream& SdrCustomShapeAdjustmentItem::Store( SvStream& rOut, sal_uInt16 nItemV SfxPoolItem* SdrCustomShapeAdjustmentItem::Clone( SfxItemPool * /*pPool*/) const { SdrCustomShapeAdjustmentItem* pItem = new SdrCustomShapeAdjustmentItem; - - if (pItem) - pItem->aAdjustmentValueList = aAdjustmentValueList; - + pItem->aAdjustmentValueList = aAdjustmentValueList; return pItem; } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 08afe8891e22..60f7e0b91594 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -970,14 +970,10 @@ void SdrHdlColor::CreateB2dIAObject() (sal_uInt16)(aBmpCol.GetSizePixel().Width() - 1) >> 1, (sal_uInt16)(aBmpCol.GetSizePixel().Height() - 1) >> 1 ); - DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); // OVERLAYMANAGER - if(pNewOverlayObject) - { - xManager->add(*pNewOverlayObject); - maOverlayGroup.append(*pNewOverlayObject); - } + xManager->add(*pNewOverlayObject); + maOverlayGroup.append(*pNewOverlayObject); } } } @@ -1293,17 +1289,13 @@ void SdrHdlLine::CreateB2dIAObject() aPosition1, aPosition2 ); - DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); // OVERLAYMANAGER - if(pNewOverlayObject) - { - // color(?) - pNewOverlayObject->setBaseColor(Color(COL_LIGHTRED)); + // color(?) + pNewOverlayObject->setBaseColor(Color(COL_LIGHTRED)); - xManager->add(*pNewOverlayObject); - maOverlayGroup.append(*pNewOverlayObject); - } + xManager->add(*pNewOverlayObject); + maOverlayGroup.append(*pNewOverlayObject); } } } @@ -1356,20 +1348,15 @@ void SdrHdlBezWgt::CreateB2dIAObject() aPosition1, aPosition2 ); - DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); - // OVERLAYMANAGER - if(pNewOverlayObject) - { - // line part is not hittable - pNewOverlayObject->setHittable(false); + // line part is not hittable + pNewOverlayObject->setHittable(false); - // color(?) - pNewOverlayObject->setBaseColor(Color(COL_LIGHTBLUE)); + // color(?) + pNewOverlayObject->setBaseColor(Color(COL_LIGHTBLUE)); - xManager->add(*pNewOverlayObject); - maOverlayGroup.append(*pNewOverlayObject); - } + xManager->add(*pNewOverlayObject); + maOverlayGroup.append(*pNewOverlayObject); } } } @@ -1411,16 +1398,12 @@ void E3dVolumeMarker::CreateB2dIAObject() ::sdr::overlay::OverlayObject* pNewOverlayObject = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( aWireframePoly); - DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); // OVERLAYMANAGER - if(pNewOverlayObject) - { - pNewOverlayObject->setBaseColor(Color(COL_BLACK)); + pNewOverlayObject->setBaseColor(Color(COL_BLACK)); - xManager->add(*pNewOverlayObject); - maOverlayGroup.append(*pNewOverlayObject); - } + xManager->add(*pNewOverlayObject); + maOverlayGroup.append(*pNewOverlayObject); } } } @@ -1680,12 +1663,9 @@ void ImpTextframeHdl::CreateB2dIAObject() true); // allow animation; the Handle is not shown at text edit time // OVERLAYMANAGER - if(pNewOverlayObject) - { - pNewOverlayObject->setHittable(false); - xManager->add(*pNewOverlayObject); - maOverlayGroup.append(*pNewOverlayObject); - } + pNewOverlayObject->setHittable(false); + xManager->add(*pNewOverlayObject); + maOverlayGroup.append(*pNewOverlayObject); } } } @@ -2533,16 +2513,12 @@ void SdrCropViewHdl::CreateB2dIAObject() if(xManager.is()) { ::sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence); - DBG_ASSERT(pNew, "Got NO new IAO!"); - if(pNew) - { - // only informative object, no hit - pNew->setHittable(false); + // only informative object, no hit + pNew->setHittable(false); - xManager->add(*pNew); - maOverlayGroup.append(*pNew); - } + xManager->add(*pNew); + maOverlayGroup.append(*pNew); } } } diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index dfc3d10eda7c..c8aec7d0de11 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1407,22 +1407,18 @@ Reference< XInputStream > SdrGrafObj::getInputStream() if( nSize && pSourceData ) { sal_uInt8 * pBuffer = new sal_uInt8[ nSize ]; - if( pBuffer ) - { - memcpy( pBuffer, pSourceData, nSize ); + memcpy( pBuffer, pSourceData, nSize ); - SvMemoryStream* pStream = new SvMemoryStream( (void*)pBuffer, (sal_Size)nSize, StreamMode::READ ); - pStream->ObjectOwnsMemory( true ); - xStream.set( new utl::OInputStreamWrapper( pStream, true ) ); - } + SvMemoryStream* pStream = new SvMemoryStream( (void*)pBuffer, (sal_Size)nSize, StreamMode::READ ); + pStream->ObjectOwnsMemory( true ); + xStream.set( new utl::OInputStreamWrapper( pStream, true ) ); } } if (!xStream.is() && !aFileName.isEmpty()) { SvFileStream* pStream = new SvFileStream( aFileName, StreamMode::READ ); - if( pStream ) - xStream.set( new utl::OInputStreamWrapper( pStream ) ); + xStream.set( new utl::OInputStreamWrapper( pStream ) ); } } diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx index 7ccf90332d59..a2be884b8a4c 100644 --- a/svx/source/svdraw/svdotxtr.cxx +++ b/svx/source/svdraw/svdotxtr.cxx @@ -459,24 +459,21 @@ SdrObject* SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPol pPathObj->SetPathPoly(basegfx::tools::expandToCurve(pPathObj->GetPathPoly())); } - if(pPathObj) + pPathObj->ImpSetAnchorPos(aAnchor); + pPathObj->NbcSetLayer(SdrLayerID(GetLayer())); + + if(pModel) { - pPathObj->ImpSetAnchorPos(aAnchor); - pPathObj->NbcSetLayer(SdrLayerID(GetLayer())); + pPathObj->SetModel(pModel); - if(pModel) + if(!bNoSetAttr) { - pPathObj->SetModel(pModel); - - if(!bNoSetAttr) - { - sdr::properties::ItemChangeBroadcaster aC(*pPathObj); + sdr::properties::ItemChangeBroadcaster aC(*pPathObj); - pPathObj->ClearMergedItem(); - pPathObj->SetMergedItemSet(GetObjectItemSet()); - pPathObj->GetProperties().BroadcastItemChange(aC); - pPathObj->NbcSetStyleSheet(GetStyleSheet(), true); - } + pPathObj->ClearMergedItem(); + pPathObj->SetMergedItemSet(GetObjectItemSet()); + pPathObj->GetProperties().BroadcastItemChange(aC); + pPathObj->NbcSetStyleSheet(GetStyleSheet(), true); } } diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 619b7ab08f03..7ef851568cdb 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -75,8 +75,7 @@ SvxDrawPage::SvxDrawPage( SdrPage* pInPage ) throw() // create (hidden) view mpView = new SdrView( mpModel ); - if( mpView ) - mpView->SetDesignMode(true); + mpView->SetDesignMode(true); } SvxDrawPage::~SvxDrawPage() throw() @@ -896,8 +895,7 @@ void SvxDrawPage::ChangeModel( SdrModel* pNewModel ) { delete mpView; mpView = new SdrView( mpModel ); - if( mpView ) - mpView->SetDesignMode(true); + mpView->SetDesignMode(true); } } } diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 9f6e15f28eff..e8a2a5dc54ad 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1895,27 +1895,24 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff ) { sal_uInt8* pNewBuf = new sal_uInt8[nNewSize]; - if( pNewBuf ) + bRetVal = true; // Success! + if( nNewSize < nSize ) // Are we shrinking? { - bRetVal = true; // Success! - if( nNewSize < nSize ) // Are we shrinking? - { - memcpy( pNewBuf, pBuf, (size_t)nNewSize ); - if( nPos > nNewSize ) - nPos = 0L; - if( nEndOfData >= nNewSize ) - nEndOfData = nNewSize-1L; - } - else - { - memcpy( pNewBuf, pBuf, (size_t)nSize ); - } + memcpy( pNewBuf, pBuf, (size_t)nNewSize ); + if( nPos > nNewSize ) + nPos = 0L; + if( nEndOfData >= nNewSize ) + nEndOfData = nNewSize-1L; + } + else + { + memcpy( pNewBuf, pBuf, (size_t)nSize ); + } - FreeMemory(); + FreeMemory(); - pBuf = pNewBuf; - nSize = nNewSize; - } + pBuf = pNewBuf; + nSize = nNewSize; } else { diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index 06e1d97ea02d..fc378c2bd4c4 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -99,19 +99,14 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) // 1 Byte -> 0xFF if colour is transparent // 3 Bytes -> RGB value of the colour mpColMap = new sal_uInt8[ mnColors * ( 4 + mnCpp ) ]; - if ( mpColMap ) + for ( sal_uLong i = 0; i < mnColors; i++ ) { - for ( sal_uLong i = 0; i < mnColors; i++ ) + if ( !ImplGetColor( i ) ) { - if ( !ImplGetColor( i ) ) - { - mbStatus = false; - break; - } + mbStatus = false; + break; } } - else - mbStatus = false; if ( mbStatus ) { diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index bc0dceef63c2..0c890d08281b 100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx @@ -297,34 +297,31 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap() pRetval = new Gdiplus::Bitmap(nW, nH, PixelFormat24bppRGB); - if(pRetval) + if ( pRetval->GetLastStatus() == Gdiplus::Ok ) { - if ( pRetval->GetLastStatus() == Gdiplus::Ok ) + sal_uInt8* pSrcRGB(pRGB->mpBits); + const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); + const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); + const Gdiplus::Rect aAllRect(0, 0, nW, nH); + Gdiplus::BitmapData aGdiPlusBitmapData; + pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat24bppRGB, &aGdiPlusBitmapData); + + // copy data to Gdiplus::Bitmap; format is BGR here in both cases, so memcpy is possible + for(sal_uInt32 y(0); y < nH; y++) { - sal_uInt8* pSrcRGB(pRGB->mpBits); - const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); - const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); - const Gdiplus::Rect aAllRect(0, 0, nW, nH); - Gdiplus::BitmapData aGdiPlusBitmapData; - pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat24bppRGB, &aGdiPlusBitmapData); - - // copy data to Gdiplus::Bitmap; format is BGR here in both cases, so memcpy is possible - for(sal_uInt32 y(0); y < nH; y++) - { - const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); - sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); - - memcpy(targetPixels, pSrcRGB, nW * 3); - pSrcRGB += nW * 3 + nExtraRGB; - } + const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); + sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); - pRetval->UnlockBits(&aGdiPlusBitmapData); - } - else - { - delete pRetval; - pRetval = NULL; + memcpy(targetPixels, pSrcRGB, nW * 3); + pSrcRGB += nW * 3 + nExtraRGB; } + + pRetval->UnlockBits(&aGdiPlusBitmapData); + } + else + { + delete pRetval; + pRetval = NULL; } } @@ -424,45 +421,42 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph pRetval = new Gdiplus::Bitmap(nW, nH, PixelFormat32bppARGB); - if(pRetval) + if ( pRetval->GetLastStatus() == Gdiplus::Ok ) // 2nd place to secure with new Gdiplus::Bitmap { - if ( pRetval->GetLastStatus() == Gdiplus::Ok ) // 2nd place to secure with new Gdiplus::Bitmap + sal_uInt8* pSrcRGB(pRGB->mpBits); + sal_uInt8* pSrcA(pA->mpBits); + const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); + const sal_uInt32 nExtraA(pA->mnScanlineSize - nW); + const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); + const Gdiplus::Rect aAllRect(0, 0, nW, nH); + Gdiplus::BitmapData aGdiPlusBitmapData; + pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &aGdiPlusBitmapData); + + // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR from Bitmap and + // A from alpha, so inner loop is needed (who invented BitmapEx..?) + for(sal_uInt32 y(0); y < nH; y++) { - sal_uInt8* pSrcRGB(pRGB->mpBits); - sal_uInt8* pSrcA(pA->mpBits); - const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3)); - const sal_uInt32 nExtraA(pA->mnScanlineSize - nW); - const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN); - const Gdiplus::Rect aAllRect(0, 0, nW, nH); - Gdiplus::BitmapData aGdiPlusBitmapData; - pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &aGdiPlusBitmapData); - - // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR from Bitmap and - // A from alpha, so inner loop is needed (who invented BitmapEx..?) - for(sal_uInt32 y(0); y < nH; y++) - { - const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); - sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); + const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1); + sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride); - for(sal_uInt32 x(0); x < nW; x++) - { - *targetPixels++ = *pSrcRGB++; - *targetPixels++ = *pSrcRGB++; - *targetPixels++ = *pSrcRGB++; - *targetPixels++ = 0xff - *pSrcA++; - } - - pSrcRGB += nExtraRGB; - pSrcA += nExtraA; + for(sal_uInt32 x(0); x < nW; x++) + { + *targetPixels++ = *pSrcRGB++; + *targetPixels++ = *pSrcRGB++; + *targetPixels++ = *pSrcRGB++; + *targetPixels++ = 0xff - *pSrcA++; } - pRetval->UnlockBits(&aGdiPlusBitmapData); - } - else - { - delete pRetval; - pRetval = NULL; + pSrcRGB += nExtraRGB; + pSrcA += nExtraA; } + + pRetval->UnlockBits(&aGdiPlusBitmapData); + } + else + { + delete pRetval; + pRetval = NULL; } } diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx index b1e3ae7573fc..4129b72369fa 100644 --- a/xmloff/source/draw/animationexport.cxx +++ b/xmloff/source/draw/animationexport.cxx @@ -549,12 +549,8 @@ AnimationsExporterImpl::AnimationsExporterImpl( SvXMLExport& rExport, const Refe } mpSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport ); - if( mpSdPropHdlFactory ) - { - // set lock to avoid deletion - mpSdPropHdlFactory->acquire(); - } - + // set lock to avoid deletion + mpSdPropHdlFactory->acquire(); } AnimationsExporterImpl::~AnimationsExporterImpl() diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 723542bc48ec..9320d384c09b 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -431,33 +431,31 @@ void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent // prepare factory parts mpSdPropHdlFactory = new XMLSdPropHdlFactory( GetModel(), *this ); - if(mpSdPropHdlFactory) - { - // set lock to avoid deletion - mpSdPropHdlFactory->acquire(); - // build one ref - const rtl::Reference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory; + // set lock to avoid deletion + mpSdPropHdlFactory->acquire(); - // construct PropertySetMapper - rtl::Reference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( aFactoryRef, true); + // build one ref + const rtl::Reference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory; - // get or create text paragraph export - GetTextParagraphExport(); - mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, *this ); - // set lock to avoid deletion - mpPropertySetMapper->acquire(); + // construct PropertySetMapper + rtl::Reference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( aFactoryRef, true); - // chain text attributes - mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); + // get or create text paragraph export + GetTextParagraphExport(); + mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, *this ); + // set lock to avoid deletion + mpPropertySetMapper->acquire(); - // construct PresPagePropsMapper - xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef, true); + // chain text attributes + mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); - mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this ); - // set lock to avoid deletion - mpPresPagePropsMapper->acquire(); - } + // construct PresPagePropsMapper + xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef, true); + + mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this ); + // set lock to avoid deletion + mpPresPagePropsMapper->acquire(); // add family name GetAutoStylePool()->AddFamily( diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index 2a670787c57b..4522e18e0643 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -167,11 +167,8 @@ XMLShapeImportHelper::XMLShapeImportHelper( // construct PresPagePropsMapper xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, mpSdPropHdlFactory, false); mpPresPagePropsMapper = new SvXMLImportPropertyMapper( xMapper, rImporter ); - if(mpPresPagePropsMapper) - { - // set lock to avoid deletion - mpPresPagePropsMapper->acquire(); - } + // set lock to avoid deletion + mpPresPagePropsMapper->acquire(); uno::Reference< lang::XServiceInfo > xInfo( rImporter.GetModel(), uno::UNO_QUERY ); const OUString aSName( "com.sun.star.presentation.PresentationDocument" ); diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx index dc05038ac5ed..ad3ac71e40fc 100644 --- a/xmloff/source/draw/ximp3dscene.cxx +++ b/xmloff/source/draw/ximp3dscene.cxx @@ -231,11 +231,8 @@ SvXMLImportContext * SdXML3DSceneAttributesHelper::create3DLightContext( sal_uIn SvXMLImportContext* pContext = new SdXML3DLightContext(mrImport, nPrfx, rLName, xAttrList); // remember SdXML3DLightContext for later evaluation - if(pContext) - { - pContext->AddFirstRef(); - maList.push_back( static_cast<SdXML3DLightContext*>(pContext) ); - } + pContext->AddFirstRef(); + maList.push_back( static_cast<SdXML3DLightContext*>(pContext) ); return pContext; } diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 10b60335737e..594ac324743d 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -436,12 +436,9 @@ SvXMLImportContext *SdXMLPageMasterContext::CreateChildContext( pContext = new SdXMLPageMasterStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList); // remember SdXMLPresentationPlaceholderContext for later evaluation - if(pContext) - { - pContext->AddFirstRef(); - DBG_ASSERT(!mpPageMasterStyle, "PageMasterStyle is set, there seem to be two of them (!)"); - mpPageMasterStyle = static_cast<SdXMLPageMasterStyleContext*>(pContext); - } + pContext->AddFirstRef(); + DBG_ASSERT(!mpPageMasterStyle, "PageMasterStyle is set, there seem to be two of them (!)"); + mpPageMasterStyle = static_cast<SdXMLPageMasterStyleContext*>(pContext); } // call base class @@ -496,11 +493,8 @@ SvXMLImportContext *SdXMLPresentationPageLayoutContext::CreateChildContext( GetSdImport(), nPrefix, rLocalName, xAttrList); // remember SdXMLPresentationPlaceholderContext for later evaluation - if(pContext) - { - pContext->AddFirstRef(); - maList.push_back( static_cast<SdXMLPresentationPlaceholderContext*>(pContext) ); - } + pContext->AddFirstRef(); + maList.push_back( static_cast<SdXMLPresentationPlaceholderContext*>(pContext) ); } // call base class @@ -915,11 +909,8 @@ SvXMLImportContext* SdXMLMasterPageContext::CreateChildContext( XML_STYLE_FAMILY_SD_PRESENTATION_ID); // add this style to the outer StylesContext class for later processing - if(pNew) - { - pContext = pNew; - GetSdImport().GetShapeImport()->GetStylesContext()->AddStyle(*pNew); - } + pContext = pNew; + GetSdImport().GetShapeImport()->GetStylesContext()->AddStyle(*pNew); } break; } @@ -1533,11 +1524,8 @@ SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext( pContext = new SdXMLMasterPageContext(GetSdImport(), nPrefix, rLocalName, xAttrList, xNewShapes); - if(pContext) - { - pContext->AddFirstRef(); - maMasterPageList.push_back( static_cast<SdXMLMasterPageContext*>(pContext) ); - } + pContext->AddFirstRef(); + maMasterPageList.push_back( static_cast<SdXMLMasterPageContext*>(pContext) ); } } } diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index d52fc223afdc..e7af2df809da 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -770,9 +770,6 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: createCertificateFr if( rawCertificate.getLength() > 0 ) { xcert = new X509Certificate_MSCryptImpl() ; - if( xcert == NULL ) - throw RuntimeException() ; - xcert->setRawCert( rawCertificate ) ; } else { xcert = NULL ; @@ -1064,9 +1061,7 @@ X509Certificate_MSCryptImpl* MswcryCertContextToXCert( PCCERT_CONTEXT cert ) if( cert != NULL ) { xcert = new X509Certificate_MSCryptImpl() ; - if( xcert != NULL ) { - xcert->setMswcryCert( cert ) ; - } + xcert->setMswcryCert( cert ) ; } else { xcert = NULL ; } diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx index d39846bc5839..8faef3a597de 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx @@ -210,8 +210,6 @@ OUString SAL_CALL X509Certificate_MSCryptImpl :: getIssuerName() throw ( ::com:: // Here the cbIssuer count the last 0x00 , take care. if( cbIssuer != 0 ) { char* issuer = new char[ cbIssuer ] ; - if( issuer == NULL ) - throw RuntimeException() ; cbIssuer = CertNameToStr( X509_ASN_ENCODING | PKCS_7_ASN_ENCODING , @@ -260,8 +258,6 @@ OUString SAL_CALL X509Certificate_MSCryptImpl :: getSubjectName() throw ( ::com: if( cbSubject != 0 ) { wchar_t* subject = new wchar_t[ cbSubject ] ; - if( subject == NULL ) - throw RuntimeException() ; cbSubject = CertNameToStrW( X509_ASN_ENCODING | PKCS_7_ASN_ENCODING , |