From bb61ad0c63de1af2ad8f00586cc81a22fd065f7a Mon Sep 17 00:00:00 2001 From: "dahyeong.kim" Date: Wed, 31 Jul 2013 16:14:34 +0900 Subject: [PATCH] [2.2.1] Change FBase_String.h to FBaseUtil_AtomicOperations.h Change-Id: I6a3b11ac3b9d8a989a5752e3e6479071bc1be071 Signed-off-by: dahyeong.kim --- src/base/FBaseString.cpp | 14 ++++----- ...FBase_String.h => FBaseUtil_AtomicOperations.h} | 33 ++++++++++++---------- 2 files changed, 25 insertions(+), 22 deletions(-) rename src/base/inc/{FBase_String.h => FBaseUtil_AtomicOperations.h} (60%) diff --git a/src/base/FBaseString.cpp b/src/base/FBaseString.cpp index 0e40454..bf69291 100644 --- a/src/base/FBaseString.cpp +++ b/src/base/FBaseString.cpp @@ -36,7 +36,7 @@ #include #include #include -#include "FBase_String.h" +#include "FBaseUtil_AtomicOperations.h" #include "FBaseUtil_IcuConverter.h" namespace Tizen { namespace Base @@ -154,7 +154,7 @@ String::String(const String& value) { if (*(value.__pRefCount) != UNSHAREABLE) { - _String::AtomicInc(value.__pRefCount); + Utility::_AtomicOperations::AtomicInc(value.__pRefCount); __pRefCount = value.__pRefCount; __pValue = value.__pValue; __capacity = value.__capacity; @@ -183,7 +183,7 @@ String::~String(void) } else { - _String::AtomicDec(__pRefCount); + Utility::_AtomicOperations::AtomicDec(__pRefCount); __pRefCount = null; } } @@ -387,7 +387,7 @@ String::Append(const wchar_t* p) SysTryReturnResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed"); wcsncpy(__pValue, pValue, __length); - _String::AtomicDec(__pRefCount); + Utility::_AtomicOperations::AtomicDec(__pRefCount); __pRefCount = pRefCntTemp.release(); } @@ -1035,7 +1035,7 @@ String::SetCapacity(int capacity) { std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1)); SysTryReturnResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed"); - _String::AtomicDec(__pRefCount); + Utility::_AtomicOperations::AtomicDec(__pRefCount); __pRefCount = pRefCntTemp.release(); } } @@ -1484,7 +1484,7 @@ String::ExpandCapacity(int minCapacity) std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1)); SysTryReturn(NID_BASE, pRefCntTemp != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY)); - _String::AtomicDec(__pRefCount); + Utility::_AtomicOperations::AtomicDec(__pRefCount); __pRefCount = pRefCntTemp.release(); } } @@ -1519,7 +1519,7 @@ String::AboutToModify(int capacity, bool isUnshareable) wcsncpy(__pValue, pValue, __length); __pValue[__length] = '\0'; - _String::AtomicDec(__pRefCount); + Utility::_AtomicOperations::AtomicDec(__pRefCount); __pRefCount = pRefCntTemp.release(); } diff --git a/src/base/inc/FBase_String.h b/src/base/inc/FBaseUtil_AtomicOperations.h similarity index 60% rename from src/base/inc/FBase_String.h rename to src/base/inc/FBaseUtil_AtomicOperations.h index 3012767..d2dbc77 100644 --- a/src/base/inc/FBase_String.h +++ b/src/base/inc/FBaseUtil_AtomicOperations.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// Copyright (c) 2013 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. @@ -15,21 +15,22 @@ // /** - * @file FBase_String.h + * @file FBaseUtil_AtomicOperations.h * @brief This is the header file for handling atomic operations. */ -#ifndef _FBASE_INTERNAL_STRING_H_ -#define _FBASE_INTERNAL_STRING_H_ +#ifndef _FBASE_UTIL_ATOMIC_OPERATIONS_H_ +#define _FBASE_UTIL_ATOMIC_OPERATIONS_H_ -namespace Tizen { namespace Base +namespace Tizen { namespace Base { namespace Utility { -namespace _String +namespace _AtomicOperations { /** - * Atomically add the value to the variable that pRefCount points to. + * Atomically add the @c value to the variable that @c pRefCount points to. * - * @since 2.1 + * @since 2.1 + * @remarks This method supposes 4 byte alignment in ARM architecture. */ inline int AtomicAdd(volatile int* pRefCount, int value) @@ -53,9 +54,10 @@ AtomicAdd(volatile int* pRefCount, int value) } /** - * Atomically increase the variable that pRefCount points to by 1 + * Atomically increase the variable that @c pRefCount points to by 1 * - * @since 2.1 + * @since 2.1 + * @remarks This method supposes 4 byte alignment in ARM architecture. */ inline int AtomicInc(volatile int* pRefCount) @@ -64,15 +66,16 @@ AtomicInc(volatile int* pRefCount) } /** - * Atomically decrease the variable that pRefCount points to by 1 + * Atomically decrease the variable that @c pRefCount points to by 1 * - * @since 2.1 + * @since 2.1 + * @remarks This method supposes 4 byte alignment in ARM architecture. */ inline int AtomicDec(volatile int* pRefCount) { return AtomicAdd(pRefCount, -1); } -} // _String -}} // Tizen::Base -#endif // _FBASE_INTERNAL_STRING_H_ \ No newline at end of file + +}}}} // Tizen::Base::Utility::_AtomicOperations +#endif // _FBASE_UTIL_ATOMIC_OPERATIONS_H_ -- 2.7.4