mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 05:10:58 +00:00
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:
parent
89b2b64d5e
commit
fed6ff1796
5 changed files with 115 additions and 107 deletions
|
@ -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>
|
2011-02-28 Riccardo Mottola <rm@gnu.org>
|
||||||
|
|
||||||
* Source/GSLayoutManager.m
|
* Source/GSLayoutManager.m
|
||||||
|
|
|
@ -432,7 +432,7 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
|
||||||
}
|
}
|
||||||
else // interleaved RGB or RGBA
|
else // interleaved RGB or RGBA
|
||||||
{
|
{
|
||||||
OBJC_MALLOC(rgbPlanes, GifByteType, width*height*3);
|
rgbPlanes = malloc(sizeof(GifByteType)*width*height*3);
|
||||||
if (!rgbPlanes)
|
if (!rgbPlanes)
|
||||||
{
|
{
|
||||||
SET_ERROR_MSG(@"GIFRepresentation: malloc out of memory.");
|
SET_ERROR_MSG(@"GIFRepresentation: malloc out of memory.");
|
||||||
|
@ -461,23 +461,23 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
|
||||||
if (!GIFColorMap)
|
if (!GIFColorMap)
|
||||||
{
|
{
|
||||||
SET_ERROR_MSG(@"GIFRepresentation (giflib): MakeMapObject() failed.");
|
SET_ERROR_MSG(@"GIFRepresentation (giflib): MakeMapObject() failed.");
|
||||||
OBJC_FREE(rgbPlanes);
|
free(rgbPlanes);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
OBJC_MALLOC(GIFImage, GifByteType, height*width);
|
GIFImage = malloc(sizeof(GifByteType)*height*width);
|
||||||
if (!GIFImage)
|
if (!GIFImage)
|
||||||
{
|
{
|
||||||
SET_ERROR_MSG(@"GIFRepresentation: malloc out of memory.");
|
SET_ERROR_MSG(@"GIFRepresentation: malloc out of memory.");
|
||||||
OBJC_FREE(rgbPlanes);
|
free(rgbPlanes);
|
||||||
}
|
}
|
||||||
status = QuantizeBuffer(width, height, &colorMapSize,
|
status = QuantizeBuffer(width, height, &colorMapSize,
|
||||||
redPlane, greenPlane, bluePlane,
|
redPlane, greenPlane, bluePlane,
|
||||||
GIFImage, GIFColorMap->Colors);
|
GIFImage, GIFColorMap->Colors);
|
||||||
if (status == GIF_ERROR)
|
if (status == GIF_ERROR)
|
||||||
{
|
{
|
||||||
OBJC_FREE(GIFImage);
|
free(GIFImage);
|
||||||
OBJC_FREE(rgbPlanes);
|
free(rgbPlanes);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,13 +490,13 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
|
||||||
GIFColorMap->ColorCount = colorMapSize;
|
GIFColorMap->ColorCount = colorMapSize;
|
||||||
GIFColorMap->BitsPerPixel = h;
|
GIFColorMap->BitsPerPixel = h;
|
||||||
|
|
||||||
if ( ![self isPlanar] ) OBJC_FREE(rgbPlanes);
|
if (![self isPlanar]) free(rgbPlanes);
|
||||||
|
|
||||||
// Write the converted image out to the NSData
|
// Write the converted image out to the NSData
|
||||||
GIFRep = [NSMutableData dataWithLength: 0];
|
GIFRep = [NSMutableData dataWithLength: 0];
|
||||||
if (!GIFRep)
|
if (!GIFRep)
|
||||||
{
|
{
|
||||||
OBJC_FREE(GIFImage);
|
free(GIFImage);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
GIFFile = EGifOpen(GIFRep, gs_gif_output);
|
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)
|
if (status == GIF_ERROR)
|
||||||
{
|
{
|
||||||
SET_ERROR_MSG(@"GIFRepresentation (giflib): EGifPutScreenDesc() failed.");
|
SET_ERROR_MSG(@"GIFRepresentation (giflib): EGifPutScreenDesc() failed.");
|
||||||
OBJC_FREE(GIFImage);
|
free(GIFImage);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
|
||||||
if (status == GIF_ERROR)
|
if (status == GIF_ERROR)
|
||||||
{
|
{
|
||||||
SET_ERROR_MSG(@"GIFRepresentation (giflib): EGifPutImageDesc() failed.");
|
SET_ERROR_MSG(@"GIFRepresentation (giflib): EGifPutImageDesc() failed.");
|
||||||
OBJC_FREE(GIFImage);
|
free(GIFImage);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,14 +524,14 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len)
|
||||||
if (status == GIF_ERROR)
|
if (status == GIF_ERROR)
|
||||||
{
|
{
|
||||||
SET_ERROR_MSG(@"GIFRepresentation (giflib): EGifPutLine() failed.");
|
SET_ERROR_MSG(@"GIFRepresentation (giflib): EGifPutLine() failed.");
|
||||||
OBJC_FREE(GIFImage);
|
free(GIFImage);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
GIFImageP += width;
|
GIFImageP += width;
|
||||||
}
|
}
|
||||||
status = EGifCloseFile(GIFFile);
|
status = EGifCloseFile(GIFFile);
|
||||||
|
|
||||||
OBJC_FREE(GIFImage);
|
free(GIFImage);
|
||||||
|
|
||||||
return GIFRep;
|
return GIFRep;
|
||||||
}
|
}
|
||||||
|
|
|
@ -634,7 +634,7 @@ static void gs_jpeg_memory_dest_destroy (j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
unsigned char * RGB, * pRGB, * pRGBA;
|
unsigned char * RGB, * pRGB, * pRGBA;
|
||||||
unsigned int iRGB, iRGBA;
|
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)
|
while (cinfo.next_scanline < cinfo.image_height)
|
||||||
{
|
{
|
||||||
iRGBA = cinfo.next_scanline * row_stride;
|
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;
|
row_pointer[0] = RGB;
|
||||||
jpeg_write_scanlines (&cinfo, row_pointer, 1);
|
jpeg_write_scanlines (&cinfo, row_pointer, 1);
|
||||||
}
|
}
|
||||||
OBJC_FREE(RGB);
|
free(RGB);
|
||||||
}
|
}
|
||||||
else // no alpha channel
|
else // no alpha channel
|
||||||
{
|
{
|
||||||
|
|
|
@ -1932,12 +1932,12 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
||||||
|
|
||||||
if (NSTiffRead(image, info, [self bitmapData]))
|
if (NSTiffRead(image, info, [self bitmapData]))
|
||||||
{
|
{
|
||||||
OBJC_FREE(info);
|
free(info);
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
NSLog(@"Tiff read invalid TIFF image data in directory %d", imageNumber);
|
NSLog(@"Tiff read invalid TIFF image data in directory %d", imageNumber);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
OBJC_FREE(info);
|
free(info);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ TiffHandleClose(thandle_t handle)
|
||||||
chandle_t* chand = (chandle_t *)handle;
|
chandle_t* chand = (chandle_t *)handle;
|
||||||
|
|
||||||
/* Presumably, we don't need the handle anymore */
|
/* Presumably, we don't need the handle anymore */
|
||||||
OBJC_FREE(chand);
|
free(chand);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ NSTiffOpenDataRead(const char* data, long size)
|
||||||
TIFFSetWarningHandler(NSTiffWarning);
|
TIFFSetWarningHandler(NSTiffWarning);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBJC_MALLOC(handle, chandle_t, 1);
|
handle = malloc(sizeof(chandle_t));
|
||||||
handle->data = (char*)data;
|
handle->data = (char*)data;
|
||||||
handle->outdata = 0;
|
handle->outdata = 0;
|
||||||
handle->position = 0;
|
handle->position = 0;
|
||||||
|
@ -221,7 +221,7 @@ TIFF*
|
||||||
NSTiffOpenDataWrite(char **data, long *size)
|
NSTiffOpenDataWrite(char **data, long *size)
|
||||||
{
|
{
|
||||||
chandle_t* handle;
|
chandle_t* handle;
|
||||||
OBJC_MALLOC(handle, chandle_t, 1);
|
handle = malloc(sizeof(chandle_t));
|
||||||
handle->data = *data;
|
handle->data = *data;
|
||||||
handle->outdata = data;
|
handle->outdata = data;
|
||||||
handle->position = 0;
|
handle->position = 0;
|
||||||
|
@ -269,7 +269,7 @@ NSTiffGetInfo(int imageNumber, TIFF* image)
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
OBJC_MALLOC(info, NSTiffInfo, 1);
|
info = malloc(sizeof(NSTiffInfo));
|
||||||
memset(info, 0, sizeof(NSTiffInfo));
|
memset(info, 0, sizeof(NSTiffInfo));
|
||||||
if (imageNumber >= 0)
|
if (imageNumber >= 0)
|
||||||
{
|
{
|
||||||
|
@ -567,14 +567,14 @@ NSTiffGetColormap(TIFF* image)
|
||||||
if (info->photoInterp != PHOTOMETRIC_PALETTE)
|
if (info->photoInterp != PHOTOMETRIC_PALETTE)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
OBJC_MALLOC(map, NSTiffColormap, 1);
|
map = malloc(sizeof(NSTiffColormap));
|
||||||
map->size = 1 << info->bitsPerSample;
|
map->size = 1 << info->bitsPerSample;
|
||||||
|
|
||||||
if (!TIFFGetField(image, TIFFTAG_COLORMAP,
|
if (!TIFFGetField(image, TIFFTAG_COLORMAP,
|
||||||
&map->red, &map->green, &map->blue))
|
&map->red, &map->green, &map->blue))
|
||||||
{
|
{
|
||||||
TIFFError(TIFFFileName(image), "Missing required \"Colormap\" tag");
|
TIFFError(TIFFFileName(image), "Missing required \"Colormap\" tag");
|
||||||
OBJC_FREE(map);
|
free(map);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (CheckAndCorrectColormap(map) == 8)
|
if (CheckAndCorrectColormap(map) == 8)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue