From 57183195c9e292a0d08c5a280eddcd57539a78d9 Mon Sep 17 00:00:00 2001 From: "HARMEL, Bernard" Date: Tue, 30 Jul 2024 14:35:46 +0200 Subject: [PATCH] 5.7.2.5 --- CMakeLists.txt | 2 +- lib/include/bofstd/bofbasicloggerfactory.h | 18 +++++++++--------- lib/include/bofstd/bofstd.h | 19 ++++++++++++++----- tests/src/main.cpp | 2 +- tests/src/ut_fs.cpp | 6 +++--- vcpkg.json | 2 +- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d946f7f..33fa2b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,7 @@ include(cmake/fetch_content.cmake) # in code coverage computation as they are test programs themselves. set(EXTRA_COVERAGE_EXCLUSION "\'${CMAKE_CURRENT_SOURCE_DIR}/integration/*\'") -project(bofstd VERSION 5.7.2.4) +project(bofstd VERSION 5.7.2.5) if (EMSCRIPTEN) message("Force pthread detection for BofStd compilation under EMSCRIPTEN") diff --git a/lib/include/bofstd/bofbasicloggerfactory.h b/lib/include/bofstd/bofbasicloggerfactory.h index 99b2cc8..e4fa45e 100644 --- a/lib/include/bofstd/bofbasicloggerfactory.h +++ b/lib/include/bofstd/bofbasicloggerfactory.h @@ -23,16 +23,16 @@ #include BEGIN_BOF_NAMESPACE() -class BasicLogger : public BOF::IBofLogger +class BofBasicLogger : public BOF::IBofLogger { public: - BasicLogger(const std::string &_rLibNamePrefix_S, const std::string &_rLoggerChannelName_S) + BofBasicLogger(const std::string &_rLibNamePrefix_S, const std::string &_rLoggerChannelName_S) : BOF::IBofLogger() { mChannelName_S = _rLibNamePrefix_S + _rLoggerChannelName_S; Open(false, false, false, 0, ""); } - virtual ~BasicLogger() + virtual ~BofBasicLogger() { if (mpLogFile_X) { @@ -60,7 +60,7 @@ class BasicLogger : public BOF::IBofLogger t = std::time(nullptr); std::strftime(pDateTime_c, sizeof(pDateTime_c), "%Y-%m-%d %H:%M:%S", std::localtime(&t)); - BOF_GET_FILE_FROM_PATH(_rFile_S.c_str(), pFile_c) + BOF_GET_FILE_FROM_PATH(_rFile_S.c_str(), pFile_c); sprintf(pHeader_c, "%s: %zd [%s] %s:%d (%s)->", pDateTime_c, DeltaInuS, mChannelName_S.c_str(), pFile_c, _Line_U32, _rFunc_S.c_str()); mNbLogLine_U32++; if (mOutputOnScreen_B) @@ -136,7 +136,7 @@ class BasicLogger : public BOF::IBofLogger bool SwapLogFile() { bool Rts_B = false; - char pBackLogFilePath_c[1024]; + char pBackLogFilePath_c[1024+32]; //if (Close()) //No because never ending loop (Close call V_Log) and modify var mOutputOnScreen_B if (mpLogFile_X) @@ -202,13 +202,13 @@ class BofBasicLoggerFactory : public BOF::IBofLoggerFactory } std::shared_ptr V_Create(const std::string &_rLibNamePrefix_S, const std::string &_rLoggerChannelName_S) override { - std::shared_ptr psRts = nullptr; + std::shared_ptr psRts = nullptr; std::string ChannelName_S; std::lock_guard Lock(mLoggerCollectionMtx); if (V_GetLogger(_rLibNamePrefix_S, _rLoggerChannelName_S) == nullptr) { - psRts = std::make_shared(_rLibNamePrefix_S, _rLoggerChannelName_S); + psRts = std::make_shared(_rLibNamePrefix_S, _rLoggerChannelName_S); if (psRts) { if (psRts->Open(mOutputOnScreen_B, mAppend_B, mAutoFlush_B, mMaxSize_U32, mLogFileSubDir_S)) @@ -226,7 +226,7 @@ class BofBasicLoggerFactory : public BOF::IBofLoggerFactory } std::shared_ptr V_GetLogger(const std::string &_rLibNamePrefix_S, const std::string &_rLoggerChannelName_S) override { - std::shared_ptr psRts = nullptr; + std::shared_ptr psRts = nullptr; std::string ChannelName_S; // no mutex as it is used by V_Create and V_Destroy ChannelName_S = BuildChannelName(_rLibNamePrefix_S, _rLoggerChannelName_S); @@ -254,7 +254,7 @@ class BofBasicLoggerFactory : public BOF::IBofLoggerFactory private: std::mutex mLoggerCollectionMtx; - std::map> mLoggerCollection; + std::map> mLoggerCollection; bool mOutputOnScreen_B; bool mAppend_B; bool mAutoFlush_B; diff --git a/lib/include/bofstd/bofstd.h b/lib/include/bofstd/bofstd.h index 76f9e73..f2b77e7 100644 --- a/lib/include/bofstd/bofstd.h +++ b/lib/include/bofstd/bofstd.h @@ -36,15 +36,15 @@ cmake -DCMAKE_TOOLCHAIN_FILE=C:/pro/vcpkg/scripts/buildsystems/vcpkg.cmake -DBUI #if defined(_WIN32) #define NOMINMAX #include -#include #include +#include typedef bool(WINAPI *BofSignalHandler)(uint32_t); #else #if defined(__EMSCRIPTEN__) #include //for emscripten_performance_now in Bof_RdTsc using BofEmscriptenCallback = std::function; #else -#include //for __rdtsc in Bof_RdTsc +#include //for __rdtsc in Bof_RdTsc #endif typedef bool (*BofSignalHandler)(uint32_t); #endif @@ -350,8 +350,17 @@ const uintptr_t BOF_INVALID_HANDLE_VALUE = ((uintptr_t)-1); { \ pFile = strrchr(pPath, '/'); \ if (!pFile) \ + { \ pFile = strrchr(pPath, '\\'); \ - pFile = pFile ? ++pFile : pPath; \ + } \ + if (pFile) \ + { \ + pFile++; \ + } \ + else \ + { \ + pFile = pPath; \ + } \ } #define BOF_COMPUTE_DELTA(start, end, delta) \ { \ @@ -656,7 +665,7 @@ inline BOFSTD_EXPORT uint64_t Bof_RdTsc() asm volatile ("rdtsc" : "=a" (Low_U32), "=d" (High_U32)); return (((uint64_t)High_U32 << 32) | Low_U32); */ - return static_cast(emscripten_performance_now() * 1000000.0); //Calls JavaScript performance.now(), returns a high precision wallclock time value in msecs. + return static_cast(emscripten_performance_now() * 1000000.0); // Calls JavaScript performance.now(), returns a high precision wallclock time value in msecs. #else return __rdtsc(); #endif @@ -735,7 +744,7 @@ class BOFSTD_EXPORT BofException : public std::exception BOF::BofException Exception(Header, Context, Where.str(), ErrorCode); \ throw Exception; \ } -//extern BOFSTDPARAM GL_BofStdParam_X; +// extern BOFSTDPARAM GL_BofStdParam_X; END_BOF_NAMESPACE() diff --git a/tests/src/main.cpp b/tests/src/main.cpp index b53c197..d37447d 100644 --- a/tests/src/main.cpp +++ b/tests/src/main.cpp @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) //::testing::GTEST_FLAG(filter) = "RawCircularBuffer_Test.FillWrapOverwrite"; //::testing::GTEST_FLAG(filter) = "RawCircularBuffer_Test.*:CircularBuffer_Test.*:RawCircularBufferInSlotMode_Test.*"; //::testing::GTEST_FLAG(filter) = "BofThreadPool_Test.Dispatch"; - ::testing::GTEST_FLAG(filter) = "ut_logger_ibofloggerfactory.MultipleChannel*"; + //::testing::GTEST_FLAG(filter) = "Fs_Test.**"; // ::testing::GTEST_FLAG(filter) = "RawCircularBufferAlwaysContiguous_Test.*:RawCircularBuffer_Test.*:RawCircularBufferInSlotMode_Test.*"; // std::string CrtDir_S; // BOF::Bof_GetCurrentDirectory(CrtDir_S); diff --git a/tests/src/ut_fs.cpp b/tests/src/ut_fs.cpp index 8ca659d..796b09c 100644 --- a/tests/src/ut_fs.cpp +++ b/tests/src/ut_fs.cpp @@ -756,8 +756,8 @@ TEST(Fs_Test, ResetFileContent) NewLine_S = Line_S + Line_S; EXPECT_STREQ(LineRead_S.c_str(), NewLine_S.c_str()); -#if defined(_WIN32) -#else +//#if defined(_WIN32) +//#else EXPECT_EQ(Bof_ResetFileContent(Path, false, Line_S.size()), BOF_ERR_NO_ERROR); EXPECT_EQ(Bof_ReadFile(Path, LineRead_S), BOF_ERR_NO_ERROR); @@ -772,5 +772,5 @@ TEST(Fs_Test, ResetFileContent) EXPECT_EQ(Bof_ReadFile(Path, LineRead_S), BOF_ERR_NO_ERROR); // EXPECT_STREQ(LineRead_S.c_str(), (Line_S + LineWrt_S).c_str()); EXPECT_STREQ(LineRead_S.c_str(), Line_S.c_str()); // Extra zero are inserted at the beginning as Io has an offset of Line_S.size() but the file has been shrinked to O byte->write add extra 0 upp to crt file pos LineWrt_S.c_str()); -#endif +//#endif } \ No newline at end of file diff --git a/vcpkg.json b/vcpkg.json index f4c469d..a1921b8 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "bofstd", - "version": "5.7.2.4", + "version": "5.7.2.5", "description": "The onbings general purpose C++ Multiplatform library", "dependencies": [ {