Commit e2bd884c1 for imagemagick.org
commit e2bd884c19c50b21458833a9e7a2f8528a683d25
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Thu Aug 27 22:09:55 2026 +0200
Moved EscapeParenthesis to the ghostscript-private.h header file.
diff --git a/MagickCore/annotate.c b/MagickCore/annotate.c
index 09632791d..5624a72e4 100644
--- a/MagickCore/annotate.c
+++ b/MagickCore/annotate.c
@@ -83,6 +83,7 @@
#include "MagickCore/utility-private.h"
#include "MagickCore/xwindow.h"
#include "MagickCore/xwindow-private.h"
+#include "coders/ghostscript-private.h"
#if defined(MAGICKCORE_FREETYPE_DELEGATE)
#if defined(__MINGW32__)
# undef interface
@@ -2192,50 +2193,6 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info,
%
*/
-static char *EscapeParenthesis(const char *source)
-{
- char
- *destination;
-
- char
- *q;
-
- const char
- *p;
-
- size_t
- length;
-
- assert(source != (const char *) NULL);
- length=0;
- for (p=source; *p != '\0'; p++)
- {
- if ((*p == '\\') || (*p == '(') || (*p == ')'))
- {
- if (~length < 1)
- ThrowFatalException(ResourceLimitFatalError,"UnableToEscapeString");
- length++;
- }
- length++;
- }
- destination=(char *) NULL;
- if (~length >= (MagickPathExtent-1))
- destination=(char *) AcquireQuantumMemory(length+MagickPathExtent,
- sizeof(*destination));
- if (destination == (char *) NULL)
- ThrowFatalException(ResourceLimitFatalError,"UnableToEscapeString");
- *destination='\0';
- q=destination;
- for (p=source; *p != '\0'; p++)
- {
- if ((*p == '\\') || (*p == '(') || (*p == ')'))
- *q++='\\';
- *q++=(*p);
- }
- *q='\0';
- return(destination);
-}
-
static MagickBooleanType RenderPostscript(Image *image,
const DrawInfo *draw_info,const PointInfo *offset,TypeMetric *metrics,
ExceptionInfo *exception)
diff --git a/coders/ghostscript-private.h b/coders/ghostscript-private.h
index 6f176196a..38d523253 100644
--- a/coders/ghostscript-private.h
+++ b/coders/ghostscript-private.h
@@ -16,6 +16,8 @@
#ifndef MAGICK_GHOSTSCRIPT_BUFFER_PRIVATE_H
#define MAGICK_GHOSTSCRIPT_BUFFER_PRIVATE_H
+#include "MagickCore/delegate.h"
+#include "MagickCore/delegate-private.h"
#include "MagickCore/profile-private.h"
#include "coders/bytebuffer-private.h"
@@ -201,7 +203,7 @@ static inline MagickBooleanType InvokeGhostscriptDelegate(
#endif
}
-static MagickBooleanType IsGhostscriptRendered(const char *path)
+static inline MagickBooleanType IsGhostscriptRendered(const char *path)
{
MagickBooleanType
status;
@@ -275,4 +277,48 @@ static inline void ReadGhostScriptXMPProfile(MagickByteBuffer *buffer,
SetStringInfoLength(*profile,(size_t) count);
}
+static inline char *EscapeParenthesis(const char *source)
+{
+ char
+ *destination;
+
+ char
+ *q;
+
+ const char
+ *p;
+
+ size_t
+ length;
+
+ assert(source != (const char *) NULL);
+ length=0;
+ for (p=source; *p != '\0'; p++)
+ {
+ if ((*p == '\\') || (*p == '(') || (*p == ')'))
+ {
+ if (~length < 1)
+ ThrowFatalException(ResourceLimitFatalError,"UnableToEscapeString");
+ length++;
+ }
+ length++;
+ }
+ destination=(char *) NULL;
+ if (~length >= (MagickPathExtent-1))
+ destination=(char *) AcquireQuantumMemory(length+MagickPathExtent,
+ sizeof(*destination));
+ if (destination == (char *) NULL)
+ ThrowFatalException(ResourceLimitFatalError,"UnableToEscapeString");
+ *destination='\0';
+ q=destination;
+ for (p=source; *p != '\0'; p++)
+ {
+ if ((*p == '\\') || (*p == '(') || (*p == ')'))
+ *q++='\\';
+ *q++=(*p);
+ }
+ *q='\0';
+ return(destination);
+}
+
#endif
diff --git a/coders/pdf.c b/coders/pdf.c
index 43121287c..d76bd4458 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -52,8 +52,6 @@
#include "MagickCore/colorspace-private.h"
#include "MagickCore/compress.h"
#include "MagickCore/constitute.h"
-#include "MagickCore/delegate.h"
-#include "MagickCore/delegate-private.h"
#include "MagickCore/distort.h"
#include "MagickCore/draw.h"
#include "MagickCore/exception.h"
@@ -86,7 +84,6 @@
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree-private.h"
-#include "coders/bytebuffer-private.h"
#include "coders/coders-private.h"
#include "coders/ghostscript-private.h"
@@ -915,50 +912,6 @@ ModuleExport void UnregisterPDFImage(void)
%
*/
-static char *EscapeParenthesis(const char *source)
-{
- char
- *destination;
-
- char
- *q;
-
- const char
- *p;
-
- size_t
- length;
-
- assert(source != (const char *) NULL);
- length=0;
- for (p=source; *p != '\0'; p++)
- {
- if ((*p == '\\') || (*p == '(') || (*p == ')'))
- {
- if (~length < 1)
- ThrowFatalException(ResourceLimitFatalError,"UnableToEscapeString");
- length++;
- }
- length++;
- }
- destination=(char *) NULL;
- if (~length >= (MagickPathExtent-1))
- destination=(char *) AcquireQuantumMemory(length+MagickPathExtent,
- sizeof(*destination));
- if (destination == (char *) NULL)
- ThrowFatalException(ResourceLimitFatalError,"UnableToEscapeString");
- *destination='\0';
- q=destination;
- for (p=source; *p != '\0'; p++)
- {
- if ((*p == '\\') || (*p == '(') || (*p == ')'))
- *q++='\\';
- *q++=(*p);
- }
- *q='\0';
- return(destination);
-}
-
static size_t UTF8ToUTF16(const unsigned char *utf8,wchar_t *utf16)
{
const unsigned char