From f2083b42b26ef525fdf6e51a7b685c8c0177e5da Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Sat, 22 May 2021 15:51:51 -0700 Subject: [PATCH] Character 255 is a non-breaking space in CP437 Now IS_WHITESPACE() will return true for that char and this allows things like truncsp() to truncate trailing white-space (e.g. from a FILE_ID.DIZ), even if it contains a terminating 0xFF character for some unknown reason. --- src/xpdev/gen_defs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xpdev/gen_defs.h b/src/xpdev/gen_defs.h index d615693e74..b42e3412b4 100644 --- a/src/xpdev/gen_defs.h +++ b/src/xpdev/gen_defs.h @@ -37,6 +37,7 @@ #ifndef _GEN_DEFS_H #define _GEN_DEFS_H +#include "cp437defs.h" #include <errno.h> /* Resolve multi-named errno constants */ @@ -451,7 +452,7 @@ typedef struct { /* ASCIIZ char* parsing helper macros */ /* These (unsigned char) typecasts defeat MSVC debug assertion when passed a negative value */ -#define IS_WHITESPACE(c) isspace((unsigned char)(c)) +#define IS_WHITESPACE(c) (isspace((unsigned char)(c)) || c == CP437_NO_BREAK_SPACE) #define IS_CONTROL(c) iscntrl((unsigned char)(c)) #define IS_ALPHA(c) isalpha((unsigned char)(c)) #define IS_ALPHANUMERIC(c) isalnum((unsigned char)(c)) -- GitLab