From: dahyeong.kim Date: Wed, 17 Jul 2013 13:41:59 +0000 (+0900) Subject: [devel_3.0_main] Cherry-pick Beautification of source-code. 80383 X-Git-Tag: accepted/tizen/20130912.081851^2~103^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12d3f7f5ba6bb63321777c77281594ebfd57dda1;p=platform%2Fframework%2Fnative%2Fappfw.git [devel_3.0_main] Cherry-pick Beautification of source-code. 80383 Change-Id: I7d3ca0ee00e17e13f052bea9c296edb9991fb809 Signed-off-by: dahyeong.kim --- diff --git a/src/base/FBaseBoolean.cpp b/src/base/FBaseBoolean.cpp index a4a47be..1533176 100644 --- a/src/base/FBaseBoolean.cpp +++ b/src/base/FBaseBoolean.cpp @@ -18,11 +18,9 @@ * @file FBaseBool.cpp * @brief This is the implementation file for Boolean class. */ - #include #include - namespace Tizen { namespace Base { @@ -87,7 +85,7 @@ Boolean::operator =(const Boolean& rhs) bool Boolean::Equals(const Object& obj) const { - const Boolean* pOther = dynamic_cast (&obj); + const Boolean* pOther = dynamic_cast< const Boolean* >(&obj); if (pOther == null) { return false; @@ -99,7 +97,7 @@ Boolean::Equals(const Object& obj) const int Boolean::GetHashCode(void) const { - return static_cast (value); + return static_cast< int >(value); } bool diff --git a/src/base/FBaseBufferBase.cpp b/src/base/FBaseBufferBase.cpp index 38b5cc6..e4b1a88 100644 --- a/src/base/FBaseBufferBase.cpp +++ b/src/base/FBaseBufferBase.cpp @@ -18,14 +18,12 @@ * @file FBaseBufferBase.cpp * @brief This is the implementation for BufferBase class. */ - #include #include #include #include #include - namespace Tizen { namespace Base { @@ -59,18 +57,18 @@ BufferBase::Construct(int capacity) void* pTemp = null; // check whether the size of memory is larger than the maximum of unsigned int - unsigned long long size = static_cast (sizeof(_BufferData)) + - static_cast (capacity) * static_cast (GetTypeSize()); - SysTryReturnResult(NID_BASE, size <= static_cast ((unsigned int) -1), E_OUT_OF_MEMORY, + unsigned long long size = static_cast< unsigned long long >(sizeof(_BufferData)) + + static_cast< unsigned long long >(capacity) * static_cast< unsigned long long >(GetTypeSize()); + SysTryReturnResult(NID_BASE, size <= static_cast< unsigned long long >((unsigned int) -1), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - pTemp = malloc(static_cast (size)); + pTemp = malloc(static_cast< unsigned int >(size)); SysTryReturnResult(NID_BASE, 0 != pTemp, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - memset(pTemp, 0, static_cast (size)); + memset(pTemp, 0, static_cast< unsigned int >(size)); - _pData = static_cast <_BufferData*>(pTemp); + _pData = static_cast< _BufferData* >(pTemp); _pData->refCount = 1; _pData->capacityInByte = capacity * GetTypeSize(); @@ -261,13 +259,13 @@ BufferBase::ExpandCapacity(int newCapacity) "The capacity is less than the current capacity."); // check whether the size of memory is larger than the maximum of unsigned int - unsigned long long size = static_cast (sizeof(_BufferData)) + - static_cast (newCapacity) * static_cast (GetTypeSize()); + unsigned long long size = static_cast< unsigned long long >(sizeof(_BufferData)) + + static_cast< unsigned long long >(newCapacity) * static_cast< unsigned long long >(GetTypeSize()); - SysTryReturnResult(NID_BASE, size <= static_cast ((unsigned int) -1), E_OUT_OF_MEMORY, + SysTryReturnResult(NID_BASE, size <= static_cast< unsigned long long >((unsigned int) -1), E_OUT_OF_MEMORY, "Memory allocation failed."); - _pData = static_cast<_BufferData*>(realloc(_pData, static_cast(size))); + _pData = static_cast< _BufferData* >(realloc(_pData, static_cast< unsigned int >(size))); SysTryReturnResult(NID_BASE, 0 != _pData, E_OUT_OF_MEMORY, "Memory allocation failed."); _capacity = newCapacity; @@ -304,8 +302,8 @@ BufferBase::Dispose(void) } BufferBase::_BufferData::_BufferData() - :capacityInByte(0) - ,refCount(0) + : capacityInByte(0) + , refCount(0) { } @@ -316,7 +314,7 @@ BufferBase::_BufferData::~_BufferData() byte* BufferBase::_BufferData::GetArray(void) { - return reinterpret_cast (this + 1); + return reinterpret_cast< byte* >(this + 1); } }} // Tizen::Base diff --git a/src/base/FBaseByteBuffer.cpp b/src/base/FBaseByteBuffer.cpp index 97eb212..fe78b4b 100644 --- a/src/base/FBaseByteBuffer.cpp +++ b/src/base/FBaseByteBuffer.cpp @@ -18,13 +18,11 @@ * @file FBaseByteBuffer.cpp * @brief This is the implementation for ByteBuffer class. */ - #include #include #include #include - static const byte DOUBLE_SIZE = sizeof(double); static const byte FLOAT_SIZE = sizeof(float); static const byte INT_SIZE = sizeof(int); @@ -76,7 +74,7 @@ ByteBuffer::Construct(int capacity) } result -ByteBuffer::Construct(const byte *pBuffer, int index, int length, int capacity) +ByteBuffer::Construct(const byte* pBuffer, int index, int length, int capacity) { SysTryReturn(NID_BASE, pBuffer != null, E_INVALID_ARG, E_INVALID_ARG, "[%s] The pBuffer is null.", GetErrorMessage(E_INVALID_ARG)); @@ -90,13 +88,13 @@ ByteBuffer::Construct(const byte *pBuffer, int index, int length, int capacity) void* pTemp = null; int sizeofBufferData = sizeof(_BufferData); - __pArrayStart = const_cast (pBuffer + index); + __pArrayStart = const_cast< byte* >(pBuffer + index); pTemp = malloc(sizeofBufferData); SysTryReturn(NID_BASE, pTemp != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s]", GetErrorMessage(E_OUT_OF_MEMORY)); memset(pTemp, 0, sizeofBufferData); - _pData = static_cast <_BufferData*>(pTemp); + _pData = static_cast< _BufferData* >(pTemp); _pData->refCount = 1; _pData->capacityInByte = capacity; @@ -119,7 +117,7 @@ ByteBuffer::operator [](int index) byte ByteBuffer::operator [](int index) const { - return const_cast(*this)[index]; + return const_cast< ByteBuffer& >(*this)[index]; } bool @@ -159,7 +157,7 @@ ByteBuffer::operator !=(const ByteBuffer& buffer) const DoubleBuffer* ByteBuffer::AsDoubleBufferN(void) const { - std::unique_ptr pBuffer(new (std::nothrow) DoubleBuffer()); + std::unique_ptr< DoubleBuffer > pBuffer(new (std::nothrow) DoubleBuffer()); pBuffer->_pData = _pData; AddRef(); pBuffer->_capacity = GetRemaining() / DOUBLE_SIZE; @@ -175,7 +173,7 @@ ByteBuffer::AsDoubleBufferN(void) const FloatBuffer* ByteBuffer::AsFloatBufferN(void) const { - std::unique_ptr pBuffer(new (std::nothrow) FloatBuffer()); + std::unique_ptr< FloatBuffer > pBuffer(new (std::nothrow) FloatBuffer()); pBuffer->_pData = _pData; AddRef(); pBuffer->_capacity = GetRemaining() / FLOAT_SIZE; @@ -191,7 +189,7 @@ ByteBuffer::AsFloatBufferN(void) const IntBuffer* ByteBuffer::AsIntBufferN(void) const { - std::unique_ptr pBuffer(new (std::nothrow) IntBuffer()); + std::unique_ptr< IntBuffer > pBuffer(new (std::nothrow) IntBuffer()); pBuffer->_pData = _pData; AddRef(); pBuffer->_capacity = GetRemaining() / INT_SIZE; @@ -207,7 +205,7 @@ ByteBuffer::AsIntBufferN(void) const LongBuffer* ByteBuffer::AsLongBufferN(void) const { - std::unique_ptr pBuffer(new (std::nothrow) LongBuffer()); + std::unique_ptr< LongBuffer > pBuffer(new (std::nothrow) LongBuffer()); pBuffer->_pData = _pData; AddRef(); pBuffer->_capacity = GetRemaining() / LONG_SIZE; @@ -223,7 +221,7 @@ ByteBuffer::AsLongBufferN(void) const LongLongBuffer* ByteBuffer::AsLongLongBufferN(void) const { - std::unique_ptr pBuffer(new (std::nothrow) LongLongBuffer()); + std::unique_ptr< LongLongBuffer > pBuffer(new (std::nothrow) LongLongBuffer()); pBuffer->_pData = _pData; AddRef(); pBuffer->_capacity = GetRemaining() / LONGLONG_SIZE; @@ -239,7 +237,7 @@ ByteBuffer::AsLongLongBufferN(void) const McharBuffer* ByteBuffer::AsMcharBufferN(void) const { - std::unique_ptr pBuffer(new (std::nothrow) McharBuffer()); + std::unique_ptr< McharBuffer > pBuffer(new (std::nothrow) McharBuffer()); pBuffer->_pData = _pData; AddRef(); pBuffer->_capacity = GetRemaining() / MCHAR_SIZE; @@ -255,7 +253,7 @@ ByteBuffer::AsMcharBufferN(void) const WcharBuffer* ByteBuffer::AsWcharBufferN(void) const { - std::unique_ptr pBuffer(new (std::nothrow) WcharBuffer()); + std::unique_ptr< WcharBuffer > pBuffer(new (std::nothrow) WcharBuffer()); pBuffer->_pData = _pData; AddRef(); pBuffer->_capacity = GetRemaining() / MCHAR_SIZE; @@ -271,7 +269,7 @@ ByteBuffer::AsWcharBufferN(void) const ShortBuffer* ByteBuffer::AsShortBufferN(void) const { - std::unique_ptr pBuffer(new (std::nothrow) ShortBuffer()); + std::unique_ptr< ShortBuffer > pBuffer(new (std::nothrow) ShortBuffer()); pBuffer->_pData = _pData; AddRef(); pBuffer->_capacity = GetRemaining() / SHORT_SIZE; @@ -287,7 +285,7 @@ ByteBuffer::AsShortBufferN(void) const result ByteBuffer::CopyFrom(ByteBuffer& buffer) { - SysTryReturn(NID_BASE, this != static_cast (&buffer), E_INVALID_ARG, E_INVALID_ARG, + SysTryReturn(NID_BASE, this != static_cast< void* >(&buffer), E_INVALID_ARG, E_INVALID_ARG, "[%s] The source and target buffers are identical.", GetErrorMessage(E_INVALID_ARG)); int copyLength = buffer.GetRemaining(); SysTryReturn(NID_BASE, @@ -347,7 +345,7 @@ ByteBuffer::GetDouble(double& value) GetRemaining() >= DOUBLE_SIZE, E_UNDERFLOW, E_UNDERFLOW, "[%s] The remaining bytes of this buffer are smaller than the size of double", GetErrorMessage(E_UNDERFLOW)); - value = *reinterpret_cast (&__pArrayStart[_position]); + value = *reinterpret_cast< double* >(&__pArrayStart[_position]); _position += DOUBLE_SIZE; return E_SUCCESS; @@ -361,7 +359,7 @@ ByteBuffer::GetDouble(int index, double& value) const "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of double(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, DOUBLE_SIZE); - value = *reinterpret_cast (&__pArrayStart[index]); + value = *reinterpret_cast< double* >(&__pArrayStart[index]); return E_SUCCESS; } @@ -373,7 +371,7 @@ ByteBuffer::GetFloat(float& value) GetRemaining() >= FLOAT_SIZE, E_UNDERFLOW, E_UNDERFLOW, "[%s] The remaining bytes of this buffer are smaller than the size of float.", GetErrorMessage(E_UNDERFLOW)); - value = *reinterpret_cast (&__pArrayStart[_position]); + value = *reinterpret_cast< float* >(&__pArrayStart[_position]); _position += FLOAT_SIZE; return E_SUCCESS; @@ -387,7 +385,7 @@ ByteBuffer::GetFloat(int index, float& value) const "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of float(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, FLOAT_SIZE); - value = *reinterpret_cast (&__pArrayStart[index]); + value = *reinterpret_cast< float* >(&__pArrayStart[index]); return E_SUCCESS; } @@ -399,7 +397,7 @@ ByteBuffer::GetInt(int& value) GetRemaining() >= INT_SIZE, E_UNDERFLOW, E_UNDERFLOW, "[%s] The remaining bytes of this buffer are smaller than the size of int.", GetErrorMessage(E_UNDERFLOW)); - value = *reinterpret_cast (&__pArrayStart[_position]); + value = *reinterpret_cast< int* >(&__pArrayStart[_position]); _position += INT_SIZE; return E_SUCCESS; @@ -413,7 +411,7 @@ ByteBuffer::GetInt(int index, int& value) const "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of int(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, INT_SIZE); - value = *reinterpret_cast (&__pArrayStart[index]); + value = *reinterpret_cast< int* >(&__pArrayStart[index]); return E_SUCCESS; } @@ -425,7 +423,7 @@ ByteBuffer::GetLong(long& value) GetRemaining() >= LONG_SIZE, E_UNDERFLOW, E_UNDERFLOW, "[%s] The remaining bytes of this buffer are smaller than the size of long.", GetErrorMessage(E_UNDERFLOW)); - value = *reinterpret_cast (&__pArrayStart[_position]); + value = *reinterpret_cast< long* >(&__pArrayStart[_position]); _position += LONG_SIZE; return E_SUCCESS; @@ -439,7 +437,7 @@ ByteBuffer::GetLong(int index, long& value) const "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of long(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, LONG_SIZE); - value = *reinterpret_cast (&__pArrayStart[index]); + value = *reinterpret_cast< long* >(&__pArrayStart[index]); return E_SUCCESS; } @@ -451,7 +449,7 @@ ByteBuffer::GetLongLong(long long& value) GetRemaining() >= LONGLONG_SIZE, E_UNDERFLOW, E_UNDERFLOW, "[%s] The remaining bytes of this buffer are smaller than the size of long long.", GetErrorMessage(E_UNDERFLOW)); - value = *reinterpret_cast (&__pArrayStart[_position]); + value = *reinterpret_cast< long long* >(&__pArrayStart[_position]); _position += LONGLONG_SIZE; return E_SUCCESS; @@ -465,7 +463,7 @@ ByteBuffer::GetLongLong(int index, long long& value) const "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of long long(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, LONGLONG_SIZE); - value = *reinterpret_cast (&__pArrayStart[index]); + value = *reinterpret_cast< long long* >(&__pArrayStart[index]); return E_SUCCESS; } @@ -477,7 +475,7 @@ ByteBuffer::GetMchar(wchar_t& value) GetRemaining() >= MCHAR_SIZE, E_UNDERFLOW, E_UNDERFLOW, "[%s] The remaining bytes of this buffer are smaller than the size of wchar_t.", GetErrorMessage(E_UNDERFLOW)); - value = *reinterpret_cast (&__pArrayStart[_position]); + value = *reinterpret_cast< wchar_t* >(&__pArrayStart[_position]); _position += MCHAR_SIZE; return E_SUCCESS; @@ -490,7 +488,7 @@ ByteBuffer::GetWchar(wchar_t& value) GetRemaining() >= MCHAR_SIZE, E_UNDERFLOW, E_UNDERFLOW, "[%s] The remaining bytes of this buffer are smaller than the size of wchar_t.", GetErrorMessage(E_UNDERFLOW)); - value = *reinterpret_cast (&__pArrayStart[_position]); + value = *reinterpret_cast< wchar_t* >(&__pArrayStart[_position]); _position += MCHAR_SIZE; return E_SUCCESS; @@ -504,7 +502,7 @@ ByteBuffer::GetMchar(int index, wchar_t& value) const "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of wchar_t(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, MCHAR_SIZE); - value = *reinterpret_cast (&__pArrayStart[index]); + value = *reinterpret_cast< wchar_t* >(&__pArrayStart[index]); return E_SUCCESS; } @@ -517,7 +515,7 @@ ByteBuffer::GetWchar(int index, wchar_t& value) const "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of wchar_t(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, MCHAR_SIZE); - value = *reinterpret_cast (&__pArrayStart[index]); + value = *reinterpret_cast< wchar_t* >(&__pArrayStart[index]); return E_SUCCESS; } @@ -529,7 +527,7 @@ ByteBuffer::GetShort(short& value) GetRemaining() >= SHORT_SIZE, E_UNDERFLOW, E_UNDERFLOW, "[%s] The remaining bytes of this buffer are smaller than the size of short.", GetErrorMessage(E_UNDERFLOW)); - value = *reinterpret_cast (&__pArrayStart[_position]); + value = *reinterpret_cast< short* >(&__pArrayStart[_position]); _position += SHORT_SIZE; return E_SUCCESS; @@ -543,7 +541,7 @@ ByteBuffer::GetShort(int index, short& value) const "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of short(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, SHORT_SIZE); - value = *reinterpret_cast (&__pArrayStart[index]); + value = *reinterpret_cast< short* >(&__pArrayStart[index]); return E_SUCCESS; } @@ -551,7 +549,7 @@ ByteBuffer::GetShort(int index, short& value) const result ByteBuffer::ReadFrom(ByteBuffer& buffer) { - SysTryReturn(NID_BASE, this != static_cast (&buffer), E_INVALID_ARG, E_INVALID_ARG, + SysTryReturn(NID_BASE, this != static_cast< void* >(&buffer), E_INVALID_ARG, E_INVALID_ARG, "[%s] The source and target buffers are identical.", GetErrorMessage(E_INVALID_ARG)); int copyLength = (GetRemaining() < buffer.GetRemaining()) ? GetRemaining() : buffer.GetRemaining(); @@ -606,7 +604,7 @@ ByteBuffer::SetDouble(double value) GetRemaining() >= DOUBLE_SIZE, E_OVERFLOW, E_OVERFLOW, "[%s] The remaining bytes of this buffer are smaller than size of double.", GetErrorMessage(E_OVERFLOW)); - *reinterpret_cast (&__pArrayStart[_position]) = value; + *reinterpret_cast< double* >(&__pArrayStart[_position]) = value; _position += DOUBLE_SIZE; return E_SUCCESS; @@ -620,7 +618,7 @@ ByteBuffer::SetDouble(int index, double value) "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of double(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, DOUBLE_SIZE); - *reinterpret_cast (&__pArrayStart[index]) = value; + *reinterpret_cast< double* >(&__pArrayStart[index]) = value; return E_SUCCESS; } @@ -632,7 +630,7 @@ ByteBuffer::SetFloat(float value) GetRemaining() >= FLOAT_SIZE, E_OVERFLOW, E_OVERFLOW, "[%s] The remaining bytes of this buffer are smaller than size of float.", GetErrorMessage(E_OVERFLOW)); - *reinterpret_cast (&__pArrayStart[_position]) = value; + *reinterpret_cast< float* >(&__pArrayStart[_position]) = value; _position += FLOAT_SIZE; return E_SUCCESS; @@ -646,7 +644,7 @@ ByteBuffer::SetFloat(int index, float value) "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of float(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, FLOAT_SIZE); - *reinterpret_cast (&__pArrayStart[index]) = value; + *reinterpret_cast< float* >(&__pArrayStart[index]) = value; return E_SUCCESS; } @@ -658,7 +656,7 @@ ByteBuffer::SetInt(int value) GetRemaining() >= INT_SIZE, E_OVERFLOW, E_OVERFLOW, "[%s] The remaining bytes of this buffer are smaller than size of int.", GetErrorMessage(E_OVERFLOW)); - *reinterpret_cast (&__pArrayStart[_position]) = value; + *reinterpret_cast< int* >(&__pArrayStart[_position]) = value; _position += INT_SIZE; return E_SUCCESS; @@ -672,7 +670,7 @@ ByteBuffer::SetInt(int index, int value) "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of int(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, INT_SIZE); - *reinterpret_cast (&__pArrayStart[index]) = value; + *reinterpret_cast< int* >(&__pArrayStart[index]) = value; return E_SUCCESS; } @@ -684,7 +682,7 @@ ByteBuffer::SetLong(long value) GetRemaining() >= LONG_SIZE, E_OVERFLOW, E_OVERFLOW, "[%s] The remaining bytes of this buffer are smaller than size of long.", GetErrorMessage(E_OVERFLOW)); - *reinterpret_cast (&__pArrayStart[_position]) = value; + *reinterpret_cast< long* >(&__pArrayStart[_position]) = value; _position += LONG_SIZE; return E_SUCCESS; @@ -698,7 +696,7 @@ ByteBuffer::SetLong(int index, long value) "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of long(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, LONG_SIZE); - *reinterpret_cast (&__pArrayStart[index]) = value; + *reinterpret_cast< long* >(&__pArrayStart[index]) = value; return E_SUCCESS; } @@ -710,7 +708,7 @@ ByteBuffer::SetLongLong(long long value) GetRemaining() >= LONGLONG_SIZE, E_OVERFLOW, E_OVERFLOW, "[%s] The remaining bytes of this buffer are smaller than size of long long.", GetErrorMessage(E_OVERFLOW)); - *reinterpret_cast (&__pArrayStart[_position]) = value; + *reinterpret_cast< long long* >(&__pArrayStart[_position]) = value; _position += LONGLONG_SIZE; return E_SUCCESS; @@ -724,7 +722,7 @@ ByteBuffer::SetLongLong(int index, long long value) "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of long long(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, LONGLONG_SIZE); - *reinterpret_cast (&__pArrayStart[index]) = value; + *reinterpret_cast< long long* >(&__pArrayStart[index]) = value; return E_SUCCESS; } @@ -736,7 +734,7 @@ ByteBuffer::SetMchar(wchar_t value) GetRemaining() >= MCHAR_SIZE, E_OVERFLOW, E_OVERFLOW, "[%s] The remaining bytes of this buffer are smaller than size of wchar_t.", GetErrorMessage(E_OVERFLOW)); - *reinterpret_cast (&__pArrayStart[_position]) = value; + *reinterpret_cast< wchar_t* >(&__pArrayStart[_position]) = value; _position += MCHAR_SIZE; return E_SUCCESS; @@ -749,7 +747,7 @@ ByteBuffer::SetWchar(wchar_t value) GetRemaining() >= MCHAR_SIZE, E_OVERFLOW, E_OVERFLOW, "[%s] The remaining bytes of this buffer are smaller than size of wchar_t.", GetErrorMessage(E_OVERFLOW)); - *reinterpret_cast (&__pArrayStart[_position]) = value; + *reinterpret_cast< wchar_t* >(&__pArrayStart[_position]) = value; _position += MCHAR_SIZE; return E_SUCCESS; @@ -763,7 +761,7 @@ ByteBuffer::SetMchar(int index, wchar_t value) "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of wchar_t(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, MCHAR_SIZE); - *reinterpret_cast (&__pArrayStart[index]) = value; + *reinterpret_cast< wchar_t* >(&__pArrayStart[index]) = value; return E_SUCCESS; } @@ -776,7 +774,7 @@ ByteBuffer::SetWchar(int index, wchar_t value) "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of wchar_t(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, MCHAR_SIZE); - *reinterpret_cast (&__pArrayStart[index]) = value; + *reinterpret_cast< wchar_t* >(&__pArrayStart[index]) = value; return E_SUCCESS; } @@ -788,7 +786,7 @@ ByteBuffer::SetShort(short value) GetRemaining() >= SHORT_SIZE, E_OVERFLOW, E_OVERFLOW, "[%s] The remaining bytes of this buffer are smaller than size of short.", GetErrorMessage(E_OVERFLOW)); - *reinterpret_cast (&__pArrayStart[_position]) = value; + *reinterpret_cast< short* >(&__pArrayStart[_position]) = value; _position += SHORT_SIZE; return E_SUCCESS; @@ -802,7 +800,7 @@ ByteBuffer::SetShort(int index, short value) "[%s] The index(%d) MUST be greater than or equal to 0, and less then the 'current limit(%d) - size of short(%d)'.", GetErrorMessage(E_OUT_OF_RANGE), index, _limit, SHORT_SIZE); - *reinterpret_cast (&__pArrayStart[index]) = value; + *reinterpret_cast< short* >(&__pArrayStart[index]) = value; return E_SUCCESS; } @@ -810,7 +808,7 @@ ByteBuffer::SetShort(int index, short value) ByteBuffer* ByteBuffer::SliceN(void) const { - std::unique_ptr pBuffer(new (std::nothrow) ByteBuffer()); + std::unique_ptr< ByteBuffer > pBuffer(new (std::nothrow) ByteBuffer()); pBuffer->_pData = _pData; AddRef(); pBuffer->_capacity = GetRemaining(); @@ -839,7 +837,7 @@ bool ByteBuffer::Equals(const Tizen::Base::Object& obj) const { bool out = false; - const ByteBuffer* pOther = dynamic_cast (&obj); + const ByteBuffer* pOther = dynamic_cast< const ByteBuffer* >(&obj); if (pOther == null) { out = false; @@ -861,7 +859,7 @@ ByteBuffer::GetHashCode(void) const int offset = _position; for (int i = 0; i < len; ++i) { - hash = (hash << 5) - hash + static_cast (__pArrayStart[offset + (i * sizeof(hash))]); + hash = (hash << 5) - hash + static_cast< int >(__pArrayStart[offset + (i * sizeof(hash))]); } return hash; diff --git a/src/base/FBaseCharacter.cpp b/src/base/FBaseCharacter.cpp index dc5c9bd..a72e896 100644 --- a/src/base/FBaseCharacter.cpp +++ b/src/base/FBaseCharacter.cpp @@ -18,14 +18,12 @@ * @file FBaseCharacter.cpp * @brief This is the implementation file for Char class. */ - #include #include #include #include #include "FBase_CharacterImpl.h" - namespace Tizen { namespace Base { @@ -64,7 +62,7 @@ Character::CompareTo(const Character& value) const bool Character::Equals(const Object& obj) const { - const Character* pOther = dynamic_cast (&obj); + const Character* pOther = dynamic_cast< const Character* >(&obj); if (pOther == null) { return false; @@ -204,7 +202,7 @@ Character::IsLetter(wchar_t ch) if (Tizen::App::_AppInfo::GetApiVersion() == _API_VERSION_2_0 && Tizen::App::_AppInfo::IsOspCompat()) { - return(iswalpha(ch) !=0); + return(iswalpha(ch) != 0); } else { diff --git a/src/base/FBaseDateTime.cpp b/src/base/FBaseDateTime.cpp index 4a691d9..5195df3 100644 --- a/src/base/FBaseDateTime.cpp +++ b/src/base/FBaseDateTime.cpp @@ -18,7 +18,6 @@ * @file FBaseDateTime.cpp * @brief This file contains implementation of DateTime class */ - #include #include #include @@ -108,11 +107,11 @@ DateTime::SetValue(int year, int month, int day, int hour, int minute, int secon { SysTryReturn(NID_BASE, ((year >= MIN_YEAR && year <= _MAX_YEAR) && - (month >= MIN_MONTH && month <= MAX_MONTH) && - (hour >= MIN_HOUR && hour <= MAX_HOUR) && - (minute >= MIN_MINUTE && minute <= MAX_MINUTE) && - ((second & LOW_16BIT) >= MIN_SECOND && (second & LOW_16BIT) <= MAX_SECOND) && - ((second >> INT_HALF_BIT) >= MIN_TICK && (second >> INT_HALF_BIT) <= MAX_TICK)), + (month >= MIN_MONTH && month <= MAX_MONTH) && + (hour >= MIN_HOUR && hour <= MAX_HOUR) && + (minute >= MIN_MINUTE && minute <= MAX_MINUTE) && + ((second & LOW_16BIT) >= MIN_SECOND && (second & LOW_16BIT) <= MAX_SECOND) && + ((second >> INT_HALF_BIT) >= MIN_TICK && (second >> INT_HALF_BIT) <= MAX_TICK)), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[%s] One of the year(%d), month(%d), day(%d), hour(%d), minute(%d), second(%d) and tick(%d) is out of allowable range.", GetErrorMessage(E_OUT_OF_RANGE), year, month, day, hour, minute, second & LOW_16BIT, second >> INT_HALF_BIT); @@ -137,11 +136,11 @@ DateTime::SetValue(int year, int month, int day, int hour, int minute, int secon { SysTryReturn(NID_BASE, ((year >= MIN_YEAR && year <= _MAX_YEAR) && - (month >= MIN_MONTH && month <= MAX_MONTH) && - (hour >= MIN_HOUR && hour <= MAX_HOUR) && - (minute >= MIN_MINUTE && minute <= MAX_MINUTE) && - (second >= MIN_SECOND && second <= MAX_SECOND) && - ((millisecond * TICKS_PER_MILLISECOND >= MIN_TICK) && (millisecond * TICKS_PER_MILLISECOND <= MAX_TICK))), + (month >= MIN_MONTH && month <= MAX_MONTH) && + (hour >= MIN_HOUR && hour <= MAX_HOUR) && + (minute >= MIN_MINUTE && minute <= MAX_MINUTE) && + (second >= MIN_SECOND && second <= MAX_SECOND) && + ((millisecond * TICKS_PER_MILLISECOND >= MIN_TICK) && (millisecond * TICKS_PER_MILLISECOND <= MAX_TICK))), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[%s] One of the year(%d), month(%d), day(%d), hour(%d), minute(%d), second(%d) and tick(%d) is out of allowable range.", GetErrorMessage(E_OUT_OF_RANGE), year, month, day, hour, minute, second, millisecond * TICKS_PER_MILLISECOND); @@ -182,8 +181,8 @@ bool DateTime::operator ==(const DateTime& rhs) const { return((__dateTime.year == rhs.__dateTime.year) && (__dateTime.month == rhs.__dateTime.month) - && (__dateTime.day == rhs.__dateTime.day) && (__dateTime.hour == rhs.__dateTime.hour) && - (__dateTime.minute == rhs.__dateTime.minute) && (__dateTime.second == rhs.__dateTime.second)); + && (__dateTime.day == rhs.__dateTime.day) && (__dateTime.hour == rhs.__dateTime.hour) && + (__dateTime.minute == rhs.__dateTime.minute) && (__dateTime.second == rhs.__dateTime.second)); } bool @@ -373,17 +372,17 @@ DateTime::AddMonths(int months) tmp.__dateTime.year += months / MAX_MONTH; // Get the year to add int tempMonth = tmp.__dateTime.month + months % MAX_MONTH; - if (tempMonth > MAX_MONTH) // Month was added and moved to next year + if (tempMonth > MAX_MONTH) // Month was added and moved to next year { tmp.__dateTime.year++; tmp.__dateTime.month = tempMonth - MAX_MONTH; } - else if (tempMonth <= 0) // Month was subtracted and moved to previous year + else if (tempMonth <= 0) // Month was subtracted and moved to previous year { tmp.__dateTime.year--; tmp.__dateTime.month = MAX_MONTH + tempMonth; } - else // Keep current year + else // Keep current year { tmp.__dateTime.month += months % MAX_MONTH; } @@ -391,26 +390,26 @@ DateTime::AddMonths(int months) // Check the days in Month if (tmp.__dateTime.month != 2) // Current month is not Feb { - if (tmp.__dateTime.day == 31) // Previous day is 31th + if (tmp.__dateTime.day == 31) // Previous day is 31th { result r = SetValue(tmp.__dateTime.year, tmp.__dateTime.month, tmp.__dateTime.day); - if (IsFailed(r)) // Current month doesn't have 31th + if (IsFailed(r)) // Current month doesn't have 31th { - tmp.__dateTime.day = 30; // Set day to 30th + tmp.__dateTime.day = 30; // Set day to 30th } } } - else // Current month is Feb + else // Current month is Feb { - if (tmp.__dateTime.day > 28) // Previous day is over 28th + if (tmp.__dateTime.day > 28) // Previous day is over 28th { - if (tmp.IsLeapYear()) // Leap year + if (tmp.IsLeapYear()) // Leap year { - tmp.__dateTime.day = 29; // Set day to 29th + tmp.__dateTime.day = 29; // Set day to 29th } - else // Not leap year + else // Not leap year { - tmp.__dateTime.day = 28; // Set day to 28th + tmp.__dateTime.day = 28; // Set day to 28th } } } @@ -516,7 +515,7 @@ DateTime::CompareTo(const DateTime& value) const bool DateTime::Equals(const Object& obj) const { - const DateTime* pOther = dynamic_cast (&obj); + const DateTime* pOther = dynamic_cast< const DateTime* >(&obj); if (pOther == null) { return false; @@ -602,8 +601,8 @@ DateTime::ToString(void) const wchar_t date[] = L"01/01/1970 00:00:00"; swprintf(date, (sizeof(date) / sizeof(wchar_t)), L"%2d/%2d/%4d %2d:%2d:%2d", - __dateTime.month, __dateTime.day, __dateTime.year, __dateTime.hour, __dateTime.minute, - (__dateTime.second & LOW_16BIT)); + __dateTime.month, __dateTime.day, __dateTime.year, __dateTime.hour, __dateTime.minute, + (__dateTime.second & LOW_16BIT)); if (__dateTime.month < 10) { @@ -658,7 +657,7 @@ DateTime::Parse(const String& str, DateTime& dt) E_INVALID_FORMAT, E_INVALID_FORMAT, ("[%s] The str(%s) is not formatted like 'mm/dd/yyyy hh:mm:ss'."), GetErrorMessage(E_INVALID_FORMAT), str.GetPointer()); - std::unique_ptr pTmp(new (std::nothrow) wchar_t [5]); + std::unique_ptr< wchar_t[] > pTmp(new (std::nothrow) wchar_t[5]); SysTryReturn(NID_BASE, pTmp != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -955,5 +954,3 @@ DateTime::ConvertDateToSeconds(const TmDateTime* pDateTime) const } }} // Tizen::Base - - diff --git a/src/base/FBaseDouble.cpp b/src/base/FBaseDouble.cpp index e5795d7..8aebf82 100644 --- a/src/base/FBaseDouble.cpp +++ b/src/base/FBaseDouble.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for Double class. * @see Number */ - #include #include #include @@ -31,7 +30,6 @@ #include #include "FBase_LocalizedNumParser.h" - namespace Tizen { namespace Base { diff --git a/src/base/FBaseDoubleComparer.cpp b/src/base/FBaseDoubleComparer.cpp index e0d53ad..762d731 100644 --- a/src/base/FBaseDoubleComparer.cpp +++ b/src/base/FBaseDoubleComparer.cpp @@ -19,13 +19,11 @@ * @brief This is the implementation file for DoubleComparer class. * @see Double and Tizen::Base::Collection::IComparer */ - #include #include #include #include - namespace Tizen { namespace Base { @@ -42,8 +40,8 @@ DoubleComparer::~DoubleComparer(void) result DoubleComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const { - const Double* pDouble1 = dynamic_cast (&obj1); - const Double* pDouble2 = dynamic_cast (&obj2); + const Double* pDouble1 = dynamic_cast< const Double* >(&obj1); + const Double* pDouble2 = dynamic_cast< const Double* >(&obj2); SysTryReturn(NID_BASE, (pDouble1 != null && pDouble2 != null), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Double.", GetErrorMessage(E_INVALID_ARG)); @@ -52,5 +50,4 @@ DoubleComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Obje return E_SUCCESS; } - }} //Tizen::Base diff --git a/src/base/FBaseDoubleMatrix.cpp b/src/base/FBaseDoubleMatrix.cpp index a893c36..e9a2ed7 100644 --- a/src/base/FBaseDoubleMatrix.cpp +++ b/src/base/FBaseDoubleMatrix.cpp @@ -18,7 +18,6 @@ * @file FBaseDoubleMatrix.cpp * @brief This is the implementation for DoubleMatrix class. */ - #include #include #include @@ -117,7 +116,7 @@ DoubleMatrix::DoubleMatrix(int rowCount, int columnCount, const double* pArray[] DoubleMatrix::~DoubleMatrix(void) { - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] __pMatrix[i]; } @@ -184,7 +183,7 @@ DoubleMatrix::operator =(const DoubleMatrix& rhs) bool DoubleMatrix::Equals(const Tizen::Base::Object& obj) const { - const DoubleMatrix* pOther = dynamic_cast (&obj); + const DoubleMatrix* pOther = dynamic_cast< const DoubleMatrix* >(&obj); if (pOther == null) { @@ -241,20 +240,20 @@ DoubleMatrix::AddToEachElement(double value) bool DoubleMatrix::AllocateCapacity(int rowCount, int columnCount) { - std::unique_ptr pMatrix(new (std::nothrow) double* [rowCount]); + std::unique_ptr< double*[] > pMatrix(new (std::nothrow) double*[rowCount]); SysTryReturn(NID_BASE, pMatrix != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - for ( int i = 0 ; i < rowCount ; i++ ) + for (int i = 0; i < rowCount; i++) { pMatrix[i] = new (std::nothrow) double[columnCount]; if (pMatrix[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMatrix[j]; } - return false; + return false; } } @@ -275,7 +274,7 @@ DoubleMatrix::CalculateDeterminant(double** pMatrix, int order) const // For pe } double determinant = 0.0f; - std::unique_ptr pMinor(new (std::nothrow) double* [order - 1]); + std::unique_ptr< double*[] > pMinor(new (std::nothrow) double*[order - 1]); SysTryReturn(NID_BASE, pMinor != null, determinant, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); for (int i = 0; i < order - 1; i++) @@ -283,11 +282,11 @@ DoubleMatrix::CalculateDeterminant(double** pMatrix, int order) const // For pe pMinor[i] = new (std::nothrow) double[order - 1]; if (pMinor[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMinor[j]; } - return determinant; + return determinant; } } @@ -295,7 +294,7 @@ DoubleMatrix::CalculateDeterminant(double** pMatrix, int order) const // For pe for (int i = 0; i < order; i++) { GetMinor(pMatrix, pMinor.get(), 0, i, order); - + if (signFlag == true) { determinant += pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1); @@ -304,7 +303,7 @@ DoubleMatrix::CalculateDeterminant(double** pMatrix, int order) const // For pe else { determinant += -pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1); - signFlag = true; + signFlag = true; } } @@ -329,7 +328,7 @@ DoubleMatrix::GetColumnN(int columnIndex) const "[%s] Invalid argument is used. The columnIndex is larger than the column count of the current instance.", GetErrorMessage(E_INVALID_ARG)); - std::unique_ptr pColumn(new (std::nothrow) double [__row]); + std::unique_ptr< double[] > pColumn(new (std::nothrow) double[__row]); SysTryReturn(NID_BASE, pColumn != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -365,27 +364,27 @@ DoubleMatrix::GetInverseN(void) const SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION, "[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION)); - std::unique_ptr pInverseMatrix(new (std::nothrow) DoubleMatrix(__row, __column)); + std::unique_ptr< DoubleMatrix > pInverseMatrix(new (std::nothrow) DoubleMatrix(__row, __column)); SysTryReturn(NID_BASE, pInverseMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); double determinant = CalculateDeterminant(__pMatrix, __row); - if (Tizen::Base::Double::Compare(determinant,0.0f) == 0) + if (Tizen::Base::Double::Compare(determinant, 0.0f) == 0) { return null; } - std::unique_ptr pMinor(new (std::nothrow) double* [__row - 1]); + std::unique_ptr< double*[] > pMinor(new (std::nothrow) double*[__row - 1]); SysTryReturn(NID_BASE, pMinor != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - for (int i = 0; i < __row -1; i++) + for (int i = 0; i < __row - 1; i++) { pMinor[i] = new (std::nothrow) double[__row - 1]; if (pMinor[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMinor[j]; } @@ -403,10 +402,10 @@ DoubleMatrix::GetInverseN(void) const { pInverseMatrix->__pMatrix[j][i] = -pInverseMatrix->__pMatrix[j][i]; } - } + } } - for ( int i = 0 ; i < __row -1 ; i++ ) + for (int i = 0; i < __row - 1; i++) { delete[] pMinor[i]; } @@ -430,7 +429,7 @@ DoubleMatrix::GetMinor(double** pSrc, double** pDest, int rowIndex, int columnIn if (i != rowIndex) { columnCount = 0; - + for (int j = 0; j < order; j++) { if (j != columnIndex) @@ -457,7 +456,7 @@ DoubleMatrix::GetRowN(int rowIndex) const "[%s] Invalid argument is used. The rowIndex is larger than the row count of the current instance.", GetErrorMessage(E_INVALID_ARG)); - std::unique_ptr pRow(new (std::nothrow) double [__column]); + std::unique_ptr< double[] > pRow(new (std::nothrow) double[__column]); SysTryReturn(NID_BASE, pRow != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -490,7 +489,7 @@ DoubleMatrix::GetTransposeN(void) const SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION, "[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION)); - std::unique_ptr pTransposeMatrix(new (std::nothrow) DoubleMatrix(*this)); + std::unique_ptr< DoubleMatrix > pTransposeMatrix(new (std::nothrow) DoubleMatrix(*this)); SysTryReturn(NID_BASE, pTransposeMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -525,20 +524,20 @@ DoubleMatrix::IsIdentity(void) const { if (i == j) { - if (Tizen::Base::Double::Compare(__pMatrix[i][j],1.0f) != 0) + if (Tizen::Base::Double::Compare(__pMatrix[i][j], 1.0f) != 0) { return false; } } else { - if (Tizen::Base::Double::Compare(__pMatrix[i][j],0.0f) != 0) + if (Tizen::Base::Double::Compare(__pMatrix[i][j], 0.0f) != 0) { return false; } } - + } } return true; @@ -547,7 +546,7 @@ DoubleMatrix::IsIdentity(void) const bool DoubleMatrix::IsInvertible(void) const { - int ret = Tizen::Base::Double::Compare(GetDeterminant(),0.0f); + int ret = Tizen::Base::Double::Compare(GetDeterminant(), 0.0f); if (ret == 0) { @@ -565,15 +564,15 @@ DoubleMatrix::Multiply(const DoubleMatrix& matrix) SysTryReturnResult(NID_BASE, __column == matrix.__row, E_INVALID_ARG, "The column count of the current instance is not same with the row count of the specified instance."); - std::unique_ptr pResult(new (std::nothrow) double* [__row]); + std::unique_ptr< double*[] > pResult(new (std::nothrow) double*[__row]); SysTryReturnResult(NID_BASE, pResult != null, E_OUT_OF_MEMORY, "Allocating memory is failed."); - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { pResult[i] = new (std::nothrow) double[matrix.__column]; if (pResult[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pResult[j]; } @@ -594,7 +593,7 @@ DoubleMatrix::Multiply(const DoubleMatrix& matrix) } } - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] __pMatrix[i]; } @@ -646,7 +645,7 @@ DoubleMatrix::SetAsIdentity(void) else { __pMatrix[i][j] = 0.0f; - } + } } } @@ -662,7 +661,7 @@ DoubleMatrix::Invert(void) SysTryReturnResult(NID_BASE, Tizen::Base::Double::Compare(determinant, 0.0f) != 0, E_INVALID_OPERATION, "The current instance is not invertible."); - std::unique_ptr pInverse(new (std::nothrow) double* [__row]); + std::unique_ptr< double*[] > pInverse(new (std::nothrow) double*[__row]); SysTryReturnResult(NID_BASE, pInverse != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -671,7 +670,7 @@ DoubleMatrix::Invert(void) pInverse[i] = new (std::nothrow) double[__row]; if (pInverse[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pInverse[j]; } @@ -679,27 +678,27 @@ DoubleMatrix::Invert(void) } } - std::unique_ptr pMinor(new (std::nothrow) double* [__row - 1]); + std::unique_ptr< double*[] > pMinor(new (std::nothrow) double*[__row - 1]); if (pMinor == null) { - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] pInverse[i]; } return E_OUT_OF_MEMORY; } - for (int i = 0; i < __row -1; i++) + for (int i = 0; i < __row - 1; i++) { pMinor[i] = new double[__row - 1]; if (pMinor[i] == null) { - for( int k = 0 ; k < __row ; k++ ) + for (int k = 0; k < __row; k++) { delete[] pInverse[k]; } - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMinor[j]; } @@ -713,14 +712,14 @@ DoubleMatrix::Invert(void) { GetMinor(__pMatrix, pMinor.get(), i, j, __row); pInverse[j][i] = CalculateDeterminant(pMinor.get(), __row - 1) / determinant; - if ((i +j +2) % 2 == 1) + if ((i + j + 2) % 2 == 1) { pInverse[j][i] = -pInverse[j][i]; } - } + } } - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] __pMatrix[i]; } @@ -728,7 +727,7 @@ DoubleMatrix::Invert(void) __pMatrix = pInverse.release(); - for (int i = 0 ; i < __row -1; i++ ) + for (int i = 0; i < __row - 1; i++) { delete[] pMinor[i]; } @@ -767,7 +766,7 @@ DoubleMatrix::SetColumn(int columnIndex, const double* pArray) for (int i = 0; i < __row; i++) { - __pMatrix[i][columnIndex] = pArray[i]; + __pMatrix[i][columnIndex] = pArray[i]; } return E_SUCCESS; @@ -782,7 +781,7 @@ DoubleMatrix::SetRow(int rowIndex, const double* pArray) for (int i = 0; i < __column; i++) { - __pMatrix[rowIndex][i] = pArray[i]; + __pMatrix[rowIndex][i] = pArray[i]; } return E_SUCCESS; @@ -837,7 +836,7 @@ DoubleMatrix::SetAsNull(void) { for (int j = 0; j < __column; j++) { - __pMatrix[i][j] = 0.0f; + __pMatrix[i][j] = 0.0f; } } } diff --git a/src/base/FBaseDoubleMatrix3.cpp b/src/base/FBaseDoubleMatrix3.cpp index 61d277b..4ad7b30 100644 --- a/src/base/FBaseDoubleMatrix3.cpp +++ b/src/base/FBaseDoubleMatrix3.cpp @@ -18,7 +18,6 @@ * @file FBaseDoubleMatrix3.cpp * @brief This is the implementation for DoubleMatrix class. */ - #include #include @@ -293,7 +292,7 @@ operator -(const double& value, const DoubleMatrix3& rhs) bool DoubleMatrix3::Equals(const Tizen::Base::Object& obj) const { - const DoubleMatrix3* pMatrix = dynamic_cast (&obj); + const DoubleMatrix3* pMatrix = dynamic_cast< const DoubleMatrix3* >(&obj); if (pMatrix == null) { diff --git a/src/base/FBaseDoubleMatrix4.cpp b/src/base/FBaseDoubleMatrix4.cpp index 4763c8d..0e3c797 100644 --- a/src/base/FBaseDoubleMatrix4.cpp +++ b/src/base/FBaseDoubleMatrix4.cpp @@ -18,7 +18,6 @@ * @file FBaseDoubleMatrix4.cpp * @brief This is the implementation for DoubleMatrix class. */ - #include #include @@ -356,7 +355,7 @@ operator -(const double& value, const DoubleMatrix4& rhs) bool DoubleMatrix4::Equals(const Tizen::Base::Object& obj) const { - const DoubleMatrix4* pMatrix = dynamic_cast (&obj); + const DoubleMatrix4* pMatrix = dynamic_cast< const DoubleMatrix4* >(&obj); if (pMatrix == null) { diff --git a/src/base/FBaseErrors.cpp b/src/base/FBaseErrors.cpp index 047a83c..7275969 100644 --- a/src/base/FBaseErrors.cpp +++ b/src/base/FBaseErrors.cpp @@ -13,10 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // + /** * @file FBaseErrors.cpp * @brief This is the implementation file of Result class. */ - #include - diff --git a/src/base/FBaseFloat.cpp b/src/base/FBaseFloat.cpp index 2279176..800af2e 100644 --- a/src/base/FBaseFloat.cpp +++ b/src/base/FBaseFloat.cpp @@ -19,8 +19,6 @@ * @brief This is the implementation file for Float class. * @see Number class */ - -// Includes #include #include #include diff --git a/src/base/FBaseFloatComparer.cpp b/src/base/FBaseFloatComparer.cpp index 61e59da..e6c5657 100644 --- a/src/base/FBaseFloatComparer.cpp +++ b/src/base/FBaseFloatComparer.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for FloatComparer class. * @see Float and Tizen::Base::Collection::IComparer */ - #include #include #include @@ -40,8 +39,8 @@ FloatComparer::~FloatComparer(void) result FloatComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const { - const Float* pFloat1 = dynamic_cast (&obj1); - const Float* pFloat2 = dynamic_cast (&obj2); + const Float* pFloat1 = dynamic_cast< const Float* >(&obj1); + const Float* pFloat2 = dynamic_cast< const Float* >(&obj2); SysTryReturn(NID_BASE, (pFloat1 != null && pFloat2 != null), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used.Both of the obj1 and obj2 MUST be Float.", GetErrorMessage(E_INVALID_ARG)); diff --git a/src/base/FBaseFloatMatrix.cpp b/src/base/FBaseFloatMatrix.cpp index 05cb4de..bcd60e0 100644 --- a/src/base/FBaseFloatMatrix.cpp +++ b/src/base/FBaseFloatMatrix.cpp @@ -18,7 +18,6 @@ * @file FBaseFloatMatrix.cpp * @brief This is the implementation for FloatMatrix class. */ - #include #include #include @@ -117,7 +116,7 @@ FloatMatrix::FloatMatrix(int rowCount, int columnCount, const float* pArray[]) FloatMatrix::~FloatMatrix(void) { - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] __pMatrix[i]; } @@ -184,7 +183,7 @@ FloatMatrix::operator =(const FloatMatrix& rhs) bool FloatMatrix::Equals(const Tizen::Base::Object& obj) const { - const FloatMatrix* pOther = dynamic_cast (&obj); + const FloatMatrix* pOther = dynamic_cast< const FloatMatrix* >(&obj); if (pOther == null) { @@ -241,20 +240,20 @@ FloatMatrix::AddToEachElement(float value) bool FloatMatrix::AllocateCapacity(int rowCount, int columnCount) { - std::unique_ptr pMatrix(new (std::nothrow) float* [rowCount]); + std::unique_ptr< float*[] > pMatrix(new (std::nothrow) float*[rowCount]); SysTryReturn(NID_BASE, pMatrix != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - for ( int i = 0 ; i < rowCount ; i++ ) + for (int i = 0; i < rowCount; i++) { pMatrix[i] = new (std::nothrow) float[columnCount]; if (pMatrix[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMatrix[j]; } - return false; + return false; } } @@ -275,7 +274,7 @@ FloatMatrix::CalculateDeterminant(float** pMatrix, int order) const // For perf } float determinant = 0.0f; - std::unique_ptr pMinor(new (std::nothrow) float* [order - 1]); + std::unique_ptr< float*[] > pMinor(new (std::nothrow) float*[order - 1]); SysTryReturn(NID_BASE, pMinor != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); for (int i = 0; i < order - 1; i++) @@ -283,11 +282,11 @@ FloatMatrix::CalculateDeterminant(float** pMatrix, int order) const // For perf pMinor[i] = new (std::nothrow) float[order - 1]; if (pMinor[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMinor[j]; } - return determinant; + return determinant; } } @@ -295,7 +294,7 @@ FloatMatrix::CalculateDeterminant(float** pMatrix, int order) const // For perf for (int i = 0; i < order; i++) { GetMinor(pMatrix, pMinor.get(), 0, i, order); - + if (signFlag == true) { determinant += pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1); @@ -304,7 +303,7 @@ FloatMatrix::CalculateDeterminant(float** pMatrix, int order) const // For perf else { determinant += -pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1); - signFlag = true; + signFlag = true; } } @@ -329,7 +328,7 @@ FloatMatrix::GetColumnN(int columnIndex) const "[%s] Invalid argument is used. The columnIndex is larger than the column count of the current instance.", GetErrorMessage(E_INVALID_ARG)); - std::unique_ptr pColumn(new (std::nothrow) float [__row]); + std::unique_ptr< float[] > pColumn(new (std::nothrow) float[__row]); SysTryReturn(NID_BASE, pColumn != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -365,30 +364,30 @@ FloatMatrix::GetInverseN(void) const SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION, "[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION)); - std::unique_ptr pInverseMatrix(new (std::nothrow) FloatMatrix(__row, __column)); + std::unique_ptr< FloatMatrix > pInverseMatrix(new (std::nothrow) FloatMatrix(__row, __column)); SysTryReturn(NID_BASE, pInverseMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); float determinant = CalculateDeterminant(__pMatrix, __row); - if (Tizen::Base::Float::Compare(determinant,0.0f) == 0) + if (Tizen::Base::Float::Compare(determinant, 0.0f) == 0) { return null; } - std::unique_ptr pMinor(new (std::nothrow) float* [__row - 1]); + std::unique_ptr< float*[] > pMinor(new (std::nothrow) float*[__row - 1]); SysTryReturn(NID_BASE, pMinor != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - for (int i = 0; i < __row -1; i++) + for (int i = 0; i < __row - 1; i++) { pMinor[i] = new (std::nothrow) float[__row - 1]; if (pMinor[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMinor[j]; - } + } return null; } @@ -404,10 +403,10 @@ FloatMatrix::GetInverseN(void) const { pInverseMatrix->__pMatrix[j][i] = -pInverseMatrix->__pMatrix[j][i]; } - } + } } - for ( int i = 0 ; i < __row -1 ; i++ ) + for (int i = 0; i < __row - 1; i++) { delete[] pMinor[i]; } @@ -429,7 +428,7 @@ FloatMatrix::GetMinor(float** pSrc, float** pDest, int rowIndex, int columnIndex if (i != rowIndex) { columnCount = 0; - + for (int j = 0; j < order; j++) { if (j != columnIndex) @@ -456,7 +455,7 @@ FloatMatrix::GetRowN(int rowIndex) const "[%s] Invalid argument is used. The rowIndex is larger than the row count of the current instance.", GetErrorMessage(E_INVALID_ARG)); - std::unique_ptr pRow(new (std::nothrow) float [__column]); + std::unique_ptr< float[] > pRow(new (std::nothrow) float[__column]); SysTryReturn(NID_BASE, pRow != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -489,7 +488,7 @@ FloatMatrix::GetTransposeN(void) const SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION, "[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION)); - std::unique_ptr pTransposeMatrix(new (std::nothrow) FloatMatrix(*this)); + std::unique_ptr< FloatMatrix > pTransposeMatrix(new (std::nothrow) FloatMatrix(*this)); SysTryReturn(NID_BASE, pTransposeMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -524,20 +523,20 @@ FloatMatrix::IsIdentity(void) const { if (i == j) { - if (Tizen::Base::Float::Compare(__pMatrix[i][j],1.0f) != 0) + if (Tizen::Base::Float::Compare(__pMatrix[i][j], 1.0f) != 0) { return false; } } else { - if (Tizen::Base::Float::Compare(__pMatrix[i][j],0.0f) != 0) + if (Tizen::Base::Float::Compare(__pMatrix[i][j], 0.0f) != 0) { return false; } } - + } } return true; @@ -546,7 +545,7 @@ FloatMatrix::IsIdentity(void) const bool FloatMatrix::IsInvertible(void) const { - int ret = Tizen::Base::Float::Compare(GetDeterminant(),0.0f); + int ret = Tizen::Base::Float::Compare(GetDeterminant(), 0.0f); if (ret == 0) { @@ -564,15 +563,15 @@ FloatMatrix::Multiply(const FloatMatrix& matrix) SysTryReturnResult(NID_BASE, __column == matrix.__row, E_INVALID_ARG, "The column count of the current instance is not same with the row count of the specified instance."); - std::unique_ptr pResult(new (std::nothrow) float* [__row]); + std::unique_ptr< float*[] > pResult(new (std::nothrow) float*[__row]); SysTryReturnResult(NID_BASE, pResult != null, E_OUT_OF_MEMORY, "Memory allocation failed."); - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { pResult[i] = new (std::nothrow) float[matrix.__column]; if (pResult[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pResult[j]; } @@ -593,7 +592,7 @@ FloatMatrix::Multiply(const FloatMatrix& matrix) } } - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] __pMatrix[i]; } @@ -633,7 +632,7 @@ FloatMatrix::SetAsIdentity(void) { SysTryReturnResult(NID_BASE, __row == __column, E_INVALID_OPERATION, "The current instance is not a square matrix."); - for (int i = 0; i < __row; i ++) + for (int i = 0; i < __row; i++) { for (int j = 0; j < __column; j++) { @@ -644,7 +643,7 @@ FloatMatrix::SetAsIdentity(void) else { __pMatrix[i][j] = 0.0f; - } + } } } @@ -660,7 +659,7 @@ FloatMatrix::Invert(void) SysTryReturnResult(NID_BASE, Tizen::Base::Float::Compare(determinant, 0.0f) != 0, E_INVALID_OPERATION, "The current instance is not invertible."); - std::unique_ptr pInverse(new (std::nothrow) float* [__row]); + std::unique_ptr< float*[] > pInverse(new (std::nothrow) float*[__row]); SysTryReturn(NID_BASE, pInverse != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -669,18 +668,18 @@ FloatMatrix::Invert(void) pInverse[i] = new (std::nothrow) float[__row]; if (pInverse[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pInverse[j]; - } + } return E_OUT_OF_MEMORY; } } - std::unique_ptr pMinor(new (std::nothrow) float* [__row - 1]); + std::unique_ptr< float*[] > pMinor(new (std::nothrow) float*[__row - 1]); if (pMinor == null) { - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] pInverse[i]; } @@ -692,12 +691,12 @@ FloatMatrix::Invert(void) pMinor[i] = new (std::nothrow) float[__row - 1]; if (pMinor[i] == null) { - for (int k = 0 ; k < __row ; k++) + for (int k = 0; k < __row; k++) { delete[] pInverse[k]; } - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMinor[j]; } @@ -712,14 +711,14 @@ FloatMatrix::Invert(void) { GetMinor(__pMatrix, pMinor.get(), i, j, __row); pInverse[j][i] = CalculateDeterminant(pMinor.get(), __row - 1) / determinant; - if ((i +j +2) % 2 == 1) + if ((i + j + 2) % 2 == 1) { pInverse[j][i] = -pInverse[j][i]; } - } + } } - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] __pMatrix[i]; } @@ -727,7 +726,7 @@ FloatMatrix::Invert(void) __pMatrix = pInverse.release(); - for ( int i = 0 ; i < __row -1; i++ ) + for (int i = 0; i < __row - 1; i++) { delete[] pMinor[i]; } @@ -766,7 +765,7 @@ FloatMatrix::SetColumn(int columnIndex, const float* pArray) for (int i = 0; i < __row; i++) { - __pMatrix[i][columnIndex] = pArray[i]; + __pMatrix[i][columnIndex] = pArray[i]; } return E_SUCCESS; @@ -781,7 +780,7 @@ FloatMatrix::SetRow(int rowIndex, const float* pArray) for (int i = 0; i < __column; i++) { - __pMatrix[rowIndex][i] = pArray[i]; + __pMatrix[rowIndex][i] = pArray[i]; } return E_SUCCESS; @@ -836,7 +835,7 @@ FloatMatrix::SetAsNull(void) { for (int j = 0; j < __column; j++) { - __pMatrix[i][j] = 0.0f; + __pMatrix[i][j] = 0.0f; } } } diff --git a/src/base/FBaseFloatMatrix3.cpp b/src/base/FBaseFloatMatrix3.cpp index 35c7bbf..a597969 100644 --- a/src/base/FBaseFloatMatrix3.cpp +++ b/src/base/FBaseFloatMatrix3.cpp @@ -18,7 +18,6 @@ * @file FBaseFloatMatrix3.cpp * @brief This is the implementation for FloatMatrix class. */ - #include #include @@ -293,7 +292,7 @@ operator -(const float& value, const FloatMatrix3& rhs) bool FloatMatrix3::Equals(const Tizen::Base::Object& obj) const { - const FloatMatrix3* pMatrix = dynamic_cast (&obj); + const FloatMatrix3* pMatrix = dynamic_cast< const FloatMatrix3* >(&obj); if (pMatrix == null) { diff --git a/src/base/FBaseFloatMatrix4.cpp b/src/base/FBaseFloatMatrix4.cpp index ed4f7d9..95bbb47 100644 --- a/src/base/FBaseFloatMatrix4.cpp +++ b/src/base/FBaseFloatMatrix4.cpp @@ -18,7 +18,6 @@ * @file FBaseFloatMatrix4.cpp * @brief This is the implementation for FloatMatrix class. */ - #include #include @@ -356,7 +355,7 @@ operator -(const float& value, const FloatMatrix4& rhs) bool FloatMatrix4::Equals(const Tizen::Base::Object& obj) const { - const FloatMatrix4* pMatrix = dynamic_cast (&obj); + const FloatMatrix4* pMatrix = dynamic_cast< const FloatMatrix4* >(&obj); if (pMatrix == null) { diff --git a/src/base/FBaseInit.cpp b/src/base/FBaseInit.cpp index 24a7fa4..bbc066c 100644 --- a/src/base/FBaseInit.cpp +++ b/src/base/FBaseInit.cpp @@ -17,44 +17,33 @@ /** * @file FBaseInit.cpp */ - #include "FBaseRt_ThreadManager.h" -//#include "FBaseResourceTracker.h" - -//Tizen::Base::__ResourceTracker* __gpResourceTracker = null; - - void BaseInit(void) { -// __gpResourceTracker = new Tizen::Base::__ResourceTracker(); -// __gpResourceTracker->Construct(); + } void BaseFinalize(void) { -// if (__gpResourceTracker) -// delete __gpResourceTracker; + } extern "C" { - void FBase_Initialize(void) { Tizen::Base::Runtime::_ThreadManager::Initialize(); } - void FBase_Finalize(void) { Tizen::Base::Runtime::_ThreadManager::Finalize(); } - } diff --git a/src/base/FBaseInt8.cpp b/src/base/FBaseInt8.cpp index 428c353..ae0a1d2 100644 --- a/src/base/FBaseInt8.cpp +++ b/src/base/FBaseInt8.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for Int8 class. * @see Number class */ - #include #include #include @@ -28,8 +27,6 @@ #include #include - - namespace Tizen { namespace Base { @@ -74,7 +71,7 @@ Int8::CompareTo(const Int8& value) const bool Int8::Equals(const Object& obj) const { - const Int8* pOther = dynamic_cast (&obj); + const Int8* pOther = dynamic_cast< const Int8* >(&obj); if (pOther == null) { return (false); @@ -86,13 +83,13 @@ Int8::Equals(const Object& obj) const int Int8::GetHashCode(void) const { - return static_cast (value); + return static_cast< int >(value); } int Int8::GetHashCode(char val) { - return static_cast (val); + return static_cast< int >(val); } result @@ -169,7 +166,7 @@ Int8::Parse(const String& s, char& ret) { int len = s.GetLength(); SysTryReturn(NID_BASE, (len > 0 && len < 5), E_NUM_FORMAT, E_NUM_FORMAT, - "[%s] The length of s(%ls) MUST be greater than 0 and less than 5.", GetErrorMessage(E_NUM_FORMAT), s.GetPointer()); + "[%s] The length of s(%ls) MUST be greater than 0 and less than 5.", GetErrorMessage(E_NUM_FORMAT), s.GetPointer()); return Parse(s, Character::RADIX_DECIMAL, ret); } @@ -214,43 +211,43 @@ Int8::Parse(const String& s, int radix, char& ret) char Int8::ToChar(void) const { - return static_cast (value); + return static_cast< char >(value); } short Int8::ToShort(void) const { - return static_cast (value); + return static_cast< short >(value); } int Int8::ToInt(void) const { - return static_cast (value); + return static_cast< int >(value); } long Int8::ToLong(void) const { - return static_cast (value); + return static_cast< long >(value); } long long Int8::ToLongLong(void) const { - return static_cast (value); + return static_cast< long long >(value); } float Int8::ToFloat(void) const { - return static_cast (value); + return static_cast< float >(value); } double Int8::ToDouble(void) const { - return static_cast (value); + return static_cast< double >(value); } String diff --git a/src/base/FBaseInt8Comparer.cpp b/src/base/FBaseInt8Comparer.cpp index 740d54c..bf4599b 100644 --- a/src/base/FBaseInt8Comparer.cpp +++ b/src/base/FBaseInt8Comparer.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for Int8Comparer class. * @see Int8 and Tizen::Base::Collection::IComparer */ - #include #include #include @@ -40,8 +39,8 @@ Int8Comparer::~Int8Comparer(void) result Int8Comparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const { - const Int8* pInteger1 = dynamic_cast (&obj1); - const Int8* pInteger2 = dynamic_cast (&obj2); + const Int8* pInteger1 = dynamic_cast< const Int8* >(&obj1); + const Int8* pInteger2 = dynamic_cast< const Int8* >(&obj2); SysTryReturn(NID_BASE, (pInteger1 != null && pInteger2 != null), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Integer.", GetErrorMessage(E_INVALID_ARG)); diff --git a/src/base/FBaseIntMatrix.cpp b/src/base/FBaseIntMatrix.cpp index 142a65a..0c2cbb8 100644 --- a/src/base/FBaseIntMatrix.cpp +++ b/src/base/FBaseIntMatrix.cpp @@ -18,7 +18,6 @@ * @file FBaseIntMatrix.cpp * @brief This is the implementation for IntMatrix class. */ - #include #include #include @@ -117,7 +116,7 @@ IntMatrix::IntMatrix(int rowCount, int columnCount, const int* pArray[]) IntMatrix::~IntMatrix(void) { - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] __pMatrix[i]; } @@ -184,7 +183,7 @@ IntMatrix::operator =(const IntMatrix& rhs) bool IntMatrix::Equals(const Tizen::Base::Object& obj) const { - const IntMatrix* pOther = dynamic_cast (&obj); + const IntMatrix* pOther = dynamic_cast< const IntMatrix* >(&obj); if (pOther == null) { @@ -241,20 +240,20 @@ IntMatrix::AddToEachElement(int value) bool IntMatrix::AllocateCapacity(int rowCount, int columnCount) { - std::unique_ptr pMatrix(new (std::nothrow) int* [rowCount]); + std::unique_ptr< int*[] > pMatrix(new (std::nothrow) int*[rowCount]); SysTryReturn(NID_BASE, pMatrix != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - for ( int i = 0 ; i < rowCount ; i++ ) + for (int i = 0; i < rowCount; i++) { pMatrix[i] = new (std::nothrow) int[columnCount]; if (pMatrix[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMatrix[j]; } - return false; + return false; } } @@ -275,19 +274,19 @@ IntMatrix::CalculateDeterminant(int** pMatrix, int order) const // For perfoman } int determinant = 0; - std::unique_ptr pMinor(new (std::nothrow) int* [order - 1]); + std::unique_ptr< int*[] > pMinor(new (std::nothrow) int*[order - 1]); SysTryReturn(NID_BASE, pMinor != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - for (int i = 0; i < order -1; i++) + for (int i = 0; i < order - 1; i++) { pMinor[i] = new (std::nothrow) int[order - 1]; if (pMinor[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMinor[j]; } - return determinant; + return determinant; } } @@ -298,17 +297,17 @@ IntMatrix::CalculateDeterminant(int** pMatrix, int order) const // For perfoman if (signFlag == true) { - determinant += pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order -1); + determinant += pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1); signFlag = false; } else { - determinant += -pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order -1); + determinant += -pMatrix[0][i] * CalculateDeterminant(pMinor.get(), order - 1); signFlag = true; } } - for (int i = 0; i < order -1; i++) + for (int i = 0; i < order - 1; i++) { delete[] pMinor[i]; } @@ -329,7 +328,7 @@ IntMatrix::GetColumnN(int columnIndex) const "[%s] Invalid argument is used. The columnIndex is larger than the column count of the current instance.", GetErrorMessage(E_INVALID_ARG)); - std::unique_ptr pColumn(new (std::nothrow) int [__row]); + std::unique_ptr< int[] > pColumn(new (std::nothrow) int[__row]); SysTryReturn(NID_BASE, pColumn != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -365,7 +364,7 @@ IntMatrix::GetInverseN(void) const SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION, "[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION)); - std::unique_ptr pInverseMatrix(new (std::nothrow) IntMatrix(__row, __column)); + std::unique_ptr< IntMatrix > pInverseMatrix(new (std::nothrow) IntMatrix(__row, __column)); SysTryReturn(NID_BASE, pInverseMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -376,7 +375,7 @@ IntMatrix::GetInverseN(void) const return null; } - std::unique_ptr pMinor(new (std::nothrow) int* [__row - 1]); + std::unique_ptr< int*[] > pMinor(new (std::nothrow) int*[__row - 1]); SysTryReturn(NID_BASE, pMinor != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -385,7 +384,7 @@ IntMatrix::GetInverseN(void) const pMinor[i] = new (std::nothrow) int[__row - 1]; if (pMinor[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMinor[j]; } @@ -406,7 +405,7 @@ IntMatrix::GetInverseN(void) const } } - for ( int i = 0 ; i < __row - 1 ; i++) + for (int i = 0; i < __row - 1; i++) { delete[] pMinor[i]; } @@ -457,7 +456,7 @@ IntMatrix::GetRowN(int rowIndex) const "[%s] Invalid argument is used. The rowIndex is larger than the row count of the current instance.", GetErrorMessage(E_INVALID_ARG)); - std::unique_ptr pRow(new (std::nothrow) int [__column]); + std::unique_ptr< int[] > pRow(new (std::nothrow) int[__column]); SysTryReturn(NID_BASE, pRow != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -490,7 +489,7 @@ IntMatrix::GetTransposeN(void) const SysTryReturn(NID_BASE, __row == __column, null, E_INVALID_OPERATION, "[%s] The current instance is not a square matrix.", GetErrorMessage(E_INVALID_OPERATION)); - std::unique_ptr pTransposeMatrix(new (std::nothrow) IntMatrix(*this)); + std::unique_ptr< IntMatrix > pTransposeMatrix(new (std::nothrow) IntMatrix(*this)); SysTryReturn(NID_BASE, pTransposeMatrix != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -563,15 +562,15 @@ IntMatrix::Multiply(const IntMatrix& matrix) SysTryReturnResult(NID_BASE, __column == matrix.__row, E_INVALID_ARG, "The column count of the current instance is not same with the row count of the specified instance."); - std::unique_ptr pResult(new (std::nothrow) int* [__row]); + std::unique_ptr< int*[] > pResult(new (std::nothrow) int*[__row]); SysTryReturnResult(NID_BASE, pResult != null, E_OUT_OF_MEMORY, "Memory allocation failed."); - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { pResult[i] = new int[matrix.__column]; if (pResult[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pResult[j]; } @@ -592,7 +591,7 @@ IntMatrix::Multiply(const IntMatrix& matrix) } } - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] __pMatrix[i]; } @@ -659,7 +658,7 @@ IntMatrix::Invert(void) int determinant = CalculateDeterminant(__pMatrix, __row); SysTryReturnResult(NID_BASE, determinant != 0, E_INVALID_OPERATION, "The current instance is not invertible."); - std::unique_ptr pInverse(new (std::nothrow) int* [__row]); + std::unique_ptr< int*[] > pInverse(new (std::nothrow) int*[__row]); SysTryReturn(NID_BASE, pInverse != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); @@ -668,18 +667,18 @@ IntMatrix::Invert(void) pInverse[i] = new (std::nothrow) int[__row]; if (pInverse[i] == null) { - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pInverse[j]; - } + } return E_OUT_OF_MEMORY; } } - std::unique_ptr pMinor(new (std::nothrow) int* [__row - 1]); + std::unique_ptr< int*[] > pMinor(new (std::nothrow) int*[__row - 1]); if (pMinor == null) { - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] pInverse[i]; } @@ -691,12 +690,12 @@ IntMatrix::Invert(void) pMinor[i] = new int[__row - 1]; if (pMinor[i] == null) { - for ( int k = 0 ; k < __row ; k++ ) + for (int k = 0; k < __row; k++) { delete[] pInverse[k]; } - for (int j = 0; j < i; j++) + for (int j = 0; j < i; j++) { delete[] pMinor[j]; } @@ -711,14 +710,14 @@ IntMatrix::Invert(void) { GetMinor(__pMatrix, pMinor.get(), i, j, __row); pInverse[j][i] = CalculateDeterminant(pMinor.get(), __row - 1) / determinant; - if ((i +j +2) % 2 == 1) + if ((i + j + 2) % 2 == 1) { pInverse[j][i] = -pInverse[j][i]; } } } - for ( int i = 0 ; i < __row ; i++ ) + for (int i = 0; i < __row; i++) { delete[] __pMatrix[i]; } @@ -726,7 +725,7 @@ IntMatrix::Invert(void) __pMatrix = pInverse.release(); - for ( int i = 0 ; i < __row - 1; i++ ) + for (int i = 0; i < __row - 1; i++) { delete[] pMinor[i]; } diff --git a/src/base/FBaseInteger.cpp b/src/base/FBaseInteger.cpp index 8676747..83027a1 100644 --- a/src/base/FBaseInteger.cpp +++ b/src/base/FBaseInteger.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for Integer class. * @see Number */ - #include #include #include @@ -73,7 +72,7 @@ Integer::CompareTo(const Integer& value) const bool Integer::Equals(const Object& obj) const { - const Integer* pOther = dynamic_cast (&obj); + const Integer* pOther = dynamic_cast< const Integer* >(&obj); if (pOther == null) { return false; @@ -183,13 +182,13 @@ Integer::Parse(const String& s, int radix, int& ret) char Integer::ToChar(void) const { - return static_cast (value); + return static_cast< char >(value); } short Integer::ToShort(void) const { - return static_cast (value); + return static_cast< short >(value); } int @@ -201,25 +200,25 @@ Integer::ToInt(void) const long Integer::ToLong(void) const { - return static_cast (value); + return static_cast< long >(value); } long long Integer::ToLongLong(void) const { - return static_cast (value); + return static_cast< long long >(value); } float Integer::ToFloat(void) const { - return static_cast (value); + return static_cast< float >(value); } double Integer::ToDouble(void) const { - return static_cast (value); + return static_cast< double >(value); } String diff --git a/src/base/FBaseIntegerComparer.cpp b/src/base/FBaseIntegerComparer.cpp index 52ce57f..fc9507a 100644 --- a/src/base/FBaseIntegerComparer.cpp +++ b/src/base/FBaseIntegerComparer.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for IntegerComparer class. * @see Integer and Tizen::Base::Collection::IComparer */ - #include #include #include @@ -40,8 +39,8 @@ IntegerComparer::~IntegerComparer(void) result IntegerComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const { - const Integer* pInteger1 = dynamic_cast (&obj1); - const Integer* pInteger2 = dynamic_cast (&obj2); + const Integer* pInteger1 = dynamic_cast< const Integer* >(&obj1); + const Integer* pInteger2 = dynamic_cast< const Integer* >(&obj2); SysTryReturn(NID_BASE, (pInteger1 != null && pInteger2 != null), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Integer.", GetErrorMessage(E_INVALID_ARG)); diff --git a/src/base/FBaseLong.cpp b/src/base/FBaseLong.cpp index eb55e11..c043b11 100644 --- a/src/base/FBaseLong.cpp +++ b/src/base/FBaseLong.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for Long class. * @see Number */ - #include #include #include @@ -72,7 +71,7 @@ Long::CompareTo(const Long& value) const bool Long::Equals(const Object& obj) const { - const Long* pOther = dynamic_cast (&obj); + const Long* pOther = dynamic_cast< const Long* >(&obj); if (pOther == null) { return false; @@ -84,13 +83,13 @@ Long::Equals(const Object& obj) const int Long::GetHashCode(void) const { - return static_cast (value); + return static_cast< int >(value); } int Long::GetHashCode(long val) { - return static_cast (val); + return static_cast< int >(val); } result @@ -181,19 +180,19 @@ Long::Parse(const String& s, int radix, long& ret) char Long::ToChar(void) const { - return static_cast (value); + return static_cast< char >(value); } short Long::ToShort(void) const { - return static_cast (value); + return static_cast< short >(value); } int Long::ToInt(void) const { - return static_cast (value); + return static_cast< int >(value); } long @@ -205,19 +204,19 @@ Long::ToLong(void) const long long Long::ToLongLong(void) const { - return static_cast (value); + return static_cast< long long >(value); } float Long::ToFloat(void) const { - return static_cast (value); + return static_cast< float >(value); } double Long::ToDouble(void) const { - return static_cast (value); + return static_cast< double >(value); } String diff --git a/src/base/FBaseLongComparer.cpp b/src/base/FBaseLongComparer.cpp index 7be9655..0f182ec 100644 --- a/src/base/FBaseLongComparer.cpp +++ b/src/base/FBaseLongComparer.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for LongComparer class. * @see Long and Tizen::Base::Collection::IComparer */ - #include #include #include @@ -40,8 +39,8 @@ LongComparer::~LongComparer(void) result LongComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const { - const Long* pLong1 = dynamic_cast (&obj1); - const Long* pLong2 = dynamic_cast (&obj2); + const Long* pLong1 = dynamic_cast< const Long* >(&obj1); + const Long* pLong2 = dynamic_cast< const Long* >(&obj2); SysTryReturn(NID_BASE, (pLong1 != null && pLong2 != null), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Long.", GetErrorMessage(E_INVALID_ARG)); diff --git a/src/base/FBaseLongLong.cpp b/src/base/FBaseLongLong.cpp index 97c2c8a..0b0dee4 100644 --- a/src/base/FBaseLongLong.cpp +++ b/src/base/FBaseLongLong.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for LongLong class. * @see Number */ - #include #include #include @@ -72,7 +71,7 @@ LongLong::CompareTo(const LongLong& value) const bool LongLong::Equals(const Object& obj) const { - const LongLong* pOther = dynamic_cast (&obj); + const LongLong* pOther = dynamic_cast< const LongLong* >(&obj); if (pOther == null) { return false; @@ -84,49 +83,49 @@ LongLong::Equals(const Object& obj) const int LongLong::GetHashCode(void) const { - return static_cast (value); + return static_cast< int >(value); } int LongLong::GetHashCode(long long val) { - return static_cast (val); + return static_cast< int >(val); } char LongLong::ToChar(void) const { - return static_cast (value); + return static_cast< char >(value); } short LongLong::ToShort(void) const { - return static_cast (value); + return static_cast< short >(value); } int LongLong::ToInt(void) const { - return static_cast (value); + return static_cast< int >(value); } long LongLong::ToLong(void) const { - return static_cast (value); + return static_cast< long >(value); } float LongLong::ToFloat(void) const { - return static_cast (value); + return static_cast< float >(value); } double LongLong::ToDouble(void) const { - return static_cast (value); + return static_cast< double >(value); } long long diff --git a/src/base/FBaseLongLongComparer.cpp b/src/base/FBaseLongLongComparer.cpp index ee965e1..4d8dbdb 100644 --- a/src/base/FBaseLongLongComparer.cpp +++ b/src/base/FBaseLongLongComparer.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for LongLongComparer class. * @see LongLong and Tizen::Base::Collection::IComparer */ - #include #include #include @@ -40,8 +39,8 @@ LongLongComparer::~LongLongComparer(void) result LongLongComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const { - const LongLong* pLongLong1 = dynamic_cast (&obj1); - const LongLong* pLongLong2 = dynamic_cast (&obj2); + const LongLong* pLongLong1 = dynamic_cast< const LongLong* >(&obj1); + const LongLong* pLongLong2 = dynamic_cast< const LongLong* >(&obj2); SysTryReturn(NID_BASE, (pLongLong1 != null && pLongLong2 != null), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Both of the obj1 and obj2 MUST be LongLong."); diff --git a/src/base/FBaseObject.cpp b/src/base/FBaseObject.cpp index 33b7b63..a4fbb1f 100644 --- a/src/base/FBaseObject.cpp +++ b/src/base/FBaseObject.cpp @@ -18,10 +18,8 @@ * @file FBaseObject.cpp * @brief This is the implementation file for Object class. */ - #include - namespace Tizen { namespace Base { diff --git a/src/base/FBaseResult.cpp b/src/base/FBaseResult.cpp index 56ffb73..9c8e92f 100644 --- a/src/base/FBaseResult.cpp +++ b/src/base/FBaseResult.cpp @@ -18,7 +18,6 @@ * @file FBaseResult.cpp * @brief This is the implementation file of Result class. */ - #include #include #include @@ -82,7 +81,7 @@ const char* __errTable1100[] = "E_ALREADY_OPENED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1103)) "E_AUTHENTICATION", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1104)) "E_APP_NOT_INSTALLED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1105)) - "E_ALREADY_SET", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1106)) + "E_ALREADY_SET", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1106)) "E_ACCOUNT_ALREADY_EXIST", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1107)) "E_ACCOUNT_NOT_FOUND" //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1108)) }; @@ -94,7 +93,7 @@ const char* __errTable1300[] = "E_CONNECTION_FAILED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1302)) "E_CONNECTION_RESET", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1303)) "E_CREDENTIAL_EXPIRED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1304)) - "E_CERTIFICATE_VERIFICATION_FAILED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1305)) + "E_CERTIFICATE_VERIFICATION_FAILED", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1305)) "E_CONTEXT_UNAVAILABLE" //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1306)) }; @@ -112,7 +111,7 @@ const char* __errTable1400[] = "E_DNS", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1409)) "E_DNS_NOT_FOUND", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1410)) "E_DATA_NOT_ENOUGH", //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1411)) - "E_DISPLAY_RIGHT_VIOLATED" //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1412)) + "E_DISPLAY_RIGHT_VIOLATED" //(ERR_SRC_FRAMEWORK + SET_E_CAUSE(1412)) }; const char* __errTable1500[] = @@ -362,22 +361,24 @@ GetErrorMessage(result value) } #define MAX_CHECK_COUNT 100 -_OSP_EXPORT_ result TransExceptionsExclusiveInternal(result r, result e, int num,...); +_OSP_EXPORT_ result TransExceptionsExclusiveInternal(result r, result e, int num, ...); -_OSP_EXPORT_ result TransExceptionsInclusiveInternal(result r, result e, int num,...); +_OSP_EXPORT_ result TransExceptionsInclusiveInternal(result r, result e, int num, ...); -result +result TransExceptionsExclusiveInternal(result r, result e, int num, ...) { va_list ap; bool ref = false; int count = 0; - if(r == E_SUCCESS) + if (r == E_SUCCESS) + { return r; + } - va_start(ap,num); - for(; count < num; count++ ) + va_start(ap, num); + for (; count < num; count++) { if (r == va_arg(ap, result)) { @@ -386,25 +387,29 @@ TransExceptionsExclusiveInternal(result r, result e, int num, ...) } } va_end(ap); - if(ref) + if (ref) + { return r; - - return e; + } + + return e; } -result +result TransExceptionsInclusiveInternal(result r, result e, int num, ...) { va_list ap; bool ref = false; int count = 0; - - if(r == E_SUCCESS) + + if (r == E_SUCCESS) + { return r; + } - va_start(ap,num); - for(; count < num ; count++ ) + va_start(ap, num); + for (; count < num; count++) { if (r == va_arg(ap, result)) { @@ -413,13 +418,11 @@ TransExceptionsInclusiveInternal(result r, result e, int num, ...) } } va_end(ap); - if(ref) + if (ref) + { return e; - - return r; - -} - - + } + return r; +} diff --git a/src/base/FBaseShort.cpp b/src/base/FBaseShort.cpp index 8740a9a..d4e2fd9 100644 --- a/src/base/FBaseShort.cpp +++ b/src/base/FBaseShort.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for Short class. * @see Number */ - #include #include #include @@ -72,7 +71,7 @@ Short::CompareTo(const Short& value) const bool Short::Equals(const Object& obj) const { - const Short* pOther = dynamic_cast (&obj); + const Short* pOther = dynamic_cast< const Short* >(&obj); if (pOther == null) { return false; @@ -90,13 +89,13 @@ Short::Equals(short value) const int Short::GetHashCode(void) const { - return static_cast (value); + return static_cast< int >(value); } int Short::GetHashCode(short val) { - return static_cast (val); + return static_cast< int >(val); } result @@ -218,7 +217,7 @@ Short::Parse(const String& s, int radix, short& ret) char Short::ToChar(void) const { - return static_cast (value); + return static_cast< char >(value); } short @@ -230,31 +229,31 @@ Short::ToShort(void) const int Short::ToInt(void) const { - return static_cast (value); + return static_cast< int >(value); } long Short::ToLong(void) const { - return static_cast (value); + return static_cast< long >(value); } long long Short::ToLongLong(void) const { - return static_cast (value); + return static_cast< long long >(value); } float Short::ToFloat(void) const { - return static_cast (value); + return static_cast< float >(value); } double Short::ToDouble(void) const { - return static_cast (value); + return static_cast< double >(value); } String diff --git a/src/base/FBaseShortComparer.cpp b/src/base/FBaseShortComparer.cpp index 7c91082..b6cf073 100644 --- a/src/base/FBaseShortComparer.cpp +++ b/src/base/FBaseShortComparer.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for ShortComparer class. * @see Short class and Tizen::Base::Collection::IComparer */ - #include #include #include @@ -40,8 +39,8 @@ ShortComparer::~ShortComparer(void) result ShortComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const { - const Short* pShort1 = dynamic_cast (&obj1); - const Short* pShort2 = dynamic_cast (&obj2); + const Short* pShort1 = dynamic_cast< const Short* >(&obj1); + const Short* pShort2 = dynamic_cast< const Short* >(&obj2); SysTryReturn(NID_BASE, (pShort1 != null && pShort2 != null), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be Short.", GetErrorMessage(E_INVALID_ARG)); diff --git a/src/base/FBaseString.cpp b/src/base/FBaseString.cpp index 56f37c5..ed75249 100644 --- a/src/base/FBaseString.cpp +++ b/src/base/FBaseString.cpp @@ -18,7 +18,6 @@ * @file FBaseString.cpp * @brief This is the implementation for String class. */ - #include #include #include @@ -40,7 +39,6 @@ #include "FBase_String.h" #include "FBaseUtil_IcuConverter.h" - namespace Tizen { namespace Base { @@ -1060,7 +1058,7 @@ String::SetCapacity(int capacity) result String::SetCharAt(wchar_t ch, int indexAt) { - SysTryReturn(NID_BASE,indexAt >= 0 && indexAt < __length, E_OUT_OF_RANGE, E_OUT_OF_RANGE, + SysTryReturn(NID_BASE, indexAt >= 0 && indexAt < __length, E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[%s] The indexAt(%d) MUST be greater than or equal to 0, and less then the length of this string(%d).", GetErrorMessage(E_OUT_OF_RANGE), indexAt, __length); @@ -1147,7 +1145,7 @@ String::StartsWith(const String& str, int startIndex) const SysTryReturn(NID_BASE, startIndex >= 0 && startIndex < __length, false, E_OUT_OF_RANGE, "[%s] The startIndex(%d) MUST be greater than or equal to 0, and less than the length of this string(%d).", GetErrorMessage(E_OUT_OF_RANGE), startIndex, __length); - SysTryReturn(NID_BASE, str.__length > 0, false, E_INVALID_ARG, + SysTryReturn(NID_BASE, str.__length > 0, false, E_INVALID_ARG, "[%s] Invalid argument is used. The length of str(%d) MUST be greater than 0.", GetErrorMessage(E_INVALID_ARG), str.__length); @@ -1382,7 +1380,7 @@ String::Trim(void) bool trimRight = lastIndex < __length; bool trimLeft = startIndex > 0; - if (!trimRight && !trimLeft) // nothing to trim + if (!trimRight && !trimLeft) // nothing to trim { return; } @@ -1477,7 +1475,7 @@ String::ExpandCapacity(int minCapacity) capacity = minCapacity; } - std::unique_ptr pNewValue(new (std::nothrow) wchar_t[capacity + 1]); // + 1 for null character + std::unique_ptr< wchar_t[] > pNewValue(new (std::nothrow) wchar_t[capacity + 1]); // + 1 for null character SysTryReturn(NID_BASE, pNewValue != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); diff --git a/src/base/FBaseStringComparer.cpp b/src/base/FBaseStringComparer.cpp index 8c9b2b9..c2a9228 100644 --- a/src/base/FBaseStringComparer.cpp +++ b/src/base/FBaseStringComparer.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for StringComparer class. * @see String class and Tizen::Base::Collection::IComparer */ - #include #include #include @@ -40,8 +39,8 @@ StringComparer::~StringComparer(void) result StringComparer::Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const { - const String* pString1 = dynamic_cast (&obj1); - const String* pString2 = dynamic_cast (&obj2); + const String* pString1 = dynamic_cast< const String* >(&obj1); + const String* pString2 = dynamic_cast< const String* >(&obj2); SysTryReturn(NID_BASE, (pString1 != null && pString2 != null), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. Both of the obj1 and obj2 MUST be String.", GetErrorMessage(E_INVALID_ARG)); diff --git a/src/base/FBaseStringHashCodeProvider.cpp b/src/base/FBaseStringHashCodeProvider.cpp index 795ed43..58b9868 100644 --- a/src/base/FBaseStringHashCodeProvider.cpp +++ b/src/base/FBaseStringHashCodeProvider.cpp @@ -18,7 +18,6 @@ * @file FBaseStringHashCodeProvider.cpp * @brief This is the implementation file for StringHashCodeProvider class. */ - #include #include diff --git a/src/base/FBaseTimeSpan.cpp b/src/base/FBaseTimeSpan.cpp index 032b958..bd48bc7 100644 --- a/src/base/FBaseTimeSpan.cpp +++ b/src/base/FBaseTimeSpan.cpp @@ -18,7 +18,6 @@ * @file FBaseTimeSpan.cpp * @brief This is the implementation file of TimeSpan class. */ - #include #include @@ -141,7 +140,7 @@ TimeSpan::CompareTo(const TimeSpan& value) const bool TimeSpan::Equals(const Object& obj) const { - const TimeSpan* pOther = dynamic_cast (&obj); + const TimeSpan* pOther = dynamic_cast< const TimeSpan* >(&obj); if (pOther == null) { return false; diff --git a/src/base/FBaseTypes.cpp b/src/base/FBaseTypes.cpp index f6a5bbb..4892cbc 100644 --- a/src/base/FBaseTypes.cpp +++ b/src/base/FBaseTypes.cpp @@ -18,7 +18,4 @@ * @file FBaseTypes.cpp * @brief This file defines the built-in types. */ - -// Includes #include - diff --git a/src/base/FBaseUuId.cpp b/src/base/FBaseUuId.cpp index 1cc12d7..90ca696 100644 --- a/src/base/FBaseUuId.cpp +++ b/src/base/FBaseUuId.cpp @@ -18,7 +18,6 @@ * @file FBaseUuId.cpp * @brief This is the implementation file for UuId class. */ - #include #include #include @@ -27,9 +26,8 @@ #include #include #include -#include "FBase_StringConverter.h" #include - +#include "FBase_StringConverter.h" namespace Tizen { namespace Base { @@ -69,7 +67,7 @@ UuId::~UuId(void) bool operator ==(const UUID& uuid1, const UuId& uuid2) { - byte uuid[16] = {0,}; + byte uuid[16] = {0, }; memcpy(uuid, &uuid1, sizeof(uuid)); UuId::ConvertToUuId(uuid); @@ -135,7 +133,7 @@ UuId::operator =(const UuId& uuid) bool UuId::Equals(const Object& obj) const { - const UuId* pOther = dynamic_cast(&obj); + const UuId* pOther = dynamic_cast< const UuId* >(&obj); if (pOther == null) { @@ -196,8 +194,8 @@ UuId::ToString(void) const return String(pChar); */ - char uuid_str[36] = {0,}; - + char uuid_str[36] = {0, }; + uuid_unparse(this->uuid, uuid_str); return String(uuid_str); @@ -207,8 +205,8 @@ UUID UuId::ToUUID(void) const { UUID uuid; - byte uuidValue[16] = {0,}; - + byte uuidValue[16] = {0, }; + uuid_copy(uuidValue, this->uuid); ConvertToUuId(uuidValue); @@ -316,14 +314,14 @@ UuId::Parse(const String& str, UuId& uuid) SysTryReturnResult(NID_BASE, length == 36, E_INVALID_ARG, "The length of str(%d) MUST be 36.", length); SysTryReturnResult(NID_BASE, !(str[8] != L'-' || str[13] != L'-' || str[18] != L'-' || str[23] != L'-') - ,E_INVALID_ARG, "The str(%ls) is not valid UuId type.", str.GetPointer()); + , E_INVALID_ARG, "The str(%ls) is not valid UuId type.", str.GetPointer()); uuid_t uuidValue; - std::unique_ptr pStr(_StringConverter::CopyToCharArrayN(str)); + std::unique_ptr< char[] > pStr(_StringConverter::CopyToCharArrayN(str)); SysTryReturnResult(NID_BASE, pStr != null, E_OUT_OF_MEMORY, "Memory allocation failed."); int ret = uuid_parse(pStr.get(), uuidValue); - SysTryReturnResult(NID_BASE, ret == 0, E_INVALID_ARG, "The str(%ls) MUST consist of only alphanumeric characters and '-'.", str.GetPointer()); + SysTryReturnResult(NID_BASE, ret == 0, E_INVALID_ARG, "The str(%ls) MUST consist of only alphanumeric characters and '-'.", str.GetPointer()); uuid_copy(uuid.uuid, uuidValue); @@ -360,11 +358,11 @@ UuId::ConvertToUuId(byte uuid[16]) { byte value = 0x00; - for (int i=0; i<2; i++) + for (int i = 0; i < 2; i++) { value = uuid[i]; - uuid[i] = uuid[3-i]; - uuid[3-i] = value; + uuid[i] = uuid[3 - i]; + uuid[3 - i] = value; } value = uuid[4]; diff --git a/src/base/FBase_CharacterImpl.cpp b/src/base/FBase_CharacterImpl.cpp index a86a89f..d11460a 100644 --- a/src/base/FBase_CharacterImpl.cpp +++ b/src/base/FBase_CharacterImpl.cpp @@ -18,13 +18,11 @@ * @file FBase_CharacterImpl.cpp * @brief This is the implementation file for _CharImpl class. */ - #include #include #include #include "FBase_CharacterImpl.h" - namespace Tizen { namespace Base { diff --git a/src/base/FBase_CharacterImpl.h b/src/base/FBase_CharacterImpl.h index f578d54..fe3fe93 100644 --- a/src/base/FBase_CharacterImpl.h +++ b/src/base/FBase_CharacterImpl.h @@ -20,7 +20,6 @@ * * This header file contains the declarations of the _CharacterImpl class. */ - #ifndef _FBASE_INTERNAL_CHARACTER_IMPL_H_ #define _FBASE_INTERNAL_CHARACTER_IMPL_H_ @@ -28,7 +27,6 @@ #include #include - namespace Tizen { namespace Base { @@ -315,6 +313,6 @@ private: }; // _CharacterImpl -} } // Tizen::Base +}} // Tizen::Base #endif // _FBASE_INTERNAL_CHARACTER_IMPL_H_ diff --git a/src/base/FBase_Exception.cpp b/src/base/FBase_Exception.cpp index 8c111ae..32fd62b 100644 --- a/src/base/FBase_Exception.cpp +++ b/src/base/FBase_Exception.cpp @@ -18,7 +18,6 @@ * @file FBaseExceptionInternal.cpp * @brief This is the implementation file for Exception. */ - #include "FBase_Exception.h" const char* ExceptionStrings[] = @@ -317,7 +316,6 @@ const char* ExceptionStrings[] = "UndefinedException" // for exception handling }; - /** * Returns a string representation of the specified exception. It is useful when printing out a caught exception. * diff --git a/src/base/FBase_LocalizedNumParser.cpp b/src/base/FBase_LocalizedNumParser.cpp index 34b43b2..7d5b68d 100644 --- a/src/base/FBase_LocalizedNumParser.cpp +++ b/src/base/FBase_LocalizedNumParser.cpp @@ -18,7 +18,6 @@ * @file FBase_LocalizedNumParser.cpp * @brief This is the implementation file for _LocalizedNumParser class. */ - #include #include #include @@ -47,8 +46,7 @@ public: } } - result - Construct(const char* pLocale) + result Construct(const char* pLocale) { _locale = newlocale(LC_ALL, pLocale, null); SysTryReturnResult(NID_BASE, _locale != null, E_INVALID_ARG, "Creating a new locale object is failed. pLocale is invalid."); @@ -153,4 +151,4 @@ _LocalizedNumParser::ToString(float value, const char* pLocale) return String(sValue); } -}} // Tizen::Base +}} // Tizen::Base diff --git a/src/base/FBase_NativeError.cpp b/src/base/FBase_NativeError.cpp index 30e3b09..03b785c 100644 --- a/src/base/FBase_NativeError.cpp +++ b/src/base/FBase_NativeError.cpp @@ -18,19 +18,16 @@ * @file FBaseNativeError.cpp * @brief This is the implementation file of functions for native error handling. */ - #include #include #include #include #include -#include "FBase_NativeError.h" #include +#include "FBase_NativeError.h" #include "device.h" #include "sqlite3.h" - - using namespace Tizen::Base; static int nativeErrorToResultTable[] = @@ -177,7 +174,7 @@ E_UNKNOWN, // ENOTRECOVERABLE 131 /* State not recoverable */ static int sqlErrorToResultTable[] = { E_SUCCESS, // SQLITE_OK 0 /* Successful result */ - E_DATABASE, // SQLITE_ERROR 1 /* SQL error or missing database */ + E_DATABASE, // SQLITE_ERROR 1 /* SQL error or missing database */ E_DATABASE, // SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ E_DATABASE, // SQLITE_PERM 3 /* Access permission denied */ E_DATABASE, // SQLITE_ABORT 4 /* Callback routine requested an abort */ @@ -303,9 +300,6 @@ _NativeError::ConvertNativeSystemErrorToResult(int err) { case SYSTEM_INFO_ERROR_INVALID_PARAMETER: return E_INVALID_ARG; - //case SYSTEM_INFO_ERROR_INTERNAL: return E_SYSTEM; - //case SYSTEM_INFO_ERROR_OUT_OF_MEMORY: return E_OUT_OF_MEMORY; - //case SYSTEM_INFO_ERROR_IO : return E_IO; } return E_UNKNOWN; @@ -316,7 +310,6 @@ _NativeError::ConvertNativeDeviceErrorToResult(int err) { switch (err) { -// case DEVICE_ERROR_UNKNOWN: return E_SYSTEM; case DEVICE_ERROR_INVALID_PARAMETER: return E_INVALID_ARG; } @@ -329,7 +322,6 @@ _NativeError::ConvertNativePowerErrorToResult(int err) { switch (err) { -// case POWER_ERROR_UNKNOWN: return E_SYSTEM; case POWER_ERROR_INVALID_PARAMETER: return E_INVALID_ARG; } @@ -370,42 +362,18 @@ _NativeError::ConvertNativeAlarmErrorToResult(int err) result _NativeError::ConvertNativeHapticErrorToResult(int err) { - switch (err) - { - //case HAPTIC_ERROR_UNKNOWN: return E_SYSTEM; - //case HAPTIC_ERROR_INVALID_PARAMETER: return E_INVALID_ARG; - //case HAPTIC_ERROR_OPENED_DEVICE: return E_INVALID_STATE; - } - return E_UNKNOWN; } result _NativeError::ConvertNativeTelephonyErrorToResult(int err) { - switch (err) - { - /* deprecated on SLP SDK RC 11 */ -// case TELEPHONY_ERROR_INTERNAL: return E_SYSTEM; -// case TELEPHONY_ERROR_INVALID_PARAMETER: return E_INVALID_ARG; -// case TELEPHONY_ERROR_OUT_OF_SERVICE: return E_SERVICE_DEACTIVATED; -// case TELEPHONY_ERROR_OUT_OF_MEMORY: return E_OUT_OF_MEMORY; - } - return E_UNKNOWN; } result _NativeError::ConvertNativeSoundManagerErrorToResult(int err) { - switch (err) - { -// case SOUND_MANAGER_NO_PLAYING_SOUND: return E_SYSTEM; -// case SOUND_MANAGER_INVALID_PARAMETER: return E_INVALID_ARG; -// case SOUND_MANAGER_INVALID_OPERATION: return E_INVALID_OPERATION; -// case SOUND_MANAGER_OUT_OF_MEMORY: return E_OUT_OF_MEMORY; - } - return E_UNKNOWN; } @@ -446,4 +414,3 @@ _NativeError::ConvertNativeSqliteErrorToDetailResult(int err) return r; } - diff --git a/src/base/FBase_StringConverter.cpp b/src/base/FBase_StringConverter.cpp index fc121c1..31c69c5 100644 --- a/src/base/FBase_StringConverter.cpp +++ b/src/base/FBase_StringConverter.cpp @@ -18,7 +18,6 @@ * @file FBase_StringConverter.cpp * @brief This is the implementation for _StringConverter class. */ - #include #include #include