From 92bc997726b3f8b1f438a20985b52ffbce58eaf2 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq。com> Date: Sun, 30 Aug 2020 15:13:54 +0800 Subject: [PATCH] no message --- general/.vscode/settings.json | 68 ++++++++++++++++++++++++++++++++++- general/inc/utils.h | 6 ++-- general/src/debug.cpp | 3 +- general/src/utils.cpp | 12 +++++-- 4 files changed, 81 insertions(+), 8 deletions(-) diff --git a/general/.vscode/settings.json b/general/.vscode/settings.json index 90d3512..f7a9118 100644 --- a/general/.vscode/settings.json +++ b/general/.vscode/settings.json @@ -2,6 +2,72 @@ "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", "files.associations": { "cstring": "cpp", - "memory": "cpp" + "memory": "cpp", + "string": "cpp", + "cctype": "cpp", + "cmath": "cpp", + "concepts": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cwchar": "cpp", + "exception": "cpp", + "initializer_list": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "iterator": "cpp", + "limits": "cpp", + "new": "cpp", + "ostream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "utility": "cpp", + "xfacet": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocinfo": "cpp", + "xlocnum": "cpp", + "xmemory": "cpp", + "xstddef": "cpp", + "xstring": "cpp", + "xtr1common": "cpp", + "xutility": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "cstdarg": "cpp", + "ctime": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "string_view": "cpp", + "fstream": "cpp", + "mutex": "cpp", + "sstream": "cpp", + "thread": "cpp", + "cinttypes": "cpp" } } \ No newline at end of file diff --git a/general/inc/utils.h b/general/inc/utils.h index 0aa4aae..9476210 100644 --- a/general/inc/utils.h +++ b/general/inc/utils.h @@ -16,13 +16,15 @@ using namespace std; typedef enum { ENV_WINDOWS = 1, ENV_LINUX, - ENV_UNIX + ENV_UNIX, + ENV_NONE, }ENV_SYS; typedef enum{ GCC = 1, CLANG = 2, - CL = 3 + CL = 3, + UNKNOWN }ENV_COMPILER; inline ENV_SYS CurrentEnvSys(); inline ENV_COMPILER CurrentEnvCompiler(); diff --git a/general/src/debug.cpp b/general/src/debug.cpp index 606d19a..09ed05a 100644 --- a/general/src/debug.cpp +++ b/general/src/debug.cpp @@ -10,8 +10,7 @@ int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){ if (left != 0){ row += 1; } - snprintf(out,strlen("LN: "),"LN: "); - //char out[10240] = "LN: " ; + snprintf(out,5,"LN: "); for (int z = 1;z < rowNum + 1; z++) { char tmp[4] = {0}; sprintf(tmp,"%02d ",z); diff --git a/general/src/utils.cpp b/general/src/utils.cpp index 477440c..35c80d3 100644 --- a/general/src/utils.cpp +++ b/general/src/utils.cpp @@ -19,15 +19,21 @@ inline ENV_SYS CurrentEnvSys(){ #ifdef _UNIX return ENV_UNIX #endif + #ifdef _WIN32 + return ENV_WINDOWS + #endif + return ENV_NONE; } + inline ENV_COMPILER CurrentEnvCompiler(){ - ifdef __GNUC__ + #ifdef __GNUC__ return GCC; #endif - ifdef _MSC_VER + #ifdef _MSC_VER return CL; #endif - ifdef __clang__ + #ifdef __clang__ return CLANG; #endif + return UNKNOWN; }