Changes between Initial Version and Version 1 of rfc7_vsilapi


Ignore:
Timestamp:
Apr 28, 2007, 12:19:25 PM (17 years ago)
Author:
warmerdam
Comment:

Ported from doxygen.

Legend:

Unmodified
Added
Removed
Modified
  • rfc7_vsilapi

    v1 v1  
     1= RFC 7: Use VSILFILE for VSI*L Functions =
     2
     3Author: Eric Doenges[[BR]]
     4Contact: Eric.Doenges@gmx.net[[BR]]
     5Status: Proposed
     6
     7== Purpose ==
     8
     9To change the API for the VSI*L family of functions to use a new data-type
     10VSILFILE instead of the current FILE.
     11
     12== Background, Rationale ==
     13
     14Currently, GDAL offers two APIs to abstract file access functions (referred to
     15as VSI* and VSI*L in this document). Both APIs claim to operate on FILE
     16pointers; however, the VSI*L functions can only operate on FILE pointers
     17created by the VSIFOpenL function. This is because VSIFOpenL returns a pointer
     18to an internal C++ class typecast to a FILE pointer, not an actual FILE pointer.
     19This makes it impossible for the compiler to warn when the VSI* and VSI*L
     20functions are inappropriately mixed.
     21
     22== Proposed Fix ==
     23
     24A new opaque data-type VSILFILE shall be declared. All VSI*L functions shall
     25be changed to use this new type instead of FILE. Additionally, any GDAL code
     26that uses the VSI*L functions must be changed to use this data-type as well.
     27
     28== Compatibility Issues, Transition timeline ==
     29
     30In order to allow the compiler to detect inappropriate parameters passed to
     31any of the VSI*L functions, VSILFILE would have to be declared with the help
     32of an empty forward declaration, i.e.
     33{{{
     34typedef struct VSILFILE VSILFILE
     35}}}
     36with the struct VSILFILE itself left undefined. However, this would break
     37source compatibility for any existing code using the VSI*L API.
     38
     39Therefore, VSILFILE* will be declared as a void pointer for now, and the change
     40to a distinct pointer type deferred to a future release of gdal that is not
     41constrained with backward compatibility issues. While this will not solve the
     42primary issue (no warnings/errors from the compiler), looking at the
     43declarations of the VSI*L functions will at least make it immediately clear
     44that these functions cannot be expected to work if passed a FILE pointer.
     45