MagickCore  6.9.11-60
Convert, Edit, Or Compose Bitmap Images
delegate-private.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4 
5  You may not use this file except in compliance with the License. You may
6  obtain a copy of the License at
7 
8  https://imagemagick.org/script/license.php
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  MagickCore delegates private methods.
17 */
18 #ifndef MAGICKCORE_DELEGATE_PRIVATE_H
19 #define MAGICKCORE_DELEGATE_PRIVATE_H
20 
21 #include "magick/string_.h"
22 
23 #if defined(MAGICKCORE_GS_DELEGATE)
24 #include "ghostscript/iapi.h"
25 #include "ghostscript/ierrors.h"
26 #else
27 typedef struct gsapi_revision_s
28 {
29  const char *product;
30  const char *copyright;
31  long revision;
34 #endif
35 
36 #if defined(__cplusplus) || defined(c_plusplus)
37 extern "C" {
38 #endif
39 
40 #ifndef gs_main_instance_DEFINED
41 # define gs_main_instance_DEFINED
42 typedef struct gs_main_instance_s
44 #endif
45 
46 #if !defined(MagickDLLCall)
47 # if defined(MAGICKCORE_WINDOWS_SUPPORT)
48 # define MagickDLLCall __stdcall
49 # else
50 # define MagickDLLCall
51 # endif
52 #endif
53 
54 typedef struct _GhostInfo
55 {
57  (MagickDLLCall *delete_instance)(gs_main_instance *);
58 
61 
63  (MagickDLLCall *init_with_args)(gs_main_instance *,int,char **);
64 
66  (MagickDLLCall *new_instance)(gs_main_instance **,void *);
67 
69  (MagickDLLCall *run_string)(gs_main_instance *,const char *,int,int *);
70 
72  (MagickDLLCall *set_stdio)(gs_main_instance *,int(MagickDLLCall *)(void *,
73  char *,int),int(MagickDLLCall *)(void *,const char *,int),
74  int(MagickDLLCall *)(void *,const char *,int));
75 
77  (MagickDLLCall *revision)(gsapi_revision_t *, int);
79 
80 static inline char *SanitizeDelegateString(const char *source)
81 {
82  char
83  *sanitize_source;
84 
85  const char
86  *q;
87 
88  char
89  *p;
90 
91  static char
92 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
93  allowlist[] =
94  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "
95  "$-_.+!;*(),{}|^~[]`\'><#%/?:@&=";
96 #else
97  allowlist[] =
98  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "
99  "$-_.+!;*(),{}|\\^~[]`\"><#%/?:@&=";
100 #endif
101 
102  sanitize_source=AcquireString(source);
103  p=sanitize_source;
104  q=sanitize_source+strlen(sanitize_source);
105  for (p+=strspn(p,allowlist); p != q; p+=strspn(p,allowlist))
106  *p='_';
107  return(sanitize_source);
108 }
109 
110 #if defined(__cplusplus) || defined(c_plusplus)
111 }
112 #endif
113 
114 #endif
struct gsapi_revision_s gsapi_revision_t
struct gs_main_instance_s gs_main_instance
Definition: delegate-private.h:42
#define MagickDLLCall
Definition: delegate-private.h:50
struct _GhostInfo GhostInfo
static char * SanitizeDelegateString(const char *source)
Definition: delegate-private.h:80
MagickExport char * AcquireString(const char *source)
Definition: string.c:125
Definition: delegate-private.h:55
char void const char int int(MagickDLLCall *)(void *
char void const char int
Definition: delegate-private.h:69
char void const char int char int
Definition: delegate-private.h:73
void(MagickDLLCall *delete_instance)(gs_main_instance *)
char void const char int char const char const char int
Definition: delegate-private.h:74
int
Definition: delegate-private.h:63
char ** int(MagickDLLCall *new_instance)(gs_main_instance **
int(MagickDLLCall *init_with_args)(gs_main_instance *
int(MagickDLLCall *exit)(gs_main_instance *)
int(MagickDLLCall *revision)(gsapi_revision_t *
char void * int(MagickDLLCall *run_string)(gs_main_instance *
char void const char int * int(MagickDLLCall *set_stdio)(gs_main_instance *
Definition: delegate-private.h:28
long revisiondate
Definition: delegate-private.h:32
const char * copyright
Definition: delegate-private.h:30
const char * product
Definition: delegate-private.h:29
long revision
Definition: delegate-private.h:31