From e46af065eb2f34f123b8dd40742d2d12baccbbb5 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sat, 5 Jul 2008 21:54:21 +0200 Subject: TIFFOutputImage cleanup --- src/TIFFOutputImage.cxx | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/TIFFOutputImage.cxx b/src/TIFFOutputImage.cxx index 999e05a..204bfa5 100644 --- a/src/TIFFOutputImage.cxx +++ b/src/TIFFOutputImage.cxx @@ -18,20 +18,18 @@ TIFFOutputImage::TIFFOutputImage(const char *f, int b) { } TIFFOutputImage::~TIFFOutputImage() { - if (row) { + if (row) free(row); - } - if (file) { + + if (file) free(file); - } } int TIFFOutputImage::init_internal() { - if (row) { + if (row) free(row); - row = NULL; - } + row = NULL; row = (unsigned char*) calloc((bitspersample / 8) * 4 * W, sizeof(char)); if (!row) { @@ -39,9 +37,8 @@ TIFFOutputImage::init_internal() { return 1; } - if (tiff) { + if (tiff) TIFFClose(tiff); - } if((tiff = TIFFOpen(file, "w")) == NULL){ fprintf(stderr, "can't open %s\n", file); @@ -88,15 +85,13 @@ TIFFOutputImage::next_line_internal() { int TIFFOutputImage::done_internal() { - if (tiff) { + if (tiff) TIFFClose(tiff); - tiff = NULL; - } + tiff = NULL; - if (row) { + if (row) free(row); - row = NULL; - } + row = NULL; return 0; } -- cgit v1.2.3