#define OutputBit(count) \
{ \
+DisableMSCWarning(4127) \
if (count > 0) \
byte=byte | bit; \
+RestoreMSCWarning \
bit>>=1; \
if ((int) (bit & 0xff) == 0) \
{ \
polygon_info=AcquirePolygonThreadSet(draw_info,primitive_info);
if (polygon_info == (PolygonInfo **) NULL)
return(MagickFalse);
+DisableMSCWarning(4127)
if (0)
DrawBoundingRectangles(image,draw_info,polygon_info[0],exception);
+RestoreMSCWarning
if (image->debug != MagickFalse)
(void) LogMagickEvent(DrawEvent,GetMagickModule()," begin draw-polygon");
fill=(primitive_info->method == FillToBorderMethod) ||
default:
return(0.0);
}
- return(0.0);
}
if (LocaleCompare(symbol,"c") == 0)
return(QuantumScale*pixel.red);
magick_info->stealth=MagickTrue;
status=AddValueToSplayTree(magick_list,magick_info->name,magick_info);
if (status == MagickFalse)
- {
- char
- *message;
-
- message=GetExceptionMessage(errno);
- ThrowFatalException(ResourceLimitFatalError,
- "MemoryAllocationFailed");
- message=DestroyString(message);
- }
+ ThrowFatalException(ResourceLimitFatalError,
+ "MemoryAllocationFailed");
#if defined(MAGICKCORE_MODULES_SUPPORT)
(void) GetModuleInfo((char *) NULL,exception);
#endif
debug;
debug=_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
- debug|=_CRTDBG_CHECK_ALWAYS_DF |_CRTDBG_DELAY_FREE_MEM_DF |
- _CRTDBG_LEAK_CHECK_DF;
- if (0)
- {
- debug=_CrtSetDbgFlag(debug);
- _ASSERTE(_CrtCheckMemory());
- }
+ debug|=_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF;
+ debug=_CrtSetDbgFlag(debug);
+ _ASSERTE(_CrtCheckMemory());
}
#endif
#endif
/*
Global declarations.
*/
+#if defined _MSC_VER
+static void* MSCMalloc(size_t size)
+{
+ return malloc(size);
+}
+static void* MSCRealloc(void* ptr, size_t size)
+{
+ return realloc(ptr, size);
+}
+static void MSCFree(void* ptr)
+{
+ free(ptr);
+}
+#endif
+
static MagickMemoryMethods
memory_methods =
{
+#if defined _MSC_VER
+ (AcquireMemoryHandler) MSCMalloc,
+ (ResizeMemoryHandler) MSCRealloc,
+ (DestroyMemoryHandler) MSCFree
+#else
(AcquireMemoryHandler) malloc,
(ResizeMemoryHandler) realloc,
(DestroyMemoryHandler) free
+#endif
};
-
#if defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT)
static MemoryPool
memory_pool;
if (exception->severity < ConfigureError)
ThrowFileException(exception,ConfigureWarning,"UnableToOpenModuleFile",
path);
- return(MagickFalse);
#endif
return(MagickFalse);
}
*last;
last = kernel;
+DisableMSCWarning(4127)
while(1) {
+RestoreMSCWarning
clone = CloneKernelInfo(last);
RotateKernelInfo(clone, angle);
if ( SameKernelInfo(kernel, clone) == MagickTrue )
MagickPrivate int Exit(int status)
{
if (IsWindows95())
- TerminateProcess(GetCurrentProcess(),(unsigned int) status);
+ {
+ TerminateProcess(GetCurrentProcess(),(unsigned int) status);
+ return(0);
+ }
exit(status);
- return(0);
}
\f
#if !defined(__MINGW32__) && !defined(__MINGW64__)
value;
if (*length < 2)
- return((unsigned short) ~0UL);
+ return((unsigned short) ~0);
for (i=0; i < 2; i++)
{
c=(int) (*(*p)++);
/* common inline code to expand the interpreted text string */
#define ExtendInterpretText(string_length) do { \
+DisableMSCWarning(4127) \
size_t length=(string_length); \
if ((size_t) (q-interpret_text+length+1) >= extent) \
{ extent+=length; \
if (interpret_text == (char *) NULL) \
return((char *)NULL); \
q=interpret_text+strlen(interpret_text); \
- } } while (0) /* no trailing ; */
+ } } while (0) /* no trailing ; */ \
+RestoreMSCWarning
/* same but append the given string */
#define AppendString2Text(string) do { \
+DisableMSCWarning(4127) \
size_t length=strlen((string)); \
if ((size_t) (q-interpret_text+length+1) >= extent) \
{ extent+=length; \
} \
(void) CopyMagickString(q,(string),extent); \
q+=length; \
- } while (0) /* no trailing ; */
+ } while (0) /* no trailing ; */ \
+RestoreMSCWarning
/* same but append a 'key' and 'string' pair */
#define AppendKeyValue2Text(key,string) do { \
+DisableMSCWarning(4127) \
size_t length=strlen(key)+strlen(string)+2; \
if ((size_t) (q-interpret_text+length+1) >= extent) \
{ extent+=length; \
q=interpret_text+strlen(interpret_text); \
} \
q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(string)); \
- } while (0) /* no trailing ; */
+ } while (0) /* no trailing ; */ \
+RestoreMSCWarning
MagickExport char *InterpretImageProperties(ImageInfo *image_info,
Image *image,const char *embed_text,ExceptionInfo *exception)
register unsigned char
pixel;
+ bit=0;
for (x=((ssize_t) number_pixels-3); x > 0; x-=4)
{
for (bit=0; bit < 8; bit+=2)
ssize_t
count;
+ i=0;
#if !defined(MAGICKCORE_HAVE_PWRITE)
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_WriteRadonCell)
p=GetStringInfoDatum(signature_info->message);
if (signature_info->lsb_first == MagickFalse)
{
+DisableMSCWarning(4127)
if (sizeof(unsigned int) <= 4)
+RestoreMSCWarning
for (i=0; i < 16; i++)
{
T=(*((unsigned int *) p));
}
}
else
+DisableMSCWarning(4127)
if (sizeof(unsigned int) <= 4)
+RestoreMSCWarning
for (i=0; i < 16; i++)
{
T=(*((unsigned int *) p));
channel_statistics=(ChannelStatistics *) AcquireQuantumMemory(
MaxPixelChannels+1,sizeof(*channel_statistics));
if (channel_statistics == (ChannelStatistics *) NULL)
- return(MagickFalse);
+ return(channel_statistics);
(void) ResetMagickMemory(channel_statistics,0,(MaxPixelChannels+1)*
sizeof(*channel_statistics));
for (i=0; i <= (ssize_t) MaxPixelChannels; i++)
Magick defines.
*/
#define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y))
+#if defined(_MSC_VER)
+# define DisableMSCWarning(nr) __pragma(warning(push)) \
+ __pragma(warning(disable:nr))
+# define RestoreMSCWarning __pragma(warning(pop))
+#else
+# define DisableMSCWarning(nr)
+# define RestoreMSCWarning
+#endif
#if defined(__cplusplus) || defined(c_plusplus)
}
(ValidateEntities(tag,entities[i+1],entities) == 0))
return(MagickFalse);
}
- return(MagickTrue);
}
static void ParseProcessingInstructions(XMLTreeRoot *root,char *xml,
/* Process Options from Script */
option = arg1 = arg2 = (char*)NULL;
+DisableMSCWarning(4127)
while (1) {
+RestoreMSCWarning
{ MagickBooleanType status = GetScriptToken(token_info);
cli_wand->line=token_info->token_line;
/* Process non-specific Option */
CLIOption(cli_wand, option, arg1, arg2);
+DisableMSCWarning(4127)
} while (0); /* break block to next option */
+RestoreMSCWarning
#if MagickCommandDebug >= 5
fprintf(stderr, "Script Image Count = %ld\n",
/* Process standard image option */
CLIOption(cli_wand, option, arg1, arg2);
+DisableMSCWarning(4127)
} while (0); /* break block to next option */
+RestoreMSCWarning
#if MagickCommandDebug >= 5
(void) FormatLocaleFile(stderr, "CLI-post Image Count = %ld\n",
#define FireImageStack(postfix,advance,fire) \
if ((j <= i) && (i < (ssize_t) argc)) \
{ \
+DisableMSCWarning(4127) \
if (image_stack[k].image == (Image *) NULL) \
status&=MogrifyImageInfo(image_stack[k].image_info,(int) (i-j+1), \
(const char **) (argv+j),exception); \
j=i+1; \
pend=MagickFalse; \
} \
+RestoreMSCWarning \
}
#define MaxImageStackDepth 128
#define NewImageStack() \
CLIWandException(OptionError,"UnrecognizedOption",option);
+DisableMSCWarning(4127)
} while (0); /* break to exit code. */
+RestoreMSCWarning
/* clean up percent escape interpreted strings */
if (arg1 != arg1n )
if ( (option_type & ListOperatorFlag) != 0 )
CLIListOperatorImages(cli_wand, option, arg1, arg2);
+DisableMSCWarning(4127)
} while (0); /* end Break code block */
+RestoreMSCWarning
cli_wand->command = (const OptionInfo *) NULL; /* prevent re-use later */
}
state=IN_WHITE;
quote='\0';
offset=0;
+DisableMSCWarning(4127)
while(1)
+RestoreMSCWarning
{
/* get character */
GetChar(c);
fatal_exception=DestroyExceptionInfo(fatal_exception); \
}
+/*
+ Magick defines.
+*/
+#if defined(_MSC_VER)
+# define DisableMSCWarning(nr) __pragma(warning(push)) \
+ __pragma(warning(disable:nr))
+# define RestoreMSCWarning __pragma(warning(pop))
+#else
+# define DisableMSCWarning(nr)
+# define RestoreMSCWarning
+#endif
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
cell |= (GetPixelIndex(image,p+x+dx+dy*image->columns) == polarity) << bit; \
else \
cell |= (GetPixelGreen(image,p+x+dx+dy*image->columns) == 0) << bit; \
-} while (0)
+DisableMSCWarning(4127) \
+} while (0) \
+RestoreMSCWarning
do_cell(0,0,0);
if (two_columns)
do_cell(0,3,6);
if (two_columns)
do_cell(1,3,7);
+DisableMSCWarning(4127)
} while(0);
+RestoreMSCWarning
if (unicode)
{
*/
cin.image.orientation=(unsigned char) ReadBlobByte(image);
offset++;
- if (cin.image.orientation != (unsigned char) (~0UL))
+ if (cin.image.orientation != (unsigned char) (~0))
(void) FormatImageProperty(image,"dpx:image.orientation","%d",
cin.image.orientation);
switch (cin.image.orientation)
quantum_type=RGBQuantum;
pixels=GetQuantumPixels(quantum_info);
length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue);
+DisableMSCWarning(4127)
if (0)
+RestoreMSCWarning
{
quantum_type=GrayQuantum;
length=GetBytesPerRow(image->columns,1,image->depth,MagickTrue);
}
}
- maxMipmaps=-1;
+ maxMipmaps=SIZE_MAX;
mipmaps=0;
if ((image->columns & (image->columns - 1)) == 0 &&
(image->rows & (image->rows - 1)) == 0)
dpx.orientation.border[i]=ReadBlobShort(image);
offset+=2;
}
- if ((dpx.orientation.border[0] != (unsigned short) (~0UL)) &&
- (dpx.orientation.border[1] != (unsigned short) (~0UL)))
- (void) FormatImageProperty(image,"dpx:orientation.border","%dx%d%+d%+d", dpx.orientation.border[0],dpx.orientation.border[1],
+ if ((dpx.orientation.border[0] != (unsigned short) (~0)) &&
+ (dpx.orientation.border[1] != (unsigned short) (~0)))
+ (void) FormatImageProperty(image,"dpx:orientation.border","%dx%d%+d%+d",
+ dpx.orientation.border[0],dpx.orientation.border[1],
dpx.orientation.border[2],dpx.orientation.border[3]);
for (i=0; i < 2; i++)
{
if ((jpeg_info.data_precision != 12) && (image->depth <= 8))
jpeg_info.data_precision=8;
else
- if (sizeof(JSAMPLE) > 1)
- jpeg_info.data_precision=12;
+ jpeg_info.data_precision=BITS_IN_JSAMPLE;
jpeg_info.density_unit=(UINT8) 1;
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
sample_size = 64;
image->depth = 64; /* double type cell */
(void) SetImageOption(clone_info,"quantum:format","floating-point");
+DisableMSCWarning(4127)
if (sizeof(double) != 8)
+RestoreMSCWarning
ThrowReaderException(CoderError, "IncompatibleSizeOfDouble");
if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX)
{ /* complex double type cell */
if (iptc != (Image *)NULL)
{
char
- psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0";
+ psheader[] = "\xFF\xED\0\0Photoshop 3.0\0" "8BIM\x04\x04\0\0\0\0";
len=(unsigned int) GetBlobSize(iptc);
if (len & 1)
keyword=(const char *) NULL;
value=(char *) NULL;
SetGeometryInfo(&geometry_info);
+ (void) ResetMagickMemory(&geometry,0,sizeof(geometry));
channel=DefaultChannels;
switch (*tag)
{
{
char
name[32],
- version,
- type;
+ version;
size_t
reserved_1,
reserved_2;
short int
- x_anchor,
- y_anchor,
width,
height;
+
+ unsigned char
+ type;
+
+ unsigned short
+ x_anchor,
+ y_anchor;
} PDBImage;
/*
Forward declarations.
pdb_image.x_last=(short) ReadBlobMSBShort(image);
pdb_image.y_last=(short) ReadBlobMSBShort(image);
pdb_image.reserved_2=ReadBlobMSBLong(image);
- pdb_image.x_anchor=(short) ReadBlobMSBShort(image);
- pdb_image.y_anchor=(short) ReadBlobMSBShort(image);
+ pdb_image.x_anchor=ReadBlobMSBShort(image);
+ pdb_image.y_anchor=ReadBlobMSBShort(image);
pdb_image.width=(short) ReadBlobMSBShort(image);
pdb_image.height=(short) ReadBlobMSBShort(image);
/*
pdb_image.version=1; /* RLE Compressed */
switch (bits_per_pixel)
{
- case 1: pdb_image.type=(char) 0xff; break; /* monochrome */
- case 2: pdb_image.type=(char) 0x00; break; /* 2 bit gray */
- default: pdb_image.type=(char) 0x02; /* 4 bit gray */
+ case 1: pdb_image.type=(unsigned char) 0xff; break; /* monochrome */
+ case 2: pdb_image.type=(unsigned char) 0x00; break; /* 2 bit gray */
+ default: pdb_image.type=(unsigned char) 0x02; /* 4 bit gray */
}
pdb_image.reserved_1=0;
pdb_image.note=0;
pdb_image.x_last=0;
pdb_image.y_last=0;
pdb_image.reserved_2=0;
- pdb_image.x_anchor=(short) 0xffff;
- pdb_image.y_anchor=(short) 0xffff;
+ pdb_image.x_anchor=(unsigned short) 0xffff;
+ pdb_image.y_anchor=(unsigned short) 0xffff;
pdb_image.width=(short) image->columns;
if (image->columns % 16)
pdb_image.width=(short) (16*(image->columns/16+1));
*/
(void) WriteBlob(image,32,(unsigned char *) pdb_image.name);
(void) WriteBlobByte(image,(unsigned char) pdb_image.version);
- (void) WriteBlobByte(image,(unsigned char) pdb_image.type);
+ (void) WriteBlobByte(image,pdb_image.type);
(void) WriteBlobMSBLong(image,(unsigned int) pdb_image.reserved_1);
(void) WriteBlobMSBLong(image,(unsigned int) pdb_image.note);
(void) WriteBlobMSBShort(image,(unsigned short) pdb_image.x_last);
(void) WriteBlobMSBShort(image,(unsigned short) pdb_image.y_last);
(void) WriteBlobMSBLong(image,(unsigned int) pdb_image.reserved_2);
- (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.x_anchor);
- (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.y_anchor);
+ (void) WriteBlobMSBShort(image,pdb_image.x_anchor);
+ (void) WriteBlobMSBShort(image,pdb_image.y_anchor);
(void) WriteBlobMSBShort(image,(unsigned short) pdb_image.width);
(void) WriteBlobMSBShort(image,(unsigned short) pdb_image.height);
(void) WriteBlob(image,(size_t) (q-runlength),runlength);
#define CFormat "/Filter [ /%s ]\n"
#define ObjectsPerImage 14
+DisableMSCWarning(4310)
static const char
XMPProfile[]=
{
"<?xpacket end=\"w\"?>\n"
},
XMPProfileMagick[4]= { (char) 0xef, (char) 0xbb, (char) 0xbf, (char) 0x00 };
+RestoreMSCWarning
char
basename[MaxTextExtent],
(void) WriteBlobString(image,"\n%EndPhotoshop\n");
}
profile=GetImageProfile(image,"xmp");
+DisableMSCWarning(4127)
if (0 && (profile != (StringInfo *) NULL))
+RestoreMSCWarning
{
/*
Embed XML profile.
property=(const char *) GetImageProperty(next_image,"label",exception);
if (property == (const char *) NULL)
{
- unsigned char
+ char
layer_name[MaxTextExtent];
(void) WriteBlobMSBLong(image,16);
}
do
{
+DisableMSCWarning(4127)
if (0 && (image_info->verbose != MagickFalse))
+RestoreMSCWarning
TIFFPrintDirectory(tiff,stdout,MagickFalse);
#if defined(MAGICKCORE_HAVE_TIFFISBIGENDIAN)
(void) SetImageProperty(image,"tiff:endian",TIFFIsBigEndian(tiff) == 0 ?
(void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,page,pages);
}
(void) TIFFSetProperties(tiff,image,exception);
+DisableMSCWarning(4127)
if (0)
+RestoreMSCWarning
(void) TIFFSetEXIFProperties(tiff,image,exception);
/*
Write image scanlines.
if (image->colorspace == LabColorspace)
DecodeLabImage(image,exception);
DestroyTIFFInfo(&tiff_info);
+DisableMSCWarning(4127)
if (0 && (image_info->verbose == MagickTrue))
+RestoreMSCWarning
TIFFPrintDirectory(tiff,stdout,MagickFalse);
(void) TIFFWriteDirectory(tiff);
image=SyncNextImageInList(image);
#if defined(MAGICKCORE_WINDOWS_SUPPORT) && \
!(defined(__MINGW32__) || defined(__MINGW64__))
(void) fclose(file);
- if (URLDownloadToFile(NULL,filename,read_info->filename,NULL,NULL) != S_OK)
+ if (URLDownloadToFile(NULL,filename,read_info->filename,0,NULL) != S_OK)
{
ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
filename);
*/
if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
(void) TransformImageColorspace(image,sRGBColorspace,exception);
+DisableMSCWarning(4310)
viff_info.identifier=(char) 0xab;
+RestoreMSCWarning
viff_info.file_type=1;
viff_info.release=1;
viff_info.version=3;
/* Helper for WPG2 reader. */
#define InsertByte6(b) \
{ \
+DisableMSCWarning(4310) \
if(XorMe)\
BImgBuff[x] = (unsigned char)~b;\
else\
BImgBuff[x] = b;\
+RestoreMSCWarning \
x++; \
if((ssize_t) x >= ldblk) \
{ \
Remove comments.
*/
count=0;
+ width=0;
for (p=xpm_buffer; *p != '\0'; p++)
{
if (*p != '"')