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 unified 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,30 +1,30 @@ @@ -1,30 +1,30 @@
1# $NetBSD: Makefile,v 1.34 2022/01/01 07:50:22 dholland Exp $ 1# $NetBSD: Makefile,v 1.35 2022/01/01 09:20:40 dholland Exp $
2 2
3DISTNAME= rosegarden-2.1pl4 3DISTNAME= rosegarden-2.1pl4
4PKGNAME= rosegarden-2.1.4 4PKGNAME= rosegarden-2.1.4
5PKGREVISION= 6 5PKGREVISION= 7
6CATEGORIES= audio 6CATEGORIES= audio
7#MASTER_SITES= http://www.cannam.demon.co.uk/rosegarden/distribution/ 7#MASTER_SITES= http://www.cannam.demon.co.uk/rosegarden/distribution/
8LICENSE= gnu-gpl-v2 
9 8
10MAINTAINER= pkgsrc-users@NetBSD.org 9MAINTAINER= pkgsrc-users@NetBSD.org
11# This package is the (now really old) X11 version of Rosegarden, which 10# This package is the (now really old) X11 version of Rosegarden, which
12# upstream now barely admits ever existed and had its own version number 11# upstream now barely admits ever existed and had its own version number
13# sequence. The following *is* the project home page. Note: if anyone 12# sequence. The following *is* the project home page. Note: if anyone
14# gets around to importing a modern Rosegarden, it's probably a good idea 13# gets around to importing a modern Rosegarden, it's probably a good idea
15# to keep a copy of this package as rosegarden-x11. 14# to keep a copy of this package as rosegarden-x11.
16HOMEPAGE= https://www.rosegardenmusic.com/ 15HOMEPAGE= https://www.rosegardenmusic.com/
17COMMENT= Notation editor & MIDI sequencer 16COMMENT= Notation editor & MIDI sequencer
 17LICENSE= gnu-gpl-v2
