GraphicsMagick: Add a short-term snprintf hack to hopefully get ...
GraphicsMagick Commits <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.16720.1668298242.1350.graphicsmagick-commit@lists.sourceforge.net> |
changeset 064641820cb8 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=064641820cb8 summary: Add a short-term snprintf hack to hopefully get GM compiling for MSVC < 2015 diffstat: ChangeLog | 3 +++ magick/nt_base.h | 14 ++++++++++++++ www/Changelog.html | 2 ++ 3 files changed, 19 insertions(+), 0 deletions(-) diffs (55 lines): diff -r cebad674f368 -r 064641820cb8 ChangeLog --- a/ChangeLog Sat Nov 12 14:44:13 2022 -0600 +++ b/ChangeLog Sat Nov 12 18:10:28 2022 -0600 @@ -1,5 +1,8 @@ 2022-11-12 Bob Friesenhahn <[email protected]> + * magick/nt_base.h (snprintf): For MSVC older than 2015, fall back + to using sprintf for the moment. + * coders/msl.c (ProcessMSLScript): Handle parser creation failure. * coders/meta.c (GetIPTCStream): Assure that offset is initialized. diff -r cebad674f368 -r 064641820cb8 magick/nt_base.h --- a/magick/nt_base.h Sat Nov 12 14:44:13 2022 -0600 +++ b/magick/nt_base.h Sat Nov 12 18:10:28 2022 -0600 @@ -193,6 +193,7 @@ 1900 Visual C++ 2015 1910 Visual C++ 2017 1920 Visual C++ 2019 + 1930 Visual C++ 2022 Should look at __CLR_VER ("Defines the version of the common language runtime used when the application was compiled.") as well. @@ -213,6 +214,19 @@ #endif /* + MSVC does not have snprintf (a C'99 feature) until Visual Studio 2015. + + It is possible to cobble together an actual working equivalent using + _vsnprintf(), _vsnprintf_s(), and _vscprintf() but this quick hack just uses + sprintf since current snprintf usages were direct replacements for sprintf. + A proper implementation can come later. + */ +#if defined(_VISUALC_) && (_MSC_VER < 1900) +#undef snprintf +#define snprintf(str,size,format,...) sprintf(str,format,__VA_ARGS__) +#endif + +/* Windows provides Unix-style access() via _access() */ #define HAVE_ACCESS 1 diff -r cebad674f368 -r 064641820cb8 www/Changelog.html --- a/www/Changelog.html Sat Nov 12 14:44:13 2022 -0600 +++ b/www/Changelog.html Sat Nov 12 18:10:28 2022 -0600 @@ -40,6 +40,8 @@ <p>2022-11-12 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p> <blockquote> <ul class="simple"> +<li><p>magick/nt_base.h (snprintf): For MSVC older than 2015, fall back +to using sprintf for the moment.</p></li> <li><p>coders/msl.c (ProcessMSLScript): Handle parser creation failure.</p></li> <li><p>coders/meta.c (GetIPTCStream): Assure that offset is initialized.</p></li> <li><p>magick/floats.c (_Gm_convert_fp32_to_fp16): Fix Clang Analyzer