Fix bug #52059: httpd/makefsdata assumes UNICODE

Patch by Gisle Vanem
And fixup one variable name (currName -> curName)
This commit is contained in:
Dirk Ziegelmeier 2017-09-20 12:41:31 +02:00
parent 6447a583e2
commit 8faf765632

View File

@ -421,7 +421,7 @@ int process_sub(FILE *data_file, FILE *struct_file)
ret = tinydir_readfile_n(&dir, &file, i); ret = tinydir_readfile_n(&dir, &file, i);
if (ret == 0) { if (ret == 0) {
#if (defined _MSC_VER || defined __MINGW32__) #if (defined _MSC_VER || defined __MINGW32__) && (defined _UNICODE)
size_t i; size_t i;
char currName[256]; char currName[256];
wcstombs_s(&i, currName, sizeof(currName), file.name, sizeof(currName)); wcstombs_s(&i, currName, sizeof(currName), file.name, sizeof(currName));
@ -461,12 +461,12 @@ int process_sub(FILE *data_file, FILE *struct_file)
if (ret == 0) { if (ret == 0) {
if (!file.is_dir) { if (!file.is_dir) {
#if (defined _MSC_VER || defined __MINGW32__) #if (defined _MSC_VER || defined __MINGW32__) && (defined _UNICODE)
size_t i; size_t i;
char curName[256]; char curName[256];
wcstombs_s(&i, curName, sizeof(curName), file.name, sizeof(curName)); wcstombs_s(&i, curName, sizeof(curName), file.name, sizeof(curName));
#else #else
const char *currName = file.name; const char *curName = file.name;
#endif #endif
if (strcmp(curName, "fsdata.tmp") == 0) { if (strcmp(curName, "fsdata.tmp") == 0) {