Merge pull request #1849 from laciba96/master

Fix encoding issues in win_progsett.c and win_icon.c
This commit is contained in:
Miran Grča
2021-11-20 10:34:57 +01:00
committed by GitHub
2 changed files with 5 additions and 5 deletions

View File

@@ -135,7 +135,7 @@ void win_load_icon_set()
for (i = 0; i < count; i++)
{
plat_append_filename(temp, path_root, icon_files[i].filename);
mbstowcs(wtemp, temp, strlen(temp) + 1);
mbstoc16s(wtemp, temp, strlen(temp) + 1);
HICON ictemp;
ictemp = LoadImageW(NULL, (LPWSTR)wtemp, IMAGE_ICON, x, y, LR_LOADFROMFILE | LR_DEFAULTCOLOR);

View File

@@ -102,7 +102,7 @@ progsett_fill_iconsets(HWND hdlg)
win_get_icons_path(icon_path_root);
wchar_t search[512];
mbstowcs(search, icon_path_root, strlen(icon_path_root) + 1);
mbstoc16s(search, icon_path_root, strlen(icon_path_root) + 1);
wcscat(search, L"*.*");
hFind = FindFirstFile((LPCWSTR)search, &data);
@@ -113,7 +113,7 @@ progsett_fill_iconsets(HWND hdlg)
(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
wchar_t temp[512] = {0}, dispname[512] = {0};
mbstowcs(temp, icon_path_root, strlen(icon_path_root) + 1);
mbstoc16s(temp, icon_path_root, strlen(icon_path_root) + 1);
wcscat(temp, data.cFileName);
wcscat(temp, L"\\iconinfo.txt");
@@ -124,14 +124,14 @@ progsett_fill_iconsets(HWND hdlg)
char line[512] = {0};
if (fgets(line, 511, fp))
{
mbstowcs(dispname, line, strlen(line) + 1);
mbstoc16s(dispname, line, strlen(line) + 1);
}
fclose(fp);
}
char filename[512];
wcstombs(filename, data.cFileName, 511);
c16stombs(filename, data.cFileName, 511);
int index = SendMessage(icon_combo, CB_ADDSTRING, 0, (LPARAM)dispname);
SendMessage(icon_combo, CB_SETITEMDATA, index, (LPARAM)(strdup(filename)));