From 423995dd5bddfdd07adf73d7eb4861cc513b3753 Mon Sep 17 00:00:00 2001 From: Robert van Engelen <88845949+Robert-van-Engelen@users.noreply.github.com> Date: Sat, 1 Nov 2025 14:22:09 -0400 Subject: [PATCH 1/3] remove deprecated malloc.h malloc.h is deprecated, malloc/free are declared in stdlib.h --- dsktool/dsktool.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dsktool/dsktool.c b/dsktool/dsktool.c index aed1b85..b8b3044 100644 --- a/dsktool/dsktool.c +++ b/dsktool/dsktool.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include From 637b3973727d7d24bfcccfbe7844e827c419005e Mon Sep 17 00:00:00 2001 From: Robert van Engelen <88845949+Robert-van-Engelen@users.noreply.github.com> Date: Sat, 1 Nov 2025 14:26:20 -0400 Subject: [PATCH 2/3] compile C code with cc, not c++ & no static nothing is specifically C++ in dsktool.c comment out STATIC because this prevents linking on some systems like MacOS --- dsktool/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsktool/Makefile b/dsktool/Makefile index 5366a4a..7c4f001 100644 --- a/dsktool/Makefile +++ b/dsktool/Makefile @@ -1,7 +1,7 @@ -CC=g++ +CC=cc #CC=i686-w64-mingw32-g++ #FLAGS32=-m32 -STATIC=-static -static-libgcc -static-libstdc++ +#STATIC=-static -static-libgcc -static-libstdc++ CCFLAGS=$(FLAGS32) $(STATIC) -Wall -O2 -fpermissive -Wunused-variable OUT=dsktool #OUT=dsktool.exe From 7fb69b041fa9c10eba7ac9d05abe25a623701c15 Mon Sep 17 00:00:00 2001 From: Robert van Engelen <88845949+Robert-van-Engelen@users.noreply.github.com> Date: Sat, 1 Nov 2025 14:34:21 -0400 Subject: [PATCH 3/3] fix incorrect char comparisons reason: char may or may not be signed, no assumption should be made fix: change char comparisons --- dsktool/dsktool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dsktool/dsktool.c b/dsktool/dsktool.c index b8b3044..de85a8f 100644 --- a/dsktool/dsktool.c +++ b/dsktool/dsktool.c @@ -291,7 +291,7 @@ fileinfo_t *getfileinfo (uint16_t entrypos) { // Filter entries by name char *name = (char *)dir->name; for (i=0; i<11; i++) { - if (*name < 0x20 || *name >= 0x80) return NULL; + if (*name < 0x20 || (*name & 0x80)) return NULL; name++; } @@ -415,7 +415,7 @@ void list_advhdsk (void) { printf ("Name of volume: %s\n\n",name); for (i=0; i<190; i++) { file = getfileinfoadvh(i); - if (file->name[0]==0xFF) break; + if ((unsigned char)file->name[0]==0xFF) break; printf ("%-8s.%-3s [Diskfile Offset:%7d] %7u bytes\n", file->name, file->ext, file->first, file->size); } puts(""); @@ -655,7 +655,7 @@ void add_single_file(char *name, char *pathname) { //Search first empty directory entry dir = rootdir; for (i=0; imaxDirectoryEntries; i++) { - if (dir->name[0]<0x20 || dir->name[0]>=0x80) { + if (dir->name[0]<0x20 || (dir->name[0] & 0x80)) { break; } dir++;