~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to frmts/pcidsk/vsi_pcidsk_io.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: pcidskdataset.cpp 17097 2009-05-21 19:59:35Z warmerdam $
 
2
 * $Id: vsi_pcidsk_io.cpp 21680 2011-02-11 21:12:07Z warmerdam $
3
3
 *
4
4
 * Project:  PCIDSK Database File
5
5
 * Purpose:  PCIDSK SDK compatiable io interface built on VSI.
31
31
#include "cpl_multiproc.h"
32
32
#include "pcidsk.h"
33
33
 
34
 
CPL_CVSID("$Id: pcidskdataset.cpp 17097 2009-05-21 19:59:35Z warmerdam $");
 
34
CPL_CVSID("$Id: vsi_pcidsk_io.cpp 21680 2011-02-11 21:12:07Z warmerdam $");
35
35
 
36
36
using namespace PCIDSK;
37
37
 
 
38
EDBFile *GDAL_EDBOpen( std::string osFilename, std::string osAccess );
 
39
 
38
40
class VSI_IOInterface : public IOInterfaces
39
41
{
40
42
    virtual void   *Open( std::string filename, std::string access ) const;
59
61
    static PCIDSKInterfaces singleton_pcidsk2_interfaces;
60
62
 
61
63
    singleton_pcidsk2_interfaces.io = &singleton_vsi_interface;
 
64
    singleton_pcidsk2_interfaces.OpenEDB = GDAL_EDBOpen;
62
65
 
63
66
    return &singleton_pcidsk2_interfaces;
64
67
}
71
74
VSI_IOInterface::Open( std::string filename, std::string access ) const
72
75
 
73
76
{
74
 
    FILE *fp = VSIFOpenL( filename.c_str(), access.c_str() );
 
77
    VSILFILE *fp = VSIFOpenL( filename.c_str(), access.c_str() );
75
78
 
76
79
    if( fp == NULL )
77
80
        ThrowPCIDSKException( "Failed to open %s: %s", 
88
91
VSI_IOInterface::Seek( void *io_handle, uint64 offset, int whence ) const
89
92
 
90
93
{
91
 
    FILE *fp = (FILE *) io_handle;
 
94
    VSILFILE *fp = (VSILFILE *) io_handle;
92
95
 
93
96
    uint64 result = VSIFSeekL( fp, offset, whence );
94
97
 
107
110
uint64 VSI_IOInterface::Tell( void *io_handle ) const
108
111
 
109
112
{
110
 
    FILE *fp = (FILE *) io_handle;
 
113
    VSILFILE *fp = (VSILFILE *) io_handle;
111
114
 
112
115
    return VSIFTellL( fp );
113
116
}
120
123
                               void *io_handle ) const
121
124
 
122
125
{
123
 
    FILE *fp = (FILE *) io_handle;
 
126
    VSILFILE *fp = (VSILFILE *) io_handle;
124
127
 
125
128
    errno = 0;
126
129
 
127
 
    uint64 result = VSIFReadL( buffer, size, nmemb, fp );
 
130
    uint64 result = VSIFReadL( buffer, (size_t) size, (size_t) nmemb, fp );
128
131
 
129
132
    if( errno != 0 && result == 0 && nmemb != 0 )
130
133
        ThrowPCIDSKException( "Read(%d): %s", 
142
145
                                void *io_handle ) const
143
146
 
144
147
{
145
 
    FILE *fp = (FILE *) io_handle;
 
148
    VSILFILE *fp = (VSILFILE *) io_handle;
146
149
 
147
150
    errno = 0;
148
151
 
149
 
    uint64 result = VSIFWriteL( buffer, size, nmemb, fp );
 
152
    uint64 result = VSIFWriteL( buffer, (size_t) size, (size_t) nmemb, fp );
150
153
 
151
154
    if( errno != 0 && result == 0 && nmemb != 0 )
152
155
        ThrowPCIDSKException( "Write(%d): %s", 
163
166
int VSI_IOInterface::Eof( void *io_handle ) const
164
167
 
165
168
{
166
 
    return VSIFEofL( (FILE *) io_handle );
 
169
    return VSIFEofL( (VSILFILE *) io_handle );
167
170
}
168
171
 
169
172
/************************************************************************/
173
176
int VSI_IOInterface::Flush( void *io_handle ) const
174
177
 
175
178
{
176
 
    return VSIFFlushL( (FILE *) io_handle );
 
179
    return VSIFFlushL( (VSILFILE *) io_handle );
177
180
}
178
181
 
179
182
/************************************************************************/
183
186
int VSI_IOInterface::Close( void *io_handle ) const
184
187
 
185
188
{
186
 
    return VSIFCloseL( (FILE *) io_handle );
 
189
    return VSIFCloseL( (VSILFILE *) io_handle );
187
190
}
188
191
 
189
192
/************************************************************************/