GraphicsMagick: tests/{constitute.c, rwblob.c, rwfile.c}: Elimin...

GraphicsMagick Commits <[email protected]> Sun, 27 Oct 2024 10:42:06 -0500
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.30382.1730043733.8001.graphicsmagick-commit@lists.sourceforge.net>
changeset 0e3ff1591e15 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=0e3ff1591e15
summary: tests/{constitute.c, rwblob.c, rwfile.c}: Eliminate ugly "directive output may be truncated" warnings from GCC.

diffstat:

 ChangeLog          |  3 +++
 tests/constitute.c |  3 ++-
 tests/rwblob.c     |  3 ++-
 tests/rwfile.c     |  3 ++-
 www/ChangeLog.html |  2 ++
 5 files changed, 11 insertions(+), 3 deletions(-)

diffs (63 lines):

diff -r a4134210603a -r 0e3ff1591e15 ChangeLog
--- a/ChangeLog	Sun Oct 27 09:10:59 2024 -0500
+++ b/ChangeLog	Sun Oct 27 10:41:49 2024 -0500
@@ -1,5 +1,8 @@
 2024-10-27  Bob Friesenhahn  <[email protected]>
 
+	* tests/{constitute.c, rwblob.c, rwfile.c}: Eliminate ugly
+	"directive output may be truncated" warnings from GCC.
+
 	* tests/bitstream.c: Fixes so that 'test' mode allocates the
 	correct amount of memory for 31 and 32 bit depth.
 
diff -r a4134210603a -r 0e3ff1591e15 tests/constitute.c
--- a/tests/constitute.c	Sun Oct 27 09:10:59 2024 -0500
+++ b/tests/constitute.c	Sun Oct 27 10:41:49 2024 -0500
@@ -194,7 +194,8 @@
    */
   GetExceptionInfo( &exception );
   imageInfo->dither = 0;
-  (void) snprintf( imageInfo->filename, sizeof(imageInfo->filename), "%s%s", infile, "[0]");
+  (void) snprintf( imageInfo->filename, sizeof(imageInfo->filename), "%.*s%s",
+                   (int)(sizeof(imageInfo->filename)-sizeof("[0]")-1), infile, "[0]");
   (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                         "Reading image %s", imageInfo->filename);
   original = ReadImage ( imageInfo, &exception );
diff -r a4134210603a -r 0e3ff1591e15 tests/rwblob.c
--- a/tests/rwblob.c	Sun Oct 27 09:10:59 2024 -0500
+++ b/tests/rwblob.c	Sun Oct 27 10:41:49 2024 -0500
@@ -247,7 +247,8 @@
 
   imageInfo->dither = 0;
   if (!magick_info->adjoin && !check_for_added_frames)
-    (void) snprintf(imageInfo->filename, sizeof(imageInfo->filename), "%s%s", infile, "[0]");
+    (void) snprintf( imageInfo->filename, sizeof(imageInfo->filename), "%.*s%s",
+                     (int)(sizeof(imageInfo->filename)-sizeof("[0]")-1), infile, "[0]");
   else
     (void) snprintf(imageInfo->filename, sizeof(imageInfo->filename), "%s", infile);
 
diff -r a4134210603a -r 0e3ff1591e15 tests/rwfile.c
--- a/tests/rwfile.c	Sun Oct 27 09:10:59 2024 -0500
+++ b/tests/rwfile.c	Sun Oct 27 10:41:49 2024 -0500
@@ -269,7 +269,8 @@
   else
     {
       if (!magick_info->adjoin || !check_for_added_frames)
-        (void) snprintf(imageInfo->filename, sizeof(imageInfo->filename), "%s%s", infile, "[0]");
+        (void) snprintf( imageInfo->filename, sizeof(imageInfo->filename), "%.*s%s",
+                         (int)(sizeof(imageInfo->filename)-sizeof("[0]")-1), infile, "[0]");
       else
         (void) snprintf(imageInfo->filename, sizeof(imageInfo->filename), "%s", infile);
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),
diff -r a4134210603a -r 0e3ff1591e15 www/ChangeLog.html
--- a/www/ChangeLog.html	Sun Oct 27 09:10:59 2024 -0500
+++ b/www/ChangeLog.html	Sun Oct 27 10:41:49 2024 -0500
@@ -41,6 +41,8 @@
 <p>2024-10-27  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
+<li><p>tests/{constitute.c, rwblob.c, rwfile.c}: Eliminate ugly
+&quot;directive output may be truncated&quot; warnings from GCC.</p></li>
 <li><p>tests/bitstream.c: Fixes so that 'test' mode allocates the
 correct amount of memory for 31 and 32 bit depth.</p></li>
 <li><p>Makefile.am (coverity): Added tests programs to Coverity