18#ifndef MAGICKCORE_CONSTITUTE_PRIVATE_H
19#define MAGICKCORE_CONSTITUTE_PRIVATE_H
21#if defined(__cplusplus) || defined(c_plusplus)
25#include "magick/constitute.h"
26#include "magick/exception.h"
27#include "magick/log.h"
28#include "magick/utility.h"
30static inline MagickBooleanType IsAllowedCoder(
const char *coder)
39 const char **p = allowed_coders;
42 if (LocaleCompare(coder,*p) == 0)
49static inline Image *StrictReadImage(
const ImageInfo *image_info,
50 ExceptionInfo *exception)
53 magic[MagickPathExtent];
55 (void) GetPathComponent(image_info->filename,MagickPath,magic);
59 if (IsAllowedCoder(magic) == MagickFalse)
61 (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
62 "ExplicitCoderNotAllowed",
"`%s'",image_info->filename);
63 return((Image *) NULL);
66 return(ReadImage(image_info,exception));
68 if (IsPathAccessible(image_info->filename) == MagickFalse)
70 (void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
71 "UnableToOpenFile",
"`%s'",image_info->filename);
72 return((Image *) NULL);
74 return(ReadImage(image_info,exception));
77#if defined(__cplusplus) || defined(c_plusplus)