summaryrefslogtreecommitdiff
path: root/dtrans/source/win32
diff options
context:
space:
mode:
authorTino Rachui <tra@openoffice.org>2001-04-11 06:03:29 +0000
committerTino Rachui <tra@openoffice.org>2001-04-11 06:03:29 +0000
commit6995d0a48bcfab928ae8d9165ff2d8ea7b5c8b20 (patch)
tree80ff49f6f57640ffb369bcb0cf48015ea8dd17af /dtrans/source/win32
parentebd947a950ee2acf7d9a0f07a6a7424f2a4cfbd3 (diff)
#86003# compare formatetc and compare targetdevice fixed
Diffstat (limited to 'dtrans/source/win32')
-rw-r--r--dtrans/source/win32/misc/ImplHelper.cxx31
1 files changed, 16 insertions, 15 deletions
diff --git a/dtrans/source/win32/misc/ImplHelper.cxx b/dtrans/source/win32/misc/ImplHelper.cxx
index 8b9df47c12a4..6c51ad4e7c71 100644
--- a/dtrans/source/win32/misc/ImplHelper.cxx
+++ b/dtrans/source/win32/misc/ImplHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ImplHelper.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: tra $ $Date: 2001-03-22 14:14:29 $
+ * last change: $Author: tra $ $Date: 2001-04-11 07:03:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -331,7 +331,9 @@ DVTARGETDEVICE* SAL_CALL CopyTargetDevice( DVTARGETDEVICE* ptdSrc )
// petcSrc pointer to source FORMATETC
//
// Return Value:
-// returns TRUE is copy is successful; retuns FALSE if not successful
+// returns TRUE if copy was successful;
+// retuns FALSE if not successful, e.g. one or both of the pointers
+// were invalid or the pointers were equal
//-------------------------------------------------------------------------
sal_Bool SAL_CALL CopyFormatEtc( LPFORMATETC petcDest, LPFORMATETC petcSrc )
@@ -340,6 +342,9 @@ sal_Bool SAL_CALL CopyFormatEtc( LPFORMATETC petcDest, LPFORMATETC petcSrc )
__try
{
+ if ( petcDest == petcSrc )
+ __leave;
+
petcDest->cfFormat = petcSrc->cfFormat;
petcDest->ptd = NULL;
@@ -370,12 +375,15 @@ sal_Bool SAL_CALL CopyFormatEtc( LPFORMATETC petcDest, LPFORMATETC petcSrc )
sal_Int32 SAL_CALL CompareFormatEtc( const FORMATETC* pFetcLhs, const FORMATETC* pFetcRhs )
{
- sal_Int32 nMatch = FORMATETC_NO_MATCH;
+ sal_Int32 nMatch = FORMATETC_EXACT_MATCH;
__try
{
+ if ( pFetcLhs == pFetcRhs )
+ __leave;
+
if ( ( pFetcLhs->cfFormat != pFetcRhs->cfFormat ) ||
- ( pFetcLhs->lindex != pFetcRhs->lindex ) ||
+ ( pFetcLhs->lindex != pFetcRhs->lindex ) ||
!CompareTargetDevice( pFetcLhs->ptd, pFetcRhs->ptd ) )
{
nMatch = FORMATETC_NO_MATCH;
@@ -428,12 +436,6 @@ sal_Bool SAL_CALL CompareTargetDevice( DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE*
__try
{
- if ( ( ptdRight == NULL ) || ( ptdLeft == NULL ) )
- {
- bRet = sal_False;
- __leave;
- }
-
if ( ptdLeft == ptdRight )
{
// same address of td; must be same (handles NULL case)
@@ -441,13 +443,12 @@ sal_Bool SAL_CALL CompareTargetDevice( DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE*
__leave;
}
+ // one ot the two is NULL
+ if ( ( NULL == ptdRight ) || ( NULL == ptdLeft ) )
+ __leave;
if ( ptdLeft->tdSize != ptdRight->tdSize )
- {
- // different sizes, not equal
- bRet = sal_False;
__leave;
- }
if ( rtl_compareMemory( ptdLeft, ptdRight, ptdLeft->tdSize ) == 0 )
bRet = sal_True;