| 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 | |
| 38 | Those changes are meant to minimize the need for casting when using RawRasterBand. Backward API |
| 39 | compatibility is preserved. |
| 40 | |
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 |
| 58 | typedef struct _VSILFILE VSILFILE; |
| 59 | #else |
| 60 | typedef FILE VSILFILE; |
| 61 | #endif |
| 62 | }}} |
| 63 | |
| 64 | In a future release (GDAL 2.0 ?), the behaviour will be changed to enforce the new strong typing. |
| 65 | |
| 66 | Any 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 | |
| 72 | This would make life easier for GDAL developers to use the appropriate typing, but not affect API/ABI when |
| 73 | using release mode. |
| 74 | |
| 75 | == Implementation == |
| 76 | |
| 77 | The whole source tree ( port, gcore, frmts, ogr, swig/include ) will be altered adequatly so that the |
| 78 | compilation works in VSIL_STRICT_ENFORCE mode. Ticket #3799 contains a patch with the implementation. |
| 79 | The compilation doesn't add any new warning. The autotest suite still works after this change. |
| 80 | |
| 81 | The GeoRaster driver has been modified during the conversion process, but I'm not in position to compile it. |
| 82 | Testing appreciated. All other drivers that have been altered in the conversion process have been compiled. |
| 83 | |
| 84 | In the conversion process, a misuse of POSIX FILE API with a large file handler was discovered in the ceos2 driver, |
| 85 | but the function happened to be unusued. |