From: Jiyun Yang Date: Thu, 22 Nov 2018 01:58:37 +0000 (+0900) Subject: Revert "[Tizen] (Vector) Restore some VectorBase methods to preserve binary compatibi... X-Git-Tag: accepted/tizen/5.0/unified/20181126.062059~8 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=da43af4f47f967a5093b838ad35230e284e97fdd Revert "[Tizen] (Vector) Restore some VectorBase methods to preserve binary compatibility" This reverts commit 86a50e7332933a76d7d06ccd09927910d834488a. --- diff --git a/dali/public-api/common/dali-vector.cpp b/dali/public-api/common/dali-vector.cpp index bae8522..bb6014f 100644 --- a/dali/public-api/common/dali-vector.cpp +++ b/dali/public-api/common/dali-vector.cpp @@ -115,12 +115,12 @@ void VectorBase::Swap( VectorBase& vector ) std::swap( mData, vector.mData ); } -void VectorBase::Erase( char* address, SizeType elementSize ) +void VectorBase::Erase( uint8_t* address, SizeType elementSize ) { // erase can be called on an unallocated vector if( mData ) { - uint8_t* startAddress = reinterpret_cast< uint8_t* >( address ) + elementSize; + uint8_t* startAddress = address + elementSize; const uint8_t* endAddress = reinterpret_cast< uint8_t* >( mData ) + Count() * elementSize; SizeType numberOfBytes = endAddress - startAddress; // addresses overlap so use memmove @@ -129,13 +129,13 @@ void VectorBase::Erase( char* address, SizeType elementSize ) } } -char* VectorBase::Erase( char* first, char* last, SizeType elementSize ) +uint8_t* VectorBase::Erase( uint8_t* first, uint8_t* last, SizeType elementSize ) { - char* next = NULL; + uint8_t* next = NULL; if( mData ) { - uint8_t* startAddress = reinterpret_cast< uint8_t* >( last ); + uint8_t* startAddress = last; const uint8_t* endAddress = reinterpret_cast< uint8_t* >( mData ) + Count() * elementSize; SizeType numberOfBytes = endAddress - startAddress; // addresses overlap so use memmove @@ -148,7 +148,7 @@ char* VectorBase::Erase( char* first, char* last, SizeType elementSize ) return next; } -void VectorBase::CopyMemory( char* destination, const char* source, size_t numberOfBytes ) +void VectorBase::CopyMemory( uint8_t* destination, const uint8_t* source, size_t numberOfBytes ) { if( ( ( source < destination ) && ( source + numberOfBytes > destination ) ) || ( ( destination < source ) && ( destination + numberOfBytes > source ) ) ) diff --git a/dali/public-api/common/dali-vector.h b/dali/public-api/common/dali-vector.h index 0efb790..be556ac 100755 --- a/dali/public-api/common/dali-vector.h +++ b/dali/public-api/common/dali-vector.h @@ -182,7 +182,7 @@ protected: // for Derived classes * @param[in] elementSize Size to erase * @pre Last element cannot be erased as there is nothing to move. */ - void Erase( char* address, SizeType elementSize ); + void Erase( uint8_t* address, SizeType elementSize ); /** * @brief Erases a range of elements. @@ -194,7 +194,7 @@ protected: // for Derived classes * @param[in] elementSize Size of one of the elements to be erased * @return Address pointing to the next element of the last one */ - char* Erase( char* first, char* last, SizeType elementSize ); + uint8_t* Erase( uint8_t* first, uint8_t* last, SizeType elementSize ); /** * @brief Copies a number of bytes from \e source to \e destination. @@ -206,11 +206,11 @@ protected: // for Derived classes * @param[in] source Pointer to the source address * @param[in] numberOfBytes The number of bytes to be copied */ - void CopyMemory( char* destination, const char* source, size_t numberOfBytes ); + void CopyMemory( uint8_t* destination, const uint8_t* source, size_t numberOfBytes ); private: - // not copyable as it does not know the size of elements + // not copiable as it does not know the size of elements VectorBase( const VectorBase& ); ///< Undefined @SINCE_1_0.0 VectorBase& operator=( const VectorBase& ); ///< Undefined @SINCE_1_0.0 @@ -323,7 +323,7 @@ protected: // API for deriving classes */ void Erase( uint8_t* address, SizeType elementSize ) { - VectorBase::Erase( reinterpret_cast< char* >( address ), elementSize ); + VectorBase::Erase( address, elementSize ); } /** @@ -337,7 +337,7 @@ protected: // API for deriving classes */ uint8_t* Erase( uint8_t* first, uint8_t* last, SizeType elementSize ) { - return reinterpret_cast< uint8_t* >( VectorBase::Erase( reinterpret_cast< char* >( first ), reinterpret_cast< char *>( last ), elementSize ) ); + return VectorBase::Erase( first, last, elementSize ); } /** @@ -370,12 +370,12 @@ protected: // API for deriving classes SetCount( newCount ); // Move current items to a new position inside the vector. - CopyMemory( reinterpret_cast< char* >( at + size ), - reinterpret_cast< const char* >( at ), + CopyMemory( at + size, + at, ( reinterpret_cast( mData ) + count * elementSize ) - at ); // Copy the given items. - CopyMemory( reinterpret_cast< char* >( at ), reinterpret_cast< const char* >( from ), size ); + CopyMemory( at, from, size ); } };