LTP GCOV extension - code coverage report
Current view: directory - ogr/ogrsf_frmts/shape - shp_vsi.c
Test: gdal_filtered.info
Date: 2010-07-12 Instrumented lines: 31
Code covered: 100.0 % Executed lines: 31

       1                 : /******************************************************************************
       2                 :  * $Id: shp_vsi.c 19643 2010-05-08 21:56:18Z rouault $
       3                 :  *
       4                 :  * Project:  OpenGIS Simple Features Reference Implementation
       5                 :  * Purpose:  IO Redirection via VSI services for shp/dbf io.
       6                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2007,  Frank Warmerdam
      10                 :  *
      11                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      12                 :  * copy of this software and associated documentation files (the "Software"),
      13                 :  * to deal in the Software without restriction, including without limitation
      14                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15                 :  * and/or sell copies of the Software, and to permit persons to whom the
      16                 :  * Software is furnished to do so, subject to the following conditions:
      17                 :  *
      18                 :  * The above copyright notice and this permission notice shall be included
      19                 :  * in all copies or substantial portions of the Software.
      20                 :  *
      21                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27                 :  * DEALINGS IN THE SOFTWARE.
      28                 :  ****************************************************************************/
      29                 : 
      30                 : #include "shapefil.h"
      31                 : #include "cpl_vsi.h"
      32                 : #include "cpl_error.h"
      33                 : #include "cpl_conv.h"
      34                 : 
      35                 : CPL_CVSID("$Id: shp_vsi.c 19643 2010-05-08 21:56:18Z rouault $");
      36                 : 
      37                 : /************************************************************************/
      38                 : /*                            VSI_SHP_Open()                            */
      39                 : /************************************************************************/
      40                 : 
      41                 : SAFile VSI_SHP_Open( const char *pszFilename, const char *pszAccess )
      42                 : 
      43            5300 : {
      44            5300 :     return (SAFile) VSIFOpenL( pszFilename, pszAccess );
      45                 : }
      46                 : 
      47                 : /************************************************************************/
      48                 : /*                            VSI_SHP_Read()                            */
      49                 : /************************************************************************/
      50                 : 
      51                 : SAOffset VSI_SHP_Read( void *p, SAOffset size, SAOffset nmemb, SAFile file )
      52                 : 
      53           55036 : {
      54           55036 :     return (SAOffset) VSIFReadL( p, (size_t) size, (size_t) nmemb, 
      55                 :                                  (FILE *) file );
      56                 : }
      57                 : 
      58                 : /************************************************************************/
      59                 : /*                           VSI_SHP_Write()                            */
      60                 : /************************************************************************/
      61                 : 
      62                 : SAOffset VSI_SHP_Write( void *p, SAOffset size, SAOffset nmemb, SAFile file )
      63                 : 
      64           33237 : {
      65           33237 :     return (SAOffset) VSIFWriteL( p, (size_t) size, (size_t) nmemb, 
      66                 :                                   (FILE *) file );
      67                 : }
      68                 : 
      69                 : /************************************************************************/
      70                 : /*                            VSI_SHP_Seek()                            */
      71                 : /************************************************************************/
      72                 : 
      73                 : SAOffset VSI_SHP_Seek( SAFile file, SAOffset offset, int whence )
      74                 : 
      75           83681 : {
      76           83681 :     return (SAOffset) VSIFSeekL( (FILE *) file, (vsi_l_offset) offset, whence );
      77                 : }
      78                 : 
      79                 : /************************************************************************/
      80                 : /*                            VSI_SHP_Tell()                            */
      81                 : /************************************************************************/
      82                 : 
      83                 : SAOffset VSI_SHP_Tell( SAFile file )
      84                 : 
      85              96 : {
      86              96 :     return (SAOffset) VSIFTellL( (FILE *) file );
      87                 : }
      88                 : 
      89                 : /************************************************************************/
      90                 : /*                           VSI_SHP_Flush()                            */
      91                 : /************************************************************************/
      92                 : 
      93                 : int VSI_SHP_Flush( SAFile file )
      94                 : 
      95             447 : {
      96             447 :     return VSIFFlushL( (FILE *) file );
      97                 : }
      98                 : 
      99                 : /************************************************************************/
     100                 : /*                           VSI_SHP_Close()                            */
     101                 : /************************************************************************/
     102                 : 
     103                 : int VSI_SHP_Close( SAFile file )
     104                 : 
     105            3412 : {
     106            3412 :     return VSIFCloseL( (FILE *) file );
     107                 : }
     108                 : 
     109                 : /************************************************************************/
     110                 : /*                              SADError()                              */
     111                 : /************************************************************************/
     112                 : 
     113                 : void VSI_SHP_Error( const char *message )
     114                 : 
     115              15 : {
     116              15 :     CPLError( CE_Failure, CPLE_AppDefined, "%s", message );
     117              15 : }
     118                 : 
     119                 : /************************************************************************/
     120                 : /*                           VSI_SHP_Remove()                           */
     121                 : /************************************************************************/
     122                 : 
     123                 : int VSI_SHP_Remove( const char *pszFilename )
     124                 : 
     125             130 : {
     126             130 :     return VSIUnlink( pszFilename );
     127                 : }
     128                 : 
     129                 : /************************************************************************/
     130                 : /*                        SASetupDefaultHooks()                         */
     131                 : /************************************************************************/
     132                 : 
     133                 : void SASetupDefaultHooks( SAHooks *psHooks )
     134                 : 
     135            2059 : {
     136            2059 :     psHooks->FOpen   = VSI_SHP_Open;
     137            2059 :     psHooks->FRead   = VSI_SHP_Read;
     138            2059 :     psHooks->FWrite  = VSI_SHP_Write;
     139            2059 :     psHooks->FSeek   = VSI_SHP_Seek;
     140            2059 :     psHooks->FTell   = VSI_SHP_Tell;
     141            2059 :     psHooks->FFlush  = VSI_SHP_Flush;
     142            2059 :     psHooks->FClose  = VSI_SHP_Close;
     143                 : 
     144            2059 :     psHooks->Remove  = VSI_SHP_Remove;
     145            2059 :     psHooks->Atof    = CPLAtof;
     146                 : 
     147            2059 :     psHooks->Error   = VSI_SHP_Error;
     148            2059 : }

Generated by: LTP GCOV extension version 1.5