From 4bf73d8148e3df19a2e9cc5f0bcbc13d0515e15b Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Wed, 21 Apr 2021 12:26:06 +0300 Subject: [PATCH 1/3] Initialize iCol with zero. Uninitialized is random at debug and negative numbers fail to insert column. --- src/win/win_settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 57fce16ba..067f7c9f9 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -5060,7 +5060,7 @@ static BOOL win_settings_categories_init_columns(HWND hdlg) { LVCOLUMN lvc; - int iCol; + int iCol = 0; HWND hwndList = GetDlgItem(hdlg, IDC_SETTINGSCATLIST); lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; From b07a6023d0290b261386d28ef89ac99b43d71314 Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Wed, 21 Apr 2021 12:28:38 +0300 Subject: [PATCH 2/3] Fix compiling 86Box.rc in CMake. --- src/win/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/win/CMakeLists.txt b/src/win/CMakeLists.txt index 3fcf28d1a..cdb52aaae 100644 --- a/src/win/CMakeLists.txt +++ b/src/win/CMakeLists.txt @@ -30,6 +30,9 @@ if(MSVC) target_sources(86Box PRIVATE 86Box.manifest) target_sources(plat PRIVATE win_opendir.c) + + # Append null to resource strings (fixes file dialogs) + set_property(SOURCE 86Box.rc PROPERTY COMPILE_FLAGS -n) endif() if(DINPUT) From 90ccb754fbeb0202c69b271cbbdc8fea7caaaa98 Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Wed, 21 Apr 2021 13:00:56 +0300 Subject: [PATCH 3/3] Fix MSVC builds: win_opendir.c defined unicode on itself while it's used not in unicode. --- src/win/win_opendir.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/win/win_opendir.c b/src/win/win_opendir.c index d7755e372..5339f0713 100644 --- a/src/win/win_opendir.c +++ b/src/win/win_opendir.c @@ -17,8 +17,6 @@ * Copyright 1998-2007 MicroWalt Corporation * Copyright 2017 Fred N. van Kempen */ -#define UNICODE -#include #include #include #include @@ -158,10 +156,11 @@ readdir(DIR *p) default: /* regular entry. */ #ifdef UNICODE wcsncpy(p->dent.d_name, ffp->name, MAXNAMLEN+1); + p->dent.d_reclen = (char)wcslen(p->dent.d_name); #else strncpy(p->dent.d_name, ffp->name, MAXNAMLEN+1); + p->dent.d_reclen = (char)strlen(p->dent.d_name); #endif - p->dent.d_reclen = (char) wcslen(p->dent.d_name); } /* Read next entry. */