diff --git a/contrib/git_id/git_id.cpp b/contrib/git_id/git_id.cpp index 572db0c0e6..21b8b02f51 100644 --- a/contrib/git_id/git_id.cpp +++ b/contrib/git_id/git_id.cpp @@ -164,8 +164,8 @@ bool find_path() // don't count the root int count_fwd = 0, count_back = 0; - for (ptr = cur_path - 1; ptr = strchr(ptr + 1, '/'); count_fwd++); - for (ptr = cur_path - 1; ptr = strchr(ptr + 1, '\\'); count_back++); + for (ptr = cur_path - 1; (ptr = strchr(ptr + 1, '/')); count_fwd++); + for (ptr = cur_path - 1; (ptr = strchr(ptr + 1, '\\')); count_back++); int count = std::max(count_fwd, count_back); char path[MAX_PATH]; @@ -177,7 +177,7 @@ bool find_path() chdir(cur_path); return true; } - strncat(path_prefix, "../", MAX_PATH); + strncat(path_prefix, "../", (MAX_PATH-1)); ptr = strrchr(base_path, '\\'); if (ptr) *ptr = '\0'; @@ -219,6 +219,7 @@ bool fetch_origin() // use the public clone url if present because the private may require a password snprintf(cmd, MAX_CMD, "git fetch %s %s", (origins[1][0] ? origins[1] : origins[0]), remote_branch); int ret = system(cmd); + (void)ret; // silence unused variable warning return true; }