lewdlime / abcm2ps

abcm2ps is a command line program which converts ABC to music sheet in PostScript or SVG format. It is an extension of abc2ps which may handle many voices per staff. abcm2ps is Copyright © 2014-2016 Jean-Francois Moine.
http://moinejf.free.fr/
GNU General Public License v3.0
80 stars 31 forks source link

Minor warning #110

Open polluks opened 1 year ago

polluks commented 1 year ago

ppc-morphos-gcc-11 -g -O2 -Wall -pipe  -I.  -c -o subs.o subs.c
subs.c: In function 'user_ps_add':
subs.c:1845:38: warning: 'svg ' directive writing 4 bytes into a region of size 1 [-Wformat-overflow=]
 1845 |                 sprintf(t->text, "%%svg %s", s);
      |                                     ~^~~
subs.c:1845:17: note: 'sprintf' output 6 or more bytes into a destination of
size 2
 1845 |                 sprintf(t->text, "%%svg %s", s);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
moinejf commented 1 year ago

I don't know how to remove this warning that is not raised by my compiler (gcc version 10.2.1 20201203). Maybe an array with an undefined length could solve this problem, but I know many C compilers would not agree!

polluks commented 1 year ago

My compiler: ppc-morphos-gcc-11 (GCC/MorphOS) 11.2.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

By the way: http://aminet.net/package/mus/misc/abcm2ps

mid1221213 commented 1 year ago

I don't know how to remove this warning that is not raised by my compiler (gcc version 10.2.1 20201203). Maybe an array with an undefined length could solve this problem, but I know many C compilers would not agree!

Maybe just a matter of a #if __GNUC__ > 10 before the declaration of the array with undefined length (#else what is already present)? But that would also require a macro to define SIZEOF_U_PS_TEXT or something...

That may sound too much for "just a warning", especially when I get the warnings about Pango too (#111) :wink:

Anyway, I can provide with a PR if that may be useful, I have the code ready for review (I wanted to check this issue, go figure… :wink:)

moinejf commented 1 year ago

I think the commit 92163a7 should solve the problem.

mid1221213 commented 1 year ago

Okay :laughing: Fine for me.