* @file FBaseBufferBase.cpp
* @brief This is the implementation for BufferBase class.
*/
-
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <FBaseBufferBase.h>
#include <FBaseSysLog.h>
-
namespace Tizen { namespace Base
{
void* pTemp = null;
// check whether the size of memory is larger than the maximum of unsigned int
- 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,
+ 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 <unsigned int>(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 <unsigned int>(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();
"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 <unsigned long long>(sizeof(_BufferData)) +
- static_cast <unsigned long long>(newCapacity) * static_cast <unsigned long long>(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 long long>((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<unsigned int>(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;
}
BufferBase::_BufferData::_BufferData()
- :capacityInByte(0)
- ,refCount(0)
+ : capacityInByte(0)
+ , refCount(0)
{
}
byte*
BufferBase::_BufferData::GetArray(void)
{
- return reinterpret_cast <byte*>(this + 1);
+ return reinterpret_cast< byte* >(this + 1);
}
}} // Tizen::Base