GraphicsMagick: 2 new changesets
GraphicsMagick Commits <[email protected]> Thu, 24 Oct 2024 16:16:20 -0500
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.30271.1729804594.7812.graphicsmagick-commit@lists.sourceforge.net> |
changeset a83d143d2c41 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=a83d143d2c41 summary: oss-fuzz-build.sh: Re-enable multithreading support in libheif changeset 8c40f4de550f in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=8c40f4de550f summary: Magick++: Add InitializeMagickSentinel and update tests and demos to use it. Disable MagickCleanUp. diffstat: ChangeLog | 17 ++++++++++++++ Magick++/demo/analyze.cpp | 12 +++++---- Magick++/demo/button.cpp | 12 +++++----- Magick++/demo/demo.cpp | 12 +++++----- Magick++/demo/detrans.cpp | 14 ++++++----- Magick++/demo/flip.cpp | 11 ++++----- Magick++/demo/gravity.cpp | 14 +++++----- Magick++/demo/piddle.cpp | 12 +++++----- Magick++/demo/shapes.cpp | 12 +++++----- Magick++/demo/zoom.cpp | 40 +++++++++++++++++---------------- Magick++/lib/Image.cpp | 18 +++++++++++++- Magick++/lib/Magick++/Image.h | 36 +++++++++++++++++++++++++++++- Magick++/lib/Magick++/Include.h | 2 +- Magick++/tests/appendImages.cpp | 16 ++++++------ Magick++/tests/attributes.cpp | 16 ++++++------ Magick++/tests/averageImages.cpp | 16 ++++++------ Magick++/tests/coalesceImages.cpp | 16 ++++++------ Magick++/tests/coderInfo.cpp | 16 ++++++------ Magick++/tests/color.cpp | 16 ++++++------ Magick++/tests/colorHistogram.cpp | 16 ++++++------ Magick++/tests/exceptions.cpp | 16 +++++++----- Magick++/tests/montageImages.cpp | 19 +++++++-------- Magick++/tests/morphImages.cpp | 16 ++++++------ Magick++/tests/readWriteBlob.cpp | 22 +++++++++--------- Magick++/tests/readWriteImages.cpp | 16 ++++++------ VisualMagick/installer/inc/version.isx | 4 +- cscope.files | 1 - fuzzing/oss-fuzz-build.sh | 2 +- magick/version.h | 4 +- www/ChangeLog.html | 15 ++++++++++++ www/Magick++/Image.html | 32 +++++++++++++++++++------- www/Magick++/Image.rst | 33 ++++++++++++++++++++------- 32 files changed, 309 insertions(+), 195 deletions(-) diffs (truncated from 1590 to 500 lines): diff -r 55dbb3af2c8d -r 8c40f4de550f ChangeLog --- a/ChangeLog Thu Oct 17 10:28:42 2024 -0500 +++ b/ChangeLog Thu Oct 24 16:15:41 2024 -0500 @@ -1,3 +1,20 @@ +2024-10-24 Bob Friesenhahn <[email protected]> + + * Magick++/tests/*: Updated to use InitializeMagickSentinel. + + * Magick++/demo/*: Updated to use InitializeMagickSentinel. + + * Magick++/lib/Magick++/Image.h (InitializeMagickSentinel): Added + InitializeMagickSentinel class, which performs the function of + InitializeMagick() and invokes DestroyMagick() when an object + created based on it goes out of scope. + + * Magick++/lib/Image.cpp: Disable use of 'MagickCleanUp' static + object by default because it may cause race conditions + + * fuzzing/oss-fuzz-build.sh: Set libheif + ENABLE_MULTITHREADING_SUPPORT back to on. + 2024-10-17 Bob Friesenhahn <[email protected]> * fuzzing/oss-fuzz-build.sh: Set libheif diff -r 55dbb3af2c8d -r 8c40f4de550f Magick++/demo/analyze.cpp --- a/Magick++/demo/analyze.cpp Thu Oct 17 10:28:42 2024 -0500 +++ b/Magick++/demo/analyze.cpp Thu Oct 24 16:15:41 2024 -0500 @@ -2,12 +2,13 @@ // Demonstrate using the 'analyze' process module to compute // image statistics. // -// Copyright Bob Friesenhahn, 2003, 2004 +// Copyright Bob Friesenhahn, 2003-2024 // // Usage: analyze file... // #include <Magick++.h> +#include <cstdlib> #include <iostream> #include <iomanip> #include <list> @@ -18,11 +19,11 @@ if ( argc < 2 ) { cout << "Usage: " << argv[0] << " file..." << endl; - exit( 1 ); + return EXIT_FAILURE; } - // Initialize ImageMagick install location for Windows - InitializeMagick(*argv); + // Initialize/Deinitialize GraphicsMagick (scope based) + InitializeMagickSentinel sentinel(*argv); { std::list<std::string> attributes; @@ -58,10 +59,11 @@ catch( Exception &error_ ) { cout << error_.what() << endl; + return EXIT_FAILURE; } ++arg; } } - return 0; + return EXIT_SUCCESS; } diff -r 55dbb3af2c8d -r 8c40f4de550f Magick++/demo/button.cpp --- a/Magick++/demo/button.cpp Thu Oct 17 10:28:42 2024 -0500 +++ b/Magick++/demo/button.cpp Thu Oct 24 16:15:41 2024 -0500 @@ -1,10 +1,11 @@ // // Magick++ demo to generate a simple text button // -// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2003 +// Copyright Bob Friesenhahn, 1999-2024 // #include <Magick++.h> +#include <cstdlib> #include <string> #include <iostream> @@ -14,9 +15,8 @@ int main( int /*argc*/, char ** argv) { - - // Initialize ImageMagick install location for Windows - InitializeMagick(*argv); + // Initialize/Deinitialize GraphicsMagick (scope based) + InitializeMagickSentinel sentinel(*argv); try { @@ -102,8 +102,8 @@ catch( exception &error_ ) { cout << "Caught exception: " << error_.what() << endl; - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff -r 55dbb3af2c8d -r 8c40f4de550f Magick++/demo/demo.cpp --- a/Magick++/demo/demo.cpp Thu Oct 17 10:28:42 2024 -0500 +++ b/Magick++/demo/demo.cpp Thu Oct 24 16:15:41 2024 -0500 @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- // -// Copyright (C) Copyright 1999 - 2010 Bob Friesenhahn +// Copyright Bob Friesenhahn, 1999-2024 // // Simple demo program for Magick++ // @@ -11,6 +11,7 @@ // #include <Magick++.h> +#include <cstdlib> #include <string> #include <iostream> #include <list> @@ -21,9 +22,8 @@ int main( int /*argc*/, char ** argv) { - - // Initialize Magick - InitializeMagick(*argv); + // Initialize/Deinitialize GraphicsMagick (scope based) + InitializeMagickSentinel sentinel(*argv); try { @@ -538,8 +538,8 @@ catch( exception &error_ ) { cout << "Caught exception: " << error_.what() << endl; - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff -r 55dbb3af2c8d -r 8c40f4de550f Magick++/demo/detrans.cpp --- a/Magick++/demo/detrans.cpp Thu Oct 17 10:28:42 2024 -0500 +++ b/Magick++/demo/detrans.cpp Thu Oct 24 16:15:41 2024 -0500 @@ -5,12 +5,13 @@ // background color, or to create a similar looking effect without // transparency. // -// Copyright Bob Friesenhahn, 2000 - 2018 +// Copyright Bob Friesenhahn, 2000-2024 // // Usage: detrans color file... // #include <Magick++.h> +#include <cstdlib> #include <iostream> using namespace std; using namespace Magick; @@ -19,11 +20,11 @@ if ( argc < 3 ) { cout << "Usage: " << argv[0] << " background_color file..." << endl; - exit( 1 ); + exit(EXIT_FAILURE); } - // Initialize ImageMagick install location for Windows - InitializeMagick(*argv); + // Initialize/Deinitialize GraphicsMagick (scope based) + InitializeMagickSentinel sentinel(*argv); { Color color; @@ -34,7 +35,7 @@ { cout << error_.what() << endl; cout.flush(); - exit(1); + return EXIT_FAILURE; } char **arg = &argv[2]; @@ -51,10 +52,11 @@ catch( Exception &error_ ) { cout << error_.what() << endl; + return EXIT_FAILURE; } ++arg; } } - return 0; + return EXIT_SUCCESS; } diff -r 55dbb3af2c8d -r 8c40f4de550f Magick++/demo/flip.cpp --- a/Magick++/demo/flip.cpp Thu Oct 17 10:28:42 2024 -0500 +++ b/Magick++/demo/flip.cpp Thu Oct 24 16:15:41 2024 -0500 @@ -9,6 +9,7 @@ // #include <Magick++.h> +#include <cstdlib> #include <string> #include <iostream> #include <list> @@ -20,10 +21,8 @@ int main( int /*argc*/, char ** argv) { - - // Initialize ImageMagick install location for Windows - InitializeMagick(*argv); - + // Initialize/Deinitialize GraphicsMagick (scope based) + InitializeMagickSentinel sentinel(*argv); try { @@ -53,8 +52,8 @@ catch( exception &error_ ) { cout << "Caught exception: " << error_.what() << endl; - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff -r 55dbb3af2c8d -r 8c40f4de550f Magick++/demo/gravity.cpp --- a/Magick++/demo/gravity.cpp Thu Oct 17 10:28:42 2024 -0500 +++ b/Magick++/demo/gravity.cpp Thu Oct 24 16:15:41 2024 -0500 @@ -1,11 +1,11 @@ // This may look like C code, but it is really -*- C++ -*- // -// Copyright Bob Friesenhahn, 2000, 2001, 2003 +// Copyright Bob Friesenhahn, 2000-2024 // // Demo of text annotation with gravity. Produces an animation showing // the effect of rotated text along with various gravity specifications. // -// After running demo program, run 'animate gravity_out.miff' if you +// After running demo program, run 'gm animate gravity_out.miff' if you // are using X-Windows to see an animated result. // // Concept and algorithms lifted from PerlMagick demo script written @@ -13,6 +13,7 @@ // #include <Magick++.h> +#include <cstdlib> #include <string> #include <iostream> #include <list> @@ -23,9 +24,8 @@ int main( int /*argc*/, char ** argv) { - - // Initialize GraphicsMagick - InitializeMagick(*argv); + // Initialize/Deinitialize GraphicsMagick (scope based) + InitializeMagickSentinel sentinel(*argv); try { @@ -82,8 +82,8 @@ catch( exception &error_ ) { cout << "Caught exception: " << error_.what() << endl; - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff -r 55dbb3af2c8d -r 8c40f4de550f Magick++/demo/piddle.cpp --- a/Magick++/demo/piddle.cpp Thu Oct 17 10:28:42 2024 -0500 +++ b/Magick++/demo/piddle.cpp Thu Oct 24 16:15:41 2024 -0500 @@ -1,12 +1,13 @@ // This may look like C code, but it is really -*- C++ -*- // -// Copyright Bob Friesenhahn, 1999, 2000, 2002, 2003 +// Copyright Bob Friesenhahn, 1999-2024 // // PerlMagick "piddle" demo re-implemented using Magick++ methods. // The PerlMagick "piddle" demo is written by John Cristy // #include <Magick++.h> +#include <cstdlib> #include <string> #include <iostream> @@ -16,9 +17,8 @@ int main( int /*argc*/, char ** argv) { - - // Initialize ImageMagick install location for Windows - InitializeMagick(*argv); + // Initialize/Deinitialize GraphicsMagick (scope based) + InitializeMagickSentinel sentinel(*argv); try { @@ -179,8 +179,8 @@ catch( exception &error_ ) { cout << "Caught exception: " << error_.what() << endl; - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff -r 55dbb3af2c8d -r 8c40f4de550f Magick++/demo/shapes.cpp --- a/Magick++/demo/shapes.cpp Thu Oct 17 10:28:42 2024 -0500 +++ b/Magick++/demo/shapes.cpp Thu Oct 24 16:15:41 2024 -0500 @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- // -// Copyright Bob Friesenhahn, 1999, 2000, 2002, 2003 +// Copyright Bob Friesenhahn, 1999-2024 // // GD/PerlMagick example using Magick++ methods. // @@ -8,6 +8,7 @@ // #include <Magick++.h> +#include <cstdlib> #include <string> #include <iostream> @@ -17,9 +18,8 @@ int main( int /*argc*/, char ** argv) { - - // Initialize ImageMagick install location for Windows - InitializeMagick(*argv); + // Initialize/Deinitialize GraphicsMagick (scope based) + InitializeMagickSentinel sentinel(*argv); try { @@ -120,8 +120,8 @@ catch( exception &error_ ) { cout << "Caught exception: " << error_.what() << endl; - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff -r 55dbb3af2c8d -r 8c40f4de550f Magick++/demo/zoom.cpp --- a/Magick++/demo/zoom.cpp Thu Oct 17 10:28:42 2024 -0500 +++ b/Magick++/demo/zoom.cpp Thu Oct 24 16:15:41 2024 -0500 @@ -1,6 +1,6 @@ // This may look like C code, but it is really -*- C++ -*- // -// Copyright Bob Friesenhahn, 2001, 2002, 2003 +// Copyright Bob Friesenhahn, 2001-2024 // // Resize image using specified resize algorithm with Magick++ API // @@ -9,6 +9,7 @@ // #include <Magick++.h> +#include <cstdlib> #include <iostream> #include <fstream> #include <string> @@ -25,30 +26,31 @@ # define IOS_IN_BINARY ios::in | ios::binary #endif -static void Usage ( char **argv ) +static int Usage ( char **argv ) { cout << "Usage: " << argv[0] << " [-density resolution] [-filter algorithm] [-geometry geometry]" << " [-resample resolution] [-read-blob] input_file output_file" << endl << " algorithm - bessel blackman box catrom cubic gaussian hamming hanning" << endl << " hermite lanczos mitchell point quadratic sample scale sinc triangle" << endl; - exit(1); + + return EXIT_FAILURE; } -static void ParseError (int position, char **argv) +static int ParseError (int position, char **argv) { cout << "Argument \"" << argv[position] << "\" at position" << position << "incorrect" << endl; - Usage(argv); + return Usage(argv); } int main(int argc,char **argv) { - // Initialize ImageMagick install location for Windows - InitializeMagick(*argv); + // Initialize/Deinitialize GraphicsMagick (scope based) + InitializeMagickSentinel sentinel(*argv); if ( argc < 2 ) - Usage(argv); + return Usage(argv); enum ResizeAlgorithm { @@ -83,7 +85,7 @@ } catch( exception &/* error_ */) { - ParseError(argv_index,argv); + return ParseError(argv_index,argv); } argv_index++; continue; @@ -127,7 +129,7 @@ else if (algorithm.compare("scale") == 0) resize_algorithm=Scale; else - ParseError(argv_index,argv); + return ParseError(argv_index,argv); argv_index++; continue; } @@ -139,7 +141,7 @@ } catch( exception &/* error_ */) { - ParseError(argv_index,argv); + return ParseError(argv_index,argv); } argv_index++; continue; @@ -152,20 +154,20 @@ } catch( exception &/* error_ */) { - ParseError(argv_index,argv); + return ParseError(argv_index,argv); } argv_index++; continue; } - ParseError(argv_index,argv); + return ParseError(argv_index,argv); } if (argv_index>argc-1) - ParseError(argv_index,argv); + return ParseError(argv_index,argv); std::string input_file(argv[argv_index]); argv_index++; if (argv_index>argc) - ParseError(argv_index,argv); + return ParseError(argv_index,argv); std::string output_file(argv[argv_index]); try { @@ -189,7 +191,7 @@ if( !in ) { cout << "Failed to open file " << input_file << " for input!" << endl; - exit(1); + return EXIT_FAILURE; } in.seekg(0,ios::end); streampos file_size = in.tellg(); @@ -200,7 +202,7 @@ if (!in.good()) { cout << "Failed to read file " << input_file << " for input!" << endl; - exit(1); + return EXIT_FAILURE; } in.close(); cout << "Read " << file_size << " bytes from file \""