Sat Jan 1 09:20:41 2022 UTC ()
audio/rosegarden: legacy code fixups.

This fork of rosegarden is dead upstream but seemingly worth keeping
around, so do some maintenance.

Silence a bunch of compiler warnings (not all though). Avoid unsafe
use of tmpnam(). Avoid some uses of sprintf, including one triggering
a compiler warning about a static overflow. (Plenty more sprintf uses
remain though.) Use standard headers. Use ctype functions correctly.
Etc.

Also add patch comments. Fix some pkglint.

This is probably going to warrant a patchkit in the future.


(dholland)
diff -r1.34 -r1.35 pkgsrc/audio/rosegarden/Makefile
diff -r1.11 -r1.12 pkgsrc/audio/rosegarden/distinfo
diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-aa
diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ab
diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ac
diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ad
diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ae
diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-af
diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ag
diff -r1.1 -r1.2 pkgsrc/audio/rosegarden/patches/patch-configure
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-editor_src_Dechord.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-editor_src_Main.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-editor_src_MenuGroup.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-editor_src_MenuTools.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-editor_src_Rechord.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-lists_include_Lists.h
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-lists_src_Lists.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-sequencer_src_EventListWindow.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-sequencer_src_Main.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-sequencer_src_Menu.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-sequencer_src_MidiSetupDlgs.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-sequencer_src_PianoRoll.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-topbox_src_Main.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-yawn_src_YFile.c
diff -r0 -r1.1 pkgsrc/audio/rosegarden/patches/patch-yawn_src_YOptionMenu.c

