📄 rfc7_vsilapi.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>GDAL: RFC 7: Use VSILFILE for VSI*L Functions</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.1 --><div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul></div><h1><a class="anchor" name="rfc7_vsilapi">RFC 7: Use VSILFILE for VSI*L Functions</a></h1>Author: Eric Dönges<br> Contact: <a href="mailto:Eric.Doenges@gmx.net">Eric.Doenges@gmx.net</a><br> Status: Proposed<br><h2><a class="anchor" name="rfc7_purpose">Purpose</a></h2>To change the API for the VSI*L family of functions to use a new data-type VSILFILE instead of the current FILE.<h2><a class="anchor" name="rfc7_background">Background, Rationale</a></h2>Currently, GDAL offers two APIs to abstract file access functions (referred to as VSI* and VSI*L in this document). Both APIs claim to operate on FILE pointers; however, the VSI*L functions can only operate on FILE pointers created by the VSIFOpenL function. This is because VSIFOpenL returns a pointer to an internal C++ class typecast to a FILE pointer, not an actual FILE pointer. This makes it impossible for the compiler to warn when the VSI* and VSI*L functions are inappropriately mixed.<h2><a class="anchor" name="rfc7_proposal">Proposed Fix</a></h2>A new opaque data-type VSILFILE shall be declared. All VSI*L functions shall be changed to use this new type instead of FILE. Additionally, any GDAL code that uses the VSI*L functions must be changed to use this data-type as well.<h2><a class="anchor" name="rfc7_compatibility">Compatibility Issues, Transition timeline</a></h2>In order to allow the compiler to detect inappropriate parameters passed to any of the VSI*L functions, VSILFILE would have to be declared with the help of an empty forward declaration, i.e. <pre>typedef struct VSILFILE VSILFILE</pre> with the struct VSILFILE itself left undefined. However, this would break source compatibility for any existing code using the VSI*L API.<p>Therefore, VSILFILE* will be declared as a void pointer for now, and the change to a distinct pointer type deferred to a future release of gdal that is not constrained with backward compatibility issues. While this will not solve the primary issue (no warnings/errors from the compiler), looking at the declarations of the VSI*L functions will at least make it immediately clear that these functions cannot be expected to work if passed a FILE pointer. <hr>Generated for GDAL by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1.</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -