From c14482254da4a2040963c6abc831f8a5a2fd6c7c Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 14 May 2014 10:25:45 +0800 Subject: [PATCH] Fixes wrong indention and whitespace cleanup --- cocos/base/CCRef.cpp | 20 ++++++++++---------- cocos/base/CCRef.h | 28 ++++++++++++++-------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cocos/base/CCRef.cpp b/cocos/base/CCRef.cpp index 53dc9189c5..98f12ce363 100644 --- a/cocos/base/CCRef.cpp +++ b/cocos/base/CCRef.cpp @@ -30,7 +30,7 @@ THE SOFTWARE. NS_CC_BEGIN -#ifdef CC_USE_MEM_LEAK_DETECTION +#if CC_USE_MEM_LEAK_DETECTION void trackRef(Ref* ref); void untrackRef(Ref* ref); #endif @@ -63,9 +63,9 @@ Ref::~Ref() } } #endif - -#ifdef CC_USE_MEM_LEAK_DETECTION + +#if CC_USE_MEM_LEAK_DETECTION if (_referenceCount != 0) untrackRef(this); #endif @@ -81,7 +81,7 @@ void Ref::release() { CCASSERT(_referenceCount > 0, "reference count should greater than 0"); --_referenceCount; - + if (_referenceCount == 0) { #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) @@ -118,8 +118,8 @@ void Ref::release() CCASSERT(false, "The reference shouldn't be 0 because it is still in autorelease pool."); } #endif - -#ifdef CC_USE_MEM_LEAK_DETECTION + +#if CC_USE_MEM_LEAK_DETECTION untrackRef(this); #endif delete this; @@ -137,7 +137,7 @@ unsigned int Ref::getReferenceCount() const return _referenceCount; } -#ifdef CC_USE_MEM_LEAK_DETECTION +#if CC_USE_MEM_LEAK_DETECTION static std::list __refAllocationList; @@ -151,7 +151,7 @@ void Ref::printLeaks() else { log("[memory] WARNING: %d Ref objects still active in memory.\n", (int)__refAllocationList.size()); - + for (const auto& ref : __refAllocationList) { CC_ASSERT(ref); @@ -164,7 +164,7 @@ void Ref::printLeaks() void trackRef(Ref* ref) { CC_ASSERT(ref); - + // Create memory allocation record. __refAllocationList.push_back(ref); } @@ -177,7 +177,7 @@ void untrackRef(Ref* ref) log("[memory] CORRUPTION: Attempting to free (%s) with invalid ref tracking record.\n", typeid(*ref).name()); return; } - + __refAllocationList.erase(iter); } diff --git a/cocos/base/CCRef.h b/cocos/base/CCRef.h index 45979601a9..e418d3d659 100644 --- a/cocos/base/CCRef.h +++ b/cocos/base/CCRef.h @@ -44,16 +44,16 @@ class Ref; class CC_DLL Clonable { public: - /** returns a copy of the Ref */ + /** returns a copy of the Ref */ virtual Clonable* clone() const = 0; /** * @js NA * @lua NA */ - virtual ~Clonable() {}; + virtual ~Clonable() {}; /** returns a copy of the Ref. - @deprecated Use clone() instead + * @deprecated Use clone() instead */ CC_DEPRECATED_ATTRIBUTE Ref* copy() const { @@ -75,9 +75,9 @@ public: * @js NA */ void retain(); - + /** - * Release the ownership immediately. + * Releases the ownership immediately. * * This decrements the Ref's reference count. * @@ -90,7 +90,7 @@ public: void release(); /** - * Release the ownership sometime soon automatically. + * Releases the ownership sometime soon automatically. * * This descrements the Ref's reference count at the end of current * autorelease pool block. @@ -113,7 +113,7 @@ public: * @js NA */ unsigned int getReferenceCount() const; - + protected: /** * Constructor @@ -122,20 +122,20 @@ protected: * @js NA */ Ref(); - + public: /** * @js NA * @lua NA */ virtual ~Ref(); - + protected: /// count of references unsigned int _referenceCount; - + friend class AutoreleasePool; - + #if CC_ENABLE_SCRIPT_BINDING public: /// object id, ScriptSupport need public _ID @@ -143,9 +143,9 @@ public: /// Lua reference id int _luaID; #endif - - // Memory leak diagnostic data (only included when CC_USE_MEM_LEAK_DETECTION is defined) -#ifdef CC_USE_MEM_LEAK_DETECTION + + // Memory leak diagnostic data (only included when CC_USE_MEM_LEAK_DETECTION is defined and its value isn't zero) +#if CC_USE_MEM_LEAK_DETECTION public: static void printLeaks(); #endif