cvs diff -r1.34 -r1.35 pkgsrc/audio/rosegarden/Makefile (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/Makefile 2022/01/01 07:50:22 1.34
+++ pkgsrc/audio/rosegarden/Makefile 2022/01/01 09:20:40 1.35
@@ -1,11 +1,10 @@
-# $NetBSD: Makefile,v 1.34 2022/01/01 07:50:22 dholland Exp $
+# $NetBSD: Makefile,v 1.35 2022/01/01 09:20:40 dholland Exp $
 
 DISTNAME=	rosegarden-2.1pl4
 PKGNAME=	rosegarden-2.1.4
-PKGREVISION=	6
+PKGREVISION=	7
 CATEGORIES=	audio
 #MASTER_SITES=	http://www.cannam.demon.co.uk/rosegarden/distribution/
-LICENSE=	gnu-gpl-v2
 
 MAINTAINER=	pkgsrc-users@NetBSD.org
 # This package is the (now really old) X11 version of Rosegarden, which
@@ -15,6 +14,7 @@
 # to keep a copy of this package as rosegarden-x11.
 HOMEPAGE=	https://www.rosegardenmusic.com/
 COMMENT=	Notation editor & MIDI sequencer
+LICENSE=	gnu-gpl-v2
 
 MAKE_JOBS_SAFE=		no
 

cvs diff -r1.11 -r1.12 pkgsrc/audio/rosegarden/distinfo (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/distinfo 2021/10/26 09:59:27 1.11
+++ pkgsrc/audio/rosegarden/distinfo 2022/01/01 09:20:40 1.12
@@ -1,14 +1,29 @@
-$NetBSD: distinfo,v 1.11 2021/10/26 09:59:27 nia Exp $
+$NetBSD: distinfo,v 1.12 2022/01/01 09:20:40 dholland Exp $
 
 BLAKE2s (rosegarden-2.1pl4.tar.gz) = afa53d18180ca96ab21cf7f7f5d777264d685fdc7f4d6be868d249ad88da0849
 SHA512 (rosegarden-2.1pl4.tar.gz) = 75caf2132ac1e89bd13c650750776793c86ded8fdd0e2237831ffe64d1d4bc53f1345c2e545005f6194320b832b134145e278e816d2e251a436f011a1221f640
 Size (rosegarden-2.1pl4.tar.gz) = 587134 bytes
-SHA1 (patch-aa) = 4c45840c9a7d0b3ee43ddb300de55a442df0f7da
-SHA1 (patch-ab) = 3319061b197bd135c4267c39ddd9fd92709347e1
-SHA1 (patch-ac) = 3f4f3ed849d037d3371b9ab786cb547d6e1c8daa
-SHA1 (patch-ad) = 22b2a1a060e8b2b3f7dda5d7c7189fc96b99c1a0
-SHA1 (patch-ae) = b6fb9815ee6918dbc5b28fd1fec6bca1d42cf028
-SHA1 (patch-af) = f3c99ccf142420255ae10f19bed37933ee24c744
-SHA1 (patch-ag) = 9f1185353c2663d7b250cfff45b2fdef8639e124
-SHA1 (patch-configure) = a593f4ece3dc1db8ff70583582744be8381b8525
+SHA1 (patch-aa) = bb348c1e6ce7fc4cbac2f286b04874602c92a412
+SHA1 (patch-ab) = 7a3149396f2df86f97f655a8ec1dc2cded6354ed
+SHA1 (patch-ac) = b5516381662bf3bda155756be79aa6a2b9e11d3b
+SHA1 (patch-ad) = 2cb0b47e4195d2615d6ea289e3da703ea62bb48b
+SHA1 (patch-ae) = ea37b06b28e5959c744a970226231e2969642e67
+SHA1 (patch-af) = 856597e0234b3bad262af8eda270960d1c693239
+SHA1 (patch-ag) = 2f10a9e24e77327ffa3349418ccf6fc7da003051
+SHA1 (patch-configure) = c05ac73375eb3a3ecc0fee1d6b36122a4cffb032
+SHA1 (patch-editor_src_Dechord.c) = 9a96c3eeaa42e2c17d58f2a17f88d6e70f6442a0
+SHA1 (patch-editor_src_Main.c) = abf0b610d3069d5f5a1363b03f1404f230527390
+SHA1 (patch-editor_src_MenuGroup.c) = e36fb84f4ffe57223deb34572b2143c47b642f90
+SHA1 (patch-editor_src_MenuTools.c) = 14f6ffab96693ca196108bb3704ec7603efd1c3c
+SHA1 (patch-editor_src_Rechord.c) = 43ba7f764256a0cd4a543eac3e9255a288724519
 SHA1 (patch-editor_src_midiout_c) = 7f4eca850df83af49b3f5c69ea1283e3dfa05ee8
+SHA1 (patch-lists_include_Lists.h) = 8a715eb1114ece5dec27c0e35dcd9d8856570a2b
+SHA1 (patch-lists_src_Lists.c) = 1c145bcac5f64ced07194aeba00615690ef884bb
+SHA1 (patch-sequencer_src_EventListWindow.c) = fee447dacb8150fb7fcff47a933e0d692f339fc9
+SHA1 (patch-sequencer_src_Main.c) = 76db0abf3f51298e5801291625e808d4b70263c0
+SHA1 (patch-sequencer_src_Menu.c) = a268df92bb30080c3ece3090fba1bb1e82eac97c
+SHA1 (patch-sequencer_src_MidiSetupDlgs.c) = 90e48d51a0ca5474c79bbe82392f35c2797b8d88
+SHA1 (patch-sequencer_src_PianoRoll.c) = bb8cc302c34719e9ec8b180477bf72b76f381ce7
+SHA1 (patch-topbox_src_Main.c) = 313dac1e780bca663de7e9b6e66f3bee456d6752
+SHA1 (patch-yawn_src_YFile.c) = 1c72785d2b3cdf1ff24a95e6148a080e9cf89764
+SHA1 (patch-yawn_src_YOptionMenu.c) = 7822669bb6913793a1eb6789f2e3707e41edfb8e

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-aa (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/patches/patch-aa 2002/03/19 12:21:07 1.2
+++ pkgsrc/audio/rosegarden/patches/patch-aa 2022/01/01 09:20:41 1.3
@@ -1,4 +1,7 @@
-$NetBSD: patch-aa,v 1.2 2002/03/19 12:21:07 wiz Exp $
+$NetBSD: patch-aa,v 1.3 2022/01/01 09:20:41 dholland Exp $
+
+Configure for pkgsrc.
+Make the install rule do something useful.
 
 --- Makefile.in.orig	Fri Dec 21 15:12:43 2001
 +++ Makefile.in

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ab (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/patches/patch-ab 2002/03/19 12:21:07 1.2
+++ pkgsrc/audio/rosegarden/patches/patch-ab 2022/01/01 09:20:41 1.3
@@ -1,4 +1,6 @@
-$NetBSD: patch-ab,v 1.2 2002/03/19 12:21:07 wiz Exp $
+$NetBSD: patch-ab,v 1.3 2022/01/01 09:20:41 dholland Exp $
+
+Don't hardcode the install prefix.
 
 --- editor/src/Filter.c.orig	Mon Jul  2 09:10:49 2001
 +++ editor/src/Filter.c

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ac (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/patches/patch-ac 2002/03/19 12:21:07 1.2
+++ pkgsrc/audio/rosegarden/patches/patch-ac 2022/01/01 09:20:41 1.3
@@ -1,4 +1,6 @@
-$NetBSD: patch-ac,v 1.2 2002/03/19 12:21:07 wiz Exp $
+$NetBSD: patch-ac,v 1.3 2022/01/01 09:20:41 dholland Exp $
+
+Don't hardcode the install prefix.
 
 --- editor/src/Resources.h.orig	Fri Oct 10 06:22:00 1997
 +++ editor/src/Resources.h

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ad (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/patches/patch-ad 2002/03/19 12:21:07 1.2
+++ pkgsrc/audio/rosegarden/patches/patch-ad 2022/01/01 09:20:41 1.3
@@ -1,4 +1,6 @@
-$NetBSD: patch-ad,v 1.2 2002/03/19 12:21:07 wiz Exp $
+$NetBSD: patch-ad,v 1.3 2022/01/01 09:20:41 dholland Exp $
+
+Don't hardcode the install prefix.
 
 --- sequencer/src/Filter.c.orig	Mon Jul  2 08:59:48 2001
 +++ sequencer/src/Filter.c

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ae (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/patches/patch-ae 2002/03/19 12:21:07 1.2
+++ pkgsrc/audio/rosegarden/patches/patch-ae 2022/01/01 09:20:41 1.3
@@ -1,4 +1,6 @@
-$NetBSD: patch-ae,v 1.2 2002/03/19 12:21:07 wiz Exp $
+$NetBSD: patch-ae,v 1.3 2022/01/01 09:20:41 dholland Exp $
+
+Don't hardcode the install prefix.
 
 --- sequencer/src/Resources.h.orig	Fri Oct 10 06:21:47 1997
 +++ sequencer/src/Resources.h

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-af (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/patches/patch-af 2002/03/19 12:21:07 1.2
+++ pkgsrc/audio/rosegarden/patches/patch-af 2022/01/01 09:20:41 1.3
@@ -1,4 +1,6 @@
-$NetBSD: patch-af,v 1.2 2002/03/19 12:21:07 wiz Exp $
+$NetBSD: patch-af,v 1.3 2022/01/01 09:20:41 dholland Exp $
+
+Don't hardcode the install prefix.
 
 --- topbox/src/Resources.h.orig	Fri Oct 10 06:22:12 1997
 +++ topbox/src/Resources.h

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ag (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/patches/patch-ag 2009/07/07 16:38:39 1.2
+++ pkgsrc/audio/rosegarden/patches/patch-ag 2022/01/01 09:20:41 1.3
@@ -1,4 +1,7 @@
-$NetBSD: patch-ag,v 1.2 2009/07/07 16:38:39 joerg Exp $
+$NetBSD: patch-ag,v 1.3 2022/01/01 09:20:41 dholland Exp $
+
+DESTDIR support.
+Install the X11 application-defaults usefully.
 
 --- do-install.orig	1997-10-21 23:20:43.000000000 +0200
 +++ do-install

cvs diff -r1.1 -r1.2 pkgsrc/audio/rosegarden/patches/patch-configure (expand / switch to context diff)
--- pkgsrc/audio/rosegarden/patches/patch-configure 2014/06/26 20:26:39 1.1
+++ pkgsrc/audio/rosegarden/patches/patch-configure 2022/01/01 09:20:41 1.2
@@ -1,4 +1,6 @@
-$NetBSD: patch-configure,v 1.1 2014/06/26 20:26:39 asau Exp $
+$NetBSD: patch-configure,v 1.2 2022/01/01 09:20:41 dholland Exp $
+
+Don't use -lmalloc.
 
 --- configure.orig	2014-06-26 17:34:11.000000000 +0000
 +++ configure

File Added: pkgsrc/audio/rosegarden/patches/patch-editor_src_Dechord.c
$NetBSD: patch-editor_src_Dechord.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Ues standard headers.
Use ctype functions correctly.

--- editor/src/Dechord.c~	1997-02-24 21:43:40.000000000 +0000
+++ editor/src/Dechord.c
@@ -22,6 +22,8 @@
 		 yield single notes
 */
 
+#include <ctype.h>
+
 #include "Dechord.h"
 #ifdef USE_POSIX_REGEXP
 
@@ -170,7 +172,7 @@ Pitch NoteToPitch(char Note, ClefTag cur
   Pitch p;
   Begin("NoteToPitch");
 
-  Note = toupper((int)Note);
+  Note = toupper((unsigned char)Note);
   if((Note < 'A') && (Note > 'G')) Error("wrong note");
 
   p = Note - 'E' /* - 7 ?? */ + ClefPitchOffset(currentClef);
@@ -512,9 +514,9 @@ Chord* SpellChord(char ChordString[], Cl
   /* So the Find<x> functions will only see what is "after" the root,
      ie from "Cmaj7" we just want to see "maj7" */
 
-  while(isspace(subChordString[0])) subChordString++;
+  while(isspace((unsigned char)subChordString[0])) subChordString++;
 
-  if(isupper((int)RootNote[0])) {
+  if(isupper((unsigned char)RootNote[0])) {
 
     if(Regexec(GetAltBass, ChordString) == REG_MATCHED) { /* Get possible altered bass */
 #ifdef USE_POSIX_REGEXP

File Added: pkgsrc/audio/rosegarden/patches/patch-editor_src_Main.c
$NetBSD: patch-editor_src_Main.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Use standard headers.
Silence compiler warnings.
Call gethostname() correctly.
Don't use sprintf.

--- editor/src/Main.c.orig	2001-07-03 11:55:17.000000000 +0000
+++ editor/src/Main.c
@@ -17,8 +17,9 @@
 #include <X11/Xutil.h>
 #include <X11/cursorfont.h>
 
-#include <signal.h>
 #include <sys/types.h>
+#include <unistd.h>
+#include <signal.h>
 
 #ifdef HAVE_SPECIALIST_MALLOC_LIBRARY
 #include <malloc.h>
@@ -153,6 +154,10 @@ int ErrorXIO(Display *d)
 
 /* Handler for Toolkit errors, always fatal */
 
+static
+#if defined(__CLANG__) || defined(__GNUC__)
+__attribute__((__noreturn__))
+#endif
 void ErrorXt(char *msg)
 {
   Begin("ErrorXt");
@@ -283,12 +288,14 @@ void SetTitleBar(char **argv)
   title = (String)XtMalloc(200);
 
 #ifdef NO_GETHOSTNAME
-  sprintf(title, "%s", ApplicationName);
+  snprintf(title, 200, "%s", ApplicationName);
 #else
-  if (gethostname(machine, 99))
-    sprintf(title, "%s", ApplicationName);
-  else
-    sprintf(title, "%s  [%s]", ApplicationName, machine);
+  if (gethostname(machine, sizeof(machine)))
+    snprintf(title, 200, "%s", ApplicationName);
+  else {
+    machine[sizeof(machine) - 1] = '\0'; /* just in case */
+    snprintf(title, 200, "%s  [%s]", ApplicationName, machine);
+  }
 #endif
 
   XtSetArg(arg[0], XtNtitle,    (XtArgVal)title);

File Added: pkgsrc/audio/rosegarden/patches/patch-editor_src_MenuGroup.c
$NetBSD: patch-editor_src_MenuGroup.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Use standard headers.
Use ctype functions correctly.
Use scratch buffers that are large enough.
Don't use sprintf().

--- editor/src/MenuGroup.c~	1997-02-28 15:12:32.000000000 +0000
+++ editor/src/MenuGroup.c
@@ -6,6 +6,8 @@
 
 /* {{{ Includes */
 
+#include <ctype.h>
+
 #include "General.h"
 #include "Widgets.h"
 #include "Menu.h"
@@ -471,9 +473,9 @@ void GroupMenuTuplet(Widget w, XtPointer
 
       for (m = 0; choices[nch].description[m]; ++m) {
 	if (choices[nch].description[m] == ' ') {
-	  if (isupper(choices[nch].description[m+1])) {
+	  if (isupper((unsigned char)choices[nch].description[m+1])) {
 	    choices[nch].description[m+1] =
-	      tolower(choices[nch].description[m+1]);
+	      tolower((unsigned char)choices[nch].description[m+1]);
 	  }
 	}
       }
@@ -972,7 +974,7 @@ void GroupMenuInvert(Widget w, XtPointer
   Dimension      w1;
   XPoint         op;
   String         temp;
-  char           title[32];
+  char           title[64];
   int            i, result = -1;
 
   MajorStaveRec *mstave  = (MajorStaveRec *)stave;
@@ -997,9 +999,9 @@ void GroupMenuInvert(Widget w, XtPointer
 				tPane, MediumShade);
 
   switch(scope) {
-  case 1:  sprintf(title, "Invert Area around pitch");          break;
-  case 2:  sprintf(title, "Invert Rest of Staff around pitch"); break;
-  default: sprintf(title, "Invert Whole Piece around pitch");   break;
+  case 1:  snprintf(title, sizeof(title), "Invert Area around pitch");          break;
+  case 2:  snprintf(title, sizeof(title), "Invert Rest of Staff around pitch"); break;
+  default: snprintf(title, sizeof(title), "Invert Whole Piece around pitch");   break;
   }
 
   tLabel     = YCreateLabel(title, tTopBox);

File Added: pkgsrc/audio/rosegarden/patches/patch-editor_src_MenuTools.c
$NetBSD: patch-editor_src_MenuTools.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Use standard headers.
Don't use tmpnam().
Don't use sprintf().
Use ctype functions correctly.

--- editor/src/MenuTools.c.orig	1997-09-22 20:20:07.000000000 +0000
+++ editor/src/MenuTools.c
@@ -13,6 +13,8 @@
 #include "Menu.h"
 #include "StaveEdit.h"
 
+#include <sys/stat.h>
+#include <ctype.h>		/* for isdigit */
 #include <unistd.h>		/* for unlink */
 
 #include <Yawn.h>
@@ -28,7 +30,10 @@ void SequenceAcknowledgeCallback(IL_Retu
 {
   Begin("SequenceCompleteCallback");
 
-  if (filename) (void)unlink(filename);	/* can't do anything about failure */
+  if (filename) {
+    (void)unlink(filename);	/* can't do anything about failure */
+    XtFree(filename);
+  }
 
   StaveBusy(False);
 
@@ -68,12 +73,17 @@ void SequenceAcknowledgeCallback(IL_Retu
 
 void FileMenuSequence(Widget w, XtPointer a, XtPointer b)
 {
+  char namebuf[PATH_MAX];
+  struct stat buf;
+  int fd;
   int len;
   String name;
   String sname;
   Begin("FileMenuSequence");
 
-  if (!(filename = tmpnam(NULL))) {
+  strcpy(namebuf, "/tmp/rosegarden.XXXXXXXX");
+  fd = mkstemp(namebuf);
+  if (fd < 0 || (filename = XtNewString(namebuf)) == NULL) {
     IssueMenuComplaint("Sorry, I couldn't get a temporary file name.");
     End;
   }
@@ -83,17 +93,24 @@ void FileMenuSequence(Widget w, XtPointe
   name = (String)XtMalloc(len + 25);
 
   if (len > 13 && !strcmp(sname + len - 12, " (temporary)")) {
-    sprintf(name, "%s", sname);
+    snprintf(name, len + 25, "%s", sname);
   } else {
-    sprintf(name, "%s (temporary)", sname);
+    snprintf(name, len + 25, "%s (temporary)", sname);
   }
 
   if (MidiWriteStave(stave, filename, name) == Failed) {
     XtFree(name);
+    close(fd);
     End;
   }
 
   XtFree(name);
+  if (fstat(fd, &buf) < 0 || buf.st_size == 0) {
+    IssueMenuComplaint("Sorry, something went wrong with the temporary file.");
+    close(fd);
+    End;
+  }
+  close(fd);
 
   StaveBusy(True);
   IL_RequestService(ILS_SEQUENCE_SERVICE, SequenceAcknowledgeCallback,
@@ -271,7 +288,7 @@ void FileMenuFollowILCallback(String chu
 
   IL_AcknowledgeRequest(ILS_FOLLOW_SERVICE, IL_SERVICE_OK);
 
-  if (!isdigit(chunk[0]) && chunk[0] != '-') {
+  if (!isdigit((unsigned char)chunk[0]) && chunk[0] != '-') {
 
     if (!strcmp(chunk, ILS_FOLLOW_UNLOCK)) {
 

File Added: pkgsrc/audio/rosegarden/patches/patch-editor_src_Rechord.c
$NetBSD: patch-editor_src_Rechord.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Use standard headers.
Use ctype functions correctly.

--- editor/src/Rechord.c~	2001-06-29 16:31:01.000000000 +0000
+++ editor/src/Rechord.c
@@ -2,6 +2,8 @@
 /* Mild attempt at chord naming */
 /* G. Laurent, 09/96 */
 
+#include <ctype.h>
+
 #include "Rechord.h"
 
 #ifdef DEBUG
@@ -824,7 +826,7 @@ char* Rechord(Chord chord) {
   }
   else {
     /* There's only one note in the chord, use lower case to name it */
-    holdShortest[0] = (char)tolower((int)holdShortest[0]);
+    holdShortest[0] = tolower((unsigned char)holdShortest[0]);
   }
 
   chordName = malloc(strlen(holdShortest) + 1);

File Added: pkgsrc/audio/rosegarden/patches/patch-lists_include_Lists.h
$NetBSD: patch-lists_include_Lists.h,v 1.1 2022/01/01 09:20:41 dholland Exp $

Avoid UB:
  - declare a suitable return type for a function returning a truth value

--- lists/include/Lists.h~	2002-03-22 22:31:52.000000000 +0000
+++ lists/include/Lists.h
@@ -84,7 +84,7 @@ extern List    LIST_Split       (List a)
 				             /* should already have second, */
 				             /* 'cos it was the passed arg) */
 
-extern List	LIST_IsWithin	(List who, List start, List end);
+extern int	LIST_IsWithin	(List who, List start, List end);
 					    /* is `who' a part of list */
 					    /* *** Deemus		*/
 

File Added: pkgsrc/audio/rosegarden/patches/patch-lists_src_Lists.c
$NetBSD: patch-lists_src_Lists.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Silence compiler warnings.
Avoid UB:
  - declare a suitable return type for a function returning a truth value
  - source files must end with a newline

--- lists/src/Lists.c~	2002-03-22 22:24:07.000000000 +0000
+++ lists/src/Lists.c
@@ -218,7 +218,7 @@ List LIST_Split(List a)
 
 // ***
 /* Check if given element is a part of list chunk */
-List LIST_IsWithin (List who, List start, List end)
+int LIST_IsWithin (List who, List start, List end)
 {
   Begin ("LIST_IsWithin");
   
@@ -234,4 +234,4 @@ List LIST_IsWithin (List who, List start
   
   Return (0);
 }
-// *** Deemus
\ No newline at end of file
+// *** Deemus

File Added: pkgsrc/audio/rosegarden/patches/patch-sequencer_src_EventListWindow.c
$NetBSD: patch-sequencer_src_EventListWindow.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Silence compiler warnings.

--- sequencer/src/EventListWindow.c~	1997-06-14 15:17:36.000000000 +0000
+++ sequencer/src/EventListWindow.c
@@ -284,7 +284,7 @@ void
 Midi_DeviceMenuCB(Widget w, XtPointer a, XtPointer b)
 {
   ELWindowList ThisWindow = (ELWindowList)a;
-  int i = (int)b;
+  int i = (int)(intptr_t)b;
 
   BEGIN("Midi_DeviceMenuCB");
 

File Added: pkgsrc/audio/rosegarden/patches/patch-sequencer_src_Main.c
$NetBSD: patch-sequencer_src_Main.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Silence compiler warnings.

--- sequencer/src/Main.c~	1997-10-16 21:46:59.000000000 +0000
+++ sequencer/src/Main.c
@@ -301,6 +301,10 @@ RETURN_INT(-1);			/* no return is fatal 
 /* Midi_ErrorXt: Handler for Toolkit errors, always fatal */
 /**********************************************************/
 
+static
+#if defined(__CLANG__) || defined(__GNUC__)
+__attribute__((__noreturn__))
+#endif
 void Midi_ErrorXt(char *msg)
 {
 BEGIN("Midi_ErrorXt");

File Added: pkgsrc/audio/rosegarden/patches/patch-sequencer_src_Menu.c
$NetBSD: patch-sequencer_src_Menu.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Use standard headers.
Don't use tmpnam().

--- sequencer/src/Menu.c.orig	1997-10-21 21:19:40.000000000 +0000
+++ sequencer/src/Menu.c
@@ -3,9 +3,11 @@
  */
 
 #include <ILClient.h>
-/*#include <sys/types.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/wait.h>
-#include <unistd.h>*/
+/*#include <unistd.h>*/
+#include <limits.h>
 #include "Globals.h"
 
 #include "Types.h"
@@ -251,6 +253,10 @@ END;
 	
 void Midi_NotateCB(Widget w, XtPointer a, XtPointer b)
 {
+	char tempname[PATH_MAX];
+	struct stat buf;
+	int fd;
+
 BEGIN("Midi_NotateCB");
 
 	w = Midi_GetShellWidget(w);
@@ -264,14 +270,25 @@ BEGIN("Midi_NotateCB");
 		END;
 	}
 
-	if (!(MIDItempFileName = XtNewString(tmpnam(NULL))))
+	strcpy(tempname, "/tmp/rosegarden.XXXXXXXX");
+	fd = mkstemp(tempname);
+	if (fd < 0 || (MIDItempFileName = XtNewString(tmpnam(NULL))) == NULL)
 	{
+		close(fd);
 		YQuery(topLevel, "Sorry, I couldn't get a temporary file name.",
 		       1, 0, 0, "Continue", NULL);
 		END;
 	}
 	
 	Midi_SaveFile(MIDItempFileName);
+	if (fstat(fd, &buf) < 0 || buf.st_size == 0)
+	{
+		close(fd);
+		YQuery(topLevel, "Sorry, something went wrong with the temporary file.",
+		       1, 0, 0, "Continue", NULL);
+		END;
+	}
+	close(fd);
 
 	IL_RequestService(ILS_EDIT_SERVICE, Midi_NotateAckCB, MIDItempFileName, strlen(MIDItempFileName) + 1);
 

File Added: pkgsrc/audio/rosegarden/patches/patch-sequencer_src_MidiSetupDlgs.c
$NetBSD: patch-sequencer_src_MidiSetupDlgs.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Silence compiler warnings.

--- sequencer/src/MidiSetupDlgs.c~	1997-10-07 21:28:58.000000000 +0000
+++ sequencer/src/MidiSetupDlgs.c
@@ -91,7 +91,7 @@ Midi_ChangesAllTracksCB(Widget w, XtPoin
 /* ELWindowList ThisWindow = (ELWindowList)a; */
 BEGIN("Midi_ChangesAllTracksCB");
 
-     MenuSelection  = (int)b;
+     MenuSelection  = (int)(intptr_t)b;
 
 END;
 }

File Added: pkgsrc/audio/rosegarden/patches/patch-sequencer_src_PianoRoll.c
$NetBSD: patch-sequencer_src_PianoRoll.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Silence compiler warnings.

--- sequencer/src/PianoRoll.c~	1997-05-18 11:57:17.000000000 +0000
+++ sequencer/src/PianoRoll.c
@@ -414,7 +414,7 @@ BEGIN("Midi_PianoRollScrollbarScrollCB")
 
     Zoom = ParentWindow->Zoom;
     if (!ParentWindow) END;
-    Pos = (int)CBdata;
+    Pos = (int)(intptr_t)CBdata;
 
     YGetValue(ParentWindow->Scrollbar, XtNlength, &Length);
 

File Added: pkgsrc/audio/rosegarden/patches/patch-topbox_src_Main.c
$NetBSD: patch-topbox_src_Main.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Silence compiler warnings.

--- topbox/src/Main.c~	1999-09-21 13:34:29.000000000 +0000
+++ topbox/src/Main.c
@@ -131,6 +131,10 @@ int ErrorXIO(Display *d)
 
 /* Handler for Toolkit errors, always fatal */
 
+static
+#if defined(__CLANG__) || defined(__GNUC__)
+__attribute__((__noreturn__))
+#endif
 void ErrorXt(char *msg)
 {
   Begin("ErrorXt");

File Added: pkgsrc/audio/rosegarden/patches/patch-yawn_src_YFile.c
$NetBSD: patch-yawn_src_YFile.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Silence compiler warnings.

--- yawn/src/YFile.c~	1996-12-22 21:53:24.000000000 +0000
+++ yawn/src/YFile.c
@@ -740,7 +740,7 @@ Boolean FileSetFileNameList(void)
 
   } else {
 
-    XawListChange(fileList, filecall, filecount, mwd > 300 ? mwd+6 : 300, True);
+    XawListChange(fileList, (const char **)filecall, filecount, mwd > 300 ? mwd+6 : 300, True);
   }
 
   XawListUnhighlight(fileList);
@@ -1256,7 +1256,7 @@ void FileName(Widget w, XtPointer a, XtP
 
 void FileFilter(Widget w, XtPointer a, XtPointer b)
 {
-  int answer = (int)b;
+  int answer = (int)(intptr_t)b;
 
   FilterSuffix = fileFilterOptions[0] ? answer == 0 : False;
   GlobDots     = fileFilterOptions[0] ? answer >  1 : answer > 0;

File Added: pkgsrc/audio/rosegarden/patches/patch-yawn_src_YOptionMenu.c
$NetBSD: patch-yawn_src_YOptionMenu.c,v 1.1 2022/01/01 09:20:41 dholland Exp $

Silence compiler warnings.

--- yawn/src/YOptionMenu.c~	1996-07-18 21:03:25.000000000 +0000
+++ yawn/src/YOptionMenu.c
@@ -48,7 +48,7 @@ void _YOptionMenuCallback(Widget w, XtPo
 	XtVaSetValues(optionMenus[i].button, XtNlabel, elt->label, NULL);
 	if (optionMenus[i].callback) {
 	  optionMenus[i].callback(optionMenus[i].button,
-				  optionMenus[i].client_data, (XtPointer)j);
+				  optionMenus[i].client_data, (XtPointer)(intptr_t)j);
 	}
 
 	End;