home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / grfx_snd / tifflib / source / tif_clos.c < prev    next >
C/C++ Source or Header  |  1993-01-13  |  1KB  |  39 lines

  1. #pragma warn -use
  2. static char    *sccsid = "@(#)TIFF/tif_close.c 1.01, Copyright (c) Sam Leffler, Dieter Linde, "__DATE__;
  3. #pragma warn .use
  4. /*
  5.  * Copyright (c) 1988, 1990 by Sam Leffler.
  6.  * All rights reserved.
  7.  *
  8.  * This file is provided for unrestricted use provided that this legend is included on all tape media and as a part of the
  9.  * software program in whole or part.  Users may copy, modify or distribute this file at will.
  10.  *
  11.  * TIFF Library.
  12.  */
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include "tiffio.h"
  16.  
  17. /****************************************************************************
  18.  *
  19.  */
  20. void
  21. TIFFClose(
  22.     TIFF     *tif
  23.     )
  24. {
  25.         if (tif->tif_mode != O_RDONLY)
  26.  
  27.           /*
  28.          * Flush buffered data and directory (if dirty).
  29.          */
  30.                 TIFFFlush(tif);
  31.         if (tif->tif_cleanup)
  32.                 (*tif->tif_cleanup)(tif);
  33.         TIFFFreeDirectory(tif);
  34.         if (tif->tif_rawdata)
  35.                 free(tif->tif_rawdata);
  36.         close(tif->tif_fd);
  37.         free(tif);
  38. }
  39.