return;
}
-static void InsertRow(Image *image,unsigned char *p,ssize_t y,int bpp,
- ExceptionInfo *exception)
+static MagickBooleanType InsertRow(Image *image,unsigned char *p,ssize_t y,
+ int bpp,ExceptionInfo *exception)
{
int
bit;
ssize_t
x;
+ q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
+ if (q == (Quantum *) NULL)
+ return(MagickFalse);
switch (bpp)
{
case 1: /* Convert bitmap scanline. */
{
- q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (Quantum *) NULL)
- break;
for (x=0; x < ((ssize_t) image->columns-7); x+=8)
{
for (bit=0; bit < 8; bit++)
}
p++;
}
- if (!SyncAuthenticPixels(image,exception))
- break;
break;
}
case 2: /* Convert PseudoColor scanline. */
{
- q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (Quantum *) NULL)
- break;
for (x=0; x < ((ssize_t) image->columns-3); x+=4)
{
index=ConstrainColormapIndex(image,(*p >> 6) & 0x3,exception);
}
p++;
}
- if (SyncAuthenticPixels(image,exception) == MagickFalse)
- break;
break;
}
case 4: /* Convert PseudoColor scanline. */
{
- q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (Quantum *) NULL)
- break;
for (x=0; x < ((ssize_t) image->columns-1); x+=2)
{
index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f,exception);
p++;
q+=GetPixelChannels(image);
}
- if (SyncAuthenticPixels(image,exception) == MagickFalse)
- break;
break;
}
case 8: /* Convert PseudoColor scanline. */
{
- q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (Quantum *) NULL) break;
-
for (x=0; x < (ssize_t) image->columns; x++)
{
index=ConstrainColormapIndex(image,*p,exception);
p++;
q+=GetPixelChannels(image);
}
- if (SyncAuthenticPixels(image,exception) == MagickFalse)
- break;
}
break;
case 24: /* Convert DirectColor scanline. */
- q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (Quantum *) NULL)
- break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(image,ScaleCharToQuantum(*p++),q);
SetPixelBlue(image,ScaleCharToQuantum(*p++),q);
q+=GetPixelChannels(image);
}
- if (!SyncAuthenticPixels(image,exception))
- break;
break;
}
+ if (!SyncAuthenticPixels(image,exception))
+ return(MagickFalse);
+ return(MagickTrue);
}
x++; \
if((ssize_t) x>=ldblk) \
{ \
- InsertRow(image,BImgBuff,(ssize_t) y,bpp,exception); \
+ if (InsertRow(image,BImgBuff,(ssize_t) y,bpp,exception) != MagickFalse) \
+ y++; \
x=0; \
- y++; \
- } \
+ } \
}
/* WPG1 raster reader. */
static int UnpackWPGRaster(Image *image,int bpp,ExceptionInfo *exception)
x++; \
if((ssize_t) x >= ldblk) \
{ \
- InsertRow(image,BImgBuff,(ssize_t) y,bpp,exception); \
+ if (InsertRow(image,BImgBuff,(ssize_t) y,bpp,exception) != MagickFalse) \
+ y++; \
x=0; \
- y++; \
} \
}
/* WPG2 raster reader. */
/* duplicate the previous row RunCount x */
for(i=0;i<=RunCount;i++)
{
- InsertRow(image,BImgBuff,(ssize_t) (image->rows >= y ? y : image->rows-1),
- bpp,exception);
- y++;
+ if (InsertRow(image,BImgBuff,(ssize_t) (image->rows >= y ? y : image->rows-1),
+ bpp,exception) != MagickFalse)
+ y++;
}
}
break;