diff --git a/coders/Makefile.am b/coders/Makefile.am
index fb10ecd..6ce0999 100644
--- a/coders/Makefile.am
+++ b/coders/Makefile.am
@@ -19,6 +19,11 @@
# Where coder modules get installed
codersdir = $(CODER_PATH)
+if DPS_DELEGATE
+MAGICK_DPS_MODULES = coders/dps.la
+MAGICK_DPS_SRCS = coders/dps.c
+endif
+
if DJVU_DELEGATE
MAGICK_DJVU_MODULES = coders/djvu.la
MAGICK_DJVU_SRCS = coders/djvu.c
@@ -34,11 +39,6 @@
MAGICK_FPX_SRCS = coders/fpx.c
endif
-if WINGDI32_DELEGATE
-MAGICK_GDI32_MODULES = coders/clipboard.la coders/emf.la
-MAGICK_GDI32_SRCS = coders/clipboard.c coders/emf.c
-endif
-
if JBIG_DELEGATE
MAGICK_JBIG_MODULES = coders/jbig.la
MAGICK_JBIG_SRCS = coders/jbig.c
@@ -64,6 +64,11 @@
MAGICK_TIFF_SRCS = coders/ept.c coders/tiff.c
endif
+if WINGDI32_DELEGATE
+MAGICK_GDI32_MODULES = coders/clipboard.la coders/emf.la
+MAGICK_GDI32_SRCS = coders/clipboard.c coders/emf.c
+endif
+
if WMF_DELEGATE
MAGICK_WMF_MODULES = coders/wmf.la
MAGICK_WMF_SRCS = coders/wmf.c
@@ -92,7 +97,6 @@
coders/dib.c \
coders/dng.c \
coders/dot.c \
- coders/dps.c \
coders/dpx.c \
coders/fax.c \
coders/fits.c \
@@ -172,6 +176,7 @@
coders/xps.c \
coders/ycbcr.c \
coders/yuv.c \
+ $(MAGICK_DPS_SRCS) \
$(MAGICK_DJVU_SRCS) \
$(MAGICK_EXR_SRCS) \
$(MAGICK_FPX_SRCS) \
@@ -203,7 +208,6 @@
coders/dib.la \
coders/dng.la \
coders/dot.la \
- coders/dps.la \
coders/dpx.la \
coders/fax.la \
coders/fits.la \
@@ -283,6 +287,7 @@
coders/xps.la \
coders/ycbcr.la \
coders/yuv.la \
+ $(MAGICK_DPS_MODULES) \
$(MAGICK_DJVU_MODULES) \
$(MAGICK_EXR_MODULES) \
$(MAGICK_FPX_MODULES) \
diff --git a/coders/dpx.c b/coders/dpx.c
index bb84e2e..69167d1 100644
--- a/coders/dpx.c
+++ b/coders/dpx.c
@@ -1154,7 +1154,7 @@
SetQuantumPack(quantum_info,dpx.image.image_element[0].packing == 0 ?
MagickTrue : MagickFalse);
image_view=AcquireCacheView(image);
-#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP >= 200805)
+#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP > 200505)
#pragma omp parallel for schedule(dynamic,1) shared(row,status,quantum_type)
#endif
for (y=0; y < (long) image->rows; y++)
diff --git a/coders/pcl.c b/coders/pcl.c
index 07ef2fc..dfad735 100644
--- a/coders/pcl.c
+++ b/coders/pcl.c
@@ -352,7 +352,7 @@
read_info->antialias != MagickFalse ? 4 : 1,
read_info->antialias != MagickFalse ? 4 : 1,density,options,
read_info->filename,input_filename);
- status=SystemCommand(read_info->verbose,command) != 0 ? MagickTrue :
+ status=SystemCommand(read_info->verbose,command,exception) != 0 ? MagickTrue :
MagickFalse;
image=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(read_info->filename);
diff --git a/coders/pdf.c b/coders/pdf.c
index 81aa097..f42a505 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -102,7 +102,8 @@
% The format of the InvokePostscriptDelegate method is:
%
% MagickBooleanType InvokePostscriptDelegate(
-% const MagickBooleanType verbose,const char *command)
+% const MagickBooleanType verbose,const char *command,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -112,10 +113,15 @@
% o command: the address of a character string containing the command to
% execute.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType InvokePostscriptDelegate(
- const MagickBooleanType verbose,const char *command)
+ const MagickBooleanType verbose,const char *command,ExceptionInfo *exception)
{
+ int
+ status;
+
#if defined(MAGICKCORE_GS_DELEGATE) || defined(__WINDOWS__)
char
**argv;
@@ -128,8 +134,7 @@
int
argc,
- code,
- status;
+ code;
register long
i;
@@ -153,7 +158,10 @@
gs_func_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit;
#endif
if (gs_func == (GhostscriptVectors *) NULL)
- return(SystemCommand(verbose,command) == 0 ? MagickFalse : MagickTrue);
+ {
+ status=SystemCommand(verbose,command,exception);
+ return(status != 0 ? MagickTrue : MagickFalse);
+ }
if (verbose != MagickFalse)
{
(void) fputs("[ghostscript library]",stdout);
@@ -161,7 +169,10 @@
}
status=(gs_func->new_instance)(&interpreter,(void *) NULL);
if (status < 0)
- return(SystemCommand(verbose,command) == 0 ? MagickFalse : MagickTrue);
+ {
+ 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);
if (status == 0)
@@ -176,12 +187,22 @@
argv[i]=DestroyString(argv[i]);
argv=(char **) RelinquishMagickMemory(argv);
if ((status == 0) || (status == -101))
- return(MagickFalse);
+ {
+ char
+ *message;
+
+ message=GetExceptionMessage(errno);
+ (void) ThrowMagickException(exception,GetMagickModule(),DelegateError,
+ "`%s': %s",command,message);
+ message=DestroyString(message);
+ return(MagickFalse);
+ }
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Ghostscript returns status %d, exit code %d",status,code);
return(MagickTrue);
#else
- return(SystemCommand(verbose,command) != 0 ? MagickTrue : MagickFalse);
+ status=SystemCommand(verbose,command,exception);
+ return(status != 0 ? MagickTrue : MagickFalse);
#endif
}
@@ -544,10 +565,11 @@
if (cmyk != MagickFalse)
delegate_info=GetDelegateInfo("ps:cmyk",(char *) NULL,exception);
else
- if (LocaleCompare(image_info->magick,"AI") == 0)
- delegate_info=GetDelegateInfo("ps:alpha",(char *) NULL,exception);
- else
- delegate_info=GetDelegateInfo("ps:color",(char *) NULL,exception);
+#if defined(MAGICKCORE_PNG_DELEGATE)
+ delegate_info=GetDelegateInfo("ps:alpha",(char *) NULL,exception);
+#else
+ delegate_info=GetDelegateInfo("ps:color",(char *) NULL,exception);
+#endif
if (delegate_info == (const DelegateInfo *) NULL)
{
(void) RelinquishUniqueFileResource(postscript_filename);
@@ -596,7 +618,7 @@
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);
+ status=InvokePostscriptDelegate(read_info->verbose,command,exception);
pdf_image=(Image *) NULL;
if ((status == MagickFalse) &&
(IsPDFRendered(read_info->filename) != MagickFalse))
diff --git a/coders/png.c b/coders/png.c
index e0fa7b7..ef29476 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -2619,7 +2619,8 @@
}
quantum_scanline=(Quantum *) RelinquishMagickMemory(quantum_scanline);
}
- quantum_info=DestroyQuantumInfo(quantum_info);
+ if (quantum_info != (QuantumInfo *) NULL)
+ quantum_info=DestroyQuantumInfo(quantum_info);
if (image->storage_class == PseudoClass)
(void) SyncImage(image);
png_read_end(ping,ping_info);
@@ -7595,7 +7596,8 @@
}
}
}
- quantum_info=DestroyQuantumInfo(quantum_info);
+ if (quantum_info != (QuantumInfo *) NULL)
+ quantum_info=DestroyQuantumInfo(quantum_info);
if (logging != MagickFalse)
{
diff --git a/coders/ps.c b/coders/ps.c
index fbba139..f69f0d9 100644
--- a/coders/ps.c
+++ b/coders/ps.c
@@ -96,7 +96,8 @@
% The format of the InvokePostscriptDelegate method is:
%
% MagickBooleanType InvokePostscriptDelegate(
-% const MagickBooleanType verbose,const char *command)
+% const MagickBooleanType verbose,const char *command,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -106,10 +107,15 @@
% o command: the address of a character string containing the command to
% execute.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType InvokePostscriptDelegate(
- const MagickBooleanType verbose,const char *command)
+ const MagickBooleanType verbose,const char *command,ExceptionInfo *exception)
{
+ int
+ status;
+
#if defined(MAGICKCORE_GS_DELEGATE) || defined(__WINDOWS__)
char
**argv;
@@ -122,8 +128,7 @@
int
argc,
- code,
- status;
+ code;
register long
i;
@@ -147,7 +152,10 @@
gs_func_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit;
#endif
if (gs_func == (GhostscriptVectors *) NULL)
- return(SystemCommand(verbose,command) == 0 ? MagickFalse : MagickTrue);
+ {
+ status=SystemCommand(verbose,command,exception);
+ return(status != 0 ? MagickTrue : MagickFalse);
+ }
if (verbose != MagickFalse)
{
(void) fputs("[ghostscript library]",stdout);
@@ -155,7 +163,10 @@
}
status=(gs_func->new_instance)(&interpreter,(void *) NULL);
if (status < 0)
- return(SystemCommand(verbose,command) == 0 ? MagickFalse : MagickTrue);
+ {
+ 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);
if (status == 0)
@@ -170,12 +181,22 @@
argv[i]=DestroyString(argv[i]);
argv=(char **) RelinquishMagickMemory(argv);
if ((status == 0) || (status == -101))
- return(MagickFalse);
+ {
+ char
+ *message;
+
+ message=GetExceptionMessage(errno);
+ (void) ThrowMagickException(exception,GetMagickModule(),DelegateError,
+ "`%s': %s",command,message);
+ message=DestroyString(message);
+ return(MagickFalse);
+ }
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Ghostscript returns status %d, exit code %d",status,code);
return(MagickTrue);
#else
- return(SystemCommand(verbose,command) != 0 ? MagickTrue : MagickFalse);
+ status=SystemCommand(verbose,command,exception);
+ return(status != 0 ? MagickTrue : MagickFalse);
#endif
}
@@ -677,10 +698,11 @@
if (cmyk != MagickFalse)
delegate_info=GetDelegateInfo("ps:cmyk",(char *) NULL,exception);
else
- if (pages == 1)
- delegate_info=GetDelegateInfo("ps:alpha",(char *) NULL,exception);
- else
- delegate_info=GetDelegateInfo("ps:color",(char *) NULL,exception);
+#if defined(MAGICKCORE_PNG_DELEGATE)
+ delegate_info=GetDelegateInfo("ps:alpha",(char *) NULL,exception);
+#else
+ delegate_info=GetDelegateInfo("ps:color",(char *) NULL,exception);
+#endif
if (delegate_info == (const DelegateInfo *) NULL)
{
(void) RelinquishUniqueFileResource(postscript_filename);
@@ -723,12 +745,12 @@
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);
+ status=InvokePostscriptDelegate(read_info->verbose,command,exception);
if ((status != MagickFalse) ||
(IsPostscriptRendered(read_info->filename) == MagickFalse))
{
(void) ConcatenateMagickString(command," -c showpage",MaxTextExtent);
- status=InvokePostscriptDelegate(read_info->verbose,command);
+ status=InvokePostscriptDelegate(read_info->verbose,command,exception);
}
postscript_image=(Image *) NULL;
if (status == MagickFalse)
diff --git a/coders/xps.c b/coders/xps.c
index e139697..3421641 100644
--- a/coders/xps.c
+++ b/coders/xps.c
@@ -309,7 +309,7 @@
read_info->antialias != MagickFalse ? 4 : 1,
read_info->antialias != MagickFalse ? 4 : 1,density,options,
read_info->filename,input_filename);
- status=SystemCommand(read_info->verbose,command) != 0 ? MagickTrue :
+ status=SystemCommand(read_info->verbose,command,exception) != 0 ? MagickTrue :
MagickFalse;
image=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(read_info->filename);