diff --git a/magick/threshold.c b/magick/threshold.c
index 211e6a8..825d3dc 100644
--- a/magick/threshold.c
+++ b/magick/threshold.c
@@ -97,11 +97,11 @@
*map_id,
*description;
- unsigned long
+ size_t
width,
height;
- long
+ ssize_t
divisor,
*levels;
};
@@ -125,8 +125,8 @@
% The format of the AdaptiveThresholdImage method is:
%
% Image *AdaptiveThresholdImage(const Image *image,
-% const unsigned long width,const unsigned long height,
-% const long offset,ExceptionInfo *exception)
+% const size_t width,const size_t height,
+% const ssize_t offset,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
@@ -142,7 +142,7 @@
%
*/
MagickExport Image *AdaptiveThresholdImage(const Image *image,
- const unsigned long width,const unsigned long height,const long offset,
+ const size_t width,const size_t height,const ssize_t offset,
ExceptionInfo *exception)
{
#define ThresholdImageTag "Threshold/Image"
@@ -154,7 +154,7 @@
Image
*threshold_image;
- long
+ ssize_t
progress,
y;
@@ -196,7 +196,7 @@
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
MagickBooleanType
sync;
@@ -210,7 +210,7 @@
register IndexPacket
*restrict threshold_indexes;
- register long
+ register ssize_t
x;
register PixelPacket
@@ -218,7 +218,7 @@
if (status == MagickFalse)
continue;
- p=GetCacheViewVirtualPixels(image_view,-((long) width/2L),y-height/2L,
+ p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-height/2L,
image->columns+width,height,exception);
q=GetCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns,1,
exception);
@@ -229,9 +229,9 @@
}
indexes=GetCacheViewVirtualIndexQueue(image_view);
threshold_indexes=GetCacheViewAuthenticIndexQueue(threshold_view);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- long
+ ssize_t
v;
MagickPixelPacket
@@ -241,15 +241,15 @@
register const PixelPacket
*r;
- register long
+ register ssize_t
u;
pixel=zero;
mean=zero;
r=p;
- for (v=0; v < (long) height; v++)
+ for (v=0; v < (ssize_t) height; v++)
{
- for (u=0; u < (long) width; u++)
+ for (u=0; u < (ssize_t) width; u++)
{
pixel.red+=r[u].red;
pixel.green+=r[u].green;
@@ -367,7 +367,7 @@
ExceptionInfo
*exception;
- long
+ ssize_t
progress,
y;
@@ -390,12 +390,12 @@
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
- register long
+ register ssize_t
x;
register PixelPacket
@@ -412,7 +412,7 @@
indexes=GetCacheViewAuthenticIndexQueue(image_view);
if (channel == DefaultChannels)
{
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
q->red=(Quantum) ((MagickRealType) PixelIntensityToQuantum(q) <=
threshold ? 0 : QuantumRange);
@@ -422,7 +422,7 @@
}
}
else
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if ((channel & RedChannel) != 0)
q->red=(Quantum) ((MagickRealType) q->red <= threshold ? 0 :
@@ -523,7 +523,7 @@
GeometryInfo
geometry_info;
- long
+ ssize_t
progress,
y;
@@ -576,12 +576,12 @@
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
- register long
+ register ssize_t
x;
register PixelPacket
@@ -596,7 +596,7 @@
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if (channel != DefaultChannels)
{
@@ -710,7 +710,7 @@
ExceptionInfo
*exception;
- long
+ ssize_t
progress,
y;
@@ -723,14 +723,14 @@
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->storage_class == PseudoClass)
{
- register long
+ register ssize_t
i;
register PixelPacket
*restrict q;
q=image->colormap;
- for (i=0; i < (long) image->colors; i++)
+ for (i=0; i < (ssize_t) image->colors; i++)
{
q->red=ClampToUnsignedQuantum(q->red);
q->green=ClampToUnsignedQuantum(q->green);
@@ -750,12 +750,12 @@
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
- register long
+ register ssize_t
x;
register PixelPacket
@@ -770,7 +770,7 @@
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if ((channel & RedChannel) != 0)
q->red=ClampToUnsignedQuantum(q->red);
@@ -834,8 +834,8 @@
map->map_id=DestroyString(map->map_id);
if (map->description != (char *) NULL)
map->description=DestroyString(map->description);
- if (map->levels != (long *) NULL)
- map->levels=(long *) RelinquishMagickMemory(map->levels);
+ if (map->levels != (ssize_t *) NULL)
+ map->levels=(ssize_t *) RelinquishMagickMemory(map->levels);
map=(ThresholdMap *) RelinquishMagickMemory(map);
return(map);
}
@@ -930,7 +930,7 @@
ThrowFatalException(ResourceLimitFatalError,"UnableToAcquireThresholdMap");
map->map_id = (char *)NULL;
map->description = (char *)NULL;
- map->levels = (long *) NULL;
+ map->levels = (ssize_t *) NULL;
/* Assign Basic Attributes */
attr = GetXMLTreeAttribute(threshold, "map");
@@ -1001,14 +1001,14 @@
map = DestroyThresholdMap(map);
return(map);
}
- map->levels=(long *) AcquireQuantumMemory((size_t) map->width,map->height*
+ map->levels=(ssize_t *) AcquireQuantumMemory((size_t) map->width,map->height*
sizeof(*map->levels));
- if ( map->levels == (long *)NULL )
+ if ( map->levels == (ssize_t *)NULL )
ThrowFatalException(ResourceLimitFatalError,"UnableToAcquireThresholdMap");
{ /* parse levels into integer array */
int i;
char *p;
- for( i=0; i< (long) (map->width*map->height); i++) {
+ for( i=0; i< (ssize_t) (map->width*map->height); i++) {
map->levels[i] = (int)strtol(content, &p, 10);
if ( p == content ) {
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
@@ -1353,7 +1353,7 @@
CacheView
*image_view;
- long
+ ssize_t
progress,
y;
@@ -1410,7 +1410,7 @@
p = strchr((char *) threshold_map,',');
if ( p != (char *)NULL && isdigit((int) ((unsigned char) *(++p))) )
- levels.index = (unsigned long) strtol(p, &p, 10);
+ levels.index = (size_t) strtol(p, &p, 10);
else
levels.index = 2;
@@ -1426,15 +1426,15 @@
p=strchr((char *) threshold_map,',');
p++;
if ((channel & RedChannel) != 0)
- levels.red = (unsigned long) strtol(p, &p, 10), (void)(*p == ',' && p++);
+ levels.red = (size_t) strtol(p, &p, 10), (void)(*p == ',' && p++);
if ((channel & GreenChannel) != 0)
- levels.green = (unsigned long) strtol(p, &p, 10), (void)(*p == ',' && p++);
+ levels.green = (size_t) strtol(p, &p, 10), (void)(*p == ',' && p++);
if ((channel & BlueChannel) != 0)
- levels.blue = (unsigned long) strtol(p, &p, 10), (void)(*p == ',' && p++);
+ levels.blue = (size_t) strtol(p, &p, 10), (void)(*p == ',' && p++);
if ((channel & IndexChannel) != 0 && image->colorspace == CMYKColorspace)
- levels.index=(unsigned long) strtol(p, &p, 10), (void)(*p == ',' && p++);
+ levels.index=(size_t) strtol(p, &p, 10), (void)(*p == ',' && p++);
if ((channel & OpacityChannel) != 0)
- levels.opacity = (unsigned long) strtol(p, &p, 10), (void)(*p == ',' && p++);
+ levels.opacity = (size_t) strtol(p, &p, 10), (void)(*p == ',' && p++);
}
}
#else
@@ -1446,7 +1446,7 @@
* EG -channel BA -ordered-dither map,2,3
* will need to map g.rho -> l.blue, and g.sigma -> l.opacity
* A simpler way is needed, probably converting geometry to a temporary
- * array, then using channel to advance the index into long pixel packet.
+ * array, then using channel to advance the index into ssize_t pixel packet.
*/
#endif
@@ -1480,12 +1480,12 @@
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
- register long
+ register ssize_t
x;
register PixelPacket
@@ -1500,7 +1500,7 @@
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
register int
threshold,
@@ -1636,7 +1636,7 @@
MagickStatusType
flags;
- long
+ ssize_t
progress,
y;
@@ -1699,7 +1699,7 @@
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
MagickBooleanType
sync;
@@ -1707,7 +1707,7 @@
register IndexPacket
*restrict indexes;
- register long
+ register ssize_t
id,
x;
@@ -1725,7 +1725,7 @@
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
id=GetOpenMPThreadId();
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
IndexPacket
index;
@@ -1743,7 +1743,7 @@
GetPseudoRandomValue(random_info[id]));
index=(IndexPacket) (intensity <= threshold.index ? 0 : 1);
indexes[x]=index;
- *q++=image->colormap[(long) index];
+ *q++=image->colormap[(ssize_t) index];
}
sync=SyncCacheViewAuthenticPixels(image_view,exception);
if (sync == MagickFalse)
@@ -1776,12 +1776,12 @@
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
- register long
+ register ssize_t
id,
x;
@@ -1798,7 +1798,7 @@
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
id=GetOpenMPThreadId();
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if ((channel & RedChannel) != 0)
{
@@ -1947,7 +1947,7 @@
GeometryInfo
geometry_info;
- long
+ ssize_t
progress,
y;
@@ -2003,12 +2003,12 @@
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(dynamic,4) shared(progress,status)
#endif
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*restrict indexes;
- register long
+ register ssize_t
x;
register PixelPacket
@@ -2023,7 +2023,7 @@
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if (channel != DefaultChannels)
{