Loading .gitignore +1 −0 Original line number Diff line number Diff line build/ /.vs out/ No newline at end of file libcmdplusConfig.cmake.in +2 −2 Original line number Diff line number Diff line Loading @@ -3,5 +3,5 @@ include(CMakeFindDependencyMacro) include(${CMAKE_CURRENT_LIST_DIR}/libcmdplusTargets.cmake) include(${CMAKE_CURRENT_LIST_DIR}/libcmdplusVersion.cmake) set(CMDPLUS_INCLUDE_DIR "@CMAKE_INSTALL_INCLUDEDIR@" ) set(CMDPLUS_CONFIG_DIR "@CMAKE_INSTALL_PREFIX@/@ConfigPackageLocation@" ) No newline at end of file set(CMDPLUS_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../include") set(CMDPLUS_CONFIG_DIR "${CMAKE_CURRENT_LIST_DIR}") No newline at end of file src/cmdplus.cpp +16 −9 Original line number Diff line number Diff line Loading @@ -84,7 +84,18 @@ cmdplus::Cmd::~Cmd() { delete[] _Key; delete[] _Value; delete[] _Help; delete _nextCmd; Cmd *cur=_nextCmd;; _nextCmd=nullptr; while(cur){ Cmd *next=cur->_nextCmd; cur->_nextCmd=nullptr; delete cur->_nextCmd; cur=next; } } cmdplus::CmdController::CmdController() { Loading Loading @@ -127,8 +138,7 @@ void cmdplus::CmdController::registerCmd(const char *key, const char skey,bool r } /*set new key*/ _lastCmd->_Key = new char[strlen(key) + 1]; memcpy(_lastCmd->_Key,key,strlen(key)); _lastCmd->_Key[strlen(key)] = '\0'; memcpy(_lastCmd->_Key,key,strlen(key)+1); /*set new shortkey*/ _lastCmd->_SKey = skey; /*set reqirement flag*/ Loading @@ -136,14 +146,11 @@ void cmdplus::CmdController::registerCmd(const char *key, const char skey,bool r /*set new value*/ if (defaultvalue) { _lastCmd->_Value = new char[strlen(defaultvalue) + 1]; memcpy(_lastCmd->_Value,defaultvalue,strlen(defaultvalue)); _lastCmd->_Value[strlen(defaultvalue)] = '\0'; memcpy(_lastCmd->_Value,defaultvalue,strlen(defaultvalue)+1); } /*set new help*/ _lastCmd->_Help = new char[strlen(help) + 1]; memcpy(_lastCmd->_Help,help,strlen(help)); _lastCmd->_Help[strlen(help)] = '\0'; memcpy(_lastCmd->_Help,help,strlen(help)+1); } void cmdplus::CmdController::registerCmd(const char *key, const char skey, bool required, unsigned long defaultvalue, const char *help) { Loading src/cmdplus.h +1 −1 File changed.Contains only whitespace changes. Show changes Loading
.gitignore +1 −0 Original line number Diff line number Diff line build/ /.vs out/ No newline at end of file
libcmdplusConfig.cmake.in +2 −2 Original line number Diff line number Diff line Loading @@ -3,5 +3,5 @@ include(CMakeFindDependencyMacro) include(${CMAKE_CURRENT_LIST_DIR}/libcmdplusTargets.cmake) include(${CMAKE_CURRENT_LIST_DIR}/libcmdplusVersion.cmake) set(CMDPLUS_INCLUDE_DIR "@CMAKE_INSTALL_INCLUDEDIR@" ) set(CMDPLUS_CONFIG_DIR "@CMAKE_INSTALL_PREFIX@/@ConfigPackageLocation@" ) No newline at end of file set(CMDPLUS_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../include") set(CMDPLUS_CONFIG_DIR "${CMAKE_CURRENT_LIST_DIR}") No newline at end of file
src/cmdplus.cpp +16 −9 Original line number Diff line number Diff line Loading @@ -84,7 +84,18 @@ cmdplus::Cmd::~Cmd() { delete[] _Key; delete[] _Value; delete[] _Help; delete _nextCmd; Cmd *cur=_nextCmd;; _nextCmd=nullptr; while(cur){ Cmd *next=cur->_nextCmd; cur->_nextCmd=nullptr; delete cur->_nextCmd; cur=next; } } cmdplus::CmdController::CmdController() { Loading Loading @@ -127,8 +138,7 @@ void cmdplus::CmdController::registerCmd(const char *key, const char skey,bool r } /*set new key*/ _lastCmd->_Key = new char[strlen(key) + 1]; memcpy(_lastCmd->_Key,key,strlen(key)); _lastCmd->_Key[strlen(key)] = '\0'; memcpy(_lastCmd->_Key,key,strlen(key)+1); /*set new shortkey*/ _lastCmd->_SKey = skey; /*set reqirement flag*/ Loading @@ -136,14 +146,11 @@ void cmdplus::CmdController::registerCmd(const char *key, const char skey,bool r /*set new value*/ if (defaultvalue) { _lastCmd->_Value = new char[strlen(defaultvalue) + 1]; memcpy(_lastCmd->_Value,defaultvalue,strlen(defaultvalue)); _lastCmd->_Value[strlen(defaultvalue)] = '\0'; memcpy(_lastCmd->_Value,defaultvalue,strlen(defaultvalue)+1); } /*set new help*/ _lastCmd->_Help = new char[strlen(help) + 1]; memcpy(_lastCmd->_Help,help,strlen(help)); _lastCmd->_Help[strlen(help)] = '\0'; memcpy(_lastCmd->_Help,help,strlen(help)+1); } void cmdplus::CmdController::registerCmd(const char *key, const char skey, bool required, unsigned long defaultvalue, const char *help) { Loading