#include "wx/log.h"
#include "wx/app.h"
#include "wx/intl.h"
+ #include "wx/bitmap.h"
+ #include "wx/module.h"
#endif
-#include "wx/bitmap.h"
-#include "wx/debug.h"
extern "C"
{
#include "tiff.h"
}
#include "wx/filefn.h"
#include "wx/wfstream.h"
-#include "wx/module.h"
#ifndef TIFFLINKAGEMODE
- #if defined(__WATCOMC__) && defined(__WXMGL__)
- #define TIFFLINKAGEMODE cdecl
- #else
- #define TIFFLINKAGEMODE LINKAGEMODE
- #endif
+ #if defined(__WATCOMC__) && defined(__WXMGL__)
+ #define TIFFLINKAGEMODE cdecl
+ #else
+ #define TIFFLINKAGEMODE LINKAGEMODE
+ #endif
#endif
//-----------------------------------------------------------------------------
{
tsize_t TIFFLINKAGEMODE
-_tiffNullProc(thandle_t WXUNUSED(handle),
+wxTIFFNullProc(thandle_t WXUNUSED(handle),
tdata_t WXUNUSED(buf),
tsize_t WXUNUSED(size))
{
}
tsize_t TIFFLINKAGEMODE
-_tiffReadProc(thandle_t handle, tdata_t buf, tsize_t size)
+wxTIFFReadProc(thandle_t handle, tdata_t buf, tsize_t size)
{
wxInputStream *stream = (wxInputStream*) handle;
stream->Read( (void*) buf, (size_t) size );
}
tsize_t TIFFLINKAGEMODE
-_tiffWriteProc(thandle_t handle, tdata_t buf, tsize_t size)
+wxTIFFWriteProc(thandle_t handle, tdata_t buf, tsize_t size)
{
wxOutputStream *stream = (wxOutputStream*) handle;
stream->Write( (void*) buf, (size_t) size );
}
toff_t TIFFLINKAGEMODE
-_tiffSeekIProc(thandle_t handle, toff_t off, int whence)
+wxTIFFSeekIProc(thandle_t handle, toff_t off, int whence)
{
wxInputStream *stream = (wxInputStream*) handle;
}
toff_t TIFFLINKAGEMODE
-_tiffSeekOProc(thandle_t handle, toff_t off, int whence)
+wxTIFFSeekOProc(thandle_t handle, toff_t off, int whence)
{
wxOutputStream *stream = (wxOutputStream*) handle;
}
int TIFFLINKAGEMODE
-_tiffCloseProc(thandle_t WXUNUSED(handle))
+wxTIFFCloseIProc(thandle_t WXUNUSED(handle))
{
- return 0; // ?
+ // there is no need to close the input stream
+ return 0;
+}
+
+int TIFFLINKAGEMODE
+wxTIFFCloseOProc(thandle_t handle)
+{
+ wxOutputStream *stream = (wxOutputStream*) handle;
+
+ return stream->Close() ? 0 : -1;
}
toff_t TIFFLINKAGEMODE
-_tiffSizeProc(thandle_t handle)
+wxTIFFSizeProc(thandle_t handle)
{
wxStreamBase *stream = (wxStreamBase*) handle;
return (toff_t) stream->GetSize();
}
int TIFFLINKAGEMODE
-_tiffMapProc(thandle_t WXUNUSED(handle),
+wxTIFFMapProc(thandle_t WXUNUSED(handle),
tdata_t* WXUNUSED(pbase),
toff_t* WXUNUSED(psize))
{
}
void TIFFLINKAGEMODE
-_tiffUnmapProc(thandle_t WXUNUSED(handle),
+wxTIFFUnmapProc(thandle_t WXUNUSED(handle),
tdata_t WXUNUSED(base),
toff_t WXUNUSED(size))
{
{
TIFF* tif = TIFFClientOpen(name, mode,
(thandle_t) &stream,
- _tiffReadProc, _tiffNullProc,
- _tiffSeekIProc, _tiffCloseProc, _tiffSizeProc,
- _tiffMapProc, _tiffUnmapProc);
+ wxTIFFReadProc, wxTIFFNullProc,
+ wxTIFFSeekIProc, wxTIFFCloseIProc, wxTIFFSizeProc,
+ wxTIFFMapProc, wxTIFFUnmapProc);
return tif;
}
{
TIFF* tif = TIFFClientOpen(name, mode,
(thandle_t) &stream,
- _tiffNullProc, _tiffWriteProc,
- _tiffSeekOProc, _tiffCloseProc, _tiffSizeProc,
- _tiffMapProc, _tiffUnmapProc);
+ wxTIFFNullProc, wxTIFFWriteProc,
+ wxTIFFSeekOProc, wxTIFFCloseOProc, wxTIFFSizeProc,
+ wxTIFFMapProc, wxTIFFUnmapProc);
return tif;
}