%
% The format of the GetGeometry method is:
%
-% MagickStatusType GetGeometry(const char *geometry,long *x,long *y,
-% unsigned long *width,unsigned long *height)
+% MagickStatusType GetGeometry(const char *geometry,ssize_t *x,ssize_t *y,
+% size_t *width,size_t *height)
%
% A description of each parameter follows:
%
% specification.
%
*/
-MagickExport MagickStatusType GetGeometry(const char *geometry,long *x,long *y,
- unsigned long *width,unsigned long *height)
+MagickExport MagickStatusType GetGeometry(const char *geometry,ssize_t *x,ssize_t *y,
+ size_t *width,size_t *height)
{
char
*p,
(void) CopyMagickString(p,p+1,MaxTextExtent);
continue;
}
- switch (*p)
+ switch ((int) *p)
{
case '%':
{
value=strtod(p,&q);
if (LocaleNCompare(p,"0x",2) == 0)
value=(double) strtol(p,&q,10);
- if (((int) *q == -41) || (*q == 'x') || (*q == 'X') || (*q == '\0'))
+ if ((((int) *q) == -41) || (*q == 'x') || (*q == 'X') || (*q == '\0'))
{
/*
Parse width.
*/
q=p;
if (LocaleNCompare(p,"0x",2) == 0)
- *width=(unsigned long) strtol(p,&p,10);
+ *width=(size_t) strtol(p,&p,10);
else
- *width=(unsigned long) floor(strtod(p,&p)+0.5);
+ *width=(size_t) floor(strtod(p,&p)+0.5);
if (p != q)
flags|=WidthValue;
}
- if (((int) *p == -41) || (*p == 'x') || (*p == 'X'))
+ if ((((int) *p) == -41) || (*p == 'x') || (*p == 'X'))
{
p++;
if ((*p != '+') && (*p != '-'))
Parse height.
*/
q=p;
- *height=(unsigned long) floor(strtod(p,&p)+0.5);
+ *height=(size_t) floor(strtod(p,&p)+0.5);
if (p != q)
flags|=HeightValue;
}
if (*p == '-')
flags|=XNegative;
q=p;
- *x=(long) ceil(strtod(p,&p)-0.5);
+ *x=(ssize_t) ceil(strtod(p,&p)-0.5);
if (p != q)
flags|=XValue;
if ((*p == '+') || (*p == '-'))
if (*p == '-')
flags|=YNegative;
q=p;
- *y=(long) ceil(strtod(p,&p)-0.5);
+ *y=(ssize_t) ceil(strtod(p,&p)-0.5);
if (p != q)
flags|=YValue;
}
char
*page;
- register long
+ register ssize_t
i;
assert(page_geometry != (char *) NULL);
%
% The format of the GravityAdjustGeometry method is:
%
-% void GravityAdjustGeometry(const unsigned long width,
-% const unsigned long height,const GravityType gravity,
+% void GravityAdjustGeometry(const size_t width,
+% const size_t height,const GravityType gravity,
% RectangleInfo *region);
%
% A description of each parameter follows:
% o region: The region requiring a offset adjustment relative to gravity
%
*/
-MagickExport void GravityAdjustGeometry(const unsigned long width,
- const unsigned long height,const GravityType gravity,RectangleInfo *region)
+MagickExport void GravityAdjustGeometry(const size_t width,
+ const size_t height,const GravityType gravity,RectangleInfo *region)
{
if (region->height == 0)
region->height=height;
case EastGravity:
case SouthEastGravity:
{
- region->x=(long) (width-region->width-region->x);
+ region->x=(ssize_t) (width-region->width-region->x);
break;
}
case NorthGravity:
case CenterGravity:
case StaticGravity:
{
- region->x+=(long) (width/2-region->width/2);
+ region->x+=(ssize_t) (width/2-region->width/2);
break;
}
case ForgetGravity:
case SouthGravity:
case SouthEastGravity:
{
- region->y=(long) (height-region->height-region->y);
+ region->y=(ssize_t) (height-region->height-region->y);
break;
}
case EastGravity:
case CenterGravity:
case StaticGravity:
{
- region->y+=(long) (height/2-region->height/2);
+ region->y+=(ssize_t) (height/2-region->height/2);
break;
}
case ForgetGravity:
MagickStatusType
flags;
- register long
+ register ssize_t
i;
GetAffineMatrix(affine_matrix);
(void) CopyMagickString(p,p+1,MaxTextExtent);
continue;
}
- switch (*p)
+ switch ((int) *p)
{
case '%':
{
value=strtod(p,&q);
if (LocaleNCompare(p,"0x",2) == 0)
value=(double) strtol(p,&q,10);
- if (((int) *q == -41) || (*q == 'x') || (*q == 'X') || (*q == ',') ||
+ if ((((int) *q) == -41) || (*q == 'x') || (*q == 'X') || (*q == ',') ||
(*q == '/') || (*q == ':') || (*q =='\0'))
{
/*
}
}
q=p;
- if (((int) *p == -41) || (*p == 'x') || (*p == 'X') || (*p == ',') ||
+ if ((((int) *p) == -41) || (*p == 'x') || (*p == 'X') || (*p == ',') ||
(*p == '/') || (*p == ':'))
{
/*
p++;
while (isspace((int) ((unsigned char) *p)) != 0)
p++;
- if ((((int) *q != -41) && (*q != 'x') && (*q != 'X')) ||
+ if (((((int) *q) != -41) && (*q != 'x') && (*q != 'X')) ||
((*p != '+') && (*p != '-')))
{
q=p;
MagickStatusType
flags;
- unsigned long
+ size_t
height,
width;
scale.y=geometry_info.sigma;
if ((status & SigmaValue) == 0)
scale.y=scale.x;
- region_info->width=(unsigned long) floor((scale.x*image->columns/100.0)+
+ region_info->width=(size_t) floor((scale.x*image->columns/100.0)+
0.5);
- region_info->height=(unsigned long) floor((scale.y*image->rows/100.0)+
+ region_info->height=(size_t) floor((scale.y*image->rows/100.0)+
0.5);
}
/*
%
% The format of the ParseMetaGeometry method is:
%
-% MagickStatusType ParseMetaGeometry(const char *geometry,long *x,long *y,
-% unsigned long *width,unsigned long *height)
+% MagickStatusType ParseMetaGeometry(const char *geometry,ssize_t *x,ssize_t *y,
+% size_t *width,size_t *height)
%
% A description of each parameter follows:
%
%
*/
-static inline unsigned long MagickMax(const unsigned long x,
- const unsigned long y)
+static inline size_t MagickMax(const size_t x,
+ const size_t y)
{
if (x > y)
return(x);
return(y);
}
-MagickExport MagickStatusType ParseMetaGeometry(const char *geometry,long *x,
- long *y,unsigned long *width,unsigned long *height)
+MagickExport MagickStatusType ParseMetaGeometry(const char *geometry,ssize_t *x,
+ ssize_t *y,size_t *width,size_t *height)
{
GeometryInfo
geometry_info;
MagickStatusType
flags;
- unsigned long
+ size_t
former_height,
former_width;
/*
Ensure the image geometry is valid.
*/
- assert(x != (long *) NULL);
- assert(y != (long *) NULL);
- assert(width != (unsigned long *) NULL);
- assert(height != (unsigned long *) NULL);
+ assert(x != (ssize_t *) NULL);
+ assert(y != (ssize_t *) NULL);
+ assert(width != (size_t *) NULL);
+ assert(height != (size_t *) NULL);
if ((geometry == (char *) NULL) || (*geometry == '\0'))
return(NoValue);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",geometry);
scale.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
scale.y=scale.x;
- *width=(unsigned long) floor(scale.x*former_width/100.0+0.5);
+ *width=(size_t) floor(scale.x*former_width/100.0+0.5);
if (*width == 0)
*width=1;
- *height=(unsigned long) floor(scale.y*former_height/100.0+0.5);
+ *height=(size_t) floor(scale.y*former_height/100.0+0.5);
if (*height == 0)
*height=1;
former_width=(*width);
scale_factor=(MagickRealType) *height/(MagickRealType)
former_width;
}
- *width=MagickMax((unsigned long) floor(scale_factor*former_width+0.5),
+ *width=MagickMax((size_t) floor(scale_factor*former_width+0.5),
1UL);
- *height=MagickMax((unsigned long) floor(scale_factor*former_height+0.5),
+ *height=MagickMax((size_t) floor(scale_factor*former_height+0.5),
1UL);
}
if ((flags & GreaterValue) != 0)
scale.y=(double) former_height/(double) (distance/sqrt((double) area));
if ((scale.x < (double) *width) || (scale.y < (double) *height))
{
- *width=(unsigned long) (former_width/(distance/sqrt((double) area)));
- *height=(unsigned long) (former_height/(distance/
+ *width=(size_t) (former_width/(distance/sqrt((double) area)));
+ *height=(size_t) (former_height/(distance/
sqrt((double) area)));
}
former_width=(*width);