From be0d315e6638a196bd69c77828438044434beb80 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 Sep 2006 09:51:13 +0000 Subject: [PATCH] close output stream when TIFFClose() is called git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40975 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/imagtiff.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index 00c11c56a8..3e5392f231 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -129,9 +129,18 @@ _tiffSeekOProc(thandle_t handle, toff_t off, int whence) } int TIFFLINKAGEMODE -_tiffCloseProc(thandle_t WXUNUSED(handle)) +_tiffCloseIProc(thandle_t WXUNUSED(handle)) { - return 0; // ? + // there is no need to close the input stream + return 0; +} + +int TIFFLINKAGEMODE +_tiffCloseOProc(thandle_t handle) +{ + wxOutputStream *stream = (wxOutputStream*) handle; + + return stream->Close() ? 0 : -1; } toff_t TIFFLINKAGEMODE @@ -196,7 +205,7 @@ TIFFwxOpen(wxInputStream &stream, const char* name, const char* mode) TIFF* tif = TIFFClientOpen(name, mode, (thandle_t) &stream, _tiffReadProc, _tiffNullProc, - _tiffSeekIProc, _tiffCloseProc, _tiffSizeProc, + _tiffSeekIProc, _tiffCloseIProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); return tif; @@ -208,7 +217,7 @@ TIFFwxOpen(wxOutputStream &stream, const char* name, const char* mode) TIFF* tif = TIFFClientOpen(name, mode, (thandle_t) &stream, _tiffNullProc, _tiffWriteProc, - _tiffSeekOProc, _tiffCloseProc, _tiffSizeProc, + _tiffSeekOProc, _tiffCloseOProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); return tif; -- 2.45.2