From fc854786ed73fe768d6a3ca22c02f7013560a930 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 1 Aug 2012 21:35:49 +0300 Subject: Fix code style. --- src/utils/mkdir.cpp | 3 +++ src/utils/process.cpp | 7 ++++--- src/utils/sha256.cpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/utils') diff --git a/src/utils/mkdir.cpp b/src/utils/mkdir.cpp index 4632bec84..f73af6db5 100644 --- a/src/utils/mkdir.cpp +++ b/src/utils/mkdir.cpp @@ -54,6 +54,9 @@ int mkdir_r(const char *pathname) int len = static_cast(strlen(tmp)); + if (len < 1) + return -1; + // terminate the pathname with '/' if (tmp[len - 1] != '/') { diff --git a/src/utils/process.cpp b/src/utils/process.cpp index b02874b0d..3a742b313 100644 --- a/src/utils/process.cpp +++ b/src/utils/process.cpp @@ -86,9 +86,10 @@ bool execFile(std::string pathName, std::string name A_UNUSED, if (!arg2.empty()) args += " " + arg2; - bool res = CreateProcess(pathName.c_str(), (char*)args.c_str(), nullptr, - nullptr, false, CREATE_DEFAULT_ERROR_MODE, nullptr, nullptr, - &siStartupInfo, &piProcessInfo); + bool res = CreateProcess(pathName.c_str(), const_cast( + args.c_str()), nullptr, nullptr, false, + CREATE_DEFAULT_ERROR_MODE, nullptr, nullptr, &siStartupInfo, + &piProcessInfo); CloseHandle(piProcessInfo.hProcess); CloseHandle(piProcessInfo.hThread); diff --git a/src/utils/sha256.cpp b/src/utils/sha256.cpp index 21ded486b..a56f6ec9a 100644 --- a/src/utils/sha256.cpp +++ b/src/utils/sha256.cpp @@ -279,7 +279,7 @@ std::string SHA256Hash(const char *src, int len) unsigned char bytehash[SHA256_DIGEST_SIZE]; SHA256Context ctx; SHA256Init(&ctx); - SHA256Update(&ctx, (unsigned char *)(src), + SHA256Update(&ctx, static_cast(src), static_cast(len)); SHA256Final(&ctx, bytehash); // Convert it to hex -- cgit v1.2.3-70-g09d2