LCOV - code coverage report
Current view: directory - frmts/gtiff/libgeotiff - geo_free.c (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 11 11 100.0 %
Date: 2012-04-28 Functions: 1 1 100.0 %

       1                 : /**********************************************************************
       2                 :  *
       3                 :  *  geo_free.c  -- Public routines for GEOTIFF GeoKey access.
       4                 :  *
       5                 :  *    Written By: Niles D. Ritter.
       6                 :  *
       7                 :  *  copyright (c) 1995   Niles D. Ritter
       8                 :  *
       9                 :  *  Permission granted to use this software, so long as this copyright
      10                 :  *  notice accompanies any products derived therefrom.
      11                 :  *
      12                 :  **********************************************************************/
      13                 : 
      14                 : #include "geotiff.h"   /* public interface        */
      15                 : #include "geo_tiffp.h" /* external TIFF interface */
      16                 : #include "geo_keyp.h"  /* private interface       */
      17                 : 
      18                 : 
      19                 : /**********************************************************************
      20                 :  *
      21                 :  *                        Public Routines
      22                 :  *
      23                 :  **********************************************************************/
      24                 : 
      25                 : /**
      26                 :   
      27                 : This function deallocates an existing GeoTIFF access handle previously
      28                 : created with GTIFNew().  If the handle was
      29                 : used to write GeoTIFF keys to the TIFF file, the 
      30                 : GTIFWriteKeys() function should be used
      31                 : to flush results to the file before calling GTIFFree().  GTIFFree()
      32                 : should be called before XTIFFClose() is
      33                 : called on the corresponding TIFF file handle.<p>
      34                 : 
      35                 : */
      36                 : 
      37           11442 : void GTIFFree(GTIF* gtif)
      38                 : {
      39                 :     int     i;
      40                 :   
      41           11442 :     if (!gtif) return;
      42                 :   
      43                 :     /* Free parameter arrays */
      44           11442 :     if (gtif->gt_double) _GTIFFree (gtif->gt_double);
      45           11442 :     if (gtif->gt_short) _GTIFFree (gtif->gt_short);
      46                 :   
      47                 :     /* Free GeoKey arrays */
      48           11442 :     if (gtif->gt_keys)
      49                 :     {
      50         1155642 :         for (i = 0; i < MAX_KEYS; i++)
      51                 :         {
      52         1144200 :             if (gtif->gt_keys[i].gk_type == TYPE_ASCII)
      53                 :             {
      54           11720 :                 _GTIFFree (gtif->gt_keys[i].gk_data);
      55                 :             }
      56                 :         }
      57           11442 :         _GTIFFree (gtif->gt_keys);
      58                 :     }
      59           11442 :     if (gtif->gt_keyindex) _GTIFFree (gtif->gt_keyindex);
      60                 :   
      61           11442 :     _GTIFFree (gtif);
      62                 : }

Generated by: LCOV version 1.7