replace array int sizes to MAXPATHLEN and MD5_LEN where possible

This commit is contained in:
Svyatoslav Krasnov 2022-07-12 10:56:38 +00:00
parent 0e6eec0046
commit ba2754d36b
2 changed files with 7 additions and 6 deletions

View File

@ -181,8 +181,8 @@ static void filename_hash(const char* filename, int fanout, char* dir) {
// //
int check_download_file(const char* file_path, const char* dl_hier_path) { int check_download_file(const char* file_path, const char* dl_hier_path) {
bool md5_file_exists = false; bool md5_file_exists = false;
char md5_file_path[256]; char md5_file_path[MAXPATHLEN];
char md5_hash_src[33], md5_hash_dst[33]; char md5_hash_src[MD5_LEN], md5_hash_dst[MD5_LEN];
double nbytes; double nbytes;
std::string file_content, file_hash; std::string file_content, file_hash;
int file_size; int file_size;

View File

@ -30,7 +30,7 @@
#include <fstream> #include <fstream>
static int create_md5_file(const char* file_path, const char* md5_file_path, bool verbose) { static int create_md5_file(const char* file_path, const char* md5_file_path, bool verbose) {
char md5_file_hash[256], path[256]; char md5_file_hash[MD5_LEN], path[MAXPATHLEN];
FILE* md5_filep; FILE* md5_filep;
int retval; int retval;
double nbytes; double nbytes;
@ -61,7 +61,8 @@ int stage_file(
bool copy, bool copy,
bool verbose bool verbose
) { ) {
char dl_hier_path[256], gz_path[256], md5_file_path[256], md5_file_hash[33]; char dl_hier_path[MAXPATHLEN], gz_path[MAXPATHLEN];
char md5_file_path[MAXPATHLEN], md5_file_hash[MD5_LEN];
char* file_name; char* file_name;
double nbytes; double nbytes;
int retval; int retval;
@ -189,8 +190,8 @@ int main(int argc, char** argv) {
bool gzip = false; bool gzip = false;
bool copy = false; bool copy = false;
bool verbose = false; bool verbose = false;
char path[256]; char path[MAXPATHLEN];
char file_path[256]; char file_path[MAXPATHLEN];
if (!boinc_file_exists("html/inc/dir_hier.inc") || !boinc_file_exists("config.xml")) { if (!boinc_file_exists("html/inc/dir_hier.inc") || !boinc_file_exists("config.xml")) {
fprintf(stderr, "This program must be run in the project root directory.\n"); fprintf(stderr, "This program must be run in the project root directory.\n");