fix title setting

This commit is contained in:
cy384 2024-10-21 19:39:32 -04:00
parent 686a3010d1
commit 3839c5118e
2 changed files with 3 additions and 3 deletions

View File

@ -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; Str255 pascal_name;
strncpy((char *) &pascal_name[1], c_name, 254); 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); SetWTitle(w, pascal_name);
} }

View File

@ -105,7 +105,7 @@ extern enum THREAD_COMMAND read_thread_command;
extern enum THREAD_STATE read_thread_state; extern enum THREAD_STATE read_thread_state;
int save_prefs(void); 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); OSErr FSpPathFromLocation(FSSpec* spec, int* length, Handle* fullPath);