comparison src/gif_io.c @ 647:b39c14581166

[xemacs-hg @ 2001-08-13 04:45:47 by ben] removal of unsigned, size_t, etc.
author ben
date Mon, 13 Aug 2001 04:46:48 +0000
parents abe6d1db359e
children fdefd0186b75
comparison
equal deleted inserted replaced
646:00c54252fe4f 647:b39c14581166
1 #include <config.h> 1 #include <config.h>
2 2 #include "lisp.h"
3 #include <stdio.h> 3
4 #include <stdlib.h> 4 #include "sysfile.h"
5 #include <string.h> 5
6 #ifdef HAVE_UNISTD_H
7 #include <unistd.h>
8 #endif
9 #include "gifrlib.h" 6 #include "gifrlib.h"
10 #include "sysfile.h"
11 7
12 /****************************************************************************** 8 /******************************************************************************
13 * Set up the GifFileType structure for use. This must be called first in any * 9 * Set up the GifFileType structure for use. This must be called first in any *
14 * client program. Then, if custom IO or Error functions are desired, call * 10 * client program. Then, if custom IO or Error functions are desired, call *
15 * GifSetIOFunc/GifSetErrorFunc, then call EGifInitWrite. Else call * 11 * GifSetIOFunc/GifSetErrorFunc, then call EGifInitWrite. Else call *
100 GifSetReadFunc(GifFile, GifStdRead, IOData); 96 GifSetReadFunc(GifFile, GifStdRead, IOData);
101 GifSetWriteFunc(GifFile, GifStdWrite, IOData); 97 GifSetWriteFunc(GifFile, GifStdWrite, IOData);
102 GifSetCloseFunc(GifFile, GifStdFileClose, IOData); 98 GifSetCloseFunc(GifFile, GifStdFileClose, IOData);
103 } 99 }
104 100
105 size_t GifStdRead(GifByteType *buf, size_t size, VoidPtr method_data) 101 Memory_Count GifStdRead(GifByteType *buf, Memory_Count size, VoidPtr method_data)
106 { 102 {
107 GifStdIODataType *IOtype = (GifStdIODataType*)method_data; 103 GifStdIODataType *IOtype = (GifStdIODataType*)method_data;
108 return (fread(buf, 1, size, IOtype->File)); 104 return (fread(buf, 1, size, IOtype->File));
109 } 105 }
110 106
111 size_t GifStdWrite(GifByteType *buf, size_t size, VoidPtr method_data) 107 Memory_Count GifStdWrite(GifByteType *buf, Memory_Count size, VoidPtr method_data)
112 { 108 {
113 GifStdIODataType *IOtype = (GifStdIODataType*)method_data; 109 GifStdIODataType *IOtype = (GifStdIODataType*)method_data;
114 return (fwrite(buf, 1, size, IOtype->File)); 110 return (fwrite(buf, 1, size, IOtype->File));
115 } 111 }
116 112
122 if (ret == 0 && IOtype->FileHandle != -1) 118 if (ret == 0 && IOtype->FileHandle != -1)
123 ret = close(IOtype->FileHandle); 119 ret = close(IOtype->FileHandle);
124 return ret; 120 return ret;
125 } 121 }
126 122
127 void GifRead(GifByteType *buf, size_t size, GifFileType *GifFile) 123 void GifRead(GifByteType *buf, Memory_Count size, GifFileType *GifFile)
128 { 124 {
129 GifIODataType *GifIO = (GifIODataType*)GifFile->GifIO; 125 GifIODataType *GifIO = (GifIODataType*)GifFile->GifIO;
130 if ((*(GifIO->ReadFunc))(buf, size, GifIO->ReadFunc_data) != size) 126 if ((*(GifIO->ReadFunc))(buf, size, GifIO->ReadFunc_data) != size)
131 GifError(GifFile, "Read error!"); 127 GifError(GifFile, "Read error!");
132 } 128 }
133 129
134 void GifWrite(GifByteType *buf, size_t size, GifFileType *GifFile) 130 void GifWrite(GifByteType *buf, Memory_Count size, GifFileType *GifFile)
135 { 131 {
136 GifIODataType *GifIO = (GifIODataType*)GifFile->GifIO; 132 GifIODataType *GifIO = (GifIODataType*)GifFile->GifIO;
137 if ((*(GifIO->WriteFunc))(buf, size, GifIO->WriteFunc_data) != size) 133 if ((*(GifIO->WriteFunc))(buf, size, GifIO->WriteFunc_data) != size)
138 GifError(GifFile, "Write error!"); 134 GifError(GifFile, "Write error!");
139 } 135 }