LCOV - code coverage report
Current view: top level - ogr - ogr_expat.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 3 3 100.0 %
Date: 2025-01-18 12:42:00 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  OGR
       4             :  * Purpose:  Convenience function for parsing with Expat library
       5             :  * Author:   Even Rouault, even dot rouault at spatialys.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2009, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef OGR_EXPATH_INCLUDED
      14             : #define OGR_EXPATH_INCLUDED
      15             : 
      16             : #ifdef HAVE_EXPAT
      17             : 
      18             : #include "cpl_port.h"
      19             : #include <expat.h>
      20             : 
      21             : #include <memory>
      22             : 
      23             : /* Compatibility stuff for expat >= 1.95.0 and < 1.95.7 */
      24             : #ifndef XMLCALL
      25             : #define XMLCALL
      26             : #endif
      27             : #ifndef XML_STATUS_OK
      28             : #define XML_STATUS_OK 1
      29             : #define XML_STATUS_ERROR 0
      30             : #endif
      31             : 
      32             : /* XML_StopParser only available for expat >= 1.95.8 */
      33             : #if !defined(XML_MAJOR_VERSION) ||                                             \
      34             :     (XML_MAJOR_VERSION * 10000 + XML_MINOR_VERSION * 100 +                     \
      35             :      XML_MICRO_VERSION) < 19508
      36             : #define XML_StopParser(parser, resumable)
      37             : #warning                                                                       \
      38             :     "Expat version is too old and does not have XML_StopParser. Corrupted files could hang OGR"
      39             : #endif
      40             : 
      41             : /* Only for internal use ! */
      42             : XML_Parser CPL_DLL OGRCreateExpatXMLParser(void);
      43             : 
      44             : //
      45             : //! @cond Doxygen_Suppress
      46             : struct CPL_DLL OGRExpatUniquePtrDeleter
      47             : {
      48         199 :     void operator()(XML_Parser oParser) const
      49             :     {
      50         199 :         XML_ParserFree(oParser);
      51         199 :     }
      52             : };
      53             : 
      54             : //! @endcond
      55             : 
      56             : /** Unique pointer type for XML_Parser.
      57             :  * @since GDAL 3.2
      58             :  */
      59             : using OGRExpatUniquePtr =
      60             :     std::unique_ptr<XML_ParserStruct, OGRExpatUniquePtrDeleter>;
      61             : 
      62             : #endif /* HAVE_EXPAT */
      63             : 
      64             : #endif /* OGR_EXPATH_INCLUDED */

Generated by: LCOV version 1.14