/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*****************************************************************************
* "Gif-Lib" - Yet another gif library.
*
* Written by: Gershon Elber Ver 0.1, Jun. 1989
* Extensively hacked by: Eric S. Raymond Ver 1.?, Sep 1992
*****************************************************************************
* GIF construction tools
*****************************************************************************
* History:
* 15 Sep 92 - Version 1.0 by Eric Raymond.
****************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "gif_lib.h"
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
/******************************************************************************
* Miscellaneous utility functions
*****************************************************************************/
/* return smallest bitfield size n will fit in */
int
BitSize(int n) {
register int i;
for (i = 1; i <= 8; i++)
if ((1 << i) >= n)
break;
return (i);
}
/******************************************************************************
* Color map object functions
*****************************************************************************/
/*
* Allocate a color map of given size; initialize with contents of
* ColorMap if that pointer is non-NULL.
*/
const GifColorType * ColorMap) {
/*** FIXME: Our ColorCount has to be a power of two. Is it necessary to
* make the user know that or should we automatically round up instead? */
return ((ColorMapObject *) NULL);
}
return ((ColorMapObject *) NULL);
}
return ((ColorMapObject *) NULL);
}
if (ColorMap) {
}
return (Object);
}
/*
* Free a color map object
*/
void
}
}
#ifdef DEBUG
void
if (Object) {
for (i = 0; i < Len; i += 4) {
for (j = 0; j < 4 && j < Len; j++) {
}
}
}
}
#endif /* DEBUG */
/******************************************************************************
* Extension record functions
*****************************************************************************/
void
int Function) {
/*** FIXME:
* Someday we might have to deal with multiple extensions.
* ??? Was this a note from Gershon or from me? Does the multiple
* extension blocks solve this or do we need multiple Functions? Or is
* this an obsolete function? (People should use AddExtensionBlock
* instead?)
* Looks like AddExtensionBlock needs to take the int Function argument
* then it can take the place of this function. Right now people have to
* use both. Fix AddExtensionBlock and add this to the deprecation list.
*/
}
int
int Len,
unsigned char ExtData[]) {
else
sizeof(ExtensionBlock) *
return (GIF_ERROR);
return (GIF_ERROR);
if (ExtData) {
}
return (GIF_OK);
}
void
{
return;
}
}
/******************************************************************************
* Image block allocation functions
******************************************************************************/
/* Private Function:
* Frees the last image in the GifFile->SavedImages array
*/
void
return;
/* Remove one SavedImage from the GifFile */
GifFile->ImageCount--;
/* Deallocate its Colormap */
/* Deallocate the image data */
if (sp->RasterBits)
/* Deallocate any extensions */
if (sp->ExtensionBlocks)
/*** FIXME: We could realloc the GifFile->SavedImages structure but is
* there a point to it? Saves some memory but we'd have to do it every
* time. If this is used in FreeSavedImages then it would be inefficient
* (The whole array is going to be deallocated.) If we just use it when
* we want to free the last Image it's convenient to do it here.
*/
}
/*
* Append an image block to the SavedImages array
*/
const SavedImage * CopyFrom) {
else
return ((SavedImage *)NULL);
else {
if (CopyFrom) {
/*
* Make our own allocated copies of the heap fields in the
* copied record. This guards against potential aliasing
* problems.
*/
/* first, the local color map */
return (SavedImage *)(NULL);
}
}
/* next, the raster */
return (SavedImage *)(NULL);
}
/* finally, the extension blocks */
if (sp->ExtensionBlocks) {
sizeof(ExtensionBlock) *
return (SavedImage *)(NULL);
}
/*
* For the moment, the actual blocks can take their
* chances with free(). We'll fix this later.
*** FIXME: [Better check this out... Toshio]
* 2004 May 27: Looks like this was an ESR note.
* It means the blocks are shallow copied from InFile to
* OutFile. However, I don't see that in this code....
* Did ESR fix it but never remove this note (And other notes
* in gifspnge?)
*/
}
}
return (sp);
}
}
void
return;
}
if (sp->RasterBits)
if (sp->ExtensionBlocks)
}
}