Files
termux-packages/packages/graphicsmagick/coders-url.c.patch
termux-pacman-bot 9b87462acc enhance(main/graphicsmagick): Enable jpeg-xl support
Here is a sample output.

$ gm identify red-room.jxl
red-room.jxl JXL 555x812+0+0 DirectClass 8-bit 178.3Ki 0.000u 0m:0.000014s
2024-07-28 08:09:31 +00:00

101 lines
3.4 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
https://sourceforge.net/p/graphicsmagick/code/ci/ffe38e523f547a43219c8cdefc01c51fa4b51671/
--- a/coders/url.c
+++ b/coders/url.c
@@ -52,12 +52,19 @@
# include <win32config.h>
# endif
#endif
+#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
-#if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT
-# include <libxml/nanoftp.h>
-#endif /* defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT */
-#include <libxml/nanohttp.h>
+#if defined(LIBXML_FTP_ENABLED)
+# if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT
+# include <libxml/nanoftp.h>
+# endif /* defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT */
+#endif /* if defined(LIBXML_FTP_ENABLED) */
+#if defined(LIBXML_HTTP_ENABLED)
+# if defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN
+# include <libxml/nanohttp.h>
+# endif /* defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN */
+#endif /* if defined(LIBXML_HTTP_ENABLED) */
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -95,6 +102,7 @@
extern "C" {
#endif
+#if defined(LIBXML_FTP_ENABLED)
#if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT
static void GetFTPData(void *userdata,const char *data,int length)
{
@@ -109,6 +117,7 @@
(void) fwrite(data,length,1,file);
}
#endif /* if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT */
+#endif /* if defined(LIBXML_FTP_ENABLED) */
#if defined(__cplusplus) || defined(c_plusplus)
}
@@ -175,6 +184,7 @@
}
if (LocaleCompare(clone_info->magick,"http") == 0)
{
+#if defined(LIBXML_HTTP_ENABLED)
#if defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN
char
buffer[MaxBufferExtent];
@@ -199,9 +209,11 @@
xmlNanoHTTPCleanup();
}
#endif /* if defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN */
+#endif /* if defined(LIBXML_FTP_ENABLED) */
}
else if (LocaleCompare(clone_info->magick,"ftp") == 0)
{
+#if defined(LIBXML_FTP_ENABLED)
#if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT
void
*context;
@@ -216,6 +228,7 @@
(void) xmlNanoFTPClose(context);
}
#endif /* if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT */
+#endif /* if defined(LIBXML_FTP_ENABLED) */
}
(void) fclose(file);
if (!IsAccessibleAndNotEmpty(clone_info->filename))
@@ -264,6 +277,8 @@
MagickInfo
*entry;
+ /* HTTP URLs are not encouraged on the Internet */
+#if defined(LIBXML_HTTP_ENABLED)
#if defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN
entry=SetMagickInfo("HTTP");
entry->decoder=(DecoderHandler) ReadURLImage;
@@ -273,7 +288,10 @@
entry->coder_class=UnstableCoderClass;
(void) RegisterMagickInfo(entry);
#endif /* if defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN */
+#endif /* if defined(LIBXML_HTTP_ENABLED) */
+ /* FTP URLs have been deprecated for quite some time already */
+#if defined(LIBXML_FTP_ENABLED)
#if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT
entry=SetMagickInfo("FTP");
entry->decoder=(DecoderHandler) ReadURLImage;
@@ -283,6 +301,7 @@
entry->coder_class=UnstableCoderClass;
(void) RegisterMagickInfo(entry);
#endif /* if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT */
+#endif /* if defined(LIBXML_FTP_ENABLED) */
entry=SetMagickInfo("FILE");
entry->decoder=(DecoderHandler) ReadURLImage;