Commit 99f18ef1 authored by Brad King's avatar Brad King

ERR: Expat callback functions must be declared extern C to match function pointer types.

parent 6aa96d25
......@@ -21,7 +21,7 @@
#include "expat.h"
#include <ctype.h>
vtkCxxRevisionMacro(vtkXMLParser, "1.3");
vtkCxxRevisionMacro(vtkXMLParser, "1.4");
vtkStandardNewMacro(vtkXMLParser);
//----------------------------------------------------------------------------
......@@ -58,10 +58,10 @@ int vtkXMLParser::Parse()
// Create the expat XML parser.
this->Parser = XML_ParserCreate(0);
XML_SetElementHandler(this->Parser,
&vtkXMLParser::StartElementFunction,
&vtkXMLParser::EndElementFunction);
&vtkXMLParserStartElement,
&vtkXMLParserEndElement);
XML_SetCharacterDataHandler(this->Parser,
&vtkXMLParser::CharacterDataHandlerFunction);
&vtkXMLParserCharacterDataHandler);
XML_SetUserData(this->Parser, this);
// Parse the input.
......@@ -221,27 +221,35 @@ int vtkXMLParser::ParseBuffer(const char* buffer)
}
//----------------------------------------------------------------------------
void vtkXMLParser::StartElementFunction(void* parser, const char *name,
const char **atts)
int vtkXMLParser::IsSpace(char c)
{
static_cast<vtkXMLParser*>(parser)->StartElement(name, atts);
return isspace(c);
}
//----------------------------------------------------------------------------
void vtkXMLParser::EndElementFunction(void* parser, const char *name)
void vtkXMLParserStartElement(void* parser, const char *name,
const char **atts)
{
static_cast<vtkXMLParser*>(parser)->EndElement(name);
// Begin element handler that is registered with the XML_Parser.
// This just casts the user data to a vtkXMLParser and calls
// StartElement.
static_cast<vtkXMLParser*>(parser)->StartElement(name, atts);
}
//----------------------------------------------------------------------------
void vtkXMLParser::CharacterDataHandlerFunction(void* parser, const char* data,
int length)
void vtkXMLParserEndElement(void* parser, const char *name)
{
static_cast<vtkXMLParser*>(parser)->CharacterDataHandler(data, length);
// End element handler that is registered with the XML_Parser. This
// just casts the user data to a vtkXMLParser and calls EndElement.
static_cast<vtkXMLParser*>(parser)->EndElement(name);
}
//----------------------------------------------------------------------------
int vtkXMLParser::IsSpace(char c)
void vtkXMLParserCharacterDataHandler(void* parser, const char* data,
int length)
{
return isspace(c);
// Character data handler that is registered with the XML_Parser.
// This just casts the user data to a vtkXMLParser and calls
// CharacterDataHandler.
static_cast<vtkXMLParser*>(parser)->CharacterDataHandler(data, length);
}
......@@ -28,6 +28,13 @@
#include "vtkObject.h"
extern "C"
{
void vtkXMLParserStartElement(void*, const char*, const char**);
void vtkXMLParserEndElement(void*, const char*);
void vtkXMLParserCharacterDataHandler(void*, const char*, int);
}
class VTK_IO_EXPORT vtkXMLParser : public vtkObject
{
public:
......@@ -114,24 +121,14 @@ protected:
// routine.
static int IsSpace(char c);
// Begin element handler that is registered with the XML_Parser.
// This just casts the user data to a vtkXMLParser and calls
// StartElement.
static void StartElementFunction(void* parser, const char* name,
const char** atts);
// End element handler that is registered with the XML_Parser. This
// just casts the user data to a vtkXMLParser and calls EndElement.
static void EndElementFunction(void* parser, const char* name);
// Character data handler that is registered with the XML_Parser.
// This just casts the user data to a vtkXMLParser and calls
// CharacterDataHandler.
static void CharacterDataHandlerFunction(void* parser, const char* data,
int length);
int LegacyHack;
//BTX
friend void vtkXMLParserStartElement(void*, const char*, const char**);
friend void vtkXMLParserEndElement(void*, const char*);
friend void vtkXMLParserCharacterDataHandler(void*, const char*, int);
//ETX
private:
vtkXMLParser(const vtkXMLParser&); // Not implemented.
void operator=(const vtkXMLParser&); // Not implemented.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment