From: cristy Date: Thu, 10 Sep 2009 02:18:35 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~10743 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=defb3f0053e337dc0cce29259a16990f57e22638;p=imagemagick --- diff --git a/coders/pdf.c b/coders/pdf.c index 8da6eab1f..4170971b0 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -90,20 +90,18 @@ static MagickBooleanType % % % % % % -% I n v o k e P o s t s r i p t D e l e g a t e % +% I n v o k e P D F D e l e g a t e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% InvokePostscriptDelegate() executes the postscript interpreter with the -% specified command. +% InvokePDFDelegate() executes the PDF interpreter with the specified command. % -% The format of the InvokePostscriptDelegate method is: +% The format of the InvokePDFDelegate method is: % -% MagickBooleanType InvokePostscriptDelegate( -% const MagickBooleanType verbose,const char *command, -% ExceptionInfo *exception) +% MagickBooleanType InvokePDFDelegate(const MagickBooleanType verbose, +% const char *command,ExceptionInfo *exception) % % A description of each parameter follows: % @@ -116,8 +114,8 @@ static MagickBooleanType % o exception: return any errors or warnings in this structure. % */ -static MagickBooleanType InvokePostscriptDelegate( - const MagickBooleanType verbose,const char *command,ExceptionInfo *exception) +static MagickBooleanType InvokePDFDelegate(const MagickBooleanType verbose, + const char *command,ExceptionInfo *exception) { int status; @@ -126,8 +124,8 @@ static MagickBooleanType InvokePostscriptDelegate( char **argv; - const GhostscriptVectors - *gs_func; + const GhostInfo + *ghost_info; gs_main_instance *interpreter; @@ -140,24 +138,24 @@ static MagickBooleanType InvokePostscriptDelegate( i; #if defined(__WINDOWS__) - gs_func=NTGhostscriptDLLVectors(); + ghost_info=NTGhostscriptDLLVectors(); #else - GhostscriptVectors - gs_func_struct; + GhostInfo + ghost_info_struct; - gs_func=(&gs_func_struct); - (void) ResetMagickMemory(&gs_func,0,sizeof(gs_func)); - gs_func_struct.new_instance=(int (*)(gs_main_instance **,void *)) + ghost_info=(&ghost_info_struct); + (void) ResetMagickMemory(&ghost_info,0,sizeof(ghost_info)); + ghost_info_struct.new_instance=(int (*)(gs_main_instance **,void *)) gsapi_new_instance; - gs_func_struct.init_with_args=(int (*)(gs_main_instance *,int,char **)) + ghost_info_struct.init_with_args=(int (*)(gs_main_instance *,int,char **)) gsapi_init_with_args; - gs_func_struct.run_string=(int (*)(gs_main_instance *,const char *,int,int *)) - gsapi_run_string; - gs_func_struct.delete_instance=(void (*)(gs_main_instance *)) + ghost_info_struct.run_string=(int (*)(gs_main_instance *,const char *,int, + int *)) gsapi_run_string; + ghost_info_struct.delete_instance=(void (*)(gs_main_instance *)) gsapi_delete_instance; - gs_func_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit; + ghost_info_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit; #endif - if (gs_func == (GhostscriptVectors *) NULL) + if (ghost_info == (GhostInfo *) NULL) { status=SystemCommand(verbose,command,exception); return(status == 0 ? MagickTrue : MagickFalse); @@ -167,19 +165,19 @@ static MagickBooleanType InvokePostscriptDelegate( (void) fputs("[ghostscript library]",stdout); (void) fputs(strchr(command,' '),stdout); } - status=(gs_func->new_instance)(&interpreter,(void *) NULL); + status=(ghost_info->new_instance)(&interpreter,(void *) NULL); if (status < 0) { status=SystemCommand(verbose,command,exception); return(status == 0 ? MagickTrue : MagickFalse); } argv=StringToArgv(command,&argc); - status=(gs_func->init_with_args)(interpreter,argc-1,argv+1); + status=(ghost_info->init_with_args)(interpreter,argc-1,argv+1); if (status == 0) - status=(gs_func->run_string)(interpreter,"systemdict /start get exec\n",0, - &code); - (gs_func->exit)(interpreter); - (gs_func->delete_instance)(interpreter); + status=(ghost_info->run_string)(interpreter,"systemdict /start get exec\n", + 0,&code); + (ghost_info->exit)(interpreter); + (ghost_info->delete_instance)(interpreter); #if defined(__WINDOWS__) NTGhostscriptUnLoadDLL(); #endif @@ -617,7 +615,7 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) read_info->antialias != MagickFalse ? 4 : 1, read_info->antialias != MagickFalse ? 4 : 1,density,options, read_info->filename,postscript_filename,input_filename); - status=InvokePostscriptDelegate(read_info->verbose,command,exception); + status=InvokePDFDelegate(read_info->verbose,command,exception); pdf_image=(Image *) NULL; if ((status != MagickFalse) && (IsPDFRendered(read_info->filename) != MagickFalse)) diff --git a/coders/ps.c b/coders/ps.c index b12242383..836d33fff 100644 --- a/coders/ps.c +++ b/coders/ps.c @@ -90,7 +90,7 @@ static MagickBooleanType % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% InvokePostscriptDelegate() executes the postscript interpreter with the +% InvokePostscriptDelegate() executes the Postscript interpreter with the % specified command. % % The format of the InvokePostscriptDelegate method is: @@ -120,8 +120,8 @@ static MagickBooleanType InvokePostscriptDelegate( char **argv; - const GhostscriptVectors - *gs_func; + const GhostInfo + *ghost_info; gs_main_instance *interpreter; @@ -134,24 +134,24 @@ static MagickBooleanType InvokePostscriptDelegate( i; #if defined(__WINDOWS__) - gs_func=NTGhostscriptDLLVectors(); + ghost_info=NTGhostscriptDLLVectors(); #else - GhostscriptVectors - gs_func_struct; + GhostInfo + ghost_info_struct; - gs_func=(&gs_func_struct); - (void) ResetMagickMemory(&gs_func,0,sizeof(gs_func)); - gs_func_struct.new_instance=(int (*)(gs_main_instance **,void *)) + ghost_info=(&ghost_info_struct); + (void) ResetMagickMemory(&ghost_info,0,sizeof(ghost_info)); + ghost_info_struct.new_instance=(int (*)(gs_main_instance **,void *)) gsapi_new_instance; - gs_func_struct.init_with_args=(int (*)(gs_main_instance *,int,char **)) + ghost_info_struct.init_with_args=(int (*)(gs_main_instance *,int,char **)) gsapi_init_with_args; - gs_func_struct.run_string=(int (*)(gs_main_instance *,const char *,int,int *)) - gsapi_run_string; - gs_func_struct.delete_instance=(void (*)(gs_main_instance *)) + ghost_info_struct.run_string=(int (*)(gs_main_instance *,const char *,int, + int *)) gsapi_run_string; + ghost_info_struct.delete_instance=(void (*)(gs_main_instance *)) gsapi_delete_instance; - gs_func_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit; + ghost_info_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit; #endif - if (gs_func == (GhostscriptVectors *) NULL) + if (ghost_info == (GhostInfo *) NULL) { status=SystemCommand(verbose,command,exception); return(status == 0 ? MagickTrue : MagickFalse); @@ -161,19 +161,19 @@ static MagickBooleanType InvokePostscriptDelegate( (void) fputs("[ghostscript library]",stdout); (void) fputs(strchr(command,' '),stdout); } - status=(gs_func->new_instance)(&interpreter,(void *) NULL); + status=(ghost_info->new_instance)(&interpreter,(void *) NULL); if (status < 0) { status=SystemCommand(verbose,command,exception); return(status == 0 ? MagickTrue : MagickFalse); } argv=StringToArgv(command,&argc); - status=(gs_func->init_with_args)(interpreter,argc-1,argv+1); + status=(ghost_info->init_with_args)(interpreter,argc-1,argv+1); if (status == 0) - status=(gs_func->run_string)(interpreter,"systemdict /start get exec\n",0, - &code); - (gs_func->exit)(interpreter); - (gs_func->delete_instance)(interpreter); + status=(ghost_info->run_string)(interpreter,"systemdict /start get exec\n", + 0,&code); + (ghost_info->exit)(interpreter); + (ghost_info->delete_instance)(interpreter); #if defined(__WINDOWS__) NTGhostscriptUnLoadDLL(); #endif diff --git a/magick/delegate-private.h b/magick/delegate-private.h index e0994c04c..a628dd231 100644 --- a/magick/delegate-private.h +++ b/magick/delegate-private.h @@ -41,7 +41,7 @@ typedef struct gs_main_instance_s # endif #endif -typedef struct _GhostscriptVectors +typedef struct _GhostInfo { int (MagickDLLCall *exit)(gs_main_instance *); @@ -57,7 +57,7 @@ typedef struct _GhostscriptVectors void (MagickDLLCall *delete_instance)(gs_main_instance *); -} GhostscriptVectors; +} GhostInfo; #if defined(__cplusplus) || defined(c_plusplus) } diff --git a/magick/nt-base.c b/magick/nt-base.c index b21a0d7e8..54849f03b 100644 --- a/magick/nt-base.c +++ b/magick/nt-base.c @@ -73,11 +73,11 @@ static char *lt_slsearchpath = (char *) NULL; #endif -static GhostscriptVectors - ghostscript_vectors; +static GhostInfo + ghost_info; static void - *ghostscript_handle = (void *) NULL; + *ghost_handle = (void *) NULL; /* External declarations. @@ -738,8 +738,8 @@ MagickExport MagickBooleanType NTGetModulePath(const char *module,char *path) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% NTGhostscriptDLL() returns the path to the most recent Ghostscript DLL. The -% method returns TRUE on success otherwise FALSE. +% NTGhostscriptDLL() returns the path to the most recent Ghostscript version +% DLL. The method returns TRUE on success otherwise FALSE. % % The format of the NTGhostscriptDLL method is: % @@ -771,15 +771,15 @@ static int NTGetRegistryValue(HKEY root,const char *key,const char *name, status; /* - Get a registry value: Key = root\\key, named value = name. - */ + Get a registry value: key = root\\key, named value = name. + */ if (RegOpenKeyExA(root,key,0,KEY_READ,&hkey) != ERROR_SUCCESS) return(1); /* no match */ p=(BYTE *) value; type=REG_SZ; extent=(*length); if (p == (BYTE *) NULL) - p=(&byte); /* won't return ERROR_MORE_DATA if value is NULL */ + p=(&byte); /* ERROR_MORE_DATA only if value is NULL */ status=RegQueryValueExA(hkey,(char *) name,0,&type,p,&extent); RegCloseKey(hkey); if (status == ERROR_SUCCESS) @@ -790,12 +790,12 @@ static int NTGetRegistryValue(HKEY root,const char *key,const char *name, if (status == ERROR_MORE_DATA) { *length=extent; - return(-1); /* buffer wasn't large enough */ + return(-1); /* buffer not large enough */ } return(1); /* not found */ } -static int NTGhostscriptFind(const char **product_family,int *major_version, +static int NTLocateGhostscript(const char **product_family,int *major_version, int *minor_version) { int @@ -810,7 +810,7 @@ static int NTGhostscriptFind(const char **product_family,int *major_version, "GPL Ghostscript", "GNU Ghostscript", "AFPL Ghostscript", - "Aladdin Ghostscript" + "Aladdin Ghostscript" }; /* @@ -883,9 +883,9 @@ static int NTGhostscriptGetString(const char *name,char *value, int i, extent; - + static const char - *product_family = NULL; + *product_family = (const char *) NULL; static int major_version=0, @@ -908,9 +908,9 @@ static int NTGhostscriptGetString(const char *name,char *value, /* Get a string from the installed Ghostscript. */ - value[0]='\0'; + *value='\0'; if (product_family == NULL) - (void) NTGhostscriptFind(&product_family,&major_version,&minor_version); + (void) NTLocateGhostscript(&product_family,&major_version,&minor_version); if (product_family == NULL) return(FALSE); (void) FormatMagickString(key,MaxTextExtent,"SOFTWARE\\%s\\%d.%02d", @@ -953,21 +953,21 @@ MagickExport int NTGhostscriptDLL(char *path,int length) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% NTGhostscriptDLLVectors() returns a GhostscriptVectors structure that -% contain function vectors to invoke Ghostscript DLL functions. A null -% pointer is returned if there is an error when loading the DLL or -% retrieving the function vectors. +% NTGhostscriptDLLVectors() returns a GhostInfo structure that includes +% function vectors to invoke Ghostscript DLL functions. A null pointer is +% returned if there is an error when loading the DLL or retrieving the +% function vectors. % % The format of the NTGhostscriptDLLVectors method is: % -% const GhostscriptVectors *NTGhostscriptDLLVectors(void) +% const GhostInfo *NTGhostscriptDLLVectors(void) % */ -MagickExport const GhostscriptVectors *NTGhostscriptDLLVectors(void) +MagickExport const GhostInfo *NTGhostscriptDLLVectors(void) { if (NTGhostscriptLoadDLL() == FALSE) - return((GhostscriptVectors *) NULL); - return(&ghostscript_vectors); + return((GhostInfo *) NULL); + return(&ghost_info); } /* @@ -1092,37 +1092,33 @@ MagickExport int NTGhostscriptFonts(char *path,int length) % % int NTGhostscriptLoadDLL(void) % -%% */ MagickExport int NTGhostscriptLoadDLL(void) { char path[MaxTextExtent]; - if (ghostscript_handle != (void *) NULL) + if (ghost_handle != (void *) NULL) return(TRUE); if (NTGhostscriptDLL(path,sizeof(path)) == FALSE) return(FALSE); - ghostscript_handle=lt_dlopen(path); - if (ghostscript_handle == (void *) NULL) + ghost_handle=lt_dlopen(path); + if (ghost_handle == (void *) NULL) return(FALSE); - (void) ResetMagickMemory((void *) &ghostscript_vectors,0, - sizeof(GhostscriptVectors)); - ghostscript_vectors.exit=(int (MagickDLLCall *)(gs_main_instance*)) - lt_dlsym(ghostscript_handle,"gsapi_exit"); - ghostscript_vectors.init_with_args=(int (MagickDLLCall *)(gs_main_instance *, - int,char **)) (lt_dlsym(ghostscript_handle,"gsapi_init_with_args")); - ghostscript_vectors.new_instance=(int (MagickDLLCall *)(gs_main_instance **, - void *)) (lt_dlsym(ghostscript_handle,"gsapi_new_instance")); - ghostscript_vectors.run_string=(int (MagickDLLCall *)(gs_main_instance *, - const char *,int,int *)) (lt_dlsym(ghostscript_handle,"gsapi_run_string")); - ghostscript_vectors.delete_instance=(void (MagickDLLCall *) (gs_main_instance - *)) (lt_dlsym(ghostscript_handle,"gsapi_delete_instance")); - if ((ghostscript_vectors.exit == NULL) || - (ghostscript_vectors.init_with_args == NULL) || - (ghostscript_vectors.new_instance == NULL) || - (ghostscript_vectors.run_string == NULL) || - (ghostscript_vectors.delete_instance == NULL)) + (void) ResetMagickMemory((void *) &ghost_info,0,sizeof(GhostInfo)); + ghost_info.exit=(int (MagickDLLCall *)(gs_main_instance*)) + lt_dlsym(ghost_handle,"gsapi_exit"); + ghost_info.init_with_args=(int (MagickDLLCall *)(gs_main_instance *,int, + char **)) (lt_dlsym(ghost_handle,"gsapi_init_with_args")); + ghost_info.new_instance=(int (MagickDLLCall *)(gs_main_instance **,void *)) ( + lt_dlsym(ghost_handle,"gsapi_new_instance")); + ghost_info.run_string=(int (MagickDLLCall *)(gs_main_instance *,const char *, + int,int *)) (lt_dlsym(ghost_handle,"gsapi_run_string")); + ghost_info.delete_instance=(void (MagickDLLCall *) (gs_main_instance *)) ( + lt_dlsym(ghost_handle,"gsapi_delete_instance")); + if ((ghost_info.exit == NULL) || (ghost_info.init_with_args == NULL) || + (ghost_info.new_instance == NULL) || (ghost_info.run_string == NULL) || + (ghost_info.delete_instance == NULL)) return(FALSE); return(TRUE); } @@ -1151,12 +1147,11 @@ MagickExport int NTGhostscriptUnLoadDLL(void) int status; - if (ghostscript_handle == (void *) NULL) + if (ghost_handle == (void *) NULL) return(FALSE); - status=lt_dlclose(ghostscript_handle); - ghostscript_handle=(void *) NULL; - (void) ResetMagickMemory((void *) &ghostscript_vectors,0, - sizeof(GhostscriptVectors)); + status=lt_dlclose(ghost_handle); + ghost_handle=(void *) NULL; + (void) ResetMagickMemory((void *) &ghost_info,0,sizeof(GhostInfo)); return(status); } diff --git a/magick/nt-base.h b/magick/nt-base.h index 25e4ef0e9..5937092dc 100644 --- a/magick/nt-base.h +++ b/magick/nt-base.h @@ -306,7 +306,7 @@ typedef long ssize_t; extern MagickExport char *NTGetLastError(void); -extern MagickExport const GhostscriptVectors +extern MagickExport const GhostInfo *NTGhostscriptDLLVectors(void); #if !defined(MAGICKCORE_LTDL_DELEGATE)