Amiga: tighten two minor issues from review

- amii_set_text_font called CloseLibrary(DiskfontBase) outside the
  OpenLibrary guard; on Kickstart V36+ that is a no-op for a NULL
  handle, but on V33/V34 it is undefined.  Move the close inside
  the if-block where DiskfontBase is known non-NULL.
- amii_get_ext_cmd's bounds check used BUFSZ for an obufp[100]
  buffer; the tighter COLNO check actually bounded it but the
  expression was misleading.  Use sizeof obufp.
This commit is contained in:
Ingo Paschke
2026-05-12 15:12:07 +02:00
parent 74c87caac3
commit cb46d9effd
2 changed files with 5 additions and 4 deletions
+2 -1
View File
@@ -499,7 +499,8 @@ amii_get_ext_cmd(void)
sel = com_index;
} else {
colx = put_ext_cmd(obufp, colx, cw, bottom);
if (bufp - obufp < BUFSZ - 1 && bufp - obufp < COLNO)
if (bufp - obufp < (int) sizeof obufp - 1
&& bufp - obufp < COLNO)
bufp++;
}
} else if (c == ('X' - 64) || c == '\177') {
+3 -3
View File
@@ -1732,7 +1732,7 @@ amii_set_text_font(char *name, int size)
/* Look for windows to set, and change them */
if (DiskfontBase = OpenLibrary("diskfont.library", amii_libvers)) {
if ((DiskfontBase = OpenLibrary("diskfont.library", amii_libvers))) {
TextsFont = OpenDiskFont(&TextsFont13);
for (i = 0; TextsFont && i < MAXWIN; ++i) {
if ((cw = amii_wins[i]) && cw->win != NULL) {
@@ -1751,9 +1751,9 @@ amii_set_text_font(char *name, int size)
}
}
}
CloseLibrary(DiskfontBase);
DiskfontBase = NULL;
}
CloseLibrary(DiskfontBase);
DiskfontBase = NULL;
}
void