diff options
Diffstat (limited to 'cppu/source/uno/sequence.cxx')
-rw-r--r-- | cppu/source/uno/sequence.cxx | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index 947e803cb76a..775ea01db1b7 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -166,7 +166,7 @@ static inline bool idefaultConstructElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(double), nAlloc ); if (pSeq != 0) - { + { double * pElements = (double *) pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { @@ -180,7 +180,7 @@ static inline bool idefaultConstructElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc ); if (pSeq != 0) - { + { rtl_uString ** pElements = (rtl_uString **) pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { @@ -198,7 +198,7 @@ static inline bool idefaultConstructElements( pSeq, sizeof(typelib_TypeDescriptionReference *), nAlloc ); } if (pSeq != 0) - { + { typelib_TypeDescriptionReference ** pElements = (typelib_TypeDescriptionReference **) pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -213,7 +213,7 @@ static inline bool idefaultConstructElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(uno_Any), nAlloc ); if (pSeq != 0) - { + { uno_Any * pElements = (uno_Any *) pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { @@ -234,7 +234,7 @@ static inline bool idefaultConstructElements( ((typelib_EnumTypeDescription *) pElementTypeDescr)->nDefaultEnumValue; TYPELIB_DANGER_RELEASE( pElementTypeDescr ); - + sal_Int32 * pElements = (sal_Int32 *) pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { @@ -245,11 +245,11 @@ static inline bool idefaultConstructElements( } case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: - { + { typelib_TypeDescription * pElementTypeDescr = 0; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; - + if (nAlloc >= 0) pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); if (pSeq != 0) @@ -262,20 +262,20 @@ static inline bool idefaultConstructElements( (typelib_CompoundTypeDescription *)pElementTypeDescr ); } } - + TYPELIB_DANGER_RELEASE( pElementTypeDescr ); break; } case typelib_TypeClass_ARRAY: - { + { typelib_TypeDescription * pElementTypeDescr = 0; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; - + if (nAlloc >= 0) pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); if (pSeq != 0) - { + { char * pElements = pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { @@ -284,7 +284,7 @@ static inline bool idefaultConstructElements( (typelib_ArrayTypeDescription *)pElementTypeDescr ); } } - + TYPELIB_DANGER_RELEASE( pElementTypeDescr ); break; } @@ -293,24 +293,24 @@ static inline bool idefaultConstructElements( typelib_TypeDescription * pElementTypeDescr = 0; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; - + if (nAlloc >= 0) pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); if (pSeq != 0) - { + { sal_Int32 nValueOffset = ((typelib_UnionTypeDescription *) pElementTypeDescr)->nValueOffset; sal_Int64 nDefaultDiscr = ((typelib_UnionTypeDescription *) pElementTypeDescr)->nDefaultDiscriminant; - + typelib_TypeDescription * pDefaultTypeDescr = 0; TYPELIB_DANGER_GET( &pDefaultTypeDescr, ((typelib_UnionTypeDescription *) pElementTypeDescr)->pDefaultTypeRef ); - + char * pElements = pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { @@ -321,7 +321,7 @@ static inline bool idefaultConstructElements( } TYPELIB_DANGER_RELEASE( pDefaultTypeDescr ); } - + TYPELIB_DANGER_RELEASE( pElementTypeDescr ); break; } @@ -330,7 +330,7 @@ static inline bool idefaultConstructElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(uno_Sequence *), nAlloc ); if (pSeq != 0) - { + { uno_Sequence ** pElements = (uno_Sequence **) pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -344,7 +344,7 @@ static inline bool idefaultConstructElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(void *), nAlloc ); if (pSeq != 0) - { + { ::rtl_zeroMemory( pSeq->elements + (sizeof(void *) * nStartIndex), sizeof(void *) * (nStopIndex - nStartIndex) ); @@ -355,7 +355,7 @@ static inline bool idefaultConstructElements( pSeq = 0; break; } - + if (pSeq == 0) { OSL_ASSERT( nAlloc >= 0 ); // must have been an allocation failure @@ -383,7 +383,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Unicode), nAlloc ); if (pSeq != 0) - { + { ::rtl_copyMemory( pSeq->elements + (sizeof(sal_Unicode) * nStartIndex), (char *)pSourceElements + (sizeof(sal_Unicode) * nStartIndex), @@ -394,7 +394,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Bool), nAlloc ); if (pSeq != 0) - { + { ::rtl_copyMemory( pSeq->elements + (sizeof(sal_Bool) * nStartIndex), (char *)pSourceElements + (sizeof(sal_Bool) * nStartIndex), @@ -405,7 +405,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int8), nAlloc ); if (pSeq != 0) - { + { ::rtl_copyMemory( pSeq->elements + (sizeof(sal_Int8) * nStartIndex), (char *)pSourceElements + (sizeof(sal_Int8) * nStartIndex), @@ -417,7 +417,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int16), nAlloc ); if (pSeq != 0) - { + { ::rtl_copyMemory( pSeq->elements + (sizeof(sal_Int16) * nStartIndex), (char *)pSourceElements + (sizeof(sal_Int16) * nStartIndex), @@ -429,7 +429,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); if (pSeq != 0) - { + { ::rtl_copyMemory( pSeq->elements + (sizeof(sal_Int32) * nStartIndex), (char *)pSourceElements + (sizeof(sal_Int32) * nStartIndex), @@ -441,7 +441,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int64), nAlloc ); if (pSeq != 0) - { + { ::rtl_copyMemory( pSeq->elements + (sizeof(sal_Int64) * nStartIndex), (char *)pSourceElements + (sizeof(sal_Int64) * nStartIndex), @@ -452,7 +452,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(float), nAlloc ); if (pSeq != 0) - { + { ::rtl_copyMemory( pSeq->elements + (sizeof(float) * nStartIndex), (char *)pSourceElements + (sizeof(float) * nStartIndex), @@ -463,7 +463,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(double), nAlloc ); if (pSeq != 0) - { + { ::rtl_copyMemory( pSeq->elements + (sizeof(double) * nStartIndex), (char *)pSourceElements + (sizeof(double) * nStartIndex), @@ -474,7 +474,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); if (pSeq != 0) - { + { ::rtl_copyMemory( pSeq->elements + (sizeof(sal_Int32) * nStartIndex), (char *)pSourceElements + (sizeof(sal_Int32) * nStartIndex), @@ -486,7 +486,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc ); if (pSeq != 0) - { + { rtl_uString ** pDestElements = (rtl_uString **) pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { @@ -525,7 +525,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(uno_Any), nAlloc ); if (pSeq != 0) - { + { uno_Any * pDestElements = (uno_Any *) pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { @@ -545,13 +545,13 @@ static inline bool icopyConstructFromElements( typelib_TypeDescription * pElementTypeDescr = 0; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; - + if (nAlloc >= 0) pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); if (pSeq != 0) - { + { char * pDestElements = pSeq->elements; - + typelib_CompoundTypeDescription * pTypeDescr = (typelib_CompoundTypeDescription *)pElementTypeDescr; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -560,7 +560,7 @@ static inline bool icopyConstructFromElements( pDestElements + (nElementSize * nPos); char * pSource = (char *)pSourceElements + (nElementSize * nPos); - + if (pTypeDescr->pBaseTypeDescription) { // copy base value @@ -568,13 +568,13 @@ static inline bool icopyConstructFromElements( pDest, pSource, pTypeDescr->pBaseTypeDescription, acquire, 0 ); } - + // then copy members typelib_TypeDescriptionReference ** ppTypeRefs = pTypeDescr->ppTypeRefs; sal_Int32 * pMemberOffsets = pTypeDescr->pMemberOffsets; sal_Int32 nDescr = pTypeDescr->nMembers; - + while (nDescr--) { ::uno_type_copyData( @@ -584,7 +584,7 @@ static inline bool icopyConstructFromElements( } } } - + TYPELIB_DANGER_RELEASE( pElementTypeDescr ); break; } @@ -599,7 +599,7 @@ static inline bool icopyConstructFromElements( if (pSeq != 0) { char * pDestElements = pSeq->elements; - + sal_Int32 nValueOffset = ((typelib_UnionTypeDescription *) pElementTypeDescr)->nValueOffset; @@ -609,7 +609,7 @@ static inline bool icopyConstructFromElements( pDestElements + (nElementSize * nPos); char * pSource = (char *)pSourceElements + (nElementSize * nPos); - + typelib_TypeDescriptionReference * pSetType = _unionGetSetType( pSource, pElementTypeDescr ); ::uno_type_copyData( @@ -620,7 +620,7 @@ static inline bool icopyConstructFromElements( typelib_typedescriptionreference_release( pSetType ); } } - + TYPELIB_DANGER_RELEASE( pElementTypeDescr ); break; } @@ -654,7 +654,7 @@ static inline bool icopyConstructFromElements( if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(void *), nAlloc ); if (pSeq != 0) - { + { void ** pDestElements = (void **) pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { @@ -669,7 +669,7 @@ static inline bool icopyConstructFromElements( pSeq = 0; break; } - + if (pSeq == 0) { OSL_ASSERT( nAlloc >= 0 ); // must have been an allocation failure @@ -690,9 +690,9 @@ static inline bool ireallocSequence( uno_AcquireFunc acquire, uno_ReleaseFunc release ) { bool ret = true; - uno_Sequence * pSeq = *ppSequence; + uno_Sequence * pSeq = *ppSequence; sal_Int32 nElements = pSeq->nElements; - + if (pSeq->nRefCount > 1 || // not mem-copyable elements? typelib_TypeClass_ANY == pElementType->eTypeClass || @@ -701,10 +701,10 @@ static inline bool ireallocSequence( { // split sequence and construct new one from scratch uno_Sequence * pNew = 0; - + sal_Int32 nRest = nSize - nElements; sal_Int32 nCopy = (nRest > 0 ? nElements : nSize); - + if (nCopy >= 0) { ret = icopyConstructFromElements( @@ -719,7 +719,7 @@ static inline bool ireallocSequence( nCopy, nSize, nCopy >= 0 ? -1 /* no mem allocation */ : nSize ); } - + if (ret) { // destruct sequence @@ -758,7 +758,7 @@ static inline bool ireallocSequence( ret = (*ppSequence != 0); } } - + return ret; } @@ -779,10 +779,10 @@ sal_Bool SAL_CALL uno_type_sequence_construct( { typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pType ); - + typelib_TypeDescriptionReference * pElementType = ((typelib_IndirectTypeDescription *)pTypeDescr)->pType; - + *ppSequence = 0; if (pElements == 0) { @@ -798,7 +798,7 @@ sal_Bool SAL_CALL uno_type_sequence_construct( 0, len, acquire, len ); // alloc to len } - + TYPELIB_DANGER_RELEASE( pTypeDescr ); } else @@ -806,7 +806,7 @@ sal_Bool SAL_CALL uno_type_sequence_construct( *ppSequence = createEmptySequence(); ret = true; } - + OSL_ASSERT( (*ppSequence != 0) == ret ); return ret; } @@ -823,7 +823,7 @@ sal_Bool SAL_CALL uno_sequence_construct( { typelib_TypeDescriptionReference * pElementType = ((typelib_IndirectTypeDescription *)pTypeDescr)->pType; - + *ppSequence = 0; if (pElements == 0) { @@ -845,7 +845,7 @@ sal_Bool SAL_CALL uno_sequence_construct( *ppSequence = createEmptySequence(); ret = true; } - + OSL_ASSERT( (*ppSequence != 0) == ret ); return ret; } @@ -880,7 +880,7 @@ sal_Bool SAL_CALL uno_sequence_realloc( { OSL_ENSURE( ppSequence, "### null ptr!" ); OSL_ENSURE( nSize >= 0, "### new size must be at least 0!" ); - + bool ret = true; if (nSize != (*ppSequence)->nElements) { @@ -908,7 +908,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One( { typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pType ); - + ret = icopyConstructFromElements( &pNew, pSequence->elements, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType, @@ -919,7 +919,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One( idestructSequence( *ppSequence, pType, pTypeDescr, release ); *ppSequence = pNew; } - + TYPELIB_DANGER_RELEASE( pTypeDescr ); } else @@ -977,7 +977,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One( *ppSequence = pNew; } } - + } return ret; } |