18 18
19MAKE_JOBS_SAFE= no 19MAKE_JOBS_SAFE= no
20 20
21GNU_CONFIGURE= YES 21GNU_CONFIGURE= YES
22USE_TOOLS+= gmake makedepend 22USE_TOOLS+= gmake makedepend
23MAKE_ENV+= GCC=yes 23MAKE_ENV+= GCC=yes
24 24
25INSTALLATION_DIRS+= bin lib/X11/app-defaults 25INSTALLATION_DIRS+= bin lib/X11/app-defaults
26 26
27post-extract: 27post-extract:
28 cd ${WRKSRC} && ${MV} Rosegarden Rosegarden.in 28 cd ${WRKSRC} && ${MV} Rosegarden Rosegarden.in
29 29
30.include "../../x11/libXaw/buildlink3.mk" 30.include "../../x11/libXaw/buildlink3.mk"

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

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-aa (expand / switch to unified 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,14 +1,17 @@ @@ -1,14 +1,17 @@
1$NetBSD: patch-aa,v 1.2 2002/03/19 12:21:07 wiz Exp $ 1$NetBSD: patch-aa,v 1.3 2022/01/01 09:20:41 dholland Exp $
 2
 3Configure for pkgsrc.
 4Make the install rule do something useful.
2 5
3--- Makefile.in.orig Fri Dec 21 15:12:43 2001 6--- Makefile.in.orig Fri Dec 21 15:12:43 2001
4+++ Makefile.in 7+++ Makefile.in
5@@ -43,7 +43,7 @@ 8@@ -43,7 +43,7 @@
6  9
7  10
8 # Compile defines 11 # Compile defines
9-DEFINES = @defines@ 12-DEFINES = @defines@
10+DEFINES = '-DRGLIBDIR=\"${RGLIBDIR}\"' @defines@ 13+DEFINES = '-DRGLIBDIR=\"${RGLIBDIR}\"' @defines@
11  14
12 # Name of the compiler, plus any flags common to both compile 15 # Name of the compiler, plus any flags common to both compile
13 # and link stages; also exported 16 # and link stages; also exported
14@@ -197,3 +197,9 @@ 17@@ -197,3 +197,9 @@

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ab (expand / switch to unified 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,13 +1,15 @@ @@ -1,13 +1,15 @@
1$NetBSD: patch-ab,v 1.2 2002/03/19 12:21:07 wiz Exp $ 1$NetBSD: patch-ab,v 1.3 2022/01/01 09:20:41 dholland Exp $
 2
 3Don't hardcode the install prefix.
2 4
3--- editor/src/Filter.c.orig Mon Jul 2 09:10:49 2001 5--- editor/src/Filter.c.orig Mon Jul 2 09:10:49 2001
4+++ editor/src/Filter.c 6+++ editor/src/Filter.c
5@@ -597,7 +597,7 @@ 7@@ -597,7 +597,7 @@
6 char path[3000]; 8 char path[3000];
7 fprintf(stderr, "Rosegarden: Environment variable TCLLIBPATH is not set; " 9 fprintf(stderr, "Rosegarden: Environment variable TCLLIBPATH is not set; "
8 "guessing!\n"); 10 "guessing!\n");
9- sprintf(path, "TCLLIBPATH=%s %s /usr/local/lib/rosegarden/petal", 11- sprintf(path, "TCLLIBPATH=%s %s /usr/local/lib/rosegarden/petal",
10+ sprintf(path, "TCLLIBPATH=%s %s "RGLIBDIR"/petal", 12+ sprintf(path, "TCLLIBPATH=%s %s "RGLIBDIR"/petal",
11 homeFilterDir, appData.filtersDirectory); 13 homeFilterDir, appData.filtersDirectory);
12 putenv(path); 14 putenv(path);
13 } 15 }

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ac (expand / switch to unified 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,13 +1,15 @@ @@ -1,13 +1,15 @@
1$NetBSD: patch-ac,v 1.2 2002/03/19 12:21:07 wiz Exp $ 1$NetBSD: patch-ac,v 1.3 2022/01/01 09:20:41 dholland Exp $
 2
 3Don't hardcode the install prefix.
2 4
3--- editor/src/Resources.h.orig Fri Oct 10 06:22:00 1997 5--- editor/src/Resources.h.orig Fri Oct 10 06:22:00 1997
4+++ editor/src/Resources.h 6+++ editor/src/Resources.h
5@@ -118,7 +118,7 @@ 7@@ -118,7 +118,7 @@
6 sizeof(char *), 8 sizeof(char *),
7 XtOffset(AppDataPtr, filtersDirectory), 9 XtOffset(AppDataPtr, filtersDirectory),
8 XtRImmediate, 10 XtRImmediate,
9- (XtPointer)"/usr/local/lib/rosegarden/rosepetal-filters", 11- (XtPointer)"/usr/local/lib/rosegarden/rosepetal-filters",
10+ (XtPointer)RGLIBDIR"/rosepetal-filters", 12+ (XtPointer)RGLIBDIR"/rosepetal-filters",
11 }, 13 },
12 { 14 {
13 XtNmusicDirectory, 15 XtNmusicDirectory,

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ad (expand / switch to unified 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,13 +1,15 @@ @@ -1,13 +1,15 @@
1$NetBSD: patch-ad,v 1.2 2002/03/19 12:21:07 wiz Exp $ 1$NetBSD: patch-ad,v 1.3 2022/01/01 09:20:41 dholland Exp $
 2
 3Don't hardcode the install prefix.
2 4
3--- sequencer/src/Filter.c.orig Mon Jul 2 08:59:48 2001 5--- sequencer/src/Filter.c.orig Mon Jul 2 08:59:48 2001
4+++ sequencer/src/Filter.c 6+++ sequencer/src/Filter.c
5@@ -347,7 +347,7 @@ 7@@ -347,7 +347,7 @@
6 char path[3000]; 8 char path[3000];
7 fprintf(stderr, "Rosegarden: Environment variable TCLLIBPATH is not set; " 9 fprintf(stderr, "Rosegarden: Environment variable TCLLIBPATH is not set; "
8 "guessing!\n"); 10 "guessing!\n");
9- sprintf(path, "TCLLIBPATH=%s %s /usr/local/lib/rosegarden/petal", 11- sprintf(path, "TCLLIBPATH=%s %s /usr/local/lib/rosegarden/petal",
10+ sprintf(path, "TCLLIBPATH=%s %s "RGLIBDIR"/petal", 12+ sprintf(path, "TCLLIBPATH=%s %s "RGLIBDIR"/petal",
11 homeFilterDir, appData.filtersDirectory); 13 homeFilterDir, appData.filtersDirectory);
12 putenv(path); 14 putenv(path);
13 } 15 }

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ae (expand / switch to unified 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,14 +1,16 @@ @@ -1,14 +1,16 @@
1$NetBSD: patch-ae,v 1.2 2002/03/19 12:21:07 wiz Exp $ 1$NetBSD: patch-ae,v 1.3 2022/01/01 09:20:41 dholland Exp $
 2
 3Don't hardcode the install prefix.
2 4
3--- sequencer/src/Resources.h.orig Fri Oct 10 06:21:47 1997 5--- sequencer/src/Resources.h.orig Fri Oct 10 06:21:47 1997
4+++ sequencer/src/Resources.h 6+++ sequencer/src/Resources.h
5@@ -135,7 +135,7 @@ 7@@ -135,7 +135,7 @@
6 sizeof(String), 8 sizeof(String),
7 XtOffset(AppDataPtr, midiFmPatchFile), 9 XtOffset(AppDataPtr, midiFmPatchFile),
8 XtRImmediate, 10 XtRImmediate,
9- (XtPointer)"/usr/local/lib/rosegarden/std.sb", 11- (XtPointer)"/usr/local/lib/rosegarden/std.sb",
10+ (XtPointer)RGLIBDIR"/std.sb", 12+ (XtPointer)RGLIBDIR"/std.sb",
11 }, 13 },
12 { 14 {
13 XtNmidiFmDrumPFile, 15 XtNmidiFmDrumPFile,
14@@ -144,7 +144,7 @@ 16@@ -144,7 +144,7 @@

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-af (expand / switch to unified 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,13 +1,15 @@ @@ -1,13 +1,15 @@
1$NetBSD: patch-af,v 1.2 2002/03/19 12:21:07 wiz Exp $ 1$NetBSD: patch-af,v 1.3 2022/01/01 09:20:41 dholland Exp $
 2
 3Don't hardcode the install prefix.
2 4
3--- topbox/src/Resources.h.orig Fri Oct 10 06:22:12 1997 5--- topbox/src/Resources.h.orig Fri Oct 10 06:22:12 1997
4+++ topbox/src/Resources.h 6+++ topbox/src/Resources.h
5@@ -61,7 +61,7 @@ 7@@ -61,7 +61,7 @@
6 sizeof(char *), 8 sizeof(char *),
7 XtOffset(AppDataPtr,helpFile), 9 XtOffset(AppDataPtr,helpFile),
8 XtRImmediate, 10 XtRImmediate,
9- "/usr/local/lib/rosegarden/rosehelp.info", 11- "/usr/local/lib/rosegarden/rosehelp.info",
10+ RGLIBDIR"/help/rosehelp.info", 12+ RGLIBDIR"/help/rosehelp.info",
11 }, 13 },
12 { 14 {
13 XtNhelpTextFont, 15 XtNhelpTextFont,

cvs diff -r1.2 -r1.3 pkgsrc/audio/rosegarden/patches/patch-ag (expand / switch to unified 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,14 +1,17 @@ @@ -1,14 +1,17 @@
1$NetBSD: patch-ag,v 1.2 2009/07/07 16:38:39 joerg Exp $ 1$NetBSD: patch-ag,v 1.3 2022/01/01 09:20:41 dholland Exp $
 2
 3DESTDIR support.
 4Install the X11 application-defaults usefully.
2 5
3--- do-install.orig 1997-10-21 23:20:43.000000000 +0200 6--- do-install.orig 1997-10-21 23:20:43.000000000 +0200
4+++ do-install 7+++ do-install
5@@ -23,12 +23,12 @@ echo 8@@ -23,12 +23,12 @@ echo
6 echo Thanks 9 echo Thanks
7 echo 10 echo
8  11
9-ROSELIBDIR=$LIBDIR/rosegarden 12-ROSELIBDIR=$LIBDIR/rosegarden
10+ROSELIBDIR=${DESTDIR}$LIBDIR/rosegarden 13+ROSELIBDIR=${DESTDIR}$LIBDIR/rosegarden
11  14
12 ( set -x 15 ( set -x
13  16
14-$install -d $BINDIR 17-$install -d $BINDIR

cvs diff -r1.1 -r1.2 pkgsrc/audio/rosegarden/patches/patch-configure (expand / switch to unified 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,13 +1,15 @@ @@ -1,13 +1,15 @@
1$NetBSD: patch-configure,v 1.1 2014/06/26 20:26:39 asau Exp $ 1$NetBSD: patch-configure,v 1.2 2022/01/01 09:20:41 dholland Exp $
 2
 3Don't use -lmalloc.
2 4
3--- configure.orig 2014-06-26 17:34:11.000000000 +0000 5--- configure.orig 2014-06-26 17:34:11.000000000 +0000
4+++ configure 6+++ configure
5@@ -2677,7 +2677,7 @@ else 7@@ -2677,7 +2677,7 @@ else
6 echo "$ac_t""no" 1>&6 8 echo "$ac_t""no" 1>&6
7 fi 9 fi
8  10
9- extra_libs="-lmalloc" 11- extra_libs="-lmalloc"
10+# extra_libs="-lmalloc" 12+# extra_libs="-lmalloc"
11 # LDFLAGS="-L/usr/lib -L/usr/X11R6/lib" 13 # LDFLAGS="-L/usr/lib -L/usr/X11R6/lib"
12  14
13 PETAL_LD=ld 15 PETAL_LD=ld

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;