GraphicsMagick: Initialize locale settings for test program the ...

GraphicsMagick Commits <[email protected]> Sun, 10 Sep 2023 18:19:05 -0500
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.1200.1694387955.27378.graphicsmagick-commit@lists.sourceforge.net>
changeset abe28768b885 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=abe28768b885
summary: Initialize locale settings for test program the same as the gm utility.

diffstat:

 ChangeLog                              |   9 +++++++++
 VisualMagick/installer/inc/version.isx |   4 ++--
 magick/version.h                       |   4 ++--
 tests/constitute.c                     |  12 ++++++++++++
 tests/drawtest.c                       |  12 ++++++++++++
 tests/rwblob.c                         |  12 ++++++++++++
 tests/rwfile.c                         |  12 ++++++++++++
 wand/drawing_wand.c                    |  12 ++++++++++++
 wand/drawtest.c                        |  12 ++++++++++++
 wand/magick_wand.c                     |  11 +++++++++++
 wand/pixel_wand.c                      |  25 ++++++++++++++++++-------
 wand/wandtest.c                        |  12 ++++++++++++
 www/Changelog.html                     |  16 ++++++++++++++++
 13 files changed, 142 insertions(+), 11 deletions(-)

diffs (358 lines):

diff -r 97634dbcd2e2 -r abe28768b885 ChangeLog
--- a/ChangeLog	Sat Sep 09 13:20:39 2023 +0200
+++ b/ChangeLog	Sun Sep 10 18:19:02 2023 -0500
@@ -1,3 +1,12 @@
+2023-09-10  Bob Friesenhahn  <[email protected]>
+
+	* tests/{constitute.c, drawtest.c, rwblob.c, rwfile.c}: Initialize
+	locale settings the same as the 'gm' utility.
+
+	* magick/{drawing_wand.c, drawtest.c, magick_wand.c, pixel_wand.c,
+	wandtest.c}: Initialize locale settings the same as the 'gm'
+	utility.
+
 2023-09-09  Fojtik Jaroslav  <[email protected]>
 
 	* coders/xtrn.c Fixed crash on dereferenced NULL pointer.
diff -r 97634dbcd2e2 -r abe28768b885 VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Sat Sep 09 13:20:39 2023 +0200
+++ b/VisualMagick/installer/inc/version.isx	Sun Sep 10 18:19:02 2023 -0500
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020230907"
-#define public MagickPackageReleaseDate "snapshot-20230907"
+#define public MagickPackageVersionAddendum ".020230910"
+#define public MagickPackageReleaseDate "snapshot-20230910"
diff -r 97634dbcd2e2 -r abe28768b885 magick/version.h
--- a/magick/version.h	Sat Sep 09 13:20:39 2023 +0200
+++ b/magick/version.h	Sun Sep 10 18:19:02 2023 -0500
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x272403
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 27,24,3
-#define MagickChangeDate   "20230907"
-#define MagickReleaseDate  "snapshot-20230907"
+#define MagickChangeDate   "20230910"
+#define MagickReleaseDate  "snapshot-20230910"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r 97634dbcd2e2 -r abe28768b885 tests/constitute.c
--- a/tests/constitute.c	Sat Sep 09 13:20:39 2023 +0200
+++ b/tests/constitute.c	Sun Sep 10 18:19:02 2023 -0500
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <locale.h>
 
 int main ( int argc, char **argv )
 {
@@ -56,6 +57,17 @@
   StorageType
     storage_type=CharPixel;
 
+  /*
+    Initialize locale from environment variables (LANG, LC_CTYPE,
+    LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES,
+    LC_ALL), but require that LC_NUMERIC use common conventions.  The
+    LC_NUMERIC variable affects the decimal point character and
+    thousands separator character for the formatted input/output
+    functions and string conversion functions.
+  */
+  (void) setlocale(LC_ALL,"");
+  (void) setlocale(LC_NUMERIC,"C");
+
   if (LocaleNCompare("constitute",argv[0],7) == 0)
     InitializeMagick((char *) NULL);
   else
diff -r 97634dbcd2e2 -r abe28768b885 tests/drawtest.c
--- a/tests/drawtest.c	Sat Sep 09 13:20:39 2023 +0200
+++ b/tests/drawtest.c	Sun Sep 10 18:19:02 2023 -0500
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <locale.h>
 
 #if !defined(True)
 # define True 1
@@ -362,6 +363,17 @@
   (void) strncpy( outfile, argv[1], MaxTextExtent);
   outfile[MaxTextExtent-1]='\0';
 
+  /*
+    Initialize locale from environment variables (LANG, LC_CTYPE,
+    LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES,
+    LC_ALL), but require that LC_NUMERIC use common conventions.  The
+    LC_NUMERIC variable affects the decimal point character and
+    thousands separator character for the formatted input/output
+    functions and string conversion functions.
+  */
+  (void) setlocale(LC_ALL,"");
+  (void) setlocale(LC_NUMERIC,"C");
+
   if (LocaleNCompare("drawtest",argv[0],7) == 0)
     InitializeMagick((char *) NULL);
   else
diff -r 97634dbcd2e2 -r abe28768b885 tests/rwblob.c
--- a/tests/rwblob.c	Sat Sep 09 13:20:39 2023 +0200
+++ b/tests/rwblob.c	Sun Sep 10 18:19:02 2023 -0500
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <locale.h>
 
 int main ( int argc, char **argv )
 {
@@ -63,6 +64,17 @@
   ExceptionInfo
     exception;
 
+  /*
+    Initialize locale from environment variables (LANG, LC_CTYPE,
+    LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES,
+    LC_ALL), but require that LC_NUMERIC use common conventions.  The
+    LC_NUMERIC variable affects the decimal point character and
+    thousands separator character for the formatted input/output
+    functions and string conversion functions.
+  */
+  (void) setlocale(LC_ALL,"");
+  (void) setlocale(LC_NUMERIC,"C");
+
   if (LocaleNCompare("rwblob",argv[0],7) == 0)
     InitializeMagick((char *) NULL);
   else
diff -r 97634dbcd2e2 -r abe28768b885 tests/rwfile.c
--- a/tests/rwfile.c	Sat Sep 09 13:20:39 2023 +0200
+++ b/tests/rwfile.c	Sun Sep 10 18:19:02 2023 -0500
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <locale.h>
 
 int main ( int argc, char **argv )
 {
@@ -68,6 +69,17 @@
   (void) memset(size,0,sizeof(size));
   (void) memset(filespec,0,sizeof(filespec));
 
+  /*
+    Initialize locale from environment variables (LANG, LC_CTYPE,
+    LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES,
+    LC_ALL), but require that LC_NUMERIC use common conventions.  The
+    LC_NUMERIC variable affects the decimal point character and
+    thousands separator character for the formatted input/output
+    functions and string conversion functions.
+  */
+  (void) setlocale(LC_ALL,"");
+  (void) setlocale(LC_NUMERIC,"C");
+
   if (LocaleNCompare("rwfile",argv[0],7) == 0)
     InitializeMagick((char *) NULL);
   else
diff -r 97634dbcd2e2 -r abe28768b885 wand/drawing_wand.c
--- a/wand/drawing_wand.c	Sat Sep 09 13:20:39 2023 +0200
+++ b/wand/drawing_wand.c	Sun Sep 10 18:19:02 2023 -0500
@@ -5520,6 +5520,18 @@
   /*
     Initialize GraphicsMagick in case it is not already initialized.
   */
+
+  /*
+    Initialize locale from environment variables (LANG, LC_CTYPE,
+    LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES,
+    LC_ALL), but require that LC_NUMERIC use common conventions.  The
+    LC_NUMERIC variable affects the decimal point character and
+    thousands separator character for the formatted input/output
+    functions and string conversion functions.
+  */
+  (void) setlocale(LC_ALL,"");
+  (void) setlocale(LC_NUMERIC,"C");
+
   InitializeMagick(NULL);
 
   drawing_wand=MagickAllocateMemory(DrawingWand *,sizeof(struct _DrawingWand));
diff -r 97634dbcd2e2 -r abe28768b885 wand/drawtest.c
--- a/wand/drawtest.c	Sat Sep 09 13:20:39 2023 +0200
+++ b/wand/drawtest.c	Sun Sep 10 18:19:02 2023 -0500
@@ -12,6 +12,7 @@
 #include <sys/types.h>
 #include <time.h>
 #include <wand/magick_wand.h>
+#include <locale.h>
 
 static MagickPassFail
 ScribbleImage (MagickWand *canvas)
@@ -404,6 +405,17 @@
   outfile[MaxTextExtent-1]='\0';
   (void) strncpy( outfile, argv[1], MaxTextExtent-1 );
 
+  /*
+    Initialize locale from environment variables (LANG, LC_CTYPE,
+    LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES,
+    LC_ALL), but require that LC_NUMERIC use common conventions.  The
+    LC_NUMERIC variable affects the decimal point character and
+    thousands separator character for the formatted input/output
+    functions and string conversion functions.
+  */
+  (void) setlocale(LC_ALL,"");
+  (void) setlocale(LC_NUMERIC,"C");
+
   InitializeMagick(*argv);
 
   /*
diff -r 97634dbcd2e2 -r abe28768b885 wand/magick_wand.c
--- a/wand/magick_wand.c	Sat Sep 09 13:20:39 2023 +0200
+++ b/wand/magick_wand.c	Sun Sep 10 18:19:02 2023 -0500
@@ -11158,6 +11158,17 @@
   /*
     Initialize GraphicsMagick in case it is not already initialized.
   */
+  /*
+    Initialize locale from environment variables (LANG, LC_CTYPE,
+    LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES,
+    LC_ALL), but require that LC_NUMERIC use common conventions.  The
+    LC_NUMERIC variable affects the decimal point character and
+    thousands separator character for the formatted input/output
+    functions and string conversion functions.
+  */
+  (void) setlocale(LC_ALL,"");
+  (void) setlocale(LC_NUMERIC,"C");
+
   InitializeMagick(NULL);
 
   wand=MagickAllocateMemory(MagickWand *,sizeof(MagickWand));
diff -r 97634dbcd2e2 -r abe28768b885 wand/pixel_wand.c
--- a/wand/pixel_wand.c	Sat Sep 09 13:20:39 2023 +0200
+++ b/wand/pixel_wand.c	Sun Sep 10 18:19:02 2023 -0500
@@ -92,7 +92,7 @@
 
   ColorspaceType
     colorspace;
-                                                                                
+
   unsigned int
     matte;
 
@@ -157,7 +157,7 @@
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  ClonePixelWands creates a deep-copy an array of PixelWands. 
+%  ClonePixelWands creates a deep-copy an array of PixelWands.
 %
 %  The format of the ClonePixelWands method is:
 %
@@ -179,15 +179,15 @@
 
   unsigned long
     i;
-  
+
   assert(wands != (const PixelWand **) NULL);
   assert(number_wands > 0);
 
   clone_wands=MagickAllocateArray(PixelWand **,
-				  sizeof(PixelWand *),number_wands);
+                                  sizeof(PixelWand *),number_wands);
   if (clone_wands == (PixelWand **) NULL)
     MagickFatalError3(ResourceLimitFatalError,MemoryAllocationFailed,
-		      UnableToAllocateWand);
+                      UnableToAllocateWand);
 
   for (i=0; i < number_wands; i++)
     clone_wands[i]=ClonePixelWand(wands[i]);
@@ -252,12 +252,23 @@
   /*
     Initialize GraphicsMagick in case it is not already initialized.
   */
+  /*
+    Initialize locale from environment variables (LANG, LC_CTYPE,
+    LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES,
+    LC_ALL), but require that LC_NUMERIC use common conventions.  The
+    LC_NUMERIC variable affects the decimal point character and
+    thousands separator character for the formatted input/output
+    functions and string conversion functions.
+  */
+  (void) setlocale(LC_ALL,"");
+  (void) setlocale(LC_NUMERIC,"C");
+
   InitializeMagick(NULL);
 
   wand=MagickAllocateMemory(struct _PixelWand *,sizeof(struct _PixelWand));
   if (wand == (PixelWand *) NULL)
     MagickFatalError3(ResourceLimitFatalError,MemoryAllocationFailed,
-		      UnableToAllocateWand);
+                      UnableToAllocateWand);
   (void) memset(wand,0,sizeof(PixelWand));
   GetExceptionInfo(&wand->exception);
   wand->colorspace=RGBColorspace;
@@ -299,7 +310,7 @@
                              (size_t) number_wands*sizeof(struct _PixelWand *));
   if (wands == (PixelWand **) NULL)
     MagickFatalError3(ResourceLimitFatalError,MemoryAllocationFailed,
-		      UnableToAllocateWand);
+                      UnableToAllocateWand);
   for (i=0; i < (long) number_wands; i++)
     wands[i]=NewPixelWand();
   return(wands);
diff -r 97634dbcd2e2 -r abe28768b885 wand/wandtest.c
--- a/wand/wandtest.c	Sat Sep 09 13:20:39 2023 +0200
+++ b/wand/wandtest.c	Sun Sep 10 18:19:02 2023 -0500
@@ -75,6 +75,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <wand/magick_wand.h>
+#include <locale.h>
 
 #define False  0
 #define True  1
@@ -119,6 +120,17 @@
 
   (void) argc;
 
+  /*
+    Initialize locale from environment variables (LANG, LC_CTYPE,
+    LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES,
+    LC_ALL), but require that LC_NUMERIC use common conventions.  The
+    LC_NUMERIC variable affects the decimal point character and
+    thousands separator character for the formatted input/output
+    functions and string conversion functions.
+  */
+  (void) setlocale(LC_ALL,"");
+  (void) setlocale(LC_NUMERIC,"C");
+
   InitializeMagick(*argv);
   magick_wand=NewMagickWand();
   MagickSetSize(magick_wand,640,480);
diff -r 97634dbcd2e2 -r abe28768b885 www/Changelog.html
--- a/www/Changelog.html	Sat Sep 09 13:20:39 2023 +0200
+++ b/www/Changelog.html	Sun Sep 10 18:19:02 2023 -0500
@@ -37,6 +37,22 @@
 </div>
 
 <div class="document">
+<p>2023-09-10  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, drawtest.c, rwblob.c, rwfile.c}: Initialize
+locale settings the same as the 'gm' utility.</p></li>
+<li><p>magick/{drawing_wand.c, drawtest.c, magick_wand.c, pixel_wand.c,
+wandtest.c}: Initialize locale settings the same as the 'gm'
+utility.</p></li>
+</ul>
+</blockquote>
+<p>2023-09-09  Fojtik Jaroslav  &lt;<a class="reference external" href="mailto:JaFojtik&#37;&#52;&#48;yandex&#46;com">JaFojtik<span>&#64;</span>yandex<span>&#46;</span>com</a>&gt;</p>
+<blockquote>
+<ul class="simple">
+<li><p>coders/xtrn.c Fixed crash on dereferenced NULL pointer.</p></li>
+</ul>
+</blockquote>
 <p>2023-09-07  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">