Changes between Version 1 and Version 2 of rfc7_vsilapi


Ignore:
Timestamp:
Oct 23, 2010, 7:31:45 AM (14 years ago)
Author:
Even Rouault
Comment:

revive RFC7

Legend:

Unmodified
Added
Removed
Modified
  • rfc7_vsilapi

    v1 v2  
    11= RFC 7: Use VSILFILE for VSI*L Functions =
    22
    3 Author: Eric Doenges[[BR]]
    4 Contact: Eric.Doenges@gmx.net[[BR]]
     3Author: Even Rouault (Eric Doenges is original author) [[BR]]
     4Contact: even dot rouault at mines dash paris dot org, Eric.Doenges@gmx.net [[BR]]
    55Status: Proposed
    66
     
    2626that uses the VSI*L functions must be changed to use this data-type as well.
    2727
     28== RawRasterBand changes ==
     29
     30  * The 2 constructors are changed to accept a void* fpRaw instead of a FILE*
     31  * A new member VSILFILE* fpRawL is added. The existing member FILE* fpRaw is
     32    kept. The constructors will set the adequate member according to the value of
     33    the bIsVSIL parameter.
     34  * A new method VSILFILE* GetFPL() is added.
     35  * The old FILE* GetFP() is adapted to have same behaviour as before (can return
     36    a standard FILE handle or a VSI*L handle depending on the handle that was passed to the constructor)
     37
     38Those changes are meant to minimize the need for casting when using RawRasterBand. Backward API
     39compatibility is preserved.
     40
    2841== Compatibility Issues, Transition timeline ==
    2942
    3043In order to allow the compiler to detect inappropriate parameters passed to
    31 any of the VSI*L functions, VSILFILE would have to be declared with the help
     44any of the VSI*L functions, VSILFILE will be declared with the help
    3245of an empty forward declaration, i.e.
    3346{{{
    34 typedef struct VSILFILE VSILFILE
     47typedef struct _VSILFILE VSILFILE
    3548}}}
    36 with the struct VSILFILE itself left undefined. However, this would break
     49with the struct _VSILFILE itself left undefined.
     50
     51However, this would break
    3752source compatibility for any existing code using the VSI*L API.
     53Therefore, for now, VSILFILE is defined to be an alias of FILE, unless
     54the VSIL_STRICT_ENFORCE macro is defined.
    3855
    39 Therefore, VSILFILE* will be declared as a void pointer for now, and the change
    40 to a distinct pointer type deferred to a future release of gdal that is not
    41 constrained with backward compatibility issues. While this will not solve the
    42 primary issue (no warnings/errors from the compiler), looking at the
    43 declarations of the VSI*L functions will at least make it immediately clear
    44 that these functions cannot be expected to work if passed a FILE pointer.
    45  
     56{{{
     57#ifdef VSIL_STRICT_ENFORCE
     58typedef struct _VSILFILE VSILFILE;
     59#else
     60typedef FILE VSILFILE;
     61#endif
     62}}}
     63
     64In a future release (GDAL 2.0 ?), the behaviour will be changed to enforce the new strong typing.
     65
     66Any future development done since the adoption of this RFC should use VSILFILE when dealing with the VSIF*L API.
     67
     68== Questions ==
     69
     70* Should we define VSIL_STRICT_ENFORCE by default when DEBUG is defined ?
     71
     72This would make life easier for GDAL developers to use the appropriate typing, but not affect API/ABI when
     73using release mode.
     74
     75== Implementation ==
     76
     77The whole source tree ( port, gcore, frmts, ogr, swig/include ) will be altered adequatly so that the
     78compilation works in VSIL_STRICT_ENFORCE mode. Ticket #3799 contains a patch with the implementation.
     79The compilation doesn't add any new warning. The autotest suite still works after this change.
     80
     81The GeoRaster driver has been modified during the conversion process, but I'm not in position to compile it.
     82Testing appreciated. All other drivers that have been altered in the conversion process have been compiled.
     83
     84In the conversion process, a misuse of POSIX FILE API with a large file handler was discovered in the ceos2 driver,
     85but the function happened to be unusued.