From 7efee066fde68870de54df48d248f0591bdd42a7 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 19 Jun 2020 11:07:21 +0800 Subject: [PATCH] Remove duplicate (#2597) --- native/CMakeLists.txt | 3 - native/cocos/audio/AudioEngine.cpp | 11 +- .../cocos/audio/android/AudioEngine-inl.cpp | 10 +- .../cocos/audio/win32/AudioEngine-win32.cpp | 2 +- native/cocos/audio/win32/AudioMacros.h | 2 +- native/cocos/base/CCAutoreleasePool.cpp | 12 +- native/cocos/base/CCData.cpp | 13 +- native/cocos/base/CCLog.cpp | 119 ----- native/cocos/base/CCLog.h | 65 --- native/cocos/base/CCMap.h | 24 +- native/cocos/base/CCScheduler.cpp | 2 +- native/cocos/base/CCVector.h | 13 +- native/cocos/base/CoreDef.h | 405 ---------------- native/cocos/base/Log.cc | 44 +- native/cocos/base/Log.h | 28 +- native/cocos/base/StringUtil.h | 2 +- native/cocos/base/UTFString.h | 14 +- native/cocos/base/ZipUtils.cpp | 44 +- native/cocos/base/ccCArray.cpp | 4 +- native/cocos/base/ccMacros.h | 448 ++++++++++++++++-- native/cocos/base/ccUTF8.cpp | 3 +- native/cocos/base/memory/AllocatedObj.h | 4 +- native/cocos/base/memory/Memory.cc | 4 +- native/cocos/base/memory/NedPooling.h | 2 +- native/cocos/base/memory/StdAlloc.h | 4 +- native/cocos/base/memory/StlAlloc.h | 2 +- native/cocos/math/Mat4.cpp | 4 +- native/cocos/network/HttpClient-android.cpp | 43 +- native/cocos/network/HttpClient-apple.mm | 10 +- native/cocos/network/HttpClient.cpp | 13 +- native/cocos/network/SocketIO.cpp | 112 ++--- native/cocos/network/SocketIO.h | 6 +- native/cocos/network/Uri.cpp | 8 +- .../cocos/network/WebSocket-libwebsockets.cpp | 4 +- native/cocos/platform/CCFileUtils.cpp | 12 +- native/cocos/platform/CCImage.cpp | 20 +- .../platform/android/CCFileUtils-android.cpp | 9 +- .../cocos/platform/apple/CCFileUtils-apple.mm | 11 +- .../platform/win32/CCFileUtils-win32.cpp | 13 +- native/cocos/platform/win32/CCUtils-win32.cpp | 8 +- native/cocos/platform/win32/View-win32.cpp | 7 +- native/cocos/renderer/core/CoreStd.h | 2 +- .../renderer/core/gfx/GFXBindingLayout.h | 2 +- native/cocos/renderer/core/gfx/GFXBuffer.h | 2 +- .../renderer/core/gfx/GFXCommandAllocator.h | 2 +- .../renderer/core/gfx/GFXCommandBuffer.h | 2 +- native/cocos/renderer/core/gfx/GFXContext.h | 2 +- native/cocos/renderer/core/gfx/GFXDef.h | 8 +- native/cocos/renderer/core/gfx/GFXDevice.h | 2 +- native/cocos/renderer/core/gfx/GFXFence.h | 2 +- .../cocos/renderer/core/gfx/GFXFramebuffer.h | 2 +- .../renderer/core/gfx/GFXInputAssembler.h | 2 +- .../renderer/core/gfx/GFXPipelineLayout.h | 2 +- .../renderer/core/gfx/GFXPipelineState.h | 2 +- native/cocos/renderer/core/gfx/GFXQueue.h | 2 +- .../cocos/renderer/core/gfx/GFXRenderPass.h | 2 +- native/cocos/renderer/core/gfx/GFXSampler.h | 2 +- native/cocos/renderer/core/gfx/GFXShader.h | 2 +- native/cocos/renderer/core/gfx/GFXTexture.h | 2 +- native/cocos/renderer/core/math/CCCoreMath.h | 44 +- .../auto/jsb_cocos2dx_audioengine_auto.cpp | 2 +- .../js-bindings/auto/jsb_cocos2dx_auto.cpp | 6 +- .../auto/jsb_cocos2dx_extension_auto.cpp | 6 +- .../auto/jsb_cocos2dx_network_auto.cpp | 2 +- .../js-bindings/auto/jsb_gfx_auto.cpp | 116 ++--- .../js-bindings/auto/jsb_gles2_auto.cpp | 2 +- .../js-bindings/auto/jsb_gles3_auto.cpp | 2 +- .../js-bindings/auto/jsb_mtl_auto.cpp | 2 +- .../js-bindings/auto/jsb_video_auto.cpp | 2 +- .../js-bindings/auto/jsb_vk_auto.cpp | 2 +- .../js-bindings/docs/JSB2.0-learning-en.md | 4 +- .../js-bindings/docs/JSB2.0-learning-zh.md | 4 +- .../manual/JavaScriptJavaBridge.cpp | 4 +- .../manual/JavaScriptObjCBridge.mm | 4 +- .../manual/jsb_cocos2dx_extension_manual.cpp | 2 +- .../manual/jsb_cocos2dx_manual.cpp | 2 +- .../js-bindings/manual/jsb_conversions.hpp | 22 +- .../js-bindings/manual/jsb_gfx_manual.cpp | 2 +- .../js-bindings/manual/jsb_global.cpp | 8 +- .../js-bindings/manual/jsb_socketio.cpp | 18 +- .../js-bindings/manual/jsb_websocket.cpp | 10 +- .../js-bindings/manual/jsb_xmlhttprequest.cpp | 2 +- native/cocos/ui/edit-box/EditBox-win32.cpp | 2 +- .../assets-manager/AssetsManagerEx.cpp | 48 +- native/extensions/assets-manager/Manifest.cpp | 7 +- native/tools/bindings-generator | 2 +- 86 files changed, 852 insertions(+), 1081 deletions(-) delete mode 100644 native/cocos/base/CCLog.cpp delete mode 100644 native/cocos/base/CCLog.h delete mode 100755 native/cocos/base/CoreDef.h diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt index b9a1b37697..9fcdc5cbe6 100644 --- a/native/CMakeLists.txt +++ b/native/CMakeLists.txt @@ -227,8 +227,6 @@ cocos_source_files( cocos/base/ccConfig.h cocos/base/CCData.cpp cocos/base/CCData.h - cocos/base/CCLog.cpp - cocos/base/CCLog.h cocos/base/ccMacros.h cocos/base/CCMap.h cocos/base/ccRandom.cpp @@ -247,7 +245,6 @@ cocos_source_files( cocos/base/CCValue.cpp cocos/base/CCValue.h cocos/base/CCVector.h - cocos/base/CoreDef.h cocos/base/csscolorparser.cpp cocos/base/csscolorparser.hpp cocos/base/etc1.cpp diff --git a/native/cocos/audio/AudioEngine.cpp b/native/cocos/audio/AudioEngine.cpp index 0ce6ba4148..09cfd2ddb5 100644 --- a/native/cocos/audio/AudioEngine.cpp +++ b/native/cocos/audio/AudioEngine.cpp @@ -26,6 +26,7 @@ #include "audio/include/AudioEngine.h" #include "platform/CCFileUtils.h" #include "base/ccUtils.h" +#include "base/Log.h" #include #include @@ -232,20 +233,20 @@ int AudioEngine::play2d(const std::string& filePath, bool loop, float volume, co } if (_audioIDInfoMap.size() >= _maxInstances) { - log("Fail to play %s cause by limited max instance of AudioEngine",filePath.c_str()); + CC_LOG_INFO("Fail to play %s cause by limited max instance of AudioEngine",filePath.c_str()); break; } if (profileHelper) { if(profileHelper->profile.maxInstances != 0 && profileHelper->audioIDs.size() >= profileHelper->profile.maxInstances){ - log("Fail to play %s cause by limited max instance of AudioProfile",filePath.c_str()); + CC_LOG_INFO("Fail to play %s cause by limited max instance of AudioProfile",filePath.c_str()); break; } if (profileHelper->profile.minDelay > TIME_DELAY_PRECISION) { auto currTime = std::chrono::high_resolution_clock::now(); auto delay =(float)std::chrono::duration_cast(currTime - profileHelper->lastPlayTime).count() / 1000000.0; if (profileHelper->lastPlayTime.time_since_epoch().count() != 0 && delay <= profileHelper->profile.minDelay) { - log("Fail to play %s cause by limited minimum delay",filePath.c_str()); + CC_LOG_INFO("Fail to play %s cause by limited minimum delay",filePath.c_str()); break; } } @@ -524,7 +525,7 @@ bool AudioEngine::isLoop(int audioID) return tmpIterator->second.loop; } - log("AudioEngine::isLoop-->The audio instance %d is non-existent", audioID); + CC_LOG_INFO("AudioEngine::isLoop-->The audio instance %d is non-existent", audioID); return false; } @@ -536,7 +537,7 @@ float AudioEngine::getVolume(int audioID) return tmpIterator->second.volume; } - log("AudioEngine::getVolume-->The audio instance %d is non-existent", audioID); + CC_LOG_INFO("AudioEngine::getVolume-->The audio instance %d is non-existent", audioID); return 0.0f; } diff --git a/native/cocos/audio/android/AudioEngine-inl.cpp b/native/cocos/audio/android/AudioEngine-inl.cpp index e0e4313619..2ae2e29683 100644 --- a/native/cocos/audio/android/AudioEngine-inl.cpp +++ b/native/cocos/audio/android/AudioEngine-inl.cpp @@ -163,25 +163,25 @@ bool AudioEngineImpl::init() // create engine auto result = slCreateEngine(&_engineObject, 0, nullptr, 0, nullptr, nullptr); - if(SL_RESULT_SUCCESS != result){ ERRORLOG("create opensl engine fail"); break; } + if(SL_RESULT_SUCCESS != result){ CC_LOG_ERROR("create opensl engine fail"); break; } // realize the engine result = (*_engineObject)->Realize(_engineObject, SL_BOOLEAN_FALSE); - if(SL_RESULT_SUCCESS != result){ ERRORLOG("realize the engine fail"); break; } + if(SL_RESULT_SUCCESS != result){ CC_LOG_ERROR("realize the engine fail"); break; } // get the engine interface, which is needed in order to create other objects result = (*_engineObject)->GetInterface(_engineObject, SL_IID_ENGINE, &_engineEngine); - if(SL_RESULT_SUCCESS != result){ ERRORLOG("get the engine interface fail"); break; } + if(SL_RESULT_SUCCESS != result){ CC_LOG_ERROR("get the engine interface fail"); break; } // create output mix const SLInterfaceID outputMixIIDs[] = {}; const SLboolean outputMixReqs[] = {}; result = (*_engineEngine)->CreateOutputMix(_engineEngine, &_outputMixObject, 0, outputMixIIDs, outputMixReqs); - if(SL_RESULT_SUCCESS != result){ ERRORLOG("create output mix fail"); break; } + if(SL_RESULT_SUCCESS != result){ CC_LOG_ERROR("create output mix fail"); break; } // realize the output mix result = (*_outputMixObject)->Realize(_outputMixObject, SL_BOOLEAN_FALSE); - if(SL_RESULT_SUCCESS != result){ ERRORLOG("realize the output mix fail"); break; } + if(SL_RESULT_SUCCESS != result){ CC_LOG_ERROR("realize the output mix fail"); break; } _audioPlayerProvider = new AudioPlayerProvider(_engineEngine, _outputMixObject, outputSampleRate, bufferSizeInFrames, fdGetter, &__callerThreadUtils); diff --git a/native/cocos/audio/win32/AudioEngine-win32.cpp b/native/cocos/audio/win32/AudioEngine-win32.cpp index 341afeb1ef..65d0254416 100644 --- a/native/cocos/audio/win32/AudioEngine-win32.cpp +++ b/native/cocos/audio/win32/AudioEngine-win32.cpp @@ -45,7 +45,7 @@ #include -// log, CCLOG aren't threadsafe, since we uses sub threads for parsing pcm data, threadsafe log output +// log, CC_LOG_DEBUG aren't threadsafe, since we uses sub threads for parsing pcm data, threadsafe log output // is needed. Define the following macros (ALOGV, ALOGD, ALOGI, ALOGW, ALOGE) for threadsafe log output. //IDEA: Move _winLog, winLog to a separated file diff --git a/native/cocos/audio/win32/AudioMacros.h b/native/cocos/audio/win32/AudioMacros.h index 3ce6d70b1e..1ed9c7d208 100644 --- a/native/cocos/audio/win32/AudioMacros.h +++ b/native/cocos/audio/win32/AudioMacros.h @@ -28,7 +28,7 @@ #define QUEUEBUFFER_NUM (3) #define QUEUEBUFFER_TIME_STEP (0.1f) -// log, CCLOG aren't threadsafe, since we uses sub threads for parsing pcm data, threadsafe log output +// log, CC_LOG_DEBUG aren't threadsafe, since we uses sub threads for parsing pcm data, threadsafe log output // is needed. Define the following macros (ALOGV, ALOGD, ALOGI, ALOGW, ALOGE) for threadsafe log output. //IDEA:Move the definition of the following macros to a separated file. diff --git a/native/cocos/base/CCAutoreleasePool.cpp b/native/cocos/base/CCAutoreleasePool.cpp index 58d593b638..bdc51fd29f 100644 --- a/native/cocos/base/CCAutoreleasePool.cpp +++ b/native/cocos/base/CCAutoreleasePool.cpp @@ -24,7 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "base/CCAutoreleasePool.h" -#include "base/ccMacros.h" +#include "base/Log.h" namespace cc { @@ -50,7 +50,7 @@ AutoreleasePool::AutoreleasePool(const std::string &name) AutoreleasePool::~AutoreleasePool() { - CCLOGINFO("deallocing AutoreleasePool: %p", this); + CC_LOG_INFO("deallocing AutoreleasePool: %p", this); clear(); PoolManager::getInstance()->pop(); @@ -89,12 +89,12 @@ bool AutoreleasePool::contains(Ref* object) const void AutoreleasePool::dump() { - CCLOG("autorelease pool: %s, number of managed object %d\n", _name.c_str(), static_cast(_managedObjectArray.size())); - CCLOG("%20s%20s%20s", "Object pointer", "Object id", "reference count"); + CC_LOG_DEBUG("autorelease pool: %s, number of managed object %d\n", _name.c_str(), static_cast(_managedObjectArray.size())); + CC_LOG_DEBUG("%20s%20s%20s", "Object pointer", "Object id", "reference count"); for (const auto &obj : _managedObjectArray) { CC_UNUSED_PARAM(obj); - CCLOG("%20p%20u\n", obj, obj->getReferenceCount()); + CC_LOG_DEBUG("%20p%20u\n", obj, obj->getReferenceCount()); } } @@ -131,7 +131,7 @@ PoolManager::PoolManager() PoolManager::~PoolManager() { - CCLOGINFO("deallocing PoolManager: %p", this); + CC_LOG_INFO("deallocing PoolManager: %p", this); while (!_releasePoolStack.empty()) { diff --git a/native/cocos/base/CCData.cpp b/native/cocos/base/CCData.cpp index 1e2f92790c..2ebeda91f6 100644 --- a/native/cocos/base/CCData.cpp +++ b/native/cocos/base/CCData.cpp @@ -25,6 +25,7 @@ ****************************************************************************/ #include "base/CCData.h" +#include "base/Log.h" namespace cc { @@ -34,14 +35,14 @@ Data::Data() : _bytes(nullptr), _size(0) { - CCLOGINFO("In the empty constructor of Data."); + CC_LOG_INFO("In the empty constructor of Data."); } Data::Data(Data&& other) : _bytes(nullptr), _size(0) { - CCLOGINFO("In the move constructor of Data."); + CC_LOG_INFO("In the move constructor of Data."); move(other); } @@ -49,26 +50,26 @@ Data::Data(const Data& other) : _bytes(nullptr), _size(0) { - CCLOGINFO("In the copy constructor of Data."); + CC_LOG_INFO("In the copy constructor of Data."); copy(other._bytes, other._size); } Data::~Data() { - CCLOGINFO("deallocing Data: %p", this); + CC_LOG_INFO("deallocing Data: %p", this); clear(); } Data& Data::operator= (const Data& other) { - CCLOGINFO("In the copy assignment of Data."); + CC_LOG_INFO("In the copy assignment of Data."); copy(other._bytes, other._size); return *this; } Data& Data::operator= (Data&& other) { - CCLOGINFO("In the move assignment of Data."); + CC_LOG_INFO("In the move assignment of Data."); move(other); return *this; } diff --git a/native/cocos/base/CCLog.cpp b/native/cocos/base/CCLog.cpp deleted file mode 100644 index 81578b62a3..0000000000 --- a/native/cocos/base/CCLog.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** - Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ -#include "base/CCLog.h" -#include -#include -#include -#include - -#if (CC_PLATFORM == CC_PLATFORM_WINDOWS) -#include -#include -#include - -#endif // (CC_PLATFORM == CC_PLATFORM_WINDOWS) - -/** private functions */ -namespace -{ - const int MAX_LOG_LENGTH = 16*1024; - - // - // Free functions to log - // - - void _log(const char *format, va_list args) - { - int bufferSize = MAX_LOG_LENGTH; - char* buf = nullptr; - - do - { - buf = new (std::nothrow) char[bufferSize]; - if (buf == nullptr) - return; // not enough memory - - int ret = vsnprintf(buf, bufferSize - 3, format, args); - if (ret < 0) - { - bufferSize *= 2; - - delete [] buf; - } - else - break; - - } while (true); - - strcat(buf, "\n"); - -#if CC_PLATFORM == CC_PLATFORM_ANDROID - #include - __android_log_print(ANDROID_LOG_DEBUG, "debug info", "%s", buf); -#elif CC_PLATFORM == CC_PLATFORM_WINDOWS - int pos = 0; - int len = strlen(buf); - char tempBuf[MAX_LOG_LENGTH + 1] = { 0 }; - WCHAR wszBuf[MAX_LOG_LENGTH + 1] = { 0 }; - - do - { - std::copy(buf + pos, buf + pos + MAX_LOG_LENGTH, tempBuf); - - tempBuf[MAX_LOG_LENGTH] = 0; - - MultiByteToWideChar(CP_UTF8, 0, tempBuf, -1, wszBuf, sizeof(wszBuf)); - OutputDebugStringW(wszBuf); - WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, tempBuf, sizeof(tempBuf), nullptr, FALSE); - printf("%s", tempBuf); - - pos += MAX_LOG_LENGTH; - - } while (pos < len); - fflush(stdout); -#else - // Linux, Mac, iOS, etc - fprintf(stdout, "%s", buf); - fflush(stdout); -#endif - - //cc::log(buf); - delete [] buf; - } -} - -namespace cc -{ - - void log(const char * format, ...) - { - va_list args; - va_start(args, format); - _log(format, args); - va_end(args); - } - -} - diff --git a/native/cocos/base/CCLog.h b/native/cocos/base/CCLog.h deleted file mode 100644 index 0dee8e8007..0000000000 --- a/native/cocos/base/CCLog.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** - Copyright (c) 2013-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#pragma once - -#include "base/ccMacros.h" - -/// @cond DO_NOT_SHOW - -// Because ccMacros.h includes this header file, and CC_FORMAT_PRINTF is defined in ccMacros.h, so -// we define it here too. - -/** @def CC_FORMAT_PRINTF(formatPos, argPos) - * Only certain compiler support __attribute__((format)) - * - * @param formatPos 1-based position of format string argument. - * @param argPos 1-based position of first format-dependent argument. - */ -#if defined(__GNUC__) && (__GNUC__ >= 4) -#define CC_FORMAT_PRINTF(formatPos, argPos) __attribute__((__format__(printf, formatPos, argPos))) -#elif defined(__has_attribute) -#if __has_attribute(format) -#define CC_FORMAT_PRINTF(formatPos, argPos) __attribute__((__format__(printf, formatPos, argPos))) -#else -#define CC_FORMAT_PRINTF(formatPos, argPos) -#endif // __has_attribute(format) -#else -#define CC_FORMAT_PRINTF(formatPos, argPos) -#endif - -namespace cc -{ - - //TODO: add CC_DLL back - /** - @brief Output Debug message. - */ - void log(const char * format, ...) CC_FORMAT_PRINTF(1, 2); - -} - -/// @endcond - diff --git a/native/cocos/base/CCMap.h b/native/cocos/base/CCMap.h index 9b59d6d55f..27736db4e8 100644 --- a/native/cocos/base/CCMap.h +++ b/native/cocos/base/CCMap.h @@ -34,7 +34,7 @@ #include #endif -#include "base/ccMacros.h" +#include "base/Log.h" #include "base/ccRandom.h" #include "base/CCRef.h" @@ -90,7 +90,7 @@ public: : _data() { static_assert(std::is_convertible::value, "Invalid Type for cc::Map!"); - CCLOGINFO("In the default constructor of Map!"); + CC_LOG_INFO("In the default constructor of Map!"); } /** Constructor with capacity. */ @@ -98,7 +98,7 @@ public: : _data() { static_assert(std::is_convertible::value, "Invalid Type for cc::Map!"); - CCLOGINFO("In the constructor with capacity of Map!"); + CC_LOG_INFO("In the constructor with capacity of Map!"); _data.reserve(capacity); } @@ -106,7 +106,7 @@ public: Map(const Map& other) { static_assert(std::is_convertible::value, "Invalid Type for cc::Map!"); - CCLOGINFO("In the copy constructor of Map!"); + CC_LOG_INFO("In the copy constructor of Map!"); _data = other._data; addRefForAllObjects(); } @@ -115,7 +115,7 @@ public: Map(Map&& other) { static_assert(std::is_convertible::value, "Invalid Type for cc::Map!"); - CCLOGINFO("In the move constructor of Map!"); + CC_LOG_INFO("In the move constructor of Map!"); _data = std::move(other._data); } @@ -125,7 +125,7 @@ public: */ ~Map() { - CCLOGINFO("In the destructor of Map!"); + CC_LOG_INFO("In the destructor of Map!"); clear(); } @@ -357,25 +357,25 @@ public: // Don't uses operator since we could not decide whether it needs 'retain'/'release'. // V& operator[] ( const K& key ) // { - // CCLOG("copy: [] ref"); + // CC_LOG_DEBUG("copy: [] ref"); // return _data[key]; // } // // V& operator[] ( K&& key ) // { - // CCLOG("move [] ref"); + // CC_LOG_DEBUG("move [] ref"); // return _data[key]; // } // const V& operator[] ( const K& key ) const // { - // CCLOG("const copy []"); + // CC_LOG_DEBUG("const copy []"); // return _data.at(key); // } // // const V& operator[] ( K&& key ) const // { - // CCLOG("const move []"); + // CC_LOG_DEBUG("const move []"); // return _data.at(key); // } @@ -383,7 +383,7 @@ public: Map& operator= ( const Map& other ) { if (this != &other) { - CCLOGINFO("In the copy assignment operator of Map!"); + CC_LOG_INFO("In the copy assignment operator of Map!"); clear(); _data = other._data; addRefForAllObjects(); @@ -395,7 +395,7 @@ public: Map& operator= ( Map&& other ) { if (this != &other) { - CCLOGINFO("In the move assignment operator of Map!"); + CC_LOG_INFO("In the move assignment operator of Map!"); clear(); _data = std::move(other._data); } diff --git a/native/cocos/base/CCScheduler.cpp b/native/cocos/base/CCScheduler.cpp index e4eb43a1a9..1ecdf5ddf3 100644 --- a/native/cocos/base/CCScheduler.cpp +++ b/native/cocos/base/CCScheduler.cpp @@ -230,7 +230,7 @@ void Scheduler::schedule(const ccSchedulerFunc& callback, void *target, float in if (timer && key == timer->getKey()) { - CCLOG("CCScheduler#scheduleSelector. Selector already scheduled. Updating interval from: %.4f to %.4f", timer->getInterval(), interval); + CC_LOG_DEBUG("CCScheduler#scheduleSelector. Selector already scheduled. Updating interval from: %.4f to %.4f", timer->getInterval(), interval); timer->setInterval(interval); return; } diff --git a/native/cocos/base/CCVector.h b/native/cocos/base/CCVector.h index 0eedabf9bc..2bf528ddfc 100644 --- a/native/cocos/base/CCVector.h +++ b/native/cocos/base/CCVector.h @@ -33,6 +33,7 @@ THE SOFTWARE. #include "base/ccMacros.h" #include "base/ccRandom.h" #include "base/CCRef.h" +#include "base/Log.h" /** * @addtogroup base @@ -123,7 +124,7 @@ public: : _data() { static_assert(std::is_convertible::value, "Invalid Type for cc::Vector!"); - CCLOGINFO("In the default constructor with capacity of Vector."); + CC_LOG_INFO("In the default constructor with capacity of Vector."); reserve(capacity); } @@ -139,7 +140,7 @@ public: /** Destructor. */ ~Vector() { - CCLOGINFO("In the destructor of Vector."); + CC_LOG_INFO("In the destructor of Vector."); clear(); } @@ -147,7 +148,7 @@ public: Vector(const Vector& other) { static_assert(std::is_convertible::value, "Invalid Type for cc::Vector!"); - CCLOGINFO("In the copy constructor!"); + CC_LOG_INFO("In the copy constructor!"); _data = other._data; addRefForAllObjects(); } @@ -156,7 +157,7 @@ public: Vector(Vector&& other) { static_assert(std::is_convertible::value, "Invalid Type for cc::Vector!"); - CCLOGINFO("In the move constructor of Vector!"); + CC_LOG_INFO("In the move constructor of Vector!"); _data = std::move(other._data); } @@ -164,7 +165,7 @@ public: Vector& operator=(const Vector& other) { if (this != &other) { - CCLOGINFO("In the copy assignment operator!"); + CC_LOG_INFO("In the copy assignment operator!"); clear(); _data = other._data; addRefForAllObjects(); @@ -176,7 +177,7 @@ public: Vector& operator=(Vector&& other) { if (this != &other) { - CCLOGINFO("In the move assignment operator!"); + CC_LOG_INFO("In the move assignment operator!"); clear(); _data = std::move(other._data); } diff --git a/native/cocos/base/CoreDef.h b/native/cocos/base/CoreDef.h deleted file mode 100755 index 75ca17b1f4..0000000000 --- a/native/cocos/base/CoreDef.h +++ /dev/null @@ -1,405 +0,0 @@ -#include "base/ccMacros.h" - -#ifndef CC_CORE_CORE_DEF_H_ - #define CC_CORE_CORE_DEF_H_ - - // Initial compiler-related stuff to set. - #define CC_COMPILER_MSVC 1 - #define CC_COMPILER_CLANG 2 - #define CC_COMPILER_GNUC 3 - - // CPU Architecture - #define CC_CPU_UNKNOWN 0 - #define CC_CPU_X86 1 - #define CC_CPU_PPC 2 - #define CC_CPU_ARM 3 - #define CC_CPU_MIPS 4 - - // 32-bits or 64-bits CPU - #define CC_CPU_ARCH_32 1 - #define CC_CPU_ARCH_64 2 - - // Endian - #define CC_ENDIAN_LITTLE 1 - #define CC_ENDIAN_BIG 2 - - // Charset - #define CC_CHARSET_UNICODE 1 - #define CC_CHARSET_MULTIBYTE 2 - - // Precision - #define CC_PRECISION_FLOAT 1 - #define CC_PRECISION_DOUBLE 2 - - // Mode - #define CC_MODE_DEBUG 1 - #define CC_MODE_RELEASE 2 - - // Memory Allocator - #define CC_MEMORY_ALLOCATOR_STD 0 - #define CC_MEMORY_ALLOCATOR_NEDPOOLING 1 - #define CC_MEMORY_ALLOCATOR_JEMALLOC 2 - - // STL Memory Allocator - #define CC_STL_MEMORY_ALLOCATOR_STANDARD 1 - #define CC_STL_MEMORY_ALLOCATOR_CUSTOM 2 - - // Compiler type and version recognition - #if defined(_MSC_VER) - #define CC_COMPILER CC_COMPILER_MSVC - #if _MSC_VER >= 1900 - #define CC_COMPILER_VERSION 130 - #elif _MSC_VER >= 1800 - #define CC_COMPILER_VERSION 120 - #elif _MSC_VER >= 1700 - #define CC_COMPILER_VERSION 110 - #elif _MSC_VER >= 1600 - #define CC_COMPILER_VERSION 100 - #elif _MSC_VER >= 1500 - #define CC_COMPILER_VERSION 90 - #elif _MSC_VER >= 1400 - #define CC_COMPILER_VERSION 80 - #elif _MSC_VER >= 1300 - #define CC_COMPILER_VERSION 70 - #endif - #elif defined(__clang__) - #define CC_COMPILER CC_COMPILER_CLANG - #define CC_COMPILER_VERSION (((__clang_major__)*100) + (__clang_minor__ * 10) + __clang_patchlevel__) - #elif defined(__GNUC__) - #define CC_COMPILER CC_COMPILER_GNUC - #define CC_COMPILER_VERSION (((__GNUC__)*100) + (__GNUC_MINOR__ * 10) + __GNUC_PATCHLEVEL__) - #else - #error "Unknown compiler. Abort!" - #endif - - #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - #define CC_ENDIAN CC_ENDIAN_LITTLE - #else - #if (CC_PLATFORM == CC_PLATFORM_MAC_OSX) - #include - #else - #include - #endif // (CC_PLATFORM == CC_PLATFORM_MAC_OSX) - # - #if __BYTE_ORDER == __LITTLE_ENDIAN - #define CC_ENDIAN CC_ENDIAN_LITTLE - #else - #define CC_ENDIAN CC_ENDIAN_BIG - #endif //__BYTE_ORDER == __LITTLE_ENDIAN - #endif - - // CPU architecture type recognition - #if (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) - #define CC_CPU CC_CPU_X86 - #elif CC_PLATFORM == CC_PLATFORM_MAC_OSX && CC_ENDIAN == CC_ENDIAN_BIG - #define CC_CPU CC_CPU_PPC - #elif CC_PLATFORM == CC_PLATFORM_MAC_OSX - #define COCOS_CPU CC_CPU_X86 - #elif CC_PLATFORM == CC_PLATFORM_MAC_IOS && (defined(__i386__) || defined(__x86_64__)) - #define CC_CPU CC_CPU_X86 - #elif defined(__arm__) || defined(_M_ARM) || defined(__arm64__) || defined(_aarch64_) - #define CC_CPU CC_CPU_ARM - #elif defined(__mips64) || defined(__mips64_) - #define CC_CPU CC_CPU_MIPS - #else - #define CC_CPU CC_CPU_UNKNOWN - #endif - - #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) || defined(__arm64__) || defined(_aarch64_) || defined(__mips64) || defined(__mips64_) - #define CC_CPU_ARCH CC_CPU_ARCH_64 - #else - #define CC_CPU_ARCH CC_CPU_ARCH_32 - #endif - - #if (__cplusplus >= 201103L) - #define CC_C11 - #define register - #endif - - // C11 features - #if (CC_COMPILER == CC_COMPILER_MSVC) - #if (_MSC_VER >= 1700) - #define CC_C11_TYPED_ENUMS - #endif - #elif (CC_COMPILER == CC_COMPILER_GNUC) - #if (__GNUC_MINOR__ >= 4) - #define CC_C11_TYPED_ENUMS - #endif - #endif - - // Disable MSVC warning - #if (CC_COMPILER == CC_COMPILER_MSVC) - #pragma warning(disable : 4251 4275 4819) - #ifndef _CRT_SECURE_NO_DEPRECATE - #define _CRT_SECURE_NO_DEPRECATE - #endif - #ifndef _SCL_SECURE_NO_DEPRECATE - #define _SCL_SECURE_NO_DEPRECATE - #endif - #endif - - // Charset Settings - #if defined(_UNICODE) || defined(UNICODE) - #define CC_CHARSET CC_CHARSET_UNICODE - #else - #define CC_CHARSET CC_CHARSET_MULTIBYTE - #endif - - #if CC_COMPILER == CC_COMPILER_MSVC - #if CC_COMPILER_VERSION >= 120 - #define CC_INLINE __forceinline - #else - #define CC_INLINE inline - #endif - #elif defined(__MINGW32__) - #if !defined(CC_INLINE) - #define CC_INLINE __inline - #endif - #elif !defined(ANDROID) && (CC_COMPILER == CC_COMPILER_GNUC || CC_COMPILER == CC_COMPILER_CLANG) - #define CC_INLINE inline __attribute__((always_inline)) - #else - #define CC_INLINE __inline - #endif - - // Asserts expression is true at compile-time - #define CC_COMPILER_ASSERT(x) typedef int COMPILER_ASSERT_[!!(x)] - - #if (CC_COMPILER == CC_COMPILER_MSVC) - #define CC_RESTRICT __restrict //MSVC - #else - #define CC_RESTRICT __restrict__ //GCC... and others? - #endif - - #define CC_CACHELINE_SIZE 64 - - #if (CC_COMPILER == CC_COMPILER_MSVC) - // MSVC ENABLE/DISABLE WARNING DEFINITION - #define CC_DISABLE_WARNINGS() \ - __pragma(warning(push, 0)) - - #define CC_ENABLE_WARNINGS() \ - __pragma(warning(pop)) - #elif (CC_COMPILER == CC_COMPILER_GNUC) - // GCC ENABLE/DISABLE WARNING DEFINITION - #define CC_DISABLE_WARNINGS() \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wall\"") \ - _Pragma("clang diagnostic ignored \"-Wextra\"") \ - _Pragma("clang diagnostic ignored \"-Wtautological-compare\"") - - #define CC_ENABLE_WARNINGS() \ - _Pragma("GCC diagnostic pop") - #elif (CC_COMPILER == CC_COMPILER_CLANG) - // CLANG ENABLE/DISABLE WARNING DEFINITION - #define CC_DISABLE_WARNINGS() \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wall\"") \ - _Pragma("clang diagnostic ignored \"-Wextra\"") \ - _Pragma("clang diagnostic ignored \"-Wtautological-compare\"") - - #define CC_ENABLE_WARNINGS() \ - _Pragma("clang diagnostic pop") - #endif - - #if (CC_COMPILER == CC_COMPILER_MSVC) - #define CC_ALIGN(N) __declspec(align(N)) - #define CC_CACHE_ALIGN __declspec(align(CC_CACHELINE_SIZE)) - #define CC_PACKED_ALIGN(N) __declspec(align(N)) - - #define CC_ALIGNED_DECL(type, var, alignment) __declspec(align(alignment)) type var - - #define CC_READ_COMPILER_BARRIER() _ReadBarrier() - #define CC_WRITE_COMPILER_BARRIER() _WriteBarrier() - #define CC_COMPILER_BARRIER() _ReadWriteBarrier() - - #define CC_READ_MEMORY_BARRIER() MemoryBarrier() - #define CC_WRITE_MEMORY_BARRIER() MemoryBarrier() - #define CC_MEMORY_BARRIER() MemoryBarrier() - - #define CC_CPU_READ_MEMORY_BARRIER() \ - do { \ - __asm { lfence} \ - } while (0) - #define CC_CPU_WRITE_MEMORY_BARRIER() \ - do { \ - __asm { sfence} \ - } while (0) - #define CC_CPU_MEMORY_BARRIER() \ - do { \ - __asm { mfence} \ - } while (0) - - #elif (CC_COMPILER == CC_COMPILER_GNUC) || (CC_COMPILER == CC_COMPILER_CLANG) - #define CC_ALIGN(N) __attribute__((__aligned__((N)))) - #define CC_CACHE_ALIGN __attribute__((__aligned__((CC_CACHELINE_SIZE)))) - #define CC_PACKED_ALIGN(N) __attribute__((packed, aligned(N))) - - #define CC_ALIGNED_DECL(type, var, alignment) type var __attribute__((__aligned__(alignment))) - - #define CC_READ_COMPILER_BARRIER() \ - do { \ - __asm__ __volatile__("" \ - : \ - : \ - : "memory"); \ - } while (0) - #define CC_WRITE_COMPILER_BARRIER() \ - do { \ - __asm__ __volatile__("" \ - : \ - : \ - : "memory"); \ - } while (0) - #define CC_COMPILER_BARRIER() \ - do { \ - __asm__ __volatile__("" \ - : \ - : \ - : "memory"); \ - } while (0) - - #define CC_READ_MEMORY_BARRIER() \ - do { \ - __sync_synchronize(); \ - } while (0) - #define CC_WRITE_MEMORY_BARRIER() \ - do { \ - __sync_synchronize(); \ - } while (0) - #define CC_MEMORY_BARRIER() \ - do { \ - __sync_synchronize(); \ - } while (0) - - #define CC_CPU_READ_MEMORY_BARRIER() \ - do { \ - __asm__ __volatile__("lfence" \ - : \ - : \ - : "memory"); \ - } while (0) - #define CC_CPU_WRITE_MEMORY_BARRIER() \ - do { \ - __asm__ __volatile__("sfence" \ - : \ - : \ - : "memory"); \ - } while (0) - #define CC_CPU_MEMORY_BARRIER() \ - do { \ - __asm__ __volatile__("mfence" \ - : \ - : \ - : "memory"); \ - } while (0) - - #else - #error "Unsupported compiler!" - #endif - - #define CC_SIMD_ALIGNMENT 16 - - #if (CC_COMPILER == CC_COMPILER_MSVC) - #define CC_DECL_MALLOC __declspec(restrict) __declspec(noalias) - #else - #define CC_DECL_MALLOC __attribute__((malloc)) - #endif - - /* Stack-alignment -If macro __CC_SIMD_ALIGN_STACK defined, means there requests -special code to ensure stack align to a 16-bytes boundary. - -Note: - This macro can only guarantee callee stack pointer (esp) align - to a 16-bytes boundary, but not that for frame pointer (ebp). - Because most compiler might use frame pointer to access to stack - variables, so you need to wrap those alignment required functions - with extra function call. -*/ - #if defined(__INTEL_COMPILER) - // For intel's compiler, simply calling alloca seems to do the right - // thing. The size of the allocated block seems to be irrelevant. - #define CC_SIMD_ALIGN_STACK() _alloca(16) - #define CC_SIMD_ALIGN_ATTRIBUTE - - #elif (CC_CPU == CC_CPU_X86) && (CC_COMPILER == CC_COMPILER_GNUC || CC_COMPILER == CC_COMPILER_CLANG) && (CC_CPU_ARCH != CC_CPU_ARCH_64) - // mark functions with GCC attribute to force stack alignment to 16 bytes - #define CC_SIMD_ALIGN_ATTRIBUTE __attribute__((force_align_arg_pointer)) - #elif (CC_COMPILER == CC_COMPILER_MSVC) - // Fortunately, MSVC will align the stack automatically - #define CC_SIMD_ALIGN_ATTRIBUTE - #else - #define CC_SIMD_ALIGN_ATTRIBUTE - #endif - - #if defined(__GNUC__) - #define CC_FUNC ((const char *)(__PRETTY_FUNCTION__)) - #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 19901L - #define CC_FUNC ((const char *)(__func__)) - #else - #define CC_FUNC ((const char *)(__FUNCTION__)) - #endif - - // mode - #if (defined(_DEBUG) || defined(DEBUG)) && (CC_PLATFORM == CC_PLATFORM_WINDOWS) - #define CC_MODE CC_MODE_DEBUG - #else - #define CC_MODE CC_MODE_RELEASE - #endif - - // Engine Memory Management - #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - #if (CC_MODE == CC_MODE_DEBUG) - #define CC_MEMORY_TRACKER - #endif - #elif (CC_PLATFORM == CC_PLATFORM_ANDROID) - //# define CC_MEMORY_TRACKER - #else - #endif - - // use simd - //#define CC_USE_SIMD - - // Memory Allocator - #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD - #undef CC_MEMORY_TRACKER - //#if defined(CC_MEMORY_TRACKER) - //# define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_JEMALLOC - //#else - //# define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD - //#endif - #elif (CC_PLATFORM == CC_PLATFORM_ANDROID) - #if defined(CC_MEMORY_TRACKER) - #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_JEMALLOC - #else - #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD - #endif - #else - #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD - #endif - - // STL memory allocator - #if (CC_MEMORY_ALLOCATOR == CC_MEMORY_ALLOCATOR_STD) - #define CC_STL_MEMORY_ALLOCATOR CC_STL_MEMORY_ALLOCATOR_STANDARD - #else - #define CC_STL_MEMORY_ALLOCATOR CC_STL_MEMORY_ALLOCATOR_CUSTOM - #endif - - #define CC_TOSTR(s) #s - - #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - #ifdef CC_STATIC - #define CC_CORE_API - #else - #ifdef CC_CORE_EXPORTS - #define CC_CORE_API __declspec(dllexport) - #else - #define CC_CORE_API __declspec(dllimport) - #endif - #endif - #else - #define CC_CORE_API - #endif - -#endif // CC_CORE_CORE_DEF_H_ diff --git a/native/cocos/base/Log.cc b/native/cocos/base/Log.cc index d60c931939..07b1c67250 100755 --- a/native/cocos/base/Log.cc +++ b/native/cocos/base/Log.cc @@ -7,6 +7,7 @@ #define WIN32_LEAN_AND_MEAN #endif #include + #include #define COLOR_FATAL FOREGROUND_INTENSITY | FOREGROUND_RED #define COLOR_ERROR FOREGROUND_RED @@ -23,19 +24,24 @@ namespace cc { #define LOG_USE_TIMESTAMP -LogLevel Log::log_level = LogLevel::DEBUG; -FILE *Log::log_file_ = nullptr; +#if (COCOS2D_DEBUG == 1) +LogLevel Log::logLevel = LogLevel::DEBUG_; +#else +LogLevel Log::logLevel = LogLevel::INFO; +#endif + +FILE *Log::_logFile = nullptr; const char *LOG_LEVEL_DESCS[] = {"FATAL", "ERROR", "WARN", "INFO", "DEBUG"}; -void Log::set_log_file(const std::string &filename) { +void Log::setLogFile(const std::string &filename) { #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) - if (log_file_) { - fclose(log_file_); + if (_logFile) { + fclose(_logFile); } - log_file_ = fopen(filename.c_str(), "w"); + _logFile = fopen(filename.c_str(), "w"); - if (log_file_) { + if (_logFile) { String msg; msg += "------------------------------------------------------\n"; @@ -54,20 +60,20 @@ void Log::set_log_file(const std::string &filename) { msg += "------------------------------------------------------\n"; - fputs(msg.c_str(), log_file_); - fflush(log_file_); + fputs(msg.c_str(), _logFile); + fflush(_logFile); } #endif } -void Log::Close() { - if (log_file_) { - fclose(log_file_); - log_file_ = nullptr; +void Log::close() { + if (_logFile) { + fclose(_logFile); + _logFile = nullptr; } } -void Log::LogMessage(LogType type, LogLevel level, const char *formats, ...) { +void Log::logMessage(LogType type, LogLevel level, const char *formats, ...) { char buff[4096]; char *p = buff; char *last = buff + sizeof(buff) - 3; @@ -100,9 +106,9 @@ void Log::LogMessage(LogType type, LogLevel level, const char *formats, ...) { *p++ = '\n'; *p = 0; - if (log_file_) { - fputs(buff, log_file_); - fflush(log_file_); + if (_logFile) { + fputs(buff, _logFile); + fflush(_logFile); } #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) @@ -111,7 +117,7 @@ void Log::LogMessage(LogType type, LogLevel level, const char *formats, ...) { WORD color; switch (level) { - case LogLevel::DEBUG: color = COLOR_DEBUG; break; + case LogLevel::DEBUG_: color = COLOR_DEBUG; break; case LogLevel::INFO: color = COLOR_INFO; break; case LogLevel::WARN: color = COLOR_WARN; break; case LogLevel::ERR: color = COLOR_ERROR; break; @@ -126,7 +132,7 @@ void Log::LogMessage(LogType type, LogLevel level, const char *formats, ...) { #elif (CC_PLATFORM == CC_PLATFORM_ANDROID) android_LogPriority priority; switch (level) { - case LogLevel::DEBUG: priority = ANDROID_LOG_DEBUG; break; + case LogLevel::DEBUG_: priority = ANDROID_LOG_DEBUG; break; case LogLevel::INFO: priority = ANDROID_LOG_INFO; break; case LogLevel::WARN: priority = ANDROID_LOG_WARN; break; case LogLevel::ERR: priority = ANDROID_LOG_ERROR; break; diff --git a/native/cocos/base/Log.h b/native/cocos/base/Log.h index 9473876158..bf9bb08625 100755 --- a/native/cocos/base/Log.h +++ b/native/cocos/base/Log.h @@ -1,7 +1,7 @@ #ifndef CC_CORE_KERNEL_LOG_H_ #define CC_CORE_KERNEL_LOG_H_ -#include "CoreDef.h" +#include "ccMacros.h" #include namespace cc { @@ -17,36 +17,36 @@ enum class LogLevel : uint8_t { ERR, WARN, INFO, - DEBUG, + DEBUG_, // DEBUG is a macro on windows, so use DEBUG_ instead. COUNT, }; class CC_DLL Log { public: - static LogLevel log_level; // for read only + static LogLevel logLevel; // for read only - static CC_INLINE void set_log_level(LogLevel level) { log_level = level; } - static CC_INLINE FILE *log_file() { return log_file_; } - static void set_log_file(const std::string &filename); - static void Close(); - static void LogMessage(LogType type, LogLevel level, const char *formats, ...); + static CC_INLINE void setLogLevel(LogLevel level) { logLevel = level; } + static CC_INLINE FILE *getLogFile() { return _logFile; } + static void setLogFile(const std::string &filename); + static void close(); + static void logMessage(LogType type, LogLevel level, const char *formats, ...); private: - static FILE *log_file_; + static FILE *_logFile; }; } // namespace cc #define CC_LOG_DEBUG(formats, ...) \ - if (cc::Log::log_level >= cc::LogLevel::DEBUG) cc::Log::LogMessage(cc::LogType::KERNEL, cc::LogLevel::DEBUG, formats, ##__VA_ARGS__) + if (cc::Log::logLevel >= cc::LogLevel::DEBUG_) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::DEBUG_, formats, ##__VA_ARGS__) #define CC_LOG_INFO(formats, ...) \ - if (cc::Log::log_level >= cc::LogLevel::INFO) cc::Log::LogMessage(cc::LogType::KERNEL, cc::LogLevel::INFO, formats, ##__VA_ARGS__) + if (cc::Log::logLevel >= cc::LogLevel::INFO) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::INFO, formats, ##__VA_ARGS__) #define CC_LOG_WARNING(formats, ...) \ - if (cc::Log::log_level >= cc::LogLevel::WARN) cc::Log::LogMessage(cc::LogType::KERNEL, cc::LogLevel::WARN, formats, ##__VA_ARGS__) + if (cc::Log::logLevel >= cc::LogLevel::WARN) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::WARN, formats, ##__VA_ARGS__) #define CC_LOG_ERROR_(formats, ...) \ - if (cc::Log::log_level >= cc::LogLevel::ERR) cc::Log::LogMessage(cc::LogType::KERNEL, cc::LogLevel::ERR, formats, ##__VA_ARGS__) + if (cc::Log::logLevel >= cc::LogLevel::ERR) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::ERR, formats, ##__VA_ARGS__) #define CC_LOG_FATAL(formats, ...) \ - if (cc::Log::logLevel >= cc::LogLevel::FATAL) cc::Log::LogMessage(cc::LogType::KERNEL, cc::LogLevel::FATAL, formats, ##__VA_ARGS__) + if (cc::Log::logLevel >= cc::LogLevel::FATAL) cc::Log::logMessage(cc::LogType::KERNEL, cc::LogLevel::FATAL, formats, ##__VA_ARGS__) #define CC_LOG_ERROR(formats, ...) \ do { \ diff --git a/native/cocos/base/StringUtil.h b/native/cocos/base/StringUtil.h index a23d8e9801..417770ff4f 100755 --- a/native/cocos/base/StringUtil.h +++ b/native/cocos/base/StringUtil.h @@ -1,7 +1,7 @@ #ifndef CC_CORE_KERNEL_UTIL_STRING_UTIL_H_ #define CC_CORE_KERNEL_UTIL_STRING_UTIL_H_ -#include "CoreDef.h" +#include "ccMacros.h" #include "TypeDef.h" namespace cc { diff --git a/native/cocos/base/UTFString.h b/native/cocos/base/UTFString.h index 7a3bdd8cf8..7c6f7afc39 100755 --- a/native/cocos/base/UTFString.h +++ b/native/cocos/base/UTFString.h @@ -1,7 +1,7 @@ #ifndef CC_CORE_KERNEL_UTF_STRING_H_ #define CC_CORE_KERNEL_UTF_STRING_H_ -#include "CoreDef.h" +#include "ccMacros.h" #include "memory/StlAlloc.h" #if (CC_COMPILER == CC_COMPILER_MSVC && (CC_COMPILER_VERSION >= 70 && CC_COMPILER_VERSION < 100)) @@ -107,7 +107,7 @@ namespace cc { - For additional information on UTF-32 encoding: http://en.wikipedia.org/wiki/UTF-32 */ -class CC_CORE_API UTFString { +class CC_DLL UTFString { // constants used in UTF-8 conversions static const unsigned char _lead1 = 0xC0; //110xxxxx static const unsigned char _lead1_mask = 0x1F; //00011111 @@ -143,7 +143,7 @@ public: typedef std::basic_string dstring; // data string #endif //! base iterator class for UTFString - class CC_CORE_API _base_iterator : public std::iterator { + class CC_DLL _base_iterator : public std::iterator { friend class UTFString; protected: @@ -175,7 +175,7 @@ public: class _const_fwd_iterator; // forward declaration //! forward iterator for UTFString - class CC_CORE_API _fwd_iterator : public _base_iterator { + class CC_DLL _fwd_iterator : public _base_iterator { friend class _const_fwd_iterator; public: @@ -276,7 +276,7 @@ public: ////////////////////////////////////////////////////////////////////////// //! const forward iterator for UTFString - class CC_CORE_API _const_fwd_iterator : public _base_iterator { + class CC_DLL _const_fwd_iterator : public _base_iterator { public: _const_fwd_iterator() {} _const_fwd_iterator(const _const_fwd_iterator &i) { _become(i); } @@ -392,7 +392,7 @@ public: class _const_rev_iterator; // forward declaration //! forward iterator for UTFString - class CC_CORE_API _rev_iterator : public _base_iterator { + class CC_DLL _rev_iterator : public _base_iterator { friend class _const_rev_iterator; public: @@ -477,7 +477,7 @@ public: ////////////////////////////////////////////////////////////////////////// //! const reverse iterator for UTFString - class CC_CORE_API _const_rev_iterator : public _base_iterator { + class CC_DLL _const_rev_iterator : public _base_iterator { public: _const_rev_iterator() {} _const_rev_iterator(const _const_rev_iterator &i) { _become(i); } diff --git a/native/cocos/base/ZipUtils.cpp b/native/cocos/base/ZipUtils.cpp index fff587b86d..961e713bb8 100644 --- a/native/cocos/base/ZipUtils.cpp +++ b/native/cocos/base/ZipUtils.cpp @@ -26,6 +26,7 @@ // IDEA: hack, must be included before ziputils #include "base/ZipUtils.h" +#include "base/Log.h" #ifdef MINIZIP_FROM_SYSTEM #include #else // from our embedded sources @@ -37,7 +38,6 @@ #include #include "base/CCData.h" -#include "base/ccMacros.h" #include "platform/CCFileUtils.h" #include @@ -192,7 +192,7 @@ int ZipUtils::inflateMemoryWithHint(unsigned char *in, ssize_t inLength, unsigne /* not enough memory, ouch */ if (! *out ) { - CCLOG("ZipUtils: realloc failed"); + CC_LOG_DEBUG("ZipUtils: realloc failed"); inflateEnd(&d_stream); return Z_MEM_ERROR; } @@ -216,19 +216,19 @@ ssize_t ZipUtils::inflateMemoryWithHint(unsigned char *in, ssize_t inLength, uns if (err != Z_OK || *out == nullptr) { if (err == Z_MEM_ERROR) { - CCLOG("ZipUtils: Out of memory while decompressing map data!"); + CC_LOG_DEBUG("ZipUtils: Out of memory while decompressing map data!"); } else if (err == Z_VERSION_ERROR) { - CCLOG("ZipUtils: Incompatible zlib version!"); + CC_LOG_DEBUG("ZipUtils: Incompatible zlib version!"); } else if (err == Z_DATA_ERROR) { - CCLOG("ZipUtils: Incorrect zlib compressed data!"); + CC_LOG_DEBUG("ZipUtils: Incorrect zlib compressed data!"); } else { - CCLOG("ZipUtils: Unknown error while decompressing map data!"); + CC_LOG_DEBUG("ZipUtils: Unknown error while decompressing map data!"); } if(*out) { @@ -257,7 +257,7 @@ int ZipUtils::inflateGZipFile(const char *path, unsigned char **out) gzFile inFile = gzopen(FileUtils::getInstance()->getSuitableFOpen(path).c_str(), "rb"); if( inFile == nullptr ) { - CCLOG("ZipUtils: error open gzip file: %s", path); + CC_LOG_DEBUG("ZipUtils: error open gzip file: %s", path); return -1; } @@ -268,7 +268,7 @@ int ZipUtils::inflateGZipFile(const char *path, unsigned char **out) *out = (unsigned char*)malloc( bufferSize ); if( ! out ) { - CCLOG("ZipUtils: out of memory"); + CC_LOG_DEBUG("ZipUtils: out of memory"); return -1; } @@ -276,7 +276,7 @@ int ZipUtils::inflateGZipFile(const char *path, unsigned char **out) len = gzread(inFile, *out + offset, bufferSize); if (len < 0) { - CCLOG("ZipUtils: error in gzread"); + CC_LOG_DEBUG("ZipUtils: error in gzread"); free( *out ); *out = nullptr; return -1; @@ -300,7 +300,7 @@ int ZipUtils::inflateGZipFile(const char *path, unsigned char **out) if( ! tmp ) { - CCLOG("ZipUtils: out of memory"); + CC_LOG_DEBUG("ZipUtils: out of memory"); free( *out ); *out = nullptr; return -1; @@ -311,7 +311,7 @@ int ZipUtils::inflateGZipFile(const char *path, unsigned char **out) if (gzclose(inFile) != Z_OK) { - CCLOG("ZipUtils: gzclose failed"); + CC_LOG_DEBUG("ZipUtils: gzclose failed"); } return offset; @@ -324,7 +324,7 @@ bool ZipUtils::isCCZFile(const char *path) if (compressedData.isNull()) { - CCLOG("ZipUtils: loading file failed"); + CC_LOG_DEBUG("ZipUtils: loading file failed"); return false; } @@ -350,7 +350,7 @@ bool ZipUtils::isGZipFile(const char *path) if (compressedData.isNull()) { - CCLOG("ZipUtils: loading file failed"); + CC_LOG_DEBUG("ZipUtils: loading file failed"); return false; } @@ -379,14 +379,14 @@ int ZipUtils::inflateCCZBuffer(const unsigned char *buffer, ssize_t bufferLen, u unsigned int version = CC_SWAP_INT16_BIG_TO_HOST( header->version ); if( version > 2 ) { - CCLOG("Unsupported CCZ header format"); + CC_LOG_DEBUG("Unsupported CCZ header format"); return -1; } // verify compression format if( CC_SWAP_INT16_BIG_TO_HOST(header->compression_type) != CCZ_COMPRESSION_ZLIB ) { - CCLOG("CCZ Unsupported compression method"); + CC_LOG_DEBUG("CCZ Unsupported compression method"); return -1; } } @@ -399,14 +399,14 @@ int ZipUtils::inflateCCZBuffer(const unsigned char *buffer, ssize_t bufferLen, u unsigned int version = CC_SWAP_INT16_BIG_TO_HOST( header->version ); if( version > 0 ) { - CCLOG("Unsupported CCZ header format"); + CC_LOG_DEBUG("Unsupported CCZ header format"); return -1; } // verify compression format if( CC_SWAP_INT16_BIG_TO_HOST(header->compression_type) != CCZ_COMPRESSION_ZLIB ) { - CCLOG("CCZ Unsupported compression method"); + CC_LOG_DEBUG("CCZ Unsupported compression method"); return -1; } @@ -423,14 +423,14 @@ int ZipUtils::inflateCCZBuffer(const unsigned char *buffer, ssize_t bufferLen, u if(calculated != required) { - CCLOG("Can't decrypt image file. Is the decryption key valid?"); + CC_LOG_DEBUG("Can't decrypt image file. Is the decryption key valid?"); return -1; } #endif } else { - CCLOG("Invalid CCZ file"); + CC_LOG_DEBUG("Invalid CCZ file"); return -1; } @@ -439,7 +439,7 @@ int ZipUtils::inflateCCZBuffer(const unsigned char *buffer, ssize_t bufferLen, u *out = (unsigned char*)malloc( len ); if(! *out ) { - CCLOG("CCZ: Failed to allocate memory for texture"); + CC_LOG_DEBUG("CCZ: Failed to allocate memory for texture"); return -1; } @@ -449,7 +449,7 @@ int ZipUtils::inflateCCZBuffer(const unsigned char *buffer, ssize_t bufferLen, u if( ret != Z_OK ) { - CCLOG("CCZ: Failed to uncompress data"); + CC_LOG_DEBUG("CCZ: Failed to uncompress data"); free( *out ); *out = nullptr; return -1; @@ -467,7 +467,7 @@ int ZipUtils::inflateCCZFile(const char *path, unsigned char **out) if (compressedData.isNull()) { - CCLOG("Error loading CCZ compressed file"); + CC_LOG_DEBUG("Error loading CCZ compressed file"); return -1; } diff --git a/native/cocos/base/ccCArray.cpp b/native/cocos/base/ccCArray.cpp index 3a4cea3ecf..10b39beabc 100644 --- a/native/cocos/base/ccCArray.cpp +++ b/native/cocos/base/ccCArray.cpp @@ -24,7 +24,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ - +#include "base/Log.h" #include "base/ccCArray.h" namespace cc { @@ -71,7 +71,7 @@ void ccArrayEnsureExtraCapacity(ccArray *arr, ssize_t extra) { while (arr->max < arr->num + extra) { - CCLOGINFO("ccCArray: resizing ccArray capacity from [%d] to [%d].", + CC_LOG_INFO("ccCArray: resizing ccArray capacity from [%d] to [%d].", static_cast(arr->max), static_cast(arr->max*2)); diff --git a/native/cocos/base/ccMacros.h b/native/cocos/base/ccMacros.h index d6bc4b81f3..5edbae9ae2 100644 --- a/native/cocos/base/ccMacros.h +++ b/native/cocos/base/ccMacros.h @@ -27,9 +27,6 @@ THE SOFTWARE. ****************************************************************************/ #pragma once -#include "base/CCLog.h" -#include "base/ccConfig.h" - #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) #include #if !defined(__SSIZE_T) && !defined(_SSIZE_T_) @@ -173,54 +170,6 @@ It should work same as apples CFSwapInt32LittleToHost(..) #define CC_BREAK_IF(cond) \ if (cond) break -#define __CCLOGWITHFUNCTION(s, ...) \ - cc::log("%s : %s", __FUNCTION__, cc::StringUtils::format(s, ##__VA_ARGS__).c_str()) - -/// @name Cocos2d debug -/// @{ -#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 - #define CCLOG(...) \ - do { \ - } while (0) - #define CCLOGINFO(...) \ - do { \ - } while (0) - #define CCLOGERROR(...) \ - do { \ - } while (0) - #define CCLOGWARN(...) \ - do { \ - } while (0) - -#elif COCOS2D_DEBUG == 1 - - #if (CC_PLATFORM == CC_PLATFORM_ANDROID) - #define COCOS_LOG_TAG "cocos" - #define CCLOG(...) __android_log_print(ANDROID_LOG_DEBUG, COCOS_LOG_TAG, __VA_ARGS__) - #define CCLOGINFO(format, ...) \ - do { \ - } while (0) - #define CCLOGWARN(...) __android_log_print(ANDROID_LOG_WARN, COCOS_LOG_TAG, __VA_ARGS__) - #define CCLOGERROR(...) __android_log_print(ANDROID_LOG_ERROR, COCOS_LOG_TAG, __VA_ARGS__) - #else - #define CCLOG(format, ...) cc::log(format, ##__VA_ARGS__) - #define CCLOGERROR(format, ...) cc::log(format, ##__VA_ARGS__) - #define CCLOGINFO(format, ...) \ - do { \ - } while (0) - #define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__) - #endif - -#elif COCOS2D_DEBUG > 1 - #define CCLOG(format, ...) cc::log(format, ##__VA_ARGS__) - #define CCLOGERROR(format, ...) cc::log(format, ##__VA_ARGS__) - #define CCLOGINFO(format, ...) cc::log(format, ##__VA_ARGS__) - #define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__) -#endif // COCOS2D_DEBUG - -// end of debug group -/// @} - /** @def CC_DISALLOW_COPY_AND_ASSIGN(TypeName) * A macro to disallow the copy constructor and operator= functions. * This should be used in the private: declarations for a class @@ -268,3 +217,400 @@ It should work same as apples CFSwapInt32LittleToHost(..) #define NULL ((void *)0) #endif #endif + +/** @def CC_FORMAT_PRINTF(formatPos, argPos) + * Only certain compiler support __attribute__((format)) + * + * @param formatPos 1-based position of format string argument. + * @param argPos 1-based position of first format-dependent argument. + */ +#if defined(__GNUC__) && (__GNUC__ >= 4) + #define CC_FORMAT_PRINTF(formatPos, argPos) __attribute__((__format__(printf, formatPos, argPos))) +#elif defined(__has_attribute) + #if __has_attribute(format) + #define CC_FORMAT_PRINTF(formatPos, argPos) __attribute__((__format__(printf, formatPos, argPos))) + #else + #define CC_FORMAT_PRINTF(formatPos, argPos) + #endif // __has_attribute(format) +#else + #define CC_FORMAT_PRINTF(formatPos, argPos) +#endif + +#define CC_CORE_CORE_DEF_H_ + +// Initial compiler-related stuff to set. +#define CC_COMPILER_MSVC 1 +#define CC_COMPILER_CLANG 2 +#define CC_COMPILER_GNUC 3 + +// CPU Architecture +#define CC_CPU_UNKNOWN 0 +#define CC_CPU_X86 1 +#define CC_CPU_PPC 2 +#define CC_CPU_ARM 3 +#define CC_CPU_MIPS 4 + +// 32-bits or 64-bits CPU +#define CC_CPU_ARCH_32 1 +#define CC_CPU_ARCH_64 2 + +// Endian +#define CC_ENDIAN_LITTLE 1 +#define CC_ENDIAN_BIG 2 + +// Charset +#define CC_CHARSET_UNICODE 1 +#define CC_CHARSET_MULTIBYTE 2 + +// Precision +#define CC_PRECISION_FLOAT 1 +#define CC_PRECISION_DOUBLE 2 + +// Mode +#define CC_MODE_DEBUG 1 +#define CC_MODE_RELEASE 2 + +// Memory Allocator +#define CC_MEMORY_ALLOCATOR_STD 0 +#define CC_MEMORY_ALLOCATOR_NEDPOOLING 1 +#define CC_MEMORY_ALLOCATOR_JEMALLOC 2 + +// STL Memory Allocator +#define CC_STL_MEMORY_ALLOCATOR_STANDARD 1 +#define CC_STL_MEMORY_ALLOCATOR_CUSTOM 2 + +// Compiler type and version recognition +#if defined(_MSC_VER) + #define CC_COMPILER CC_COMPILER_MSVC + #if _MSC_VER >= 1900 + #define CC_COMPILER_VERSION 130 + #elif _MSC_VER >= 1800 + #define CC_COMPILER_VERSION 120 + #elif _MSC_VER >= 1700 + #define CC_COMPILER_VERSION 110 + #elif _MSC_VER >= 1600 + #define CC_COMPILER_VERSION 100 + #elif _MSC_VER >= 1500 + #define CC_COMPILER_VERSION 90 + #elif _MSC_VER >= 1400 + #define CC_COMPILER_VERSION 80 + #elif _MSC_VER >= 1300 + #define CC_COMPILER_VERSION 70 + #endif +#elif defined(__clang__) + #define CC_COMPILER CC_COMPILER_CLANG + #define CC_COMPILER_VERSION (((__clang_major__)*100) + (__clang_minor__ * 10) + __clang_patchlevel__) +#elif defined(__GNUC__) + #define CC_COMPILER CC_COMPILER_GNUC + #define CC_COMPILER_VERSION (((__GNUC__)*100) + (__GNUC_MINOR__ * 10) + __GNUC_PATCHLEVEL__) +#else + #error "Unknown compiler. Abort!" +#endif + +#if (CC_PLATFORM == CC_PLATFORM_WINDOWS) + #define CC_ENDIAN CC_ENDIAN_LITTLE +#else + #if (CC_PLATFORM == CC_PLATFORM_MAC_OSX) + #include + #else + #include + #endif // (CC_PLATFORM == CC_PLATFORM_MAC_OSX) + # + #if __BYTE_ORDER == __LITTLE_ENDIAN + #define CC_ENDIAN CC_ENDIAN_LITTLE + #else + #define CC_ENDIAN CC_ENDIAN_BIG + #endif //__BYTE_ORDER == __LITTLE_ENDIAN +#endif + +// CPU architecture type recognition +#if (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) + #define CC_CPU CC_CPU_X86 +#elif CC_PLATFORM == CC_PLATFORM_MAC_OSX && CC_ENDIAN == CC_ENDIAN_BIG + #define CC_CPU CC_CPU_PPC +#elif CC_PLATFORM == CC_PLATFORM_MAC_OSX + #define COCOS_CPU CC_CPU_X86 +#elif CC_PLATFORM == CC_PLATFORM_MAC_IOS && (defined(__i386__) || defined(__x86_64__)) + #define CC_CPU CC_CPU_X86 +#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64__) || defined(_aarch64_) + #define CC_CPU CC_CPU_ARM +#elif defined(__mips64) || defined(__mips64_) + #define CC_CPU CC_CPU_MIPS +#else + #define CC_CPU CC_CPU_UNKNOWN +#endif + +#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) || defined(__arm64__) || defined(_aarch64_) || defined(__mips64) || defined(__mips64_) + #define CC_CPU_ARCH CC_CPU_ARCH_64 +#else + #define CC_CPU_ARCH CC_CPU_ARCH_32 +#endif + +#if (__cplusplus >= 201103L) + #define CC_C11 + #define register +#endif + +// C11 features +#if (CC_COMPILER == CC_COMPILER_MSVC) + #if (_MSC_VER >= 1700) + #define CC_C11_TYPED_ENUMS + #endif +#elif (CC_COMPILER == CC_COMPILER_GNUC) + #if (__GNUC_MINOR__ >= 4) + #define CC_C11_TYPED_ENUMS + #endif +#endif + +// Disable MSVC warning +#if (CC_COMPILER == CC_COMPILER_MSVC) + #pragma warning(disable : 4251 4275 4819) + #ifndef _CRT_SECURE_NO_DEPRECATE + #define _CRT_SECURE_NO_DEPRECATE + #endif + #ifndef _SCL_SECURE_NO_DEPRECATE + #define _SCL_SECURE_NO_DEPRECATE + #endif +#endif + +// Charset Settings +#if defined(_UNICODE) || defined(UNICODE) + #define CC_CHARSET CC_CHARSET_UNICODE +#else + #define CC_CHARSET CC_CHARSET_MULTIBYTE +#endif + +#if CC_COMPILER == CC_COMPILER_MSVC + #if CC_COMPILER_VERSION >= 120 + #define CC_INLINE __forceinline + #else + #define CC_INLINE inline + #endif +#elif defined(__MINGW32__) + #if !defined(CC_INLINE) + #define CC_INLINE __inline + #endif +#elif !defined(ANDROID) && (CC_COMPILER == CC_COMPILER_GNUC || CC_COMPILER == CC_COMPILER_CLANG) + #define CC_INLINE inline __attribute__((always_inline)) +#else + #define CC_INLINE __inline +#endif + +// Asserts expression is true at compile-time +#define CC_COMPILER_ASSERT(x) typedef int COMPILER_ASSERT_[!!(x)] + +#if (CC_COMPILER == CC_COMPILER_MSVC) + #define CC_RESTRICT __restrict //MSVC +#else + #define CC_RESTRICT __restrict__ //GCC... and others? +#endif + +#define CC_CACHELINE_SIZE 64 + +#if (CC_COMPILER == CC_COMPILER_MSVC) + // MSVC ENABLE/DISABLE WARNING DEFINITION + #define CC_DISABLE_WARNINGS() \ + __pragma(warning(push, 0)) + + #define CC_ENABLE_WARNINGS() \ + __pragma(warning(pop)) +#elif (CC_COMPILER == CC_COMPILER_GNUC) + // GCC ENABLE/DISABLE WARNING DEFINITION + #define CC_DISABLE_WARNINGS() \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wall\"") \ + _Pragma("clang diagnostic ignored \"-Wextra\"") \ + _Pragma("clang diagnostic ignored \"-Wtautological-compare\"") + + #define CC_ENABLE_WARNINGS() \ + _Pragma("GCC diagnostic pop") +#elif (CC_COMPILER == CC_COMPILER_CLANG) + // CLANG ENABLE/DISABLE WARNING DEFINITION + #define CC_DISABLE_WARNINGS() \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wall\"") \ + _Pragma("clang diagnostic ignored \"-Wextra\"") \ + _Pragma("clang diagnostic ignored \"-Wtautological-compare\"") + + #define CC_ENABLE_WARNINGS() \ + _Pragma("clang diagnostic pop") +#endif + +#if (CC_COMPILER == CC_COMPILER_MSVC) + #define CC_ALIGN(N) __declspec(align(N)) + #define CC_CACHE_ALIGN __declspec(align(CC_CACHELINE_SIZE)) + #define CC_PACKED_ALIGN(N) __declspec(align(N)) + + #define CC_ALIGNED_DECL(type, var, alignment) __declspec(align(alignment)) type var + + #define CC_READ_COMPILER_BARRIER() _ReadBarrier() + #define CC_WRITE_COMPILER_BARRIER() _WriteBarrier() + #define CC_COMPILER_BARRIER() _ReadWriteBarrier() + + #define CC_READ_MEMORY_BARRIER() MemoryBarrier() + #define CC_WRITE_MEMORY_BARRIER() MemoryBarrier() + #define CC_MEMORY_BARRIER() MemoryBarrier() + + #define CC_CPU_READ_MEMORY_BARRIER() \ + do { \ + __asm { lfence} \ + } while (0) + #define CC_CPU_WRITE_MEMORY_BARRIER() \ + do { \ + __asm { sfence} \ + } while (0) + #define CC_CPU_MEMORY_BARRIER() \ + do { \ + __asm { mfence} \ + } while (0) + +#elif (CC_COMPILER == CC_COMPILER_GNUC) || (CC_COMPILER == CC_COMPILER_CLANG) + #define CC_ALIGN(N) __attribute__((__aligned__((N)))) + #define CC_CACHE_ALIGN __attribute__((__aligned__((CC_CACHELINE_SIZE)))) + #define CC_PACKED_ALIGN(N) __attribute__((packed, aligned(N))) + + #define CC_ALIGNED_DECL(type, var, alignment) type var __attribute__((__aligned__(alignment))) + + #define CC_READ_COMPILER_BARRIER() \ + do { \ + __asm__ __volatile__("" \ + : \ + : \ + : "memory"); \ + } while (0) + #define CC_WRITE_COMPILER_BARRIER() \ + do { \ + __asm__ __volatile__("" \ + : \ + : \ + : "memory"); \ + } while (0) + #define CC_COMPILER_BARRIER() \ + do { \ + __asm__ __volatile__("" \ + : \ + : \ + : "memory"); \ + } while (0) + + #define CC_READ_MEMORY_BARRIER() \ + do { \ + __sync_synchronize(); \ + } while (0) + #define CC_WRITE_MEMORY_BARRIER() \ + do { \ + __sync_synchronize(); \ + } while (0) + #define CC_MEMORY_BARRIER() \ + do { \ + __sync_synchronize(); \ + } while (0) + + #define CC_CPU_READ_MEMORY_BARRIER() \ + do { \ + __asm__ __volatile__("lfence" \ + : \ + : \ + : "memory"); \ + } while (0) + #define CC_CPU_WRITE_MEMORY_BARRIER() \ + do { \ + __asm__ __volatile__("sfence" \ + : \ + : \ + : "memory"); \ + } while (0) + #define CC_CPU_MEMORY_BARRIER() \ + do { \ + __asm__ __volatile__("mfence" \ + : \ + : \ + : "memory"); \ + } while (0) + +#else + #error "Unsupported compiler!" +#endif + +#define CC_SIMD_ALIGNMENT 16 + +#if (CC_COMPILER == CC_COMPILER_MSVC) + #define CC_DECL_MALLOC __declspec(restrict) __declspec(noalias) +#else + #define CC_DECL_MALLOC __attribute__((malloc)) +#endif + +/* Stack-alignment + If macro __CC_SIMD_ALIGN_STACK defined, means there requests + special code to ensure stack align to a 16-bytes boundary. + + Note: + This macro can only guarantee callee stack pointer (esp) align + to a 16-bytes boundary, but not that for frame pointer (ebp). + Because most compiler might use frame pointer to access to stack + variables, so you need to wrap those alignment required functions + with extra function call. + */ +#if defined(__INTEL_COMPILER) + // For intel's compiler, simply calling alloca seems to do the right + // thing. The size of the allocated block seems to be irrelevant. + #define CC_SIMD_ALIGN_STACK() _alloca(16) + #define CC_SIMD_ALIGN_ATTRIBUTE + +#elif (CC_CPU == CC_CPU_X86) && (CC_COMPILER == CC_COMPILER_GNUC || CC_COMPILER == CC_COMPILER_CLANG) && (CC_CPU_ARCH != CC_CPU_ARCH_64) + // mark functions with GCC attribute to force stack alignment to 16 bytes + #define CC_SIMD_ALIGN_ATTRIBUTE __attribute__((force_align_arg_pointer)) +#elif (CC_COMPILER == CC_COMPILER_MSVC) + // Fortunately, MSVC will align the stack automatically + #define CC_SIMD_ALIGN_ATTRIBUTE +#else + #define CC_SIMD_ALIGN_ATTRIBUTE +#endif + +// mode +#if (defined(_DEBUG) || defined(DEBUG)) && (CC_PLATFORM == CC_PLATFORM_WINDOWS) + #define CC_MODE CC_MODE_DEBUG +#else + #define CC_MODE CC_MODE_RELEASE +#endif + +// Engine Memory Management +#if (CC_PLATFORM == CC_PLATFORM_WINDOWS) + #if (CC_MODE == CC_MODE_DEBUG) + #define CC_MEMORY_TRACKER + #endif +#elif (CC_PLATFORM == CC_PLATFORM_ANDROID) +//# define CC_MEMORY_TRACKER +#else +#endif + +// use simd +//#define CC_USE_SIMD + +// Memory Allocator +#if (CC_PLATFORM == CC_PLATFORM_WINDOWS) + #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD + #undef CC_MEMORY_TRACKER +//#if defined(CC_MEMORY_TRACKER) +//# define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_JEMALLOC +//#else +//# define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD +//#endif +#elif (CC_PLATFORM == CC_PLATFORM_ANDROID) + #if defined(CC_MEMORY_TRACKER) + #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_JEMALLOC + #else + #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD + #endif +#else + #define CC_MEMORY_ALLOCATOR CC_MEMORY_ALLOCATOR_STD +#endif + +// STL memory allocator +#if (CC_MEMORY_ALLOCATOR == CC_MEMORY_ALLOCATOR_STD) + #define CC_STL_MEMORY_ALLOCATOR CC_STL_MEMORY_ALLOCATOR_STANDARD +#else + #define CC_STL_MEMORY_ALLOCATOR CC_STL_MEMORY_ALLOCATOR_CUSTOM +#endif + +#define CC_TOSTR(s) #s diff --git a/native/cocos/base/ccUTF8.cpp b/native/cocos/base/ccUTF8.cpp index 0e9843424b..b85bea2665 100644 --- a/native/cocos/base/ccUTF8.cpp +++ b/native/cocos/base/ccUTF8.cpp @@ -25,6 +25,7 @@ ****************************************************************************/ #include "base/ccUTF8.h" +#include "base/Log.h" #include "ConvertUTF/ConvertUTF.h" #include @@ -312,7 +313,7 @@ void StringUTF8::replace(const std::string& newStr) if (lengthString == 0) { - CCLOG("Bad utf-8 set string: %s", newStr.c_str()); + CC_LOG_DEBUG("Bad utf-8 set string: %s", newStr.c_str()); return; } diff --git a/native/cocos/base/memory/AllocatedObj.h b/native/cocos/base/memory/AllocatedObj.h index 78b21b85d0..c0a0438314 100755 --- a/native/cocos/base/memory/AllocatedObj.h +++ b/native/cocos/base/memory/AllocatedObj.h @@ -1,7 +1,7 @@ #ifndef CC_CORE_ALLOCATED_OBJ_H_ #define CC_CORE_ALLOCATED_OBJ_H_ -#include "../CoreDef.h" +#include "../ccMacros.h" // Anything that has done a #define new will screw operator new definitions up // so undefine @@ -20,7 +20,7 @@ namespace cc { to use (e.g. see StdAllocPolicy). */ template -class CC_CORE_API AllocatedObject { +class CC_DLL AllocatedObject { public: explicit AllocatedObject() {} ~AllocatedObject() {} diff --git a/native/cocos/base/memory/Memory.cc b/native/cocos/base/memory/Memory.cc index aacfe60462..97d2660a24 100755 --- a/native/cocos/base/memory/Memory.cc +++ b/native/cocos/base/memory/Memory.cc @@ -3,10 +3,10 @@ #include "StlAlloc.h" namespace cc { -CC_CORE_API SA stl_char_allocator; +CC_DLL SA stl_char_allocator; #if 0 -CC_CORE_API void* BareNewErroneouslyCalled(size_t sz) { +CC_DLL void* BareNewErroneouslyCalled(size_t sz) { return malloc(sz); } #endif diff --git a/native/cocos/base/memory/NedPooling.h b/native/cocos/base/memory/NedPooling.h index 323e6df283..3b8c87b792 100755 --- a/native/cocos/base/memory/NedPooling.h +++ b/native/cocos/base/memory/NedPooling.h @@ -1,7 +1,7 @@ #ifndef CC_CORE_NED_POOLING_H_ #define CC_CORE_NED_POOLING_H_ -#include "../CoreDef.h" +#include "base/ccMacros.h" #if (CC_MEMORY_ALLOCATOR == CC_MEMORY_ALLOCATOR_NEDPOOLING) diff --git a/native/cocos/base/memory/StdAlloc.h b/native/cocos/base/memory/StdAlloc.h index 313bf9ffd7..b0145ba14b 100755 --- a/native/cocos/base/memory/StdAlloc.h +++ b/native/cocos/base/memory/StdAlloc.h @@ -3,7 +3,7 @@ #if (CC_MEMORY_ALLOCATOR == CC_MEMORY_ALLOCATOR_STD) -#include "../CoreDef.h" +#include "base/ccMacros.h" #include #include @@ -16,7 +16,7 @@ namespace cc { @par This class just delegates to the global malloc/free. */ -class CC_CORE_API StdAllocPolicy { +class CC_DLL StdAllocPolicy { public: static CC_INLINE CC_DECL_MALLOC void *AllocateBytes(size_t count, #ifdef CC_MEMORY_TRACKER diff --git a/native/cocos/base/memory/StlAlloc.h b/native/cocos/base/memory/StlAlloc.h index 0d8890c137..fd5eb9e82c 100755 --- a/native/cocos/base/memory/StlAlloc.h +++ b/native/cocos/base/memory/StlAlloc.h @@ -141,7 +141,7 @@ inline bool operator!=(SA const &, OtherAllocator const &) { } //////////////////////////////////////////////////////////////////// -extern CC_CORE_API SA stl_char_allocator; +extern CC_DLL SA stl_char_allocator; #if (CC_STL_MEMORY_ALLOCATOR == CC_STL_MEMORY_ALLOCATOR_CUSTOM) template > diff --git a/native/cocos/math/Mat4.cpp b/native/cocos/math/Mat4.cpp index 77ecb1ae0a..8249120e65 100644 --- a/native/cocos/math/Mat4.cpp +++ b/native/cocos/math/Mat4.cpp @@ -25,7 +25,7 @@ #include #include "math/Quaternion.h" #include "math/MathUtil.h" -#include "base/ccMacros.h" +#include "base/Log.h" NS_CC_MATH_BEGIN @@ -114,7 +114,7 @@ void Mat4::createPerspective(float fieldOfView, float aspectRatio, float theta = MATH_DEG_TO_RAD(fieldOfView) * 0.5f; if (std::abs(std::fmod(theta, MATH_PIOVER2)) < MATH_EPSILON) { - CCLOGERROR("Invalid field of view value (%f) causes attempted calculation tan(%f), which is undefined.", fieldOfView, theta); + CC_LOG_ERROR("Invalid field of view value (%f) causes attempted calculation tan(%f), which is undefined.", fieldOfView, theta); return; } float divisor = std::tan(theta); diff --git a/native/cocos/network/HttpClient-android.cpp b/native/cocos/network/HttpClient-android.cpp index e2c8b1cdbb..46581c8c68 100644 --- a/native/cocos/network/HttpClient-android.cpp +++ b/native/cocos/network/HttpClient-android.cpp @@ -40,6 +40,7 @@ #include "platform/android/jni/JniHelper.h" #include "base/ccUTF8.h" +#include "base/Log.h" #ifndef JCLS_HTTPCLIENT #define JCLS_HTTPCLIENT "org/cocos2dx/lib/Cocos2dxHttpURLConnection" @@ -126,7 +127,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } } @@ -176,7 +177,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } return suc; @@ -196,7 +197,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } } @@ -215,7 +216,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } return responseCode; @@ -241,7 +242,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } return message; @@ -267,7 +268,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } } @@ -286,7 +287,7 @@ public: FILE* fp = fopen(_cookieFileName.c_str(), "w"); if (nullptr == fp) { - CCLOG("can't create or open response cookie files"); + CC_LOG_DEBUG("can't create or open response cookie files"); return 0; } @@ -316,7 +317,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } return headers; @@ -349,7 +350,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } return content; @@ -376,7 +377,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } return value; @@ -399,7 +400,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } return contentLength; @@ -424,7 +425,7 @@ public: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } return header; @@ -464,7 +465,7 @@ private: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } } @@ -486,7 +487,7 @@ private: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } } @@ -589,7 +590,7 @@ private: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } } @@ -614,7 +615,7 @@ private: } else { - CCLOGERROR("HttpClient::%s failed!", __FUNCTION__); + CC_LOG_ERROR("HttpClient::%s failed!", __FUNCTION__); } } @@ -900,11 +901,11 @@ void HttpClient::destroyInstance() { if (_httpClient == nullptr) { - CCLOG("HttpClient singleton is nullptr"); + CC_LOG_DEBUG("HttpClient singleton is nullptr"); return; } - CCLOG("HttpClient::destroyInstance ..."); + CC_LOG_DEBUG("HttpClient::destroyInstance ..."); auto thiz = _httpClient; _httpClient = nullptr; @@ -924,7 +925,7 @@ void HttpClient::destroyInstance() thiz->_sleepCondition.notify_one(); thiz->decreaseThreadCountAndMayDeleteThis(); - CCLOG("HttpClient::destroyInstance() finished!"); + CC_LOG_DEBUG("HttpClient::destroyInstance() finished!"); } void HttpClient::enableCookies(const char* cookieFile) @@ -954,14 +955,14 @@ HttpClient::HttpClient() , _cookie(nullptr) , _requestSentinel(new HttpRequest()) { - CCLOG("In the constructor of HttpClient!"); + CC_LOG_DEBUG("In the constructor of HttpClient!"); increaseThreadCount(); _scheduler = Application::getInstance()->getScheduler(); } HttpClient::~HttpClient() { - CCLOG("In the destructor of HttpClient!"); + CC_LOG_DEBUG("In the destructor of HttpClient!"); CC_SAFE_RELEASE(_requestSentinel); } diff --git a/native/cocos/network/HttpClient-apple.mm b/native/cocos/network/HttpClient-apple.mm index 91215b7349..6c517864b7 100644 --- a/native/cocos/network/HttpClient-apple.mm +++ b/native/cocos/network/HttpClient-apple.mm @@ -303,11 +303,11 @@ void HttpClient::destroyInstance() { if (nullptr == _httpClient) { - CCLOG("HttpClient singleton is nullptr"); + CC_LOG_DEBUG("HttpClient singleton is nullptr"); return; } - CCLOG("HttpClient::destroyInstance begin"); + CC_LOG_DEBUG("HttpClient::destroyInstance begin"); auto thiz = _httpClient; _httpClient = nullptr; @@ -327,7 +327,7 @@ void HttpClient::destroyInstance() thiz->_sleepCondition.notify_one(); thiz->decreaseThreadCountAndMayDeleteThis(); - CCLOG("HttpClient::destroyInstance() finished!"); + CC_LOG_DEBUG("HttpClient::destroyInstance() finished!"); } void HttpClient::enableCookies(const char* cookieFile) @@ -366,7 +366,7 @@ HttpClient::HttpClient() , _cookie(nullptr) , _requestSentinel(new HttpRequest()) { - CCLOG("In the constructor of HttpClient!"); + CC_LOG_DEBUG("In the constructor of HttpClient!"); memset(_responseMessage, 0, sizeof(char) * RESPONSE_BUFFER_SIZE); _scheduler = Application::getInstance()->getScheduler(); increaseThreadCount(); @@ -381,7 +381,7 @@ HttpClient::~HttpClient() _cookie->writeFile(); CC_SAFE_DELETE(_cookie); } - CCLOG("HttpClient destructor"); + CC_LOG_DEBUG("HttpClient destructor"); } //Lazy create semaphore & mutex & thread diff --git a/native/cocos/network/HttpClient.cpp b/native/cocos/network/HttpClient.cpp index 3d75e2b1dd..134ae3255e 100644 --- a/native/cocos/network/HttpClient.cpp +++ b/native/cocos/network/HttpClient.cpp @@ -32,6 +32,7 @@ #include "platform/CCFileUtils.h" #include "platform/CCApplication.h" #include "platform/CCStdC.h" +#include "base/Log.h" namespace cc { @@ -280,7 +281,7 @@ public: return false; CURLcode code = curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, responseCode); if (code != CURLE_OK || !(*responseCode >= 200 && *responseCode < 300)) { - CCLOGERROR("Curl curl_easy_getinfo failed: %s", curl_easy_strerror(code)); + CC_LOG_ERROR("Curl curl_easy_getinfo failed: %s", curl_easy_strerror(code)); return false; } // Get some mor data. @@ -349,11 +350,11 @@ void HttpClient::destroyInstance() { if (nullptr == _httpClient) { - CCLOG("HttpClient singleton is nullptr"); + CC_LOG_DEBUG("HttpClient singleton is nullptr"); return; } - CCLOG("HttpClient::destroyInstance begin"); + CC_LOG_DEBUG("HttpClient::destroyInstance begin"); auto thiz = _httpClient; _httpClient = nullptr; @@ -373,7 +374,7 @@ void HttpClient::destroyInstance() thiz->_sleepCondition.notify_one(); thiz->decreaseThreadCountAndMayDeleteThis(); - CCLOG("HttpClient::destroyInstance() finished!"); + CC_LOG_DEBUG("HttpClient::destroyInstance() finished!"); } void HttpClient::enableCookies(const char* cookieFile) @@ -403,7 +404,7 @@ HttpClient::HttpClient() , _cookie(nullptr) , _requestSentinel(new HttpRequest()) { - CCLOG("In the constructor of HttpClient!"); + CC_LOG_DEBUG("In the constructor of HttpClient!"); memset(_responseMessage, 0, RESPONSE_BUFFER_SIZE * sizeof(char)); _scheduler = Application::getInstance()->getScheduler(); increaseThreadCount(); @@ -412,7 +413,7 @@ HttpClient::HttpClient() HttpClient::~HttpClient() { CC_SAFE_RELEASE(_requestSentinel); - CCLOG("HttpClient destructor"); + CC_LOG_DEBUG("HttpClient destructor"); } //Lazy create semaphore & mutex & thread diff --git a/native/cocos/network/SocketIO.cpp b/native/cocos/network/SocketIO.cpp index faa74571ab..d2c595fef0 100644 --- a/native/cocos/network/SocketIO.cpp +++ b/native/cocos/network/SocketIO.cpp @@ -34,7 +34,7 @@ #include #include #include "base/ccUTF8.h" -#include "base/ccMacros.h" +#include "base/Log.h" #include "platform/CCApplication.h" #include "network/WebSocket.h" #include "network/HttpClient.h" @@ -225,7 +225,7 @@ std::string SocketIOPacket::stringify()const outS = s.GetString(); - CCLOGINFO("create args object: %s:", outS.c_str()); + CC_LOG_INFO("create args object: %s:", outS.c_str()); } return outS; @@ -288,7 +288,7 @@ std::string SocketIOPacketV10x::stringify()const outS = s.GetString(); - CCLOGINFO("create args object: %s:", outS.c_str()); + CC_LOG_INFO("create args object: %s:", outS.c_str()); return outS; @@ -411,7 +411,7 @@ SIOClientImpl::~SIOClientImpl() void SIOClientImpl::handshake() { - CCLOGINFO("SIOClientImpl::handshake() called"); + CC_LOG_INFO("SIOClientImpl::handshake() called"); std::stringstream pre; @@ -429,7 +429,7 @@ void SIOClientImpl::handshake() request->setResponseCallback(CC_CALLBACK_2(SIOClientImpl::handshakeResponse, this)); request->setTag("handshake"); - CCLOGINFO("SIOClientImpl::handshake() waiting"); + CC_LOG_INFO("SIOClientImpl::handshake() waiting"); if (_uri.isSecure() && !_caFilePath.empty()) { @@ -444,22 +444,22 @@ void SIOClientImpl::handshake() void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *response) { - CCLOGINFO("SIOClientImpl::handshakeResponse() called"); + CC_LOG_INFO("SIOClientImpl::handshakeResponse() called"); if (0 != strlen(response->getHttpRequest()->getTag())) { - CCLOGINFO("%s completed", response->getHttpRequest()->getTag()); + CC_LOG_INFO("%s completed", response->getHttpRequest()->getTag()); } long statusCode = response->getResponseCode(); char statusString[64] = {}; sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); - CCLOGINFO("response code: %ld", statusCode); + CC_LOG_INFO("response code: %ld", statusCode); if (!response->isSucceed()) { - CCLOGERROR("SIOClientImpl::handshake() failed"); - CCLOGERROR("error buffer: %s", response->getErrorBuffer()); + CC_LOG_ERROR("SIOClientImpl::handshake() failed"); + CC_LOG_ERROR("error buffer: %s", response->getErrorBuffer()); for (auto& client : _clients) { @@ -470,7 +470,7 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp return; } - CCLOGINFO("SIOClientImpl::handshake() succeeded"); + CC_LOG_INFO("SIOClientImpl::handshake() succeeded"); std::vector *buffer = response->getResponseData(); std::stringstream s; @@ -481,7 +481,7 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp s << iter; } - CCLOGINFO("SIOClientImpl::handshake() dump data: %s", s.str().c_str()); + CC_LOG_INFO("SIOClientImpl::handshake() dump data: %s", s.str().c_str()); std::string res = s.str(); std::string sid = ""; @@ -489,7 +489,7 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp if (res.find('}') != std::string::npos) { - CCLOGINFO("SIOClientImpl::handshake() Socket.IO 1.x detected"); + CC_LOG_INFO("SIOClientImpl::handshake() Socket.IO 1.x detected"); _version = SocketIOPacket::SocketIOVersion::V10x; // sample: 97:0{"sid":"GMkL6lzCmgMvMs9bAAAA","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000} // 96:0{"sid":"jzrjDlQusSUxLTd3AAAV","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40 @@ -524,12 +524,12 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp std::string timeout_str = temp.substr(a + 1, b - a); timeout = atoi(timeout_str.c_str()) / 1000; - CCLOGINFO("done parsing 1.x"); + CC_LOG_INFO("done parsing 1.x"); } else { - CCLOGINFO("SIOClientImpl::handshake() Socket.IO 0.9.x detected"); + CC_LOG_INFO("SIOClientImpl::handshake() Socket.IO 0.9.x detected"); _version = SocketIOPacket::SocketIOVersion::V09x; // sample: 3GYzE9md2Ig-lm3cf8Rv:60:60:websocket,htmlfile,xhr-polling,jsonp-polling size_t pos = 0; @@ -567,7 +567,7 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp void SIOClientImpl::openSocket() { - CCLOGINFO("SIOClientImpl::openSocket() called"); + CC_LOG_INFO("SIOClientImpl::openSocket() called"); std::stringstream s; @@ -597,7 +597,7 @@ void SIOClientImpl::openSocket() bool SIOClientImpl::init() { - CCLOGINFO("SIOClientImpl::init() successful"); + CC_LOG_INFO("SIOClientImpl::init() successful"); return true; } @@ -667,7 +667,7 @@ void SIOClientImpl::disconnectFromEndpoint(const std::string& endpoint) if (clientCount == 1 || endpoint == "/") { - CCLOGINFO("SIOClientImpl::disconnectFromEndpoint out of endpoints, checking for disconnect"); + CC_LOG_INFO("SIOClientImpl::disconnectFromEndpoint out of endpoints, checking for disconnect"); if (_connected) this->disconnect(); @@ -690,7 +690,7 @@ void SIOClientImpl::heartbeat(float /*dt*/) this->send(packet); delete packet; - CCLOGINFO("Heartbeat sent"); + CC_LOG_INFO("Heartbeat sent"); } @@ -719,16 +719,16 @@ void SIOClientImpl::send(SocketIOPacket *packet) std::string req = packet->toString(); if (_connected) { - CCLOGINFO("-->SEND:%s", req.data()); + CC_LOG_INFO("-->SEND:%s", req.data()); _ws->send(req.data()); } else - CCLOGINFO("Cant send the message (%s) because disconnected", req.c_str()); + CC_LOG_INFO("Cant send the message (%s) because disconnected", req.c_str()); } void SIOClientImpl::emit(const std::string& endpoint, const std::string& eventname, const std::string& args) { - CCLOGINFO("Emitting event \"%s\"", eventname.c_str()); + CC_LOG_INFO("Emitting event \"%s\"", eventname.c_str()); SocketIOPacket *packet = SocketIOPacket::createPacketWithType("event", _version); packet->setEndpoint(endpoint == "/" ? "" : endpoint); packet->setEvent(eventname); @@ -756,12 +756,12 @@ void SIOClientImpl::onOpen(WebSocket* /*ws*/) client.second->onOpen(); } - CCLOGINFO("SIOClientImpl::onOpen socket connected!"); + CC_LOG_INFO("SIOClientImpl::onOpen socket connected!"); } void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) { - CCLOGINFO("SIOClientImpl::onMessage received: %s", data.bytes); + CC_LOG_INFO("SIOClientImpl::onMessage received: %s", data.bytes); std::string payload = data.bytes; int control = atoi(payload.substr(0, 1).c_str()); @@ -807,39 +807,39 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) s_data = payload; - if (c == nullptr) CCLOGINFO("SIOClientImpl::onMessage client lookup returned nullptr"); + if (c == nullptr) CC_LOG_INFO("SIOClientImpl::onMessage client lookup returned nullptr"); switch (control) { case 0: - CCLOGINFO("Received Disconnect Signal for Endpoint: %s\n", endpoint.c_str()); + CC_LOG_INFO("Received Disconnect Signal for Endpoint: %s\n", endpoint.c_str()); disconnectFromEndpoint(endpoint); if (c) { c->fireEvent("disconnect", payload); } break; case 1: - CCLOGINFO("Connected to endpoint: %s \n", endpoint.c_str()); + CC_LOG_INFO("Connected to endpoint: %s \n", endpoint.c_str()); if (c) { c->onConnect(); c->fireEvent("connect", payload); } break; case 2: - CCLOGINFO("Heartbeat received\n"); + CC_LOG_INFO("Heartbeat received\n"); break; case 3: - CCLOGINFO("Message received: %s \n", s_data.c_str()); + CC_LOG_INFO("Message received: %s \n", s_data.c_str()); if (c) c->getDelegate()->onMessage(c, s_data); if (c) c->fireEvent("message", s_data); break; case 4: - CCLOGINFO("JSON Message Received: %s \n", s_data.c_str()); + CC_LOG_INFO("JSON Message Received: %s \n", s_data.c_str()); if (c) c->getDelegate()->onMessage(c, s_data); if (c) c->fireEvent("json", s_data); break; case 5: - CCLOGINFO("Event Received with data: %s \n", s_data.c_str()); + CC_LOG_INFO("Event Received with data: %s \n", s_data.c_str()); if (c) { @@ -857,15 +857,15 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) break; case 6: - CCLOGINFO("Message Ack\n"); + CC_LOG_INFO("Message Ack\n"); break; case 7: - CCLOGERROR("Error\n"); + CC_LOG_ERROR("Error\n"); //if (c) c->getDelegate()->onError(c, s_data); if (c) c->fireEvent("error", s_data); break; case 8: - CCLOGINFO("Noop\n"); + CC_LOG_INFO("Noop\n"); break; } } @@ -875,29 +875,29 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) switch (control) { case 0: - CCLOGINFO("Not supposed to receive control 0 for websocket"); - CCLOGINFO("That's not good"); + CC_LOG_INFO("Not supposed to receive control 0 for websocket"); + CC_LOG_INFO("That's not good"); break; case 1: - CCLOGINFO("Not supposed to receive control 1 for websocket"); + CC_LOG_INFO("Not supposed to receive control 1 for websocket"); break; case 2: - CCLOGINFO("Ping received, send pong"); + CC_LOG_INFO("Ping received, send pong"); payload = "3" + payload; _ws->send(payload); break; case 3: - CCLOGINFO("Pong received"); + CC_LOG_INFO("Pong received"); if (payload == "probe") { - CCLOGINFO("Request Update"); + CC_LOG_INFO("Request Update"); _ws->send("5"); } break; case 4: { int control2 = payload.at(0) - '0'; - CCLOGINFO("Message code: [%i]", control2); + CC_LOG_INFO("Message code: [%i]", control2); std::string endpoint = ""; @@ -930,20 +930,20 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) switch (control2) { case 0: - CCLOGINFO("Socket Connected"); + CC_LOG_INFO("Socket Connected"); if (c) { c->onConnect(); c->fireEvent("connect", payload); } break; case 1: - CCLOGINFO("Socket Disconnected"); + CC_LOG_INFO("Socket Disconnected"); disconnectFromEndpoint(endpoint); c->fireEvent("disconnect", payload); break; case 2: { - CCLOGINFO("Event Received (%s)", payload.c_str()); + CC_LOG_INFO("Event Received (%s)", payload.c_str()); std::string::size_type payloadFirstSlashPos = payload.find("\""); std::string::size_type payloadSecondSlashPos = payload.substr(payloadFirstSlashPos + 1).find("\""); @@ -951,7 +951,7 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) std::string eventname = payload.substr(payloadFirstSlashPos + 1, payloadSecondSlashPos - payloadFirstSlashPos + 1); - CCLOGINFO("event name %s between %i and %i", eventname.c_str(), + CC_LOG_INFO("event name %s between %i and %i", eventname.c_str(), payloadFirstSlashPos, payloadSecondSlashPos); payload = payload.substr(payloadSecondSlashPos + 4, @@ -963,26 +963,26 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) } break; case 3: - CCLOGINFO("Message Ack"); + CC_LOG_INFO("Message Ack"); break; case 4: - CCLOGERROR("Error"); + CC_LOG_ERROR("Error"); if (c) c->fireEvent("error", payload); break; case 5: - CCLOGINFO("Binary Event"); + CC_LOG_INFO("Binary Event"); break; case 6: - CCLOGINFO("Binary Ack"); + CC_LOG_INFO("Binary Ack"); break; } } break; case 5: - CCLOGINFO("Upgrade required"); + CC_LOG_INFO("Upgrade required"); break; case 6: - CCLOGINFO("Noop\n"); + CC_LOG_INFO("Noop\n"); break; } } @@ -1014,7 +1014,7 @@ void SIOClientImpl::onClose(WebSocket* /*ws*/) void SIOClientImpl::onError(WebSocket* /*ws*/, const WebSocket::ErrorCode& error) { - CCLOGERROR("Websocket error received: %d", static_cast(error)); + CC_LOG_ERROR("Websocket error received: %d", static_cast(error)); } //begin SIOClient methods @@ -1097,7 +1097,7 @@ void SIOClient::on(const std::string& eventName, SIOEvent e) void SIOClient::fireEvent(const std::string& eventName, const std::string& data) { - CCLOGINFO("SIOClient::fireEvent called with event name: %s and data: %s", eventName.c_str(), data.c_str()); + CC_LOG_INFO("SIOClient::fireEvent called with event name: %s and data: %s", eventName.c_str(), data.c_str()); _delegate->fireEventToScript(this, eventName, data); @@ -1110,7 +1110,7 @@ void SIOClient::fireEvent(const std::string& eventName, const std::string& data) return; } - CCLOGINFO("SIOClient::fireEvent no native event with name %s found", eventName.c_str()); + CC_LOG_INFO("SIOClient::fireEvent no native event with name %s found", eventName.c_str()); } void SIOClient::setTag(const char* tag) @@ -1194,10 +1194,10 @@ SIOClient* SocketIO::connect(const std::string& uri, SIODelegate& delegate, cons } else { - CCLOG("SocketIO: disconnect previous client"); + CC_LOG_DEBUG("SocketIO: disconnect previous client"); c->disconnect(); - CCLOG("SocketIO: recreate a new socket, new client, connect"); + CC_LOG_DEBUG("SocketIO: recreate a new socket, new client, connect"); SIOClientImpl* newSocket = SIOClientImpl::create(uriObj, caFilePath); SIOClient *newC = new (std::nothrow) SIOClient(path, newSocket, delegate); diff --git a/native/cocos/network/SocketIO.h b/native/cocos/network/SocketIO.h index de580b763c..8e3a5a638e 100644 --- a/native/cocos/network/SocketIO.h +++ b/native/cocos/network/SocketIO.h @@ -110,7 +110,7 @@ public: * * @param client the connected SIOClient object. */ - virtual void onConnect(SIOClient* client) { CCLOG("SIODelegate onConnect fired"); }; + virtual void onConnect(SIOClient* client) { CC_LOG_DEBUG("SIODelegate onConnect fired"); }; /** * This is kept for backwards compatibility, message is now fired as a socket.io event "message" * @@ -119,7 +119,7 @@ public: * @param client the connected SIOClient object. * @param data the message,it could be json message */ - virtual void onMessage(SIOClient* client, const std::string& data) { CCLOG("SIODelegate onMessage fired with data: %s", data.c_str()); }; + virtual void onMessage(SIOClient* client, const std::string& data) { CC_LOG_DEBUG("SIODelegate onMessage fired with data: %s", data.c_str()); }; /** * Pure virtual callback function, this function should be overridden by the subclass. * @@ -144,7 +144,7 @@ public: * @param eventName the event's name. * @param data the event's data information. */ - virtual void fireEventToScript(SIOClient* client, const std::string& eventName, const std::string& data) { CCLOG("SIODelegate event '%s' fired with data: %s", eventName.c_str(), data.c_str()); }; + virtual void fireEventToScript(SIOClient* client, const std::string& eventName, const std::string& data) { CC_LOG_DEBUG("SIODelegate event '%s' fired with data: %s", eventName.c_str(), data.c_str()); }; }; /** diff --git a/native/cocos/network/Uri.cpp b/native/cocos/network/Uri.cpp index 02aca7ff19..ae22096ca8 100644 --- a/native/cocos/network/Uri.cpp +++ b/native/cocos/network/Uri.cpp @@ -17,7 +17,7 @@ */ #include "network/Uri.h" -#include "base/ccMacros.h" // For CCLOGERROR macro +#include "base/Log.h" // For CC_LOG_ERROR macro #include #include @@ -179,7 +179,7 @@ bool Uri::doParse(const std::string& str) if (str.empty()) { - CCLOGERROR("%s", "Empty URI is invalid!"); + CC_LOG_ERROR("%s", "Empty URI is invalid!"); return false; } @@ -193,7 +193,7 @@ bool Uri::doParse(const std::string& str) std::smatch match; if (UNLIKELY(!std::regex_match(copied.cbegin(), copied.cend(), match, uriRegex))) { - CCLOGERROR("Invalid URI: %s", str.c_str()); + CC_LOG_ERROR("Invalid URI: %s", str.c_str()); return false; } @@ -230,7 +230,7 @@ bool Uri::doParse(const std::string& str) authorityMatch, authorityRegex)) { std::string invalidAuthority(authority.first, authority.second); - CCLOGERROR("Invalid URI authority: %s", invalidAuthority.c_str()); + CC_LOG_ERROR("Invalid URI authority: %s", invalidAuthority.c_str()); return false; } diff --git a/native/cocos/network/WebSocket-libwebsockets.cpp b/native/cocos/network/WebSocket-libwebsockets.cpp index 36f8152477..d0a9281093 100644 --- a/native/cocos/network/WebSocket-libwebsockets.cpp +++ b/native/cocos/network/WebSocket-libwebsockets.cpp @@ -60,7 +60,7 @@ struct lws_protocols; struct lws_vhost; #if (CC_PLATFORM == CC_PLATFORM_WINDOWS) -// log, CCLOG aren't threadsafe, since we uses sub threads for parsing pcm data, threadsafe log output +// log, CC_LOG_DEBUG aren't threadsafe, since we uses sub threads for parsing pcm data, threadsafe log output // is needed. Define the following macros (ALOGV, ALOGD, ALOGI, ALOGW, ALOGE) for threadsafe log output. //IDEA: Move _winLog, winLog to a separated file @@ -126,7 +126,7 @@ static void wsLog(const char * format, ...) #define QUOTEME_(x) #x #define QUOTEME(x) QUOTEME_(x) -// Since CCLOG isn't thread safe, we uses LOGD for multi-thread logging. +// Since CC_LOG_DEBUG isn't thread safe, we uses LOGD for multi-thread logging. #ifdef ANDROID #if COCOS2D_DEBUG > 0 #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG,__VA_ARGS__) diff --git a/native/cocos/platform/CCFileUtils.cpp b/native/cocos/platform/CCFileUtils.cpp index f5afb92259..a5e6ea24a6 100644 --- a/native/cocos/platform/CCFileUtils.cpp +++ b/native/cocos/platform/CCFileUtils.cpp @@ -29,7 +29,7 @@ THE SOFTWARE. #include #include "base/CCData.h" -#include "base/ccMacros.h" +#include "base/Log.h" #include "platform/CCSAXParser.h" #include "tinyxml2/tinyxml2.h" @@ -496,7 +496,7 @@ static tinyxml2::XMLElement* generateElementForObject(const Value& value, tinyxm if (value.getType() == Value::Type::MAP) return generateElementForDict(value.asValueMap(), doc); - CCLOG("This type cannot appear in property list"); + CC_LOG_DEBUG("This type cannot appear in property list"); return nullptr; } @@ -812,7 +812,7 @@ std::string FileUtils::fullPathForFilename(const std::string &filename) const } if(isPopupNotify()){ - CCLOG("fullPathForFilename: No file found at %s. Possible missing file.", filename.c_str()); + CC_LOG_DEBUG("fullPathForFilename: No file found at %s. Possible missing file.", filename.c_str()); } // The file wasn't found, return empty string. @@ -941,7 +941,7 @@ void FileUtils::setSearchPaths(const std::vector& searchPaths) if (!existDefaultRootPath) { - //CCLOG("Default root path doesn't exist, adding it."); + //CC_LOG_DEBUG("Default root path doesn't exist, adding it."); _searchPathArray.push_back(_defaultResRootPath); } } @@ -984,7 +984,7 @@ void FileUtils::loadFilenameLookupDictionaryFromFile(const std::string &filename int version = metadata["version"].asInt(); if (version != 1) { - CCLOG("ERROR: Invalid filenameLookup dictionary version: %d. Filename: %s", version, filename.c_str()); + CC_LOG_DEBUG("ERROR: Invalid filenameLookup dictionary version: %d. Filename: %s", version, filename.c_str()); return; } setFilenameLookupDictionary( dict["filenames"].asValueMap()); @@ -1378,7 +1378,7 @@ bool FileUtils::renameFile(const std::string &oldfullpath, const std::string &ne if (0 != errorCode) { - CCLOGERROR("Fail to rename file %s to %s !Error code is %d", oldfullpath.c_str(), newfullpath.c_str(), errorCode); + CC_LOG_ERROR("Fail to rename file %s to %s !Error code is %d", oldfullpath.c_str(), newfullpath.c_str(), errorCode); return false; } return true; diff --git a/native/cocos/platform/CCImage.cpp b/native/cocos/platform/CCImage.cpp index 1ac9fef415..a68c48eae9 100644 --- a/native/cocos/platform/CCImage.cpp +++ b/native/cocos/platform/CCImage.cpp @@ -544,7 +544,7 @@ namespace //(*cinfo->err->output_message) (cinfo); char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message) (cinfo, buffer); - CCLOG("jpeg error: %s", buffer); + CC_LOG_DEBUG("jpeg error: %s", buffer); /* Return control to the setjmp point */ longjmp(myerr->setjmp_buffer, 1); @@ -685,7 +685,7 @@ bool Image::initWithPngData(const unsigned char * data, ssize_t dataLen) png_byte bit_depth = png_get_bit_depth(png_ptr, info_ptr); png_uint_32 color_type = png_get_color_type(png_ptr, info_ptr); - //CCLOG("color type %u", color_type); + //CC_LOG_DEBUG("color type %u", color_type); // force palette images to be expanded to 24-bit RGB // it may include alpha channel @@ -812,19 +812,19 @@ bool Image::initWithPVRv2Data(const unsigned char * data, ssize_t dataLen) bool flipped = (flags & (unsigned int)PVR2TextureFlag::VerticalFlip) ? true : false; if (flipped) { - CCLOG("initWithPVRv2Data: WARNING: Image is flipped. Regenerate it using PVRTexTool"); + CC_LOG_DEBUG("initWithPVRv2Data: WARNING: Image is flipped. Regenerate it using PVRTexTool"); } if (v2_pixel_formathash.find(formatFlags) == v2_pixel_formathash.end()) { - CCLOG("initWithPVRv2Data: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", (int)formatFlags); + CC_LOG_DEBUG("initWithPVRv2Data: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", (int)formatFlags); return false; } auto it = v2_pixel_formathash.find(formatFlags); if (it == v2_pixel_formathash.end() ) { - CCLOG("initWithPVRv2Data: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", (int)formatFlags); + CC_LOG_DEBUG("initWithPVRv2Data: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", (int)formatFlags); return false; } @@ -909,7 +909,7 @@ bool Image::initWithPVRv3Data(const unsigned char * data, ssize_t dataLen) // validate version if (CC_SWAP_INT32_BIG_TO_HOST(header->version) != 0x50565203) { - CCLOG("initWithPVRv3Data: WARNING: pvr file version mismatch"); + CC_LOG_DEBUG("initWithPVRv3Data: WARNING: pvr file version mismatch"); return false; } @@ -918,7 +918,7 @@ bool Image::initWithPVRv3Data(const unsigned char * data, ssize_t dataLen) if (v3_pixel_formathash.find(pixelFormat) == v3_pixel_formathash.end()) { - CCLOG("initWithPVRv3Data: WARNING: Unsupported PVR Pixel Format: 0x%016llX. Re-encode it with a OpenGL pixel format variant", + CC_LOG_DEBUG("initWithPVRv3Data: WARNING: Unsupported PVR Pixel Format: 0x%016llX. Re-encode it with a OpenGL pixel format variant", static_cast(pixelFormat)); return false; } @@ -926,7 +926,7 @@ bool Image::initWithPVRv3Data(const unsigned char * data, ssize_t dataLen) auto it = v3_pixel_formathash.find(pixelFormat); if (it == v3_pixel_formathash.end() ) { - CCLOG("initWithPVRv3Data: WARNING: Unsupported PVR Pixel Format: 0x%016llX. Re-encode it with a OpenGL pixel format variant", + CC_LOG_DEBUG("initWithPVRv3Data: WARNING: Unsupported PVR Pixel Format: 0x%016llX. Re-encode it with a OpenGL pixel format variant", static_cast(pixelFormat)); return false; } @@ -1153,7 +1153,7 @@ bool Image::saveToFile(const std::string& filename, bool isToRGB) //only support for Image::PixelFormat::RGB888 or Image::PixelFormat::RGBA8888 uncompressed data if (isCompressed() || (_renderFormat != gfx::GFXFormat::RGB8 && _renderFormat != gfx::GFXFormat::RGBA8)) { - CCLOG("saveToFile: Image: saveToFile is only support for Image::PixelFormat::RGB888 or Image::PixelFormat::RGBA8888 uncompressed data for now"); + CC_LOG_DEBUG("saveToFile: Image: saveToFile is only support for Image::PixelFormat::RGB888 or Image::PixelFormat::RGBA8888 uncompressed data for now"); return false; } @@ -1169,7 +1169,7 @@ bool Image::saveToFile(const std::string& filename, bool isToRGB) } else { - CCLOG("saveToFile: Image: saveToFile no support file extension(only .png or .jpg) for file: %s", filename.c_str()); + CC_LOG_DEBUG("saveToFile: Image: saveToFile no support file extension(only .png or .jpg) for file: %s", filename.c_str()); return false; } } diff --git a/native/cocos/platform/android/CCFileUtils-android.cpp b/native/cocos/platform/android/CCFileUtils-android.cpp index 9a233afa63..ff8ae266df 100644 --- a/native/cocos/platform/android/CCFileUtils-android.cpp +++ b/native/cocos/platform/android/CCFileUtils-android.cpp @@ -33,6 +33,7 @@ THE SOFTWARE. #include "android/asset_manager.h" #include "android/asset_manager_jni.h" #include "base/ZipUtils.h" +#include "base/Log.h" #include #include @@ -68,7 +69,7 @@ FileUtils* FileUtils::getInstance() { delete s_sharedFileUtils; s_sharedFileUtils = nullptr; - CCLOG("ERROR: Could not init CCFileUtilsAndroid"); + CC_LOG_DEBUG("ERROR: Could not init CCFileUtilsAndroid"); } } return s_sharedFileUtils; @@ -180,7 +181,7 @@ bool FileUtilsAndroid::isFileExistInternal(const std::string& strFilePath) const bFound = true; AAsset_close(aa); } else { - // CCLOG("[AssetManager] ... in APK %s, found = false!", strFilePath.c_str()); + // CC_LOG_DEBUG("[AssetManager] ... in APK %s, found = false!", strFilePath.c_str()); } } } @@ -212,7 +213,7 @@ bool FileUtilsAndroid::isDirectoryExistInternal(const std::string& dirPath_) con // find absolute path in flash memory if (dirPath[0] == '/') { - CCLOG("find in flash memory dirPath(%s)", dirPath.c_str()); + CC_LOG_DEBUG("find in flash memory dirPath(%s)", dirPath.c_str()); struct stat st; if (stat(dirPath.c_str(), &st) == 0) { @@ -223,7 +224,7 @@ bool FileUtilsAndroid::isDirectoryExistInternal(const std::string& dirPath_) con { // find it in apk's assets dir // Found "@assets/" at the beginning of the path and we don't want it - CCLOG("find in apk dirPath(%s)", dirPath.c_str()); + CC_LOG_DEBUG("find in apk dirPath(%s)", dirPath.c_str()); const char* s = dirPath.c_str(); if (dirPath.find(_defaultResRootPath) == 0) { diff --git a/native/cocos/platform/apple/CCFileUtils-apple.mm b/native/cocos/platform/apple/CCFileUtils-apple.mm index 5d1bca3169..aed2c391db 100644 --- a/native/cocos/platform/apple/CCFileUtils-apple.mm +++ b/native/cocos/platform/apple/CCFileUtils-apple.mm @@ -35,6 +35,7 @@ THE SOFTWARE. #include "platform/CCFileUtils.h" #include "platform/CCSAXParser.h" +#include "base/Log.h" namespace cc { @@ -221,7 +222,7 @@ FileUtils* FileUtils::getInstance() { delete s_sharedFileUtils; s_sharedFileUtils = nullptr; - CCLOG("ERROR: Could not init CCFileUtilsApple"); + CC_LOG_DEBUG("ERROR: Could not init CCFileUtilsApple"); } } return s_sharedFileUtils; @@ -290,7 +291,7 @@ static int unlink_cb(const char *fpath, const struct stat *sb, int typeflag, str auto ret = remove(fpath); if (ret) { - log("Fail to remove: %s ",fpath); + CC_LOG_INFO("Fail to remove: %s ",fpath); } return ret; @@ -300,7 +301,7 @@ bool FileUtilsApple::removeDirectory(const std::string& path) { if (path.empty()) { - CCLOGERROR("Fail to remove directory, path is empty!"); + CC_LOG_ERROR("Fail to remove directory, path is empty!"); return false; } @@ -381,7 +382,7 @@ bool FileUtilsApple::writeToFile(const ValueMap& dict, const std::string &fullPa bool FileUtils::writeValueMapToFile(const ValueMap& dict, const std::string& fullPath) { valueMapCompact(const_cast(dict)); - //CCLOG("iOS||Mac Dictionary %d write to file %s", dict->_ID, fullPath.c_str()); + //CC_LOG_DEBUG("iOS||Mac Dictionary %d write to file %s", dict->_ID, fullPath.c_str()); NSMutableDictionary *nsDict = [NSMutableDictionary dictionary]; for (auto iter = dict.begin(); iter != dict.end(); ++iter) @@ -494,7 +495,7 @@ bool FileUtilsApple::createDirectory(const std::string& path) if(!result && error != nil) { - CCLOGERROR("Fail to create directory \"%s\": %s", path.c_str(), [error.localizedDescription UTF8String]); + CC_LOG_ERROR("Fail to create directory \"%s\": %s", path.c_str(), [error.localizedDescription UTF8String]); } return result; diff --git a/native/cocos/platform/win32/CCFileUtils-win32.cpp b/native/cocos/platform/win32/CCFileUtils-win32.cpp index 2eba6325b6..8e333dd23a 100644 --- a/native/cocos/platform/win32/CCFileUtils-win32.cpp +++ b/native/cocos/platform/win32/CCFileUtils-win32.cpp @@ -29,6 +29,7 @@ THE SOFTWARE. #include "platform/win32/CCFileUtils-win32.h" #include "platform/win32/CCUtils-win32.h" +#include "base/Log.h" #include #include #include @@ -86,7 +87,7 @@ FileUtils* FileUtils::getInstance() { delete s_sharedFileUtils; s_sharedFileUtils = nullptr; - CCLOG("ERROR: Could not init CCFileUtilsWin32"); + CC_LOG_DEBUG("ERROR: Could not init CCFileUtilsWin32"); } } return s_sharedFileUtils; @@ -195,7 +196,7 @@ FileUtils::Status FileUtilsWin32::getContents(const std::string& filename, Resiz ::CloseHandle(fileHandle); if (!successed) { - CCLOG("Get data from file(%s) failed, error code is %s", filename.data(), std::to_string(::GetLastError()).data()); + CC_LOG_DEBUG("Get data from file(%s) failed, error code is %s", filename.data(), std::to_string(::GetLastError()).data()); buffer->resize(sizeRead); return FileUtils::Status::ReadFailed; } @@ -284,7 +285,7 @@ bool FileUtilsWin32::renameFile(const std::string &oldfullpath, const std::strin { if (!DeleteFile(_wNew.c_str())) { - CCLOGERROR("Fail to delete file %s !Error code is 0x%x", newfullpath.c_str(), GetLastError()); + CC_LOG_ERROR("Fail to delete file %s !Error code is 0x%x", newfullpath.c_str(), GetLastError()); } } @@ -294,7 +295,7 @@ bool FileUtilsWin32::renameFile(const std::string &oldfullpath, const std::strin } else { - CCLOGERROR("Fail to rename file %s to %s !Error code is 0x%x", oldfullpath.c_str(), newfullpath.c_str(), GetLastError()); + CC_LOG_ERROR("Fail to rename file %s to %s !Error code is 0x%x", oldfullpath.c_str(), newfullpath.c_str(), GetLastError()); return false; } } @@ -360,7 +361,7 @@ bool FileUtilsWin32::createDirectory(const std::string& dirPath) BOOL ret = CreateDirectory(subpath.c_str(), NULL); if (!ret && ERROR_ALREADY_EXISTS != GetLastError()) { - CCLOGERROR("Fail create directory %s !Error code is 0x%x", utf8Path.c_str(), GetLastError()); + CC_LOG_ERROR("Fail create directory %s !Error code is 0x%x", utf8Path.c_str(), GetLastError()); return false; } } @@ -380,7 +381,7 @@ bool FileUtilsWin32::removeFile(const std::string &filepath) } else { - CCLOGERROR("Fail remove file %s !Error code is 0x%x", filepath.c_str(), GetLastError()); + CC_LOG_ERROR("Fail remove file %s !Error code is 0x%x", filepath.c_str(), GetLastError()); return false; } } diff --git a/native/cocos/platform/win32/CCUtils-win32.cpp b/native/cocos/platform/win32/CCUtils-win32.cpp index 0294a28286..b715e0f0b4 100644 --- a/native/cocos/platform/win32/CCUtils-win32.cpp +++ b/native/cocos/platform/win32/CCUtils-win32.cpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include "platform/win32/CCUtils-win32.h" #include "platform/CCStdC.h" #include -#include "base/ccMacros.h" +#include "base/Log.h" namespace cc { @@ -48,7 +48,7 @@ std::wstring StringUtf8ToWideChar(const std::string& strUtf8) } else { - CCLOG("Wrong convert to WideChar code:0x%x", GetLastError()); + CC_LOG_DEBUG("Wrong convert to WideChar code:0x%x", GetLastError()); } } return ret; @@ -72,7 +72,7 @@ std::string StringWideCharToUtf8(const std::wstring& strWideChar) } else { - CCLOG("Wrong convert to Utf8 code:0x%x", GetLastError()); + CC_LOG_DEBUG("Wrong convert to Utf8 code:0x%x", GetLastError()); } } @@ -98,7 +98,7 @@ std::string UTF8StringToMultiByte(const std::string& strUtf8) } else { - CCLOG("Wrong convert to Ansi code:0x%x", GetLastError()); + CC_LOG_DEBUG("Wrong convert to Ansi code:0x%x", GetLastError()); } } diff --git a/native/cocos/platform/win32/View-win32.cpp b/native/cocos/platform/win32/View-win32.cpp index 11ca7899fd..97f181af1d 100644 --- a/native/cocos/platform/win32/View-win32.cpp +++ b/native/cocos/platform/win32/View-win32.cpp @@ -23,6 +23,7 @@ THE SOFTWARE. ****************************************************************************/ #include "View-win32.h" +#include "base/Log.h" #include @@ -134,7 +135,7 @@ bool View::init() if (SDL_Init(SDL_INIT_VIDEO) < 0) { // Display error message - CCLOGERROR("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); + CC_LOG_ERROR("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); return false; } _inited = true; @@ -146,7 +147,7 @@ bool View::init() if (_window == NULL) { // Display error message - CCLOGERROR("Window could not be created! SDL_Error: %s\n", SDL_GetError()); + CC_LOG_ERROR("Window could not be created! SDL_Error: %s\n", SDL_GetError()); return false; } return true; @@ -262,7 +263,7 @@ bool View::pollEvent(bool * quit, bool *resume, bool *pause) keyboard.altKeyActive = mode & KMOD_ALT; keyboard.ctrlKeyActive = mode & KMOD_CTRL; keyboard.shiftKeyActive = mode & KMOD_SHIFT; - //CCLOG("==> key %d -> code %d", event.keysym.sym, keyboard.key); + //CC_LOG_DEBUG("==> key %d -> code %d", event.keysym.sym, keyboard.key); cc::EventDispatcher::dispatchKeyboardEvent(keyboard); break; } diff --git a/native/cocos/renderer/core/CoreStd.h b/native/cocos/renderer/core/CoreStd.h index 194176e60d..fedf3caba1 100644 --- a/native/cocos/renderer/core/CoreStd.h +++ b/native/cocos/renderer/core/CoreStd.h @@ -1,7 +1,7 @@ #ifndef CC_CORE_CORE_STD_H_ #define CC_CORE_CORE_STD_H_ -#include "base/CoreDef.h" +#include "base/ccMacros.h" // STD including #include diff --git a/native/cocos/renderer/core/gfx/GFXBindingLayout.h b/native/cocos/renderer/core/gfx/GFXBindingLayout.h index 5fbca2fd87..e06f8a5b55 100755 --- a/native/cocos/renderer/core/gfx/GFXBindingLayout.h +++ b/native/cocos/renderer/core/gfx/GFXBindingLayout.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXBindingLayout : public GFXObject { +class CC_DLL GFXBindingLayout : public GFXObject { public: GFXBindingLayout(GFXDevice *device); virtual ~GFXBindingLayout(); diff --git a/native/cocos/renderer/core/gfx/GFXBuffer.h b/native/cocos/renderer/core/gfx/GFXBuffer.h index 907dada188..dd66af8dbb 100755 --- a/native/cocos/renderer/core/gfx/GFXBuffer.h +++ b/native/cocos/renderer/core/gfx/GFXBuffer.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXBuffer : public GFXObject { +class CC_DLL GFXBuffer : public GFXObject { public: GFXBuffer(GFXDevice *device); virtual ~GFXBuffer(); diff --git a/native/cocos/renderer/core/gfx/GFXCommandAllocator.h b/native/cocos/renderer/core/gfx/GFXCommandAllocator.h index da18e2ec2c..088e8f4e95 100755 --- a/native/cocos/renderer/core/gfx/GFXCommandAllocator.h +++ b/native/cocos/renderer/core/gfx/GFXCommandAllocator.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXCommandAllocator : public GFXObject { +class CC_DLL GFXCommandAllocator : public GFXObject { public: GFXCommandAllocator(GFXDevice *device); virtual ~GFXCommandAllocator(); diff --git a/native/cocos/renderer/core/gfx/GFXCommandBuffer.h b/native/cocos/renderer/core/gfx/GFXCommandBuffer.h index 60bb2a8d22..0466b86c64 100755 --- a/native/cocos/renderer/core/gfx/GFXCommandBuffer.h +++ b/native/cocos/renderer/core/gfx/GFXCommandBuffer.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXCommandBuffer : public GFXObject { +class CC_DLL GFXCommandBuffer : public GFXObject { public: GFXCommandBuffer(GFXDevice *device); virtual ~GFXCommandBuffer(); diff --git a/native/cocos/renderer/core/gfx/GFXContext.h b/native/cocos/renderer/core/gfx/GFXContext.h index 615208d463..1a2ee78c2e 100755 --- a/native/cocos/renderer/core/gfx/GFXContext.h +++ b/native/cocos/renderer/core/gfx/GFXContext.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXContext : public Object { +class CC_DLL GFXContext : public Object { public: GFXContext(GFXDevice *device); virtual ~GFXContext(); diff --git a/native/cocos/renderer/core/gfx/GFXDef.h b/native/cocos/renderer/core/gfx/GFXDef.h index c836978780..38c5af6188 100755 --- a/native/cocos/renderer/core/gfx/GFXDef.h +++ b/native/cocos/renderer/core/gfx/GFXDef.h @@ -1016,17 +1016,17 @@ struct GFXFormatInfo { bool isCompressed = false; }; -extern CC_CORE_API const GFXFormatInfo GFX_FORMAT_INFOS[]; -extern CC_CORE_API const uint GFX_TYPE_SIZES[]; +extern CC_DLL const GFXFormatInfo GFX_FORMAT_INFOS[]; +extern CC_DLL const uint GFX_TYPE_SIZES[]; struct GFXMemoryStatus { uint bufferSize = 0; uint textureSize = 0; }; -extern CC_CORE_API uint GFXFormatSize(GFXFormat format, uint width, uint height, uint depth); +extern CC_DLL uint GFXFormatSize(GFXFormat format, uint width, uint height, uint depth); -extern CC_CORE_API uint GFXFormatSurfaceSize(GFXFormat format, uint width, uint height, uint depth, uint mips); +extern CC_DLL uint GFXFormatSurfaceSize(GFXFormat format, uint width, uint height, uint depth, uint mips); } // namespace gfx } // namespace cc diff --git a/native/cocos/renderer/core/gfx/GFXDevice.h b/native/cocos/renderer/core/gfx/GFXDevice.h index 46fb5ef268..fa49a8542f 100755 --- a/native/cocos/renderer/core/gfx/GFXDevice.h +++ b/native/cocos/renderer/core/gfx/GFXDevice.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXDevice : public Object { +class CC_DLL GFXDevice : public Object { public: GFXDevice(); virtual ~GFXDevice(); diff --git a/native/cocos/renderer/core/gfx/GFXFence.h b/native/cocos/renderer/core/gfx/GFXFence.h index a4dd59effe..9bf8151bc4 100644 --- a/native/cocos/renderer/core/gfx/GFXFence.h +++ b/native/cocos/renderer/core/gfx/GFXFence.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXFence : public GFXObject { +class CC_DLL GFXFence : public GFXObject { public: GFXFence(GFXDevice *device); virtual ~GFXFence(); diff --git a/native/cocos/renderer/core/gfx/GFXFramebuffer.h b/native/cocos/renderer/core/gfx/GFXFramebuffer.h index 69f87009a0..21e71ae069 100755 --- a/native/cocos/renderer/core/gfx/GFXFramebuffer.h +++ b/native/cocos/renderer/core/gfx/GFXFramebuffer.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXFramebuffer : public GFXObject { +class CC_DLL GFXFramebuffer : public GFXObject { public: GFXFramebuffer(GFXDevice *device); virtual ~GFXFramebuffer(); diff --git a/native/cocos/renderer/core/gfx/GFXInputAssembler.h b/native/cocos/renderer/core/gfx/GFXInputAssembler.h index 2dc8ed7e05..d9029f56c1 100755 --- a/native/cocos/renderer/core/gfx/GFXInputAssembler.h +++ b/native/cocos/renderer/core/gfx/GFXInputAssembler.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXInputAssembler : public GFXObject { +class CC_DLL GFXInputAssembler : public GFXObject { public: GFXInputAssembler(GFXDevice *device); virtual ~GFXInputAssembler(); diff --git a/native/cocos/renderer/core/gfx/GFXPipelineLayout.h b/native/cocos/renderer/core/gfx/GFXPipelineLayout.h index fe93d8cb19..9fa3b8e787 100755 --- a/native/cocos/renderer/core/gfx/GFXPipelineLayout.h +++ b/native/cocos/renderer/core/gfx/GFXPipelineLayout.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXPipelineLayout : public GFXObject { +class CC_DLL GFXPipelineLayout : public GFXObject { public: GFXPipelineLayout(GFXDevice *device); virtual ~GFXPipelineLayout(); diff --git a/native/cocos/renderer/core/gfx/GFXPipelineState.h b/native/cocos/renderer/core/gfx/GFXPipelineState.h index aac716b564..e75d66f914 100755 --- a/native/cocos/renderer/core/gfx/GFXPipelineState.h +++ b/native/cocos/renderer/core/gfx/GFXPipelineState.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXPipelineState : public GFXObject { +class CC_DLL GFXPipelineState : public GFXObject { public: GFXPipelineState(GFXDevice *device); virtual ~GFXPipelineState(); diff --git a/native/cocos/renderer/core/gfx/GFXQueue.h b/native/cocos/renderer/core/gfx/GFXQueue.h index c62935737d..26fe32e7c4 100755 --- a/native/cocos/renderer/core/gfx/GFXQueue.h +++ b/native/cocos/renderer/core/gfx/GFXQueue.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXQueue : public GFXObject { +class CC_DLL GFXQueue : public GFXObject { public: GFXQueue(GFXDevice *device); virtual ~GFXQueue(); diff --git a/native/cocos/renderer/core/gfx/GFXRenderPass.h b/native/cocos/renderer/core/gfx/GFXRenderPass.h index 1c646f61ce..8f8a53ccab 100755 --- a/native/cocos/renderer/core/gfx/GFXRenderPass.h +++ b/native/cocos/renderer/core/gfx/GFXRenderPass.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXRenderPass : public GFXObject { +class CC_DLL GFXRenderPass : public GFXObject { public: GFXRenderPass(GFXDevice *device); virtual ~GFXRenderPass(); diff --git a/native/cocos/renderer/core/gfx/GFXSampler.h b/native/cocos/renderer/core/gfx/GFXSampler.h index dd38ef034e..ff9f4baae1 100755 --- a/native/cocos/renderer/core/gfx/GFXSampler.h +++ b/native/cocos/renderer/core/gfx/GFXSampler.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXSampler : public GFXObject { +class CC_DLL GFXSampler : public GFXObject { public: GFXSampler(GFXDevice *device); virtual ~GFXSampler(); diff --git a/native/cocos/renderer/core/gfx/GFXShader.h b/native/cocos/renderer/core/gfx/GFXShader.h index 8cab1b8aaf..fddd549d89 100755 --- a/native/cocos/renderer/core/gfx/GFXShader.h +++ b/native/cocos/renderer/core/gfx/GFXShader.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXShader : public GFXObject { +class CC_DLL GFXShader : public GFXObject { public: GFXShader(GFXDevice *device); virtual ~GFXShader(); diff --git a/native/cocos/renderer/core/gfx/GFXTexture.h b/native/cocos/renderer/core/gfx/GFXTexture.h index 4de459938a..7a5205bd6c 100755 --- a/native/cocos/renderer/core/gfx/GFXTexture.h +++ b/native/cocos/renderer/core/gfx/GFXTexture.h @@ -6,7 +6,7 @@ namespace cc { namespace gfx { -class CC_CORE_API GFXTexture : public GFXObject { +class CC_DLL GFXTexture : public GFXObject { public: GFXTexture(GFXDevice *device); virtual ~GFXTexture(); diff --git a/native/cocos/renderer/core/math/CCCoreMath.h b/native/cocos/renderer/core/math/CCCoreMath.h index cfe68fc0af..741102267d 100755 --- a/native/cocos/renderer/core/math/CCCoreMath.h +++ b/native/cocos/renderer/core/math/CCCoreMath.h @@ -6,28 +6,28 @@ CC_MATH_NAMESPACE_BEGIN -extern CC_CORE_API const float PI; -extern CC_CORE_API const float PI_2; -extern CC_CORE_API const float PI_DIV2; -extern CC_CORE_API const float PI_DIV3; -extern CC_CORE_API const float PI_DIV4; -extern CC_CORE_API const float PI_DIV5; -extern CC_CORE_API const float PI_DIV6; -extern CC_CORE_API const float PI_DIV8; -extern CC_CORE_API const float PI_SQR; -extern CC_CORE_API const float PI_INV; -extern CC_CORE_API const float EPSILON; -extern CC_CORE_API const float LOW_EPSILON; -extern CC_CORE_API const float POS_INFINITY; -extern CC_CORE_API const float NEG_INFINITY; -extern CC_CORE_API const float LN2; -extern CC_CORE_API const float LN10; -extern CC_CORE_API const float LN2_INV; -extern CC_CORE_API const float LN10_INV; -extern CC_CORE_API const float DEG_TO_RAD; -extern CC_CORE_API const float RAD_TO_DEG; -extern CC_CORE_API const float MIN_FLOAT; -extern CC_CORE_API const float MAX_FLOAT; +extern CC_DLL const float PI; +extern CC_DLL const float PI_2; +extern CC_DLL const float PI_DIV2; +extern CC_DLL const float PI_DIV3; +extern CC_DLL const float PI_DIV4; +extern CC_DLL const float PI_DIV5; +extern CC_DLL const float PI_DIV6; +extern CC_DLL const float PI_DIV8; +extern CC_DLL const float PI_SQR; +extern CC_DLL const float PI_INV; +extern CC_DLL const float EPSILON; +extern CC_DLL const float LOW_EPSILON; +extern CC_DLL const float POS_INFINITY; +extern CC_DLL const float NEG_INFINITY; +extern CC_DLL const float LN2; +extern CC_DLL const float LN10; +extern CC_DLL const float LN2_INV; +extern CC_DLL const float LN10_INV; +extern CC_DLL const float DEG_TO_RAD; +extern CC_DLL const float RAD_TO_DEG; +extern CC_DLL const float MIN_FLOAT; +extern CC_DLL const float MAX_FLOAT; uint16_t CRC16(const char* str); uint32_t CRC32(const char* str); diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp index 1cc75535e8..84a2f47872 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp @@ -114,7 +114,7 @@ SE_BIND_CTOR(js_audioengine_AudioProfile_constructor, __jsb_cc_AudioProfile_clas static bool js_cc_AudioProfile_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::AudioProfile)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::AudioProfile)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index 8cdddb58e6..66dcc6a575 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -927,7 +927,7 @@ SE_BIND_FUNC(js_engine_FileUtils_getInstance) static bool js_cc_FileUtils_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::FileUtils)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::FileUtils)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -1290,7 +1290,7 @@ SE_BIND_CTOR(js_engine_CanvasGradient_constructor, __jsb_cc_CanvasGradient_class static bool js_cc_CanvasGradient_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::CanvasGradient)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::CanvasGradient)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -1817,7 +1817,7 @@ SE_BIND_CTOR(js_engine_CanvasRenderingContext2D_constructor, __jsb_cc_CanvasRend static bool js_cc_CanvasRenderingContext2D_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::CanvasRenderingContext2D)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::CanvasRenderingContext2D)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp index 6ae2bf02d4..d442a2645e 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp @@ -271,7 +271,7 @@ SE_BIND_CTOR(js_extension_EventAssetsManagerEx_constructor, __jsb_cc_extension_E static bool js_cc_extension_EventAssetsManagerEx_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::extension::EventAssetsManagerEx)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::extension::EventAssetsManagerEx)", s.nativeThisObject()); cc::extension::EventAssetsManagerEx* cobj = (cc::extension::EventAssetsManagerEx*)s.nativeThisObject(); cobj->release(); return true; @@ -577,7 +577,7 @@ SE_BIND_CTOR(js_extension_Manifest_constructor, __jsb_cc_extension_Manifest_clas static bool js_cc_extension_Manifest_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::extension::Manifest)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::extension::Manifest)", s.nativeThisObject()); cc::extension::Manifest* cobj = (cc::extension::Manifest*)s.nativeThisObject(); cobj->release(); return true; @@ -1190,7 +1190,7 @@ SE_BIND_CTOR(js_extension_AssetsManagerEx_constructor, __jsb_cc_extension_Assets static bool js_cc_extension_AssetsManagerEx_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::extension::AssetsManagerEx)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::extension::AssetsManagerEx)", s.nativeThisObject()); cc::extension::AssetsManagerEx* cobj = (cc::extension::AssetsManagerEx*)s.nativeThisObject(); cobj->release(); return true; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp index 13a1d9e651..2a14935727 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp @@ -101,7 +101,7 @@ SE_BIND_CTOR(js_network_Downloader_constructor, __jsb_cc_network_Downloader_clas static bool js_cc_network_Downloader_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::network::Downloader)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::network::Downloader)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_gfx_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_gfx_auto.cpp index a3ae19900f..934ed43bde 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_gfx_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_gfx_auto.cpp @@ -187,7 +187,7 @@ SE_BIND_CTOR(js_gfx_GFXOffset_constructor, __jsb_cc_gfx_GFXOffset_class, js_cc_g static bool js_cc_gfx_GFXOffset_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXOffset)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXOffset)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -433,7 +433,7 @@ SE_BIND_CTOR(js_gfx_GFXRect_constructor, __jsb_cc_gfx_GFXRect_class, js_cc_gfx_G static bool js_cc_gfx_GFXRect_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXRect)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXRect)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -641,7 +641,7 @@ SE_BIND_CTOR(js_gfx_GFXExtent_constructor, __jsb_cc_gfx_GFXExtent_class, js_cc_g static bool js_cc_gfx_GFXExtent_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXExtent)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXExtent)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -848,7 +848,7 @@ SE_BIND_CTOR(js_gfx_GFXTextureSubres_constructor, __jsb_cc_gfx_GFXTextureSubres_ static bool js_cc_gfx_GFXTextureSubres_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTextureSubres)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTextureSubres)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -1133,7 +1133,7 @@ SE_BIND_CTOR(js_gfx_GFXTextureCopy_constructor, __jsb_cc_gfx_GFXTextureCopy_clas static bool js_cc_gfx_GFXTextureCopy_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTextureCopy)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTextureCopy)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -1420,7 +1420,7 @@ SE_BIND_CTOR(js_gfx_GFXBufferTextureCopy_constructor, __jsb_cc_gfx_GFXBufferText static bool js_cc_gfx_GFXBufferTextureCopy_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBufferTextureCopy)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBufferTextureCopy)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -1746,7 +1746,7 @@ SE_BIND_CTOR(js_gfx_GFXViewport_constructor, __jsb_cc_gfx_GFXViewport_class, js_ static bool js_cc_gfx_GFXViewport_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXViewport)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXViewport)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -1995,7 +1995,7 @@ SE_BIND_CTOR(js_gfx_GFXColor_constructor, __jsb_cc_gfx_GFXColor_class, js_cc_gfx static bool js_cc_gfx_GFXColor_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXColor)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXColor)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -2320,7 +2320,7 @@ SE_BIND_CTOR(js_gfx_GFXDeviceInfo_constructor, __jsb_cc_gfx_GFXDeviceInfo_class, static bool js_cc_gfx_GFXDeviceInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXDeviceInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXDeviceInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -2530,7 +2530,7 @@ SE_BIND_CTOR(js_gfx_GFXContextInfo_constructor, __jsb_cc_gfx_GFXContextInfo_clas static bool js_cc_gfx_GFXContextInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXContextInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXContextInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -2815,7 +2815,7 @@ SE_BIND_CTOR(js_gfx_GFXBufferInfo_constructor, __jsb_cc_gfx_GFXBufferInfo_class, static bool js_cc_gfx_GFXBufferInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBufferInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBufferInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -3180,7 +3180,7 @@ SE_BIND_CTOR(js_gfx_GFXDrawInfo_constructor, __jsb_cc_gfx_GFXDrawInfo_class, js_ static bool js_cc_gfx_GFXDrawInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXDrawInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXDrawInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -3290,7 +3290,7 @@ SE_BIND_CTOR(js_gfx_GFXIndirectBuffer_constructor, __jsb_cc_gfx_GFXIndirectBuffe static bool js_cc_gfx_GFXIndirectBuffer_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXIndirectBuffer)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXIndirectBuffer)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -3768,7 +3768,7 @@ SE_BIND_CTOR(js_gfx_GFXTextureInfo_constructor, __jsb_cc_gfx_GFXTextureInfo_clas static bool js_cc_gfx_GFXTextureInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTextureInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTextureInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -4138,7 +4138,7 @@ SE_BIND_CTOR(js_gfx_GFXTextureViewInfo_constructor, __jsb_cc_gfx_GFXTextureViewI static bool js_cc_gfx_GFXTextureViewInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTextureViewInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTextureViewInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -4739,7 +4739,7 @@ SE_BIND_CTOR(js_gfx_GFXSamplerInfo_constructor, __jsb_cc_gfx_GFXSamplerInfo_clas static bool js_cc_gfx_GFXSamplerInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXSamplerInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXSamplerInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -4917,7 +4917,7 @@ SE_BIND_CTOR(js_gfx_GFXShaderMacro_constructor, __jsb_cc_gfx_GFXShaderMacro_clas static bool js_cc_gfx_GFXShaderMacro_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXShaderMacro)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXShaderMacro)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -5123,7 +5123,7 @@ SE_BIND_CTOR(js_gfx_GFXUniform_constructor, __jsb_cc_gfx_GFXUniform_class, js_cc static bool js_cc_gfx_GFXUniform_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXUniform)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXUniform)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -5369,7 +5369,7 @@ SE_BIND_CTOR(js_gfx_GFXUniformBlock_constructor, __jsb_cc_gfx_GFXUniformBlock_cl static bool js_cc_gfx_GFXUniformBlock_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXUniformBlock)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXUniformBlock)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -5655,7 +5655,7 @@ SE_BIND_CTOR(js_gfx_GFXUniformSampler_constructor, __jsb_cc_gfx_GFXUniformSample static bool js_cc_gfx_GFXUniformSampler_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXUniformSampler)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXUniformSampler)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -5864,7 +5864,7 @@ SE_BIND_CTOR(js_gfx_GFXShaderStage_constructor, __jsb_cc_gfx_GFXShaderStage_clas static bool js_cc_gfx_GFXShaderStage_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXShaderStage)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXShaderStage)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -6188,7 +6188,7 @@ SE_BIND_CTOR(js_gfx_GFXAttribute_constructor, __jsb_cc_gfx_GFXAttribute_class, j static bool js_cc_gfx_GFXAttribute_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXAttribute)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXAttribute)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -6476,7 +6476,7 @@ SE_BIND_CTOR(js_gfx_GFXShaderInfo_constructor, __jsb_cc_gfx_GFXShaderInfo_class, static bool js_cc_gfx_GFXShaderInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXShaderInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXShaderInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -6724,7 +6724,7 @@ SE_BIND_CTOR(js_gfx_GFXInputAssemblerInfo_constructor, __jsb_cc_gfx_GFXInputAsse static bool js_cc_gfx_GFXInputAssemblerInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXInputAssemblerInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXInputAssemblerInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -7049,7 +7049,7 @@ SE_BIND_CTOR(js_gfx_GFXColorAttachment_constructor, __jsb_cc_gfx_GFXColorAttachm static bool js_cc_gfx_GFXColorAttachment_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXColorAttachment)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXColorAttachment)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -7454,7 +7454,7 @@ SE_BIND_CTOR(js_gfx_GFXDepthStencilAttachment_constructor, __jsb_cc_gfx_GFXDepth static bool js_cc_gfx_GFXDepthStencilAttachment_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXDepthStencilAttachment)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXDepthStencilAttachment)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -7666,7 +7666,7 @@ SE_BIND_CTOR(js_gfx_GFXRenderPassInfo_constructor, __jsb_cc_gfx_GFXRenderPassInf static bool js_cc_gfx_GFXRenderPassInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXRenderPassInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXRenderPassInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -7951,7 +7951,7 @@ SE_BIND_CTOR(js_gfx_GFXFramebufferInfo_constructor, __jsb_cc_gfx_GFXFramebufferI static bool js_cc_gfx_GFXFramebufferInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXFramebufferInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXFramebufferInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -8238,7 +8238,7 @@ SE_BIND_CTOR(js_gfx_GFXBinding_constructor, __jsb_cc_gfx_GFXBinding_class, js_cc static bool js_cc_gfx_GFXBinding_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBinding)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBinding)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -8346,7 +8346,7 @@ SE_BIND_CTOR(js_gfx_GFXBindingLayoutInfo_constructor, __jsb_cc_gfx_GFXBindingLay static bool js_cc_gfx_GFXBindingLayoutInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBindingLayoutInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBindingLayoutInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -8746,7 +8746,7 @@ SE_BIND_CTOR(js_gfx_GFXBindingUnit_constructor, __jsb_cc_gfx_GFXBindingUnit_clas static bool js_cc_gfx_GFXBindingUnit_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBindingUnit)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBindingUnit)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -8958,7 +8958,7 @@ SE_BIND_CTOR(js_gfx_GFXPushConstantRange_constructor, __jsb_cc_gfx_GFXPushConsta static bool js_cc_gfx_GFXPushConstantRange_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPushConstantRange)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPushConstantRange)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -9126,7 +9126,7 @@ SE_BIND_CTOR(js_gfx_GFXPipelineLayoutInfo_constructor, __jsb_cc_gfx_GFXPipelineL static bool js_cc_gfx_GFXPipelineLayoutInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPipelineLayoutInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPipelineLayoutInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -9231,7 +9231,7 @@ SE_BIND_CTOR(js_gfx_GFXInputState_constructor, __jsb_cc_gfx_GFXInputState_class, static bool js_cc_gfx_GFXInputState_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXInputState)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXInputState)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -9787,7 +9787,7 @@ SE_BIND_CTOR(js_gfx_GFXRasterizerState_constructor, __jsb_cc_gfx_GFXRasterizerSt static bool js_cc_gfx_GFXRasterizerState_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXRasterizerState)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXRasterizerState)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -10627,7 +10627,7 @@ SE_BIND_CTOR(js_gfx_GFXDepthStencilState_constructor, __jsb_cc_gfx_GFXDepthStenc static bool js_cc_gfx_GFXDepthStencilState_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXDepthStencilState)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXDepthStencilState)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -11045,7 +11045,7 @@ SE_BIND_CTOR(js_gfx_GFXBlendTarget_constructor, __jsb_cc_gfx_GFXBlendTarget_clas static bool js_cc_gfx_GFXBlendTarget_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBlendTarget)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBlendTarget)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -11268,7 +11268,7 @@ SE_BIND_CTOR(js_gfx_GFXBlendState_constructor, __jsb_cc_gfx_GFXBlendState_class, static bool js_cc_gfx_GFXBlendState_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBlendState)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBlendState)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -11709,7 +11709,7 @@ SE_BIND_CTOR(js_gfx_GFXPipelineStateInfo_constructor, __jsb_cc_gfx_GFXPipelineSt static bool js_cc_gfx_GFXPipelineStateInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPipelineStateInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPipelineStateInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -11883,7 +11883,7 @@ SE_BIND_CTOR(js_gfx_GFXCommandBufferInfo_constructor, __jsb_cc_gfx_GFXCommandBuf static bool js_cc_gfx_GFXCommandBufferInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXCommandBufferInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXCommandBufferInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -11988,7 +11988,7 @@ SE_BIND_CTOR(js_gfx_GFXQueueInfo_constructor, __jsb_cc_gfx_GFXQueueInfo_class, j static bool js_cc_gfx_GFXQueueInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXQueueInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXQueueInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -12388,7 +12388,7 @@ SE_BIND_CTOR(js_gfx_GFXFormatInfo_constructor, __jsb_cc_gfx_GFXFormatInfo_class, static bool js_cc_gfx_GFXFormatInfo_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXFormatInfo)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXFormatInfo)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -12561,7 +12561,7 @@ SE_BIND_CTOR(js_gfx_GFXMemoryStatus_constructor, __jsb_cc_gfx_GFXMemoryStatus_cl static bool js_cc_gfx_GFXMemoryStatus_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXMemoryStatus)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXMemoryStatus)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -12650,7 +12650,7 @@ SE_BIND_CTOR(js_gfx_GFXObject_constructor, __jsb_cc_gfx_GFXObject_class, js_cc_g static bool js_cc_gfx_GFXObject_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXObject)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXObject)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -13966,7 +13966,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXBuffer_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBuffer)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBuffer)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -14275,7 +14275,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXTexture_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTexture)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXTexture)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -14623,7 +14623,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXSampler_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXSampler)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXSampler)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -14847,7 +14847,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXShader_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXShader)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXShader)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -15305,7 +15305,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXInputAssembler_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXInputAssembler)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXInputAssembler)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -15492,7 +15492,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXRenderPass_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXRenderPass)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXRenderPass)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -15671,7 +15671,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXFramebuffer_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXFramebuffer)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXFramebuffer)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -15874,7 +15874,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXBindingLayout_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBindingLayout)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXBindingLayout)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -16018,7 +16018,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXPipelineLayout_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPipelineLayout)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPipelineLayout)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -16285,7 +16285,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXPipelineState_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPipelineState)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXPipelineState)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -16397,7 +16397,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXCommandAllocator_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXCommandAllocator)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXCommandAllocator)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -16993,7 +16993,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXCommandBuffer_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXCommandBuffer)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXCommandBuffer)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -17131,7 +17131,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXFence_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXFence)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXFence)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { @@ -17288,7 +17288,7 @@ extern se::Object* __jsb_cc_gfx_GFXObject_proto; static bool js_cc_gfx_GFXQueue_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GFXQueue)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GFXQueue)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_gles2_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_gles2_auto.cpp index 00c3870264..66d4cf98c9 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_gles2_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_gles2_auto.cpp @@ -123,7 +123,7 @@ extern se::Object* __jsb_cc_gfx_GFXDevice_proto; static bool js_cc_gfx_GLES2Device_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GLES2Device)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GLES2Device)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_gles3_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_gles3_auto.cpp index 72505ee960..4b52fb89ce 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_gles3_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_gles3_auto.cpp @@ -69,7 +69,7 @@ extern se::Object* __jsb_cc_gfx_GFXDevice_proto; static bool js_cc_gfx_GLES3Device_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::GLES3Device)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::GLES3Device)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_mtl_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_mtl_auto.cpp index dd3afa6280..602729f15f 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_mtl_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_mtl_auto.cpp @@ -145,7 +145,7 @@ extern se::Object* __jsb_cc_gfx_GFXDevice_proto; static bool js_cc_gfx_CCMTLDevice_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::CCMTLDevice)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::CCMTLDevice)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { diff --git a/native/cocos/scripting/js-bindings/auto/jsb_video_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_video_auto.cpp index f5497fc25e..ebd5295486 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_video_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_video_auto.cpp @@ -313,7 +313,7 @@ SE_BIND_CTOR(js_video_VideoPlayer_constructor, __jsb_cc_VideoPlayer_class, js_cc static bool js_cc_VideoPlayer_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::VideoPlayer)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::VideoPlayer)", s.nativeThisObject()); cc::VideoPlayer* cobj = (cc::VideoPlayer*)s.nativeThisObject(); cobj->release(); return true; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_vk_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_vk_auto.cpp index e7609ecbab..d215fb39a8 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_vk_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_vk_auto.cpp @@ -69,7 +69,7 @@ extern se::Object* __jsb_cc_gfx_GFXDevice_proto; static bool js_cc_gfx_CCVKDevice_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::gfx::CCVKDevice)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::gfx::CCVKDevice)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { diff --git a/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-en.md b/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-en.md index decd8bf397..c26825ee4e 100644 --- a/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-en.md +++ b/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-en.md @@ -147,7 +147,7 @@ After creating a Sprite in the script layer via `var sp = new cc.Sprite("a.png") ```c++ static bool js_cocos2d_Sprite_finalize(se::State& s) { - CCLOG("jsbindings: finalizing JS object %p (cc::Sprite)", s.nativeThisObject()); + CC_LOG_DEBUG("jsbindings: finalizing JS object %p (cc::Sprite)", s.nativeThisObject()); cc::Sprite* cobj = (cc::Sprite*)s.nativeThisObject(); if (cobj->getReferenceCount() == 1) cobj->autorelease(); @@ -1126,7 +1126,7 @@ In Cocos2D-X binding, if the native object's reference count is 1, we do not use ```c++ static bool js_cocos2d_Sprite_finalize(se::State& s) { - CCLOG("jsbindings: finalizing JS object %p (cc::Sprite)", s.nativeThisObject()); + CC_LOG_DEBUG("jsbindings: finalizing JS object %p (cc::Sprite)", s.nativeThisObject()); cc::Sprite* cobj = (cc::Sprite*)s.nativeThisObject(); if (cobj->getReferenceCount() == 1) cobj->autorelease(); diff --git a/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-zh.md b/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-zh.md index b4c4924581..8d1e14fcae 100644 --- a/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-zh.md +++ b/native/cocos/scripting/js-bindings/docs/JSB2.0-learning-zh.md @@ -146,7 +146,7 @@ se::Object 继承于 se::RefCounter 引用计数管理类。目前抽象层中 ```c++ static bool js_cocos2d_Sprite_finalize(se::State& s) { - CCLOG("jsbindings: finalizing JS object %p (cc::Sprite)", s.nativeThisObject()); + CC_LOG_DEBUG("jsbindings: finalizing JS object %p (cc::Sprite)", s.nativeThisObject()); cc::Sprite* cobj = (cc::Sprite*)s.nativeThisObject(); if (cobj->getReferenceCount() == 1) cobj->autorelease(); @@ -1113,7 +1113,7 @@ cocos2d-x 的绑定中,如果引用计数为 1 了,我们不使用 release ```c++ static bool js_cocos2d_Sprite_finalize(se::State& s) { - CCLOG("jsbindings: finalizing JS object %p (cc::Sprite)", s.nativeThisObject()); + CC_LOG_DEBUG("jsbindings: finalizing JS object %p (cc::Sprite)", s.nativeThisObject()); cc::Sprite* cobj = (cc::Sprite*)s.nativeThisObject(); if (cobj->getReferenceCount() == 1) cobj->autorelease(); diff --git a/native/cocos/scripting/js-bindings/manual/JavaScriptJavaBridge.cpp b/native/cocos/scripting/js-bindings/manual/JavaScriptJavaBridge.cpp index 4cbadf32ff..df3ccde2e6 100644 --- a/native/cocos/scripting/js-bindings/manual/JavaScriptJavaBridge.cpp +++ b/native/cocos/scripting/js-bindings/manual/JavaScriptJavaBridge.cpp @@ -48,7 +48,7 @@ JNIEXPORT jint JNICALL JNI_JSJAVABRIDGE(evalString) (JNIEnv *env, jclass cls, jstring value) { if (!se::ScriptEngine::getInstance()->isValid()) { - CCLOG("ScriptEngine has not been initialized"); + CC_LOG_DEBUG("ScriptEngine has not been initialized"); return 0; } @@ -57,7 +57,7 @@ JNIEXPORT jint JNICALL JNI_JSJAVABRIDGE(evalString) std::string strValue = cc::StringUtils::getStringUTFCharsJNI(env, value, &strFlag); if (!strFlag) { - CCLOG("JavaScriptJavaBridge_evalString error, invalid string code"); + CC_LOG_DEBUG("JavaScriptJavaBridge_evalString error, invalid string code"); return 0; } se::ScriptEngine::getInstance()->evalString(strValue.c_str()); diff --git a/native/cocos/scripting/js-bindings/manual/JavaScriptObjCBridge.mm b/native/cocos/scripting/js-bindings/manual/JavaScriptObjCBridge.mm index 74ad2bdf19..e6afc2d8f8 100644 --- a/native/cocos/scripting/js-bindings/manual/JavaScriptObjCBridge.mm +++ b/native/cocos/scripting/js-bindings/manual/JavaScriptObjCBridge.mm @@ -356,7 +356,7 @@ se::Value JavaScriptObjCBridge::CallInfo::objc_to_seval(id objcVal) } else { - CCLOGERROR("Unknown number type: %s", numberType.c_str()); + CC_LOG_ERROR("Unknown number type: %s", numberType.c_str()); } } else if ([objcVal isKindOfClass:[NSString class]]) @@ -366,7 +366,7 @@ se::Value JavaScriptObjCBridge::CallInfo::objc_to_seval(id objcVal) } else if ([objcVal isKindOfClass:[NSDictionary class]]) { - CCLOGERROR("JavaScriptObjCBridge doesn't support to bind NSDictionary!"); + CC_LOG_ERROR("JavaScriptObjCBridge doesn't support to bind NSDictionary!"); } else { diff --git a/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_extension_manual.cpp b/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_extension_manual.cpp index eea5da1ee2..407fde0008 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_extension_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_extension_manual.cpp @@ -195,7 +195,7 @@ static bool js_cocos2dx_extension_initRemoteImage(se::State& s) } else { - CCLOGERROR("js_extension_loadRemoteImageOn: Failed to initWithImage."); + CC_LOG_ERROR("js_extension_loadRemoteImageOn: Failed to initWithImage."); } } CC_SAFE_RELEASE_NULL(image); diff --git a/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp b/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp index 2f1b5076f4..2d2876c93d 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp @@ -131,7 +131,7 @@ std::string __JSPlistDelegator::parse(const std::string& path) { } __JSPlistDelegator::~__JSPlistDelegator(){ - CCLOGINFO("deallocing __JSSAXDelegator: %p", this); + CC_LOG_INFO("deallocing __JSSAXDelegator: %p", this); } std::string __JSPlistDelegator::parseText(const std::string& text){ diff --git a/native/cocos/scripting/js-bindings/manual/jsb_conversions.hpp b/native/cocos/scripting/js-bindings/manual/jsb_conversions.hpp index cb43d30376..f2e5263d1a 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_conversions.hpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_conversions.hpp @@ -420,7 +420,7 @@ native_ptr_to_seval(T* v_c, se::Value* ret, bool* isReturnCachedValue = nullptr) auto iter = se::NativePtrToObjectMap::find(v); if (iter == se::NativePtrToObjectMap::end()) { // If we couldn't find native object in map, then the native object is created from native code. e.g. TMXLayer::getTileAt - // CCLOGWARN("WARNING: non-Ref type: (%s) isn't catched!", typeid(*v).name()); + // CC_LOG_DEBUGWARN("WARNING: non-Ref type: (%s) isn't catched!", typeid(*v).name()); se::Class* cls = JSBClassType::findClass(v); assert(cls != nullptr); obj = se::Object::createObjectWithClass(cls); @@ -463,7 +463,7 @@ native_ptr_to_seval(T& v_ref, se::Value* ret, bool* isReturnCachedValue = nullpt auto iter = se::NativePtrToObjectMap::find(v); if (iter == se::NativePtrToObjectMap::end()) { // If we couldn't find native object in map, then the native object is created from native code. e.g. TMXLayer::getTileAt - // CCLOGWARN("WARNING: non-Ref type: (%s) isn't catched!", typeid(*v).name()); + // CC_LOG_DEBUGWARN("WARNING: non-Ref type: (%s) isn't catched!", typeid(*v).name()); se::Class* cls = JSBClassType::findClass(v); assert(cls != nullptr); obj = se::Object::createObjectWithClass(cls); @@ -511,7 +511,7 @@ bool native_ptr_to_rooted_seval(const typename std::enable_ifsetObject(obj); @@ -545,7 +545,7 @@ native_ptr_to_seval(T* vp, se::Class* cls, se::Value* ret, bool* isReturnCachedV auto iter = se::NativePtrToObjectMap::find(v); if (iter == se::NativePtrToObjectMap::end()) { // If we couldn't find native object in map, then the native object is created from native code. e.g. TMXLayer::getTileAt -// CCLOGWARN("WARNING: Ref type: (%s) isn't catched!", typeid(*v).name()); +// CC_LOG_DEBUGWARN("WARNING: Ref type: (%s) isn't catched!", typeid(*v).name()); assert(cls != nullptr); obj = se::Object::createObjectWithClass(cls); ret->setObject(obj, true); @@ -589,7 +589,7 @@ native_ptr_to_seval(T& v_ref, se::Class* cls, se::Value* ret, bool* isReturnCach auto iter = se::NativePtrToObjectMap::find(v); if (iter == se::NativePtrToObjectMap::end()) { // If we couldn't find native object in map, then the native object is created from native code. e.g. TMXLayer::getTileAt - // CCLOGWARN("WARNING: Ref type: (%s) isn't catched!", typeid(*v).name()); + // CC_LOG_DEBUGWARN("WARNING: Ref type: (%s) isn't catched!", typeid(*v).name()); assert(cls != nullptr); obj = se::Object::createObjectWithClass(cls); ret->setObject(obj, true); @@ -637,7 +637,7 @@ bool native_ptr_to_rooted_seval(typename std::enable_ifsetObject(obj); @@ -671,7 +671,7 @@ native_ptr_to_seval(T* vp, se::Value* ret, bool* isReturnCachedValue = nullptr) auto iter = se::NativePtrToObjectMap::find(v); if (iter == se::NativePtrToObjectMap::end()) { // If we couldn't find native object in map, then the native object is created from native code. e.g. TMXLayer::getTileAt -// CCLOGWARN("WARNING: Ref type: (%s) isn't catched!", typeid(*v).name()); +// CC_LOG_DEBUGWARN("WARNING: Ref type: (%s) isn't catched!", typeid(*v).name()); se::Class* cls = JSBClassType::findClass(v); assert(cls != nullptr); obj = se::Object::createObjectWithClass(cls); @@ -686,7 +686,7 @@ native_ptr_to_seval(T* vp, se::Value* ret, bool* isReturnCachedValue = nullptr) else { obj = iter->second; -// CCLOG("INFO: Found Ref type: (%s, native: %p, se: %p) from cache!", typeid(*v).name(), v, obj); +// CC_LOG_DEBUG("INFO: Found Ref type: (%s, native: %p, se: %p) from cache!", typeid(*v).name(), v, obj); if (isReturnCachedValue != nullptr) { *isReturnCachedValue = true; @@ -714,7 +714,7 @@ native_ptr_to_seval(T* vp, se::Class* cls, se::Value* ret, bool* isReturnCachedV auto iter = se::NativePtrToObjectMap::find(v); if (iter == se::NativePtrToObjectMap::end()) { // If we couldn't find native object in map, then the native object is created from native code. e.g. TMXLayer::getTileAt -// CCLOGWARN("WARNING: Ref type: (%s) isn't catched!", typeid(*v).name()); +// CC_LOG_DEBUGWARN("WARNING: Ref type: (%s) isn't catched!", typeid(*v).name()); assert(cls != nullptr); obj = se::Object::createObjectWithClass(cls); ret->setObject(obj, true); diff --git a/native/cocos/scripting/js-bindings/manual/jsb_gfx_manual.cpp b/native/cocos/scripting/js-bindings/manual/jsb_gfx_manual.cpp index 7fec0dd1bf..158344859c 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_gfx_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_gfx_manual.cpp @@ -624,7 +624,7 @@ SE_BIND_CTOR(js_gfx_GFXSubPass_constructor, __jsb_cocos2d_GFXSubPass_class, js_c static bool js_cocos2d_GFXSubPass_finalize(se::State& s) { - CCLOGINFO("jsbindings: finalizing JS object %p (cc::GFXSubPass)", s.nativeThisObject()); + CC_LOG_INFO("jsbindings: finalizing JS object %p (cc::GFXSubPass)", s.nativeThisObject()); auto iter = se::NonRefNativePtrCreatedByCtorMap::find(s.nativeThisObject()); if (iter != se::NonRefNativePtrCreatedByCtorMap::end()) { diff --git a/native/cocos/scripting/js-bindings/manual/jsb_global.cpp b/native/cocos/scripting/js-bindings/manual/jsb_global.cpp index 9228a85183..1876e549f0 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_global.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_global.cpp @@ -445,7 +445,7 @@ SE_BIND_FUNC(jsc_garbageCollect) static bool jsc_dumpNativePtrToSeObjectMap(se::State& s) { - cc::log(">>> total: %d, Dump (native -> jsobj) map begin", (int)se::NativePtrToObjectMap::size()); + CC_LOG_DEBUG(">>> total: %d, Dump (native -> jsobj) map begin", (int)se::NativePtrToObjectMap::size()); struct NamePtrStruct { @@ -480,9 +480,9 @@ static bool jsc_dumpNativePtrToSeObjectMap(se::State& s) for (const auto& e : namePtrArray) { - cc::log("%s: %p", e.name, e.ptr); + CC_LOG_DEBUG("%s: %p", e.name, e.ptr); } - cc::log(">>> total: %d, nonRefMap: %d, Dump (native -> jsobj) map end", (int)se::NativePtrToObjectMap::size(), (int)se::NonRefNativePtrCreatedByCtorMap::size()); + CC_LOG_DEBUG(">>> total: %d, nonRefMap: %d, Dump (native -> jsobj) map end", (int)se::NativePtrToObjectMap::size(), (int)se::NonRefNativePtrCreatedByCtorMap::size()); return true; } SE_BIND_FUNC(jsc_dumpNativePtrToSeObjectMap) @@ -666,7 +666,7 @@ static bool JSB_saveByteCode(se::State& s) const auto& args = s.args(); int argc = (int)args.size(); SE_PRECONDITION2(argc == 2, false, "Invalid number of arguments"); - bool ok = true, value = true; + bool ok = true; std::string srcfile; std::string dstfile; ok &= seval_to_std_string(args[0], &srcfile); diff --git a/native/cocos/scripting/js-bindings/manual/jsb_socketio.cpp b/native/cocos/scripting/js-bindings/manual/jsb_socketio.cpp index 2c68411a25..4f269b4dc2 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_socketio.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_socketio.cpp @@ -50,7 +50,7 @@ public: virtual ~JSB_SocketIODelegate() { - CCLOGINFO("In the destructor of JSB_SocketIODelegate(%p)", this); + CC_LOG_INFO("In the destructor of JSB_SocketIODelegate(%p)", this); } virtual void onConnect(SIOClient* client) override @@ -63,7 +63,7 @@ public: virtual void onClose(SIOClient* client) override { - CCLOG("JSB SocketIO::SIODelegate->onClose method called from native"); + CC_LOG_DEBUG("JSB SocketIO::SIODelegate->onClose method called from native"); this->fireEventToScript(client, "disconnect", ""); auto iter = se::NativePtrToObjectMap::find(client); @@ -84,7 +84,7 @@ public: virtual void onError(SIOClient* client, const std::string& data) override { - CCLOG("JSB SocketIO::SIODelegate->onError method called from native with data: %s", data.c_str()); + CC_LOG_DEBUG("JSB SocketIO::SIODelegate->onError method called from native with data: %s", data.c_str()); this->fireEventToScript(client, "error", data); auto iter = se::NativePtrToObjectMap::find(client); @@ -96,7 +96,7 @@ public: virtual void fireEventToScript(SIOClient* client, const std::string& eventName, const std::string& data) override { - CCLOG("JSB SocketIO::SIODelegate->fireEventToScript method called from native with name '%s' data: %s", eventName.c_str(), data.c_str()); + CC_LOG_DEBUG("JSB SocketIO::SIODelegate->fireEventToScript method called from native with name '%s' data: %s", eventName.c_str(), data.c_str()); se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -136,7 +136,7 @@ public: if (eventName == "disconnect") { - cc::log("disconnect ... "); //IDEA: + CC_LOG_DEBUG("disconnect ... "); //IDEA: } } @@ -158,7 +158,7 @@ private: static bool SocketIO_finalize(se::State& s) { SIOClient* cobj = (SIOClient*)s.nativeThisObject(); - CCLOGINFO("jsbindings: finalizing JS object %p (SocketIO)", cobj); + CC_LOG_INFO("jsbindings: finalizing JS object %p (SocketIO)", cobj); cobj->disconnect(); JSB_SocketIODelegate* delegate = static_cast(cobj->getDelegate()); if (delegate->getReferenceCount() == 1) @@ -279,7 +279,7 @@ static bool SocketIO_on(se::State& s) ok = seval_to_std_string(args[0], &eventName); SE_PRECONDITION2(ok, false, "Converting eventName failed!"); - CCLOG("JSB SocketIO eventName to: '%s'", eventName.c_str()); + CC_LOG_DEBUG("JSB SocketIO eventName to: '%s'", eventName.c_str()); ((JSB_SocketIODelegate *)cobj->getDelegate())->addEvent(eventName, args[1], se::Value(s.thisObject())); return true; @@ -295,7 +295,7 @@ static bool SocketIO_connect(se::State& s) { const auto& args = s.args(); int argc = (int)args.size(); - CCLOG("JSB SocketIO.connect method called"); + CC_LOG_DEBUG("JSB SocketIO.connect method called"); if (argc >= 1 && argc <= 3) { @@ -334,7 +334,7 @@ static bool SocketIO_connect(se::State& s) JSB_SocketIODelegate* siodelegate = new (std::nothrow) JSB_SocketIODelegate(); - CCLOG("Calling native SocketIO.connect method"); + CC_LOG_DEBUG("Calling native SocketIO.connect method"); SIOClient* ret = SocketIO::connect(url, *siodelegate, caFilePath); if (ret != nullptr) { diff --git a/native/cocos/scripting/js-bindings/manual/jsb_websocket.cpp b/native/cocos/scripting/js-bindings/manual/jsb_websocket.cpp index 32d2c55258..7dd273d9c5 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_websocket.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_websocket.cpp @@ -69,7 +69,7 @@ JSB_WebSocketDelegate::JSB_WebSocketDelegate() JSB_WebSocketDelegate::~JSB_WebSocketDelegate() { - CCLOGINFO("In the destructor of JSB_WebSocketDelegate(%p)", this); + CC_LOG_INFO("In the destructor of JSB_WebSocketDelegate(%p)", this); } void JSB_WebSocketDelegate::onOpen(WebSocket* ws) @@ -182,7 +182,7 @@ void JSB_WebSocketDelegate::onClose(WebSocket* ws) { if (iter == se::NativePtrToObjectMap::end()) { - CCLOGINFO("WebSocket js instance was destroyted, don't need to invoke onclose callback!"); + CC_LOG_INFO("WebSocket js instance was destroyted, don't need to invoke onclose callback!"); break; } @@ -263,12 +263,12 @@ void JSB_WebSocketDelegate::setJSDelegate(const se::Value& jsDelegate) static bool WebSocket_finalize(se::State& s) { WebSocket* cobj = (WebSocket*)s.nativeThisObject(); - CCLOGINFO("jsbindings: finalizing JS object %p (WebSocket)", cobj); + CC_LOG_INFO("jsbindings: finalizing JS object %p (WebSocket)", cobj); // Manually close if web socket is not closed if (cobj->getReadyState() != WebSocket::State::CLOSED) { - CCLOGINFO("WebSocket (%p) isn't closed, try to close it!", cobj); + CC_LOG_INFO("WebSocket (%p) isn't closed, try to close it!", cobj); cobj->closeAsync(); } @@ -405,7 +405,7 @@ static bool WebSocket_send(se::State& s) //IDEA: We didn't find a way to get the JS string length in JSB2.0. // if (data.empty() && len > 0) // { -// CCLOGWARN("Text message to send is empty, but its length is greater than 0!"); +// CC_LOG_DEBUGWARN("Text message to send is empty, but its length is greater than 0!"); // //IDEA: Note that this text message contains '0x00' prefix, so its length calcuted by strlen is 0. // // we need to fix that if there is '0x00' in text message, // // since javascript language could support '0x00' inserted at the beginning or the middle of text message diff --git a/native/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp b/native/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp index 3402960ab3..18faf5e581 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp @@ -399,7 +399,7 @@ void XMLHttpRequest::getHeader(const std::string& header) } else { - CCLOG("XMLHTTPRequest invalid response code %d", code); + CC_LOG_DEBUG("XMLHTTPRequest invalid response code %d", code); } } } diff --git a/native/cocos/ui/edit-box/EditBox-win32.cpp b/native/cocos/ui/edit-box/EditBox-win32.cpp index e3f1b187fb..65f4d54c42 100644 --- a/native/cocos/ui/edit-box/EditBox-win32.cpp +++ b/native/cocos/ui/edit-box/EditBox-win32.cpp @@ -170,7 +170,7 @@ void EditBox::show(const EditBox::ShowInfo& showInfo) sizeof(buffer) / sizeof(wchar_t), NULL); std::wstring_convert> convert; - CCLOG("Can not create editbox: %s", convert.to_bytes(buffer).c_str()); + CC_LOG_DEBUG("Can not create editbox: %s", convert.to_bytes(buffer).c_str()); } } diff --git a/native/extensions/assets-manager/AssetsManagerEx.cpp b/native/extensions/assets-manager/AssetsManagerEx.cpp index 2c7fdd9dbe..89a06e593f 100644 --- a/native/extensions/assets-manager/AssetsManagerEx.cpp +++ b/native/extensions/assets-manager/AssetsManagerEx.cpp @@ -385,7 +385,7 @@ bool AssetsManagerEx::loadLocalManifest(const std::string& manifestUrl) // Fail to load local manifest if (!_localManifest->isLoaded()) { - CCLOG("AssetsManagerEx : No local manifest file found error.\n"); + CC_LOG_DEBUG("AssetsManagerEx : No local manifest file found error.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return false; } @@ -489,7 +489,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) size_t pos = zip.find_last_of("/\\"); if (pos == std::string::npos) { - CCLOG("AssetsManagerEx : no root path specified for zip file %s\n", zip.c_str()); + CC_LOG_DEBUG("AssetsManagerEx : no root path specified for zip file %s\n", zip.c_str()); return false; } const std::string rootPath = zip.substr(0, pos+1); @@ -498,7 +498,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) unzFile zipfile = unzOpen(FileUtils::getInstance()->getSuitableFOpen(zip).c_str()); if (! zipfile) { - CCLOG("AssetsManagerEx : can not open downloaded zip file %s\n", zip.c_str()); + CC_LOG_DEBUG("AssetsManagerEx : can not open downloaded zip file %s\n", zip.c_str()); return false; } @@ -506,7 +506,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) unz_global_info global_info; if (unzGetGlobalInfo(zipfile, &global_info) != UNZ_OK) { - CCLOG("AssetsManagerEx : can not read file global info of %s\n", zip.c_str()); + CC_LOG_DEBUG("AssetsManagerEx : can not read file global info of %s\n", zip.c_str()); unzClose(zipfile); return false; } @@ -529,7 +529,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) NULL, 0) != UNZ_OK) { - CCLOG("AssetsManagerEx : can not read compressed file info\n"); + CC_LOG_DEBUG("AssetsManagerEx : can not read compressed file info\n"); unzClose(zipfile); return false; } @@ -544,7 +544,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) if ( !_fileUtils->createDirectory(basename(fullPath)) ) { // Failed to create directory - CCLOG("AssetsManagerEx : can not create directory %s\n", fullPath.c_str()); + CC_LOG_DEBUG("AssetsManagerEx : can not create directory %s\n", fullPath.c_str()); unzClose(zipfile); return false; } @@ -556,7 +556,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) if (!_fileUtils->isDirectoryExist(dir)) { if (!_fileUtils->createDirectory(dir)) { // Failed to create directory - CCLOG("AssetsManagerEx : can not create directory %s\n", fullPath.c_str()); + CC_LOG_DEBUG("AssetsManagerEx : can not create directory %s\n", fullPath.c_str()); unzClose(zipfile); return false; } @@ -565,7 +565,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) // Open current file. if (unzOpenCurrentFile(zipfile) != UNZ_OK) { - CCLOG("AssetsManagerEx : can not extract file %s\n", fileName); + CC_LOG_DEBUG("AssetsManagerEx : can not extract file %s\n", fileName); unzClose(zipfile); return false; } @@ -574,7 +574,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) FILE *out = fopen(FileUtils::getInstance()->getSuitableFOpen(fullPath).c_str(), "wb"); if (!out) { - CCLOG("AssetsManagerEx : can not create decompress destination file %s (errno: %d)\n", fullPath.c_str(), errno); + CC_LOG_DEBUG("AssetsManagerEx : can not create decompress destination file %s (errno: %d)\n", fullPath.c_str(), errno); unzCloseCurrentFile(zipfile); unzClose(zipfile); return false; @@ -587,7 +587,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) error = unzReadCurrentFile(zipfile, readBuffer, BUFFER_SIZE); if (error < 0) { - CCLOG("AssetsManagerEx : can not read zip file %s, error code is %d\n", fileName, error); + CC_LOG_DEBUG("AssetsManagerEx : can not read zip file %s, error code is %d\n", fileName, error); fclose(out); unzCloseCurrentFile(zipfile); unzClose(zipfile); @@ -610,7 +610,7 @@ bool AssetsManagerEx::decompress(const std::string &zip) { if (unzGoToNextFile(zipfile) != UNZ_OK) { - CCLOG("AssetsManagerEx : can not read next file for decompressing\n"); + CC_LOG_DEBUG("AssetsManagerEx : can not read next file for decompressing\n"); unzClose(zipfile); return false; } @@ -717,7 +717,7 @@ void AssetsManagerEx::downloadVersion() // No version file found else { - CCLOG("AssetsManagerEx : No version file found, step skipped\n"); + CC_LOG_DEBUG("AssetsManagerEx : No version file found, step skipped\n"); _updateState = State::PREDOWNLOAD_MANIFEST; downloadManifest(); } @@ -732,7 +732,7 @@ void AssetsManagerEx::parseVersion() if (!_remoteManifest->isVersionLoaded()) { - CCLOG("AssetsManagerEx : Fail to parse version file, step skipped\n"); + CC_LOG_DEBUG("AssetsManagerEx : Fail to parse version file, step skipped\n"); _updateState = State::PREDOWNLOAD_MANIFEST; downloadManifest(); } @@ -780,7 +780,7 @@ void AssetsManagerEx::downloadManifest() // No manifest file found else { - CCLOG("AssetsManagerEx : No manifest file found, check update failed\n"); + CC_LOG_DEBUG("AssetsManagerEx : No manifest file found, check update failed\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_DOWNLOAD_MANIFEST); _updateState = State::UNCHECKED; } @@ -795,7 +795,7 @@ void AssetsManagerEx::parseManifest() if (!_remoteManifest->isLoaded()) { - CCLOG("AssetsManagerEx : Error parsing manifest file, %s", _tempManifestPath.c_str()); + CC_LOG_DEBUG("AssetsManagerEx : Error parsing manifest file, %s", _tempManifestPath.c_str()); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_PARSE_MANIFEST); _updateState = State::UNCHECKED; } @@ -981,18 +981,18 @@ void AssetsManagerEx::checkUpdate() { if (_updateEntry != UpdateEntry::NONE) { - CCLOGERROR("AssetsManagerEx::checkUpdate, updateEntry isn't NONE"); + CC_LOG_ERROR("AssetsManagerEx::checkUpdate, updateEntry isn't NONE"); return; } if (!_inited){ - CCLOG("AssetsManagerEx : Manifests uninited.\n"); + CC_LOG_DEBUG("AssetsManagerEx : Manifests uninited.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } if (!_localManifest->isLoaded()) { - CCLOG("AssetsManagerEx : No local manifest file found error.\n"); + CC_LOG_DEBUG("AssetsManagerEx : No local manifest file found error.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } @@ -1027,18 +1027,18 @@ void AssetsManagerEx::update() { if (_updateEntry != UpdateEntry::NONE) { - CCLOGERROR("AssetsManagerEx::update, updateEntry isn't NONE"); + CC_LOG_ERROR("AssetsManagerEx::update, updateEntry isn't NONE"); return; } if (!_inited){ - CCLOG("AssetsManagerEx : Manifests uninited.\n"); + CC_LOG_DEBUG("AssetsManagerEx : Manifests uninited.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } if (!_localManifest->isLoaded()) { - CCLOG("AssetsManagerEx : No local manifest file found error.\n"); + CC_LOG_DEBUG("AssetsManagerEx : No local manifest file found error.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } @@ -1098,7 +1098,7 @@ void AssetsManagerEx::update() void AssetsManagerEx::updateAssets(const DownloadUnits& assets) { if (!_inited){ - CCLOG("AssetsManagerEx : Manifests uninited.\n"); + CC_LOG_DEBUG("AssetsManagerEx : Manifests uninited.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } @@ -1131,7 +1131,7 @@ const DownloadUnits& AssetsManagerEx::getFailedAssets() const void AssetsManagerEx::downloadFailedAssets() { - CCLOG("AssetsManagerEx : Start update %lu failed assets.\n", static_cast(_failedUnits.size())); + CC_LOG_DEBUG("AssetsManagerEx : Start update %lu failed assets.\n", static_cast(_failedUnits.size())); updateAssets(_failedUnits); } @@ -1191,7 +1191,7 @@ void AssetsManagerEx::onError(const network::DownloadTask& task, // Skip version error occurred if (task.identifier == VERSION_ID) { - CCLOG("AssetsManagerEx : Fail to download version file, step skipped\n"); + CC_LOG_DEBUG("AssetsManagerEx : Fail to download version file, step skipped\n"); _updateState = State::PREDOWNLOAD_MANIFEST; downloadManifest(); } diff --git a/native/extensions/assets-manager/Manifest.cpp b/native/extensions/assets-manager/Manifest.cpp index 07c93bbb37..8300a80a22 100644 --- a/native/extensions/assets-manager/Manifest.cpp +++ b/native/extensions/assets-manager/Manifest.cpp @@ -27,6 +27,7 @@ #include "Manifest.h" #include "json/prettywriter.h" #include "json/stringbuffer.h" +#include "base/Log.h" #include #include @@ -116,7 +117,7 @@ void Manifest::loadJson(const std::string& url) if (content.size() == 0) { - CCLOG("Fail to retrieve local file content: %s\n", url.c_str()); + CC_LOG_DEBUG("Fail to retrieve local file content: %s\n", url.c_str()); } else { @@ -129,7 +130,7 @@ void Manifest::loadJsonFromString(const std::string& content) { if (content.size() == 0) { - CCLOG("Fail to parse empty json content."); + CC_LOG_DEBUG("Fail to parse empty json content."); } else { @@ -141,7 +142,7 @@ void Manifest::loadJsonFromString(const std::string& content) if (offset > 0) offset--; std::string errorSnippet = content.substr(offset, 10); - CCLOG("File parse error %d at <%s>\n", _json.GetParseError(), errorSnippet.c_str()); + CC_LOG_DEBUG("File parse error %d at <%s>\n", _json.GetParseError(), errorSnippet.c_str()); } } } diff --git a/native/tools/bindings-generator b/native/tools/bindings-generator index 58b9c31496..8fcfe92fe5 160000 --- a/native/tools/bindings-generator +++ b/native/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 58b9c3149626e742cfb311ed58dd8bc4ba177240 +Subproject commit 8fcfe92fe5beb8154f50b010433d50991b5f55fa