From 3839c5118e719ec0ce79aed035da99a9d1f7dd22 Mon Sep 17 00:00:00 2001 From: cy384 Date: Mon, 21 Oct 2024 19:39:32 -0400 Subject: [PATCH] fix title setting --- ssheven.c | 4 ++-- ssheven.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ssheven.c b/ssheven.c index 08971d8..dbe1bdf 100644 --- a/ssheven.c +++ b/ssheven.c @@ -53,11 +53,11 @@ void generate_key_mapping(void) } } -void set_window_title(WindowPtr w, const char* c_name) +void set_window_title(WindowPtr w, const char* c_name, size_t length) { Str255 pascal_name; strncpy((char *) &pascal_name[1], c_name, 254); - pascal_name[0] = strlen(c_name); + pascal_name[0] = length < 254 ? length : 254; SetWTitle(w, pascal_name); } diff --git a/ssheven.h b/ssheven.h index fbd7dc8..75a7fbe 100644 --- a/ssheven.h +++ b/ssheven.h @@ -105,7 +105,7 @@ extern enum THREAD_COMMAND read_thread_command; extern enum THREAD_STATE read_thread_state; int save_prefs(void); -void set_window_title(WindowPtr w, const char* c_name); +void set_window_title(WindowPtr w, const char* c_name, size_t length); OSErr FSpPathFromLocation(FSSpec* spec, int* length, Handle* fullPath);