Subject: bug#44850: 27.1; Emacs crash in font handling with font-backend ns

From: Mattias Engdegård <[email-masked]>
Date: Fri, 27 Nov 2020 18:16:48 +0100

> I'd prefer to lift the restriction introduced by doprnt.c, instead of replacing that character. It isn't clear to me why this restriction is a good idea, and it doesn't seem like lifting the restriction should be hard.

Yes, the restriction is a bit odd but perhaps there was a good reason. For this application, however, we could just switch from esprintf to sprintf in nsterm.m. (The stated reason for using esprintf was in case the string is longer than 2 GiB but I think we would have bigger problems if a frame title ever becomes that long.)

OK for master? (Also fixed the unsightly 'x' while at it)

--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7282,7 +7282,7 @@ - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
             old_title = t;
           }
         size_title = xmalloc (strlen (old_title) + 40);
-       esprintf (size_title, "%s  —  (%d x %d)", old_title, cols, rows);
+        sprintf (size_title, "%s  —  (%d × %d)", old_title, cols, rows);
         [window setTitle: [NSString stringWithUTF8String: size_title]];
         [window display];
         xfree (size_title);