< prev index next >

src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c

Print this page

        

*** 210,221 **** for (j = CrntSlot; j < RoundUpTo; j++) Map[j].Red = Map[j].Green = Map[j].Blue = 0; /* perhaps we can shrink the map? */ if (RoundUpTo < ColorUnion->ColorCount) { ! GifColorType *new_map = (GifColorType *)realloc(Map, ! sizeof(GifColorType) * RoundUpTo); if( new_map == NULL ) { GifFreeMapObject(ColorUnion); return ((ColorMapObject *) NULL); } ColorUnion->Colors = new_map; --- 210,221 ---- for (j = CrntSlot; j < RoundUpTo; j++) Map[j].Red = Map[j].Green = Map[j].Blue = 0; /* perhaps we can shrink the map? */ if (RoundUpTo < ColorUnion->ColorCount) { ! GifColorType *new_map = (GifColorType *)reallocarray(Map, ! RoundUpTo, sizeof(GifColorType)); if( new_map == NULL ) { GifFreeMapObject(ColorUnion); return ((ColorMapObject *) NULL); } ColorUnion->Colors = new_map;
*** 254,266 **** ExtensionBlock *ep; if (*ExtensionBlocks == NULL) *ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock)); else { ! ExtensionBlock* ep_new = (ExtensionBlock *)realloc(*ExtensionBlocks, ! sizeof(ExtensionBlock) * ! (*ExtensionBlockCount + 1)); if( ep_new == NULL ) return (GIF_ERROR); *ExtensionBlocks = ep_new; } --- 254,266 ---- ExtensionBlock *ep; if (*ExtensionBlocks == NULL) *ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock)); else { ! ExtensionBlock* ep_new = (ExtensionBlock *)reallocarray ! (*ExtensionBlocks, (*ExtensionBlockCount + 1), ! sizeof(ExtensionBlock)); if( ep_new == NULL ) return (GIF_ERROR); *ExtensionBlocks = ep_new; }
*** 347,358 **** GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom) { if (GifFile->SavedImages == NULL) GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage)); else ! GifFile->SavedImages = (SavedImage *)realloc(GifFile->SavedImages, ! sizeof(SavedImage) * (GifFile->ImageCount + 1)); if (GifFile->SavedImages == NULL) return ((SavedImage *)NULL); else { SavedImage *sp = &GifFile->SavedImages[GifFile->ImageCount++]; --- 347,358 ---- GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom) { if (GifFile->SavedImages == NULL) GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage)); else ! GifFile->SavedImages = (SavedImage *)reallocarray(GifFile->SavedImages, ! (GifFile->ImageCount + 1), sizeof(SavedImage)); if (GifFile->SavedImages == NULL) return ((SavedImage *)NULL); else { SavedImage *sp = &GifFile->SavedImages[GifFile->ImageCount++];
*** 377,402 **** return (SavedImage *)(NULL); } } /* next, the raster */ ! sp->RasterBits = (unsigned char *)malloc(sizeof(GifPixelType) * ! CopyFrom->ImageDesc.Height * ! CopyFrom->ImageDesc.Width); if (sp->RasterBits == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); } memcpy(sp->RasterBits, CopyFrom->RasterBits, sizeof(GifPixelType) * CopyFrom->ImageDesc.Height * CopyFrom->ImageDesc.Width); /* finally, the extension blocks */ if (sp->ExtensionBlocks != NULL) { ! sp->ExtensionBlocks = (ExtensionBlock *)malloc( ! sizeof(ExtensionBlock) * ! CopyFrom->ExtensionBlockCount); if (sp->ExtensionBlocks == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); } memcpy(sp->ExtensionBlocks, CopyFrom->ExtensionBlocks, --- 377,403 ---- return (SavedImage *)(NULL); } } /* next, the raster */ ! sp->RasterBits = (unsigned char *)reallocarray(NULL, ! (CopyFrom->ImageDesc.Height * ! CopyFrom->ImageDesc.Width), ! sizeof(GifPixelType)); if (sp->RasterBits == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); } memcpy(sp->RasterBits, CopyFrom->RasterBits, sizeof(GifPixelType) * CopyFrom->ImageDesc.Height * CopyFrom->ImageDesc.Width); /* finally, the extension blocks */ if (sp->ExtensionBlocks != NULL) { ! sp->ExtensionBlocks = (ExtensionBlock *)reallocarray(NULL, ! CopyFrom->ExtensionBlockCount, ! sizeof(ExtensionBlock)); if (sp->ExtensionBlocks == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); } memcpy(sp->ExtensionBlocks, CopyFrom->ExtensionBlocks,
< prev index next >