From 2c17c6b7ecf6d96c9b4004cd7b79d860b66e6ae3 Mon Sep 17 00:00:00 2001 From: Jiyong Date: Wed, 6 Dec 2023 10:30:38 +0900 Subject: Imported Upstream version 1.3.42 Change-Id: I4f2a12cbf50e1a459e7bac7c5a8e374071620eea --- wand/drawing_wand.c | 12 ++++++++++++ wand/drawtest.c | 12 ++++++++++++ wand/magick_wand.c | 11 +++++++++++ wand/magick_wand.h | 2 +- wand/pixel_wand.c | 25 ++++++++++++++++++------- wand/wandtest.c | 12 ++++++++++++ 6 files changed, 66 insertions(+), 8 deletions(-) (limited to 'wand') diff --git a/wand/drawing_wand.c b/wand/drawing_wand.c index 9024d62..0f1addf 100644 --- a/wand/drawing_wand.c +++ b/wand/drawing_wand.c @@ -5520,6 +5520,18 @@ WandExport DrawingWand *NewDrawingWand(void) /* 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 --git a/wand/drawtest.c b/wand/drawtest.c index ed14c4c..a81e5fa 100644 --- a/wand/drawtest.c +++ b/wand/drawtest.c @@ -12,6 +12,7 @@ #include #include #include +#include static MagickPassFail ScribbleImage (MagickWand *canvas) @@ -404,6 +405,17 @@ int main ( int argc, char **argv ) 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 --git a/wand/magick_wand.c b/wand/magick_wand.c index a1754ef..6e8dc99 100644 --- a/wand/magick_wand.c +++ b/wand/magick_wand.c @@ -11158,6 +11158,17 @@ WandExport MagickWand *NewMagickWand(void) /* 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 --git a/wand/magick_wand.h b/wand/magick_wand.h index a0bbb0d..943e2f2 100644 --- a/wand/magick_wand.h +++ b/wand/magick_wand.h @@ -98,7 +98,7 @@ extern WandExport ImageType MagickGetImageType(MagickWand *); extern WandExport ImageType - MagickGetImageSavedType(MagickWand *) MAGICK_FUNC_CONST; + MagickGetImageSavedType(MagickWand *) MAGICK_FUNC_PURE; extern WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *); diff --git a/wand/pixel_wand.c b/wand/pixel_wand.c index 20c6ff8..1db1727 100644 --- a/wand/pixel_wand.c +++ b/wand/pixel_wand.c @@ -92,7 +92,7 @@ struct _PixelWand ColorspaceType colorspace; - + unsigned int matte; @@ -157,7 +157,7 @@ ClonePixelWand(const PixelWand *wand) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% 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 @@ ClonePixelWands(const PixelWand **wands,const unsigned long number_wands) 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 @@ WandExport PixelWand *NewPixelWand(void) /* 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 @@ WandExport PixelWand **NewPixelWands(const unsigned long number_wands) (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 --git a/wand/wandtest.c b/wand/wandtest.c index b6775c7..9508444 100644 --- a/wand/wandtest.c +++ b/wand/wandtest.c @@ -75,6 +75,7 @@ #include #include #include +#include #define False 0 #define True 1 @@ -119,6 +120,17 @@ int main(int argc,char **argv) (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); -- cgit v1.2.3