* 19 Feb 98 - Version 1.2 by Jareth Hein (Support for user specified I/O) *
******************************************************************************/
-#ifdef __MSDOS__
-#include <io.h>
-#include <alloc.h>
-#include <stdlib.h>
-#include <sys\stat.h>
-#else
-#include <sys/types.h>
-#include <sys/stat.h>
-#endif /* __MSDOS__ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <config.h>
+#include "lisp.h"
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
+#include "sysfile.h"
#include "gifrlib.h"
FILE *f;
if ((f = fopen(FileName,
-#ifdef __MSDOS__
+#ifdef WIN32_NATIVE
"rb"
#else
"r"
-#endif /* __MSDOS__ */
+#endif /* WIN32_NATIVE */
)) == NULL)
GifInternError(GifFile, D_GIF_ERR_OPEN_FAILED);
{
FILE *f;
-#ifdef __MSDOS__
+#ifdef WIN32_NATIVE
setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */
f = fdopen(FileHandle, "rb"); /* Make it into a stream: */
setvbuf(f, NULL, _IOFBF, GIF_FILE_BUFFER_SIZE);/* And inc. stream buffer.*/
#else
f = fdopen(FileHandle, "r"); /* Make it into a stream: */
-#endif /* __MSDOS__ */
+#endif /* WIN32_NATIVE */
GifStdIOInit(GifFile, f, -1);
DGifInitRead(GifFile);
/* The GIF Version number is ignored at this time. Maybe we should do */
/* something more useful with it. */
Buf[GIF_STAMP_LEN] = 0;
- if (strncmp(GIF_STAMP, Buf, GIF_VERSION_POS) != 0) {
+ if (strncmp(GIF_STAMP, (const char *) Buf, GIF_VERSION_POS) != 0) {
GifInternError(GifFile, D_GIF_ERR_NOT_GIF_FILE);
- }
+ }
DGifGetScreenDesc(GifFile);
}
MakeMapObject (GifFile->Image.ColorMap->ColorCount,
GifFile->Image.ColorMap->Colors);
}
- sp->RasterBits = (GifPixelType *)NULL;
+ sp->RasterBits = NULL;
sp->ExtensionBlockCount = 0;
sp->ExtensionBlocks = (ExtensionBlock *)NULL;
}
if (!LineLen) LineLen = GifFile->Image.Width;
-#if defined(__MSDOS__) || defined(__GNUC__)
+#if defined(WIN32_NATIVE) || defined(__GNUC__)
if ((Private->PixelCount -= LineLen) > 0xffff0000UL)
#else
if ((Private->PixelCount -= LineLen) > 0xffff0000)
-#endif /* __MSDOS__ */
+#endif /* WIN32_NATIVE */
{
GifInternError(GifFile, D_GIF_ERR_DATA_TOO_BIG);
}
GifInternError(GifFile, D_GIF_ERR_NOT_READABLE);
}
-#if defined(__MSDOS__) || defined(__GNUC__)
+#if defined(WIN32_NATIVE) || defined(__GNUC__)
if (--Private->PixelCount > 0xffff0000UL)
#else
if (--Private->PixelCount > 0xffff0000)
-#endif /* __MSDOS__ */
+#endif /* WIN32_NATIVE */
{
GifInternError(GifFile, D_GIF_ERR_DATA_TOO_BIG);
}
ImageSize = sp->ImageDesc.Width * sp->ImageDesc.Height;
sp->RasterBits
- = (GifPixelType*) malloc(ImageSize * sizeof(GifPixelType));
+ = (GifPixelType*) malloc (ImageSize * sizeof(GifPixelType));
DGifGetLine(GifFile, sp->RasterBits, ImageSize);
break;
CopyFrom->ImageDesc.ColorMap->Colors);
/* next, the raster */
- sp->RasterBits = (char *)malloc(sizeof(GifPixelType)
+ sp->RasterBits = (GifPixelType *) malloc(sizeof(GifPixelType)
* CopyFrom->ImageDesc.Height
* CopyFrom->ImageDesc.Width);
memcpy(sp->RasterBits,
* Miscellaneous utility functions *
******************************************************************************/
-int BitSize(int n)
+static int BitSize(int n)
/* return smallest bitfield size n will fit in */
{
register int i;