avoid obsolete macros

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32412 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-02-28 15:43:25 +00:00
parent 89b2b64d5e
commit fed6ff1796
5 changed files with 115 additions and 107 deletions

View file

@ -1,3 +1,11 @@
2011-02-28 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSBitmapImageRep.m:
* Source/NSBitmapImageRep+GIF.m:
* Source/NSBitmapImageRep+JPEG.m:
* Source/tiff.m:
Avoid obsolete OBJC_... macros
2011-02-28 Riccardo Mottola <rm@gnu.org>
* Source/GSLayoutManager.m

View file

@ -407,7 +407,7 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
width = [self pixelsWide];
height = [self pixelsHigh];
if ( !width || !height )
if (!width || !height)
{
SET_ERROR_MSG(@"GIFRepresentation: image is zero size");
return nil;
@ -417,7 +417,7 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
colorSpaceName = [self colorSpaceName];
isRGB = ([colorSpaceName isEqualToString: NSDeviceRGBColorSpace] ||
[colorSpaceName isEqualToString: NSCalibratedRGBColorSpace]);
if ( !isRGB )
if (!isRGB)
{
SET_ERROR_MSG(@"GIFRepresentation: Only RGB is supported at this time.");
return nil;
@ -432,8 +432,8 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
}
else // interleaved RGB or RGBA
{
OBJC_MALLOC(rgbPlanes, GifByteType, width*height*3);
if ( !rgbPlanes )
rgbPlanes = malloc(sizeof(GifByteType)*width*height*3);
if (!rgbPlanes)
{
SET_ERROR_MSG(@"GIFRepresentation: malloc out of memory.");
return nil;
@ -458,26 +458,26 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
colorTable = [self valueForProperty: NSImageRGBColorTable]; // nil is OK
colorMapSize = (colorTable)? [colorTable length]/sizeof(GifColorType) : 256;
GIFColorMap = MakeMapObject(colorMapSize, [colorTable bytes]);
if ( !GIFColorMap )
if (!GIFColorMap)
{
SET_ERROR_MSG(@"GIFRepresentation (giflib): MakeMapObject() failed.");
OBJC_FREE(rgbPlanes);
free(rgbPlanes);
return nil;
}
OBJC_MALLOC(GIFImage, GifByteType, height*width);
if ( !GIFImage )
GIFImage = malloc(sizeof(GifByteType)*height*width);
if (!GIFImage)
{
SET_ERROR_MSG(@"GIFRepresentation: malloc out of memory.");
OBJC_FREE(rgbPlanes);
free(rgbPlanes);
}
status = QuantizeBuffer(width, height, &colorMapSize,
redPlane, greenPlane, bluePlane,
GIFImage, GIFColorMap->Colors);
if (status == GIF_ERROR)
{
OBJC_FREE(GIFImage);
OBJC_FREE(rgbPlanes);
free(GIFImage);
free(rgbPlanes);
return nil;
}
@ -490,13 +490,13 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
GIFColorMap->ColorCount = colorMapSize;
GIFColorMap->BitsPerPixel = h;
if ( ![self isPlanar] ) OBJC_FREE(rgbPlanes);
if (![self isPlanar]) free(rgbPlanes);
// Write the converted image out to the NSData
GIFRep = [NSMutableData dataWithLength: 0];
if ( !GIFRep )
if (!GIFRep)
{
OBJC_FREE(GIFImage);
free(GIFImage);
return nil;
}
GIFFile = EGifOpen(GIFRep, gs_gif_output);
@ -504,7 +504,7 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
if (status == GIF_ERROR)
{
SET_ERROR_MSG(@"GIFRepresentation (giflib): EGifPutScreenDesc() failed.");
OBJC_FREE(GIFImage);
free(GIFImage);
return nil;
}
@ -513,7 +513,7 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
if (status == GIF_ERROR)
{
SET_ERROR_MSG(@"GIFRepresentation (giflib): EGifPutImageDesc() failed.");
OBJC_FREE(GIFImage);
free(GIFImage);
return nil;
}
@ -524,14 +524,14 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
if (status == GIF_ERROR)
{
SET_ERROR_MSG(@"GIFRepresentation (giflib): EGifPutLine() failed.");
OBJC_FREE(GIFImage);
free(GIFImage);
return nil;
}
GIFImageP += width;
}
status = EGifCloseFile(GIFFile);
OBJC_FREE(GIFImage);
free(GIFImage);
return GIFRep;
}

View file

@ -634,7 +634,7 @@ static void gs_jpeg_memory_dest_destroy (j_compress_ptr cinfo)
{
unsigned char * RGB, * pRGB, * pRGBA;
unsigned int iRGB, iRGBA;
OBJC_MALLOC(RGB, unsigned char, 3*width);
RGB = malloc(sizeof(unsigned char)*3*width);
while (cinfo.next_scanline < cinfo.image_height)
{
iRGBA = cinfo.next_scanline * row_stride;
@ -649,7 +649,7 @@ static void gs_jpeg_memory_dest_destroy (j_compress_ptr cinfo)
row_pointer[0] = RGB;
jpeg_write_scanlines (&cinfo, row_pointer, 1);
}
OBJC_FREE(RGB);
free(RGB);
}
else // no alpha channel
{

View file

@ -1932,12 +1932,12 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
if (NSTiffRead(image, info, [self bitmapData]))
{
OBJC_FREE(info);
free(info);
RELEASE(self);
NSLog(@"Tiff read invalid TIFF image data in directory %d", imageNumber);
return nil;
}
OBJC_FREE(info);
free(info);
return self;
}

View file

@ -161,7 +161,7 @@ TiffHandleClose(thandle_t handle)
chandle_t* chand = (chandle_t *)handle;
/* Presumably, we don't need the handle anymore */
OBJC_FREE(chand);
free(chand);
return 0;
}
@ -202,7 +202,7 @@ NSTiffOpenDataRead(const char* data, long size)
TIFFSetWarningHandler(NSTiffWarning);
}
OBJC_MALLOC(handle, chandle_t, 1);
handle = malloc(sizeof(chandle_t));
handle->data = (char*)data;
handle->outdata = 0;
handle->position = 0;
@ -221,7 +221,7 @@ TIFF*
NSTiffOpenDataWrite(char **data, long *size)
{
chandle_t* handle;
OBJC_MALLOC(handle, chandle_t, 1);
handle = malloc(sizeof(chandle_t));
handle->data = *data;
handle->outdata = data;
handle->position = 0;
@ -269,7 +269,7 @@ NSTiffGetInfo(int imageNumber, TIFF* image)
if (image == NULL)
return NULL;
OBJC_MALLOC(info, NSTiffInfo, 1);
info = malloc(sizeof(NSTiffInfo));
memset(info, 0, sizeof(NSTiffInfo));
if (imageNumber >= 0)
{
@ -567,14 +567,14 @@ NSTiffGetColormap(TIFF* image)
if (info->photoInterp != PHOTOMETRIC_PALETTE)
return NULL;
OBJC_MALLOC(map, NSTiffColormap, 1);
map = malloc(sizeof(NSTiffColormap));
map->size = 1 << info->bitsPerSample;
if (!TIFFGetField(image, TIFFTAG_COLORMAP,
&map->red, &map->green, &map->blue))
{
TIFFError(TIFFFileName(image), "Missing required \"Colormap\" tag");
OBJC_FREE(map);
free(map);
return NULL;
}
if (CheckAndCorrectColormap(map) == 8)