[GitHub] [rocketmq-client-cpp] ifplusor commented on a change in pull request #185: replace boost log with spdlog, use this PR to replace https://github.com/apache/rocketmq-client-cpp/pull/163
ifplusor commented on a change in pull request #185: replace boost log with spdlog, use this PR to replace https://github.com/apache/rocketmq-client-cpp/pull/163 URL: https://github.com/apache/rocketmq-client-cpp/pull/185#discussion_r326024129 ## File path: src/common/UtilAll.cpp ## @@ -267,6 +267,50 @@ string UtilAll::getHomeDirectory() { return homeDir; } +static bool createDirectoryInner(const char *dir) +{ +if (dir == nullptr) { +return false; +} +if (access(dir, 0) == -1) { +#ifdef _WIN32 +int flag = mkdir(dir); +#else +int flag = mkdir(dir, 0755); +#endif +if (flag == 0) { +return true; +} else { +return false; +} +} + return true; +} + +void UtilAll::createDirectory(std::string const& dir) { +const char* ptr = dir.c_str(); +if (access(ptr, 0) == 0) { +return; +} +char buff[PATH_MAX] = {0}; Review comment: undefined PATH_MAX in windows, instead of MAX_PATH This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [rocketmq-client-cpp] ifplusor commented on a change in pull request #185: replace boost log with spdlog, use this PR to replace https://github.com/apache/rocketmq-client-cpp/pull/163
ifplusor commented on a change in pull request #185: replace boost log with spdlog, use this PR to replace https://github.com/apache/rocketmq-client-cpp/pull/163 URL: https://github.com/apache/rocketmq-client-cpp/pull/185#discussion_r326008265 ## File path: src/common/UtilAll.cpp ## @@ -267,6 +267,50 @@ string UtilAll::getHomeDirectory() { return homeDir; } +static bool createDirectoryInner(const char *dir) +{ +if (dir == nullptr) { +return false; +} +if (access(dir, 0) == -1) { +#ifdef _WIN32 +int flag = mkdir(dir); +#else +int flag = mkdir(dir, 0755); +#endif +if (flag == 0) { +return true; +} else { +return false; +} +} + return true; Review comment: '\t' as indentation is bad. Use two whitespace please. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [rocketmq-client-cpp] ifplusor commented on a change in pull request #185: replace boost log with spdlog, use this PR to replace https://github.com/apache/rocketmq-client-cpp/pull/163
ifplusor commented on a change in pull request #185: replace boost log with spdlog, use this PR to replace https://github.com/apache/rocketmq-client-cpp/pull/163 URL: https://github.com/apache/rocketmq-client-cpp/pull/185#discussion_r326008451 ## File path: src/common/UtilAll.cpp ## @@ -267,6 +267,50 @@ string UtilAll::getHomeDirectory() { return homeDir; } +static bool createDirectoryInner(const char *dir) +{ +if (dir == nullptr) { +return false; +} +if (access(dir, 0) == -1) { +#ifdef _WIN32 +int flag = mkdir(dir); +#else +int flag = mkdir(dir, 0755); +#endif +if (flag == 0) { Review comment: I think use "return flag == 0;" directly is better, and 'ret' is better than 'flag'. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [rocketmq-client-cpp] ifplusor commented on a change in pull request #185: replace boost log with spdlog, use this PR to replace https://github.com/apache/rocketmq-client-cpp/pull/163
ifplusor commented on a change in pull request #185: replace boost log with spdlog, use this PR to replace https://github.com/apache/rocketmq-client-cpp/pull/163 URL: https://github.com/apache/rocketmq-client-cpp/pull/185#discussion_r325453245 ## File path: src/common/UtilAll.h ## @@ -82,9 +87,9 @@ inline void deleteAndZero(Type& pointer) { } #define EMPTY_STR_PTR(ptr) (ptr == NULL || ptr[0] == '\0') #ifdef WIN32 -#define SIZET_FMT "%lu" +#define SIZET_FMT "{}" Review comment: don't change SIZET_FMT. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services