40 long myStreamStartPos;
48 long myStreamStartPos;
60 tiffis_data *
data = (tiffis_data *)fd;
62 data->myIS->read((
char *)buf, (
int)size);
64 return data->myIS->gcount();
70 tiffos_data *data = (tiffos_data *)fd;
71 ostream *os = data->myOS;
72 int pos = os->tellp();
74 os->write((
const char *)buf, size);
76 return ((
int)os->tellp()) - pos;
88 tiffos_data *data = (tiffos_data *)fd;
89 ostream *os = data->myOS;
97 os->seekp(data->myStreamStartPos + off, ios::beg);
100 os->seekp(off, ios::cur);
112 ios::iostate old_state;
115 old_state = os->rdstate();
117 os->clear(os->rdstate() & ~ios::failbit);
120 origin = data->myStreamStartPos;
123 origin = os->tellp();
127 origin = os->tellp();
131 os->clear(old_state);
134 if( origin + off > data->myStreamStartPos ) {
138 os->clear(os->rdstate() & ~ios::failbit);
142 num_fill = origin + off - (
toff_t)os->tellp();
147 os->seekp(origin + off, ios::beg);
157 tiffis_data *data = (tiffis_data *)fd;
161 data->myIS->seekg(data->myStreamStartPos + off, ios::beg);
164 data->myIS->seekg(off, ios::cur);
171 return ((
long)data->myIS->tellg()) - data->myStreamStartPos;
177 tiffos_data *data = (tiffos_data *)fd;
178 ostream *os = data->myOS;
192 tiffis_data *data = (tiffis_data *)fd;
193 int pos = data->myIS->tellg();
197 len = data->myIS->tellg();
198 data->myIS->seekg(pos);
207 delete (tiffos_data *)fd;
215 delete (tiffis_data *)fd;
234 _tiffStreamOpen(
const char*
name,
const char*
mode,
void *fd)
238 if( strchr(mode,
'w') ) {
239 tiffos_data *data =
new tiffos_data;
240 data->myOS = (ostream *)fd;
241 data->myStreamStartPos = data->myOS->tellp();
246 _tiffosReadProc, _tiffosWriteProc,
247 _tiffosSeekProc, _tiffosCloseProc,
249 _tiffDummyMapProc, _tiffDummyUnmapProc);
251 tiffis_data *data =
new tiffis_data;
252 data->myIS = (istream *)fd;
253 data->myStreamStartPos = data->myIS->tellg();
257 _tiffisReadProc, _tiffisWriteProc,
258 _tiffisSeekProc, _tiffisCloseProc,
260 _tiffDummyMapProc, _tiffDummyUnmapProc);
273 if( !os->fail() && (
int)os->tellp() < 0 ) {
279 return _tiffStreamOpen(name,
"wm", os);
286 return _tiffStreamOpen(name,
"rm", is);
GLenum GLuint GLenum GLsizei const GLchar * buf
TIFF * TIFFClientOpen(const char *name, const char *mode, thandle_t clientdata, TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, TIFFSeekProc seekproc, TIFFCloseProc closeproc, TIFFSizeProc sizeproc, TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc)
GLsizei GLsizei GLenum GLenum const GLvoid * data
TIFF * TIFFStreamOpen(const char *name, ostream *os)
GLuint const GLchar * name