From da30f8ce5d0f2851c0b714fb62a94a32c9c54ee9 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 20 Jun 2011 10:09:33 +0200 Subject: [PATCH] fixed an XML parser issue on OSX --- src/librender/scenehandler.cpp | 16 ++++++++++++---- src/mitsuba/mitsuba.cpp | 5 ++++- src/qtgui/sceneloader.cpp | 5 ++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/librender/scenehandler.cpp b/src/librender/scenehandler.cpp index 5ae565a7..681ea8e7 100644 --- a/src/librender/scenehandler.cpp +++ b/src/librender/scenehandler.cpp @@ -25,9 +25,14 @@ MTS_NAMESPACE_BEGIN -#define XMLLog(level, fmt, ...) Thread::getThread()->getLogger()->log(\ - level, NULL, __FILE__, __LINE__, "Near file offset %i: " fmt, \ - (int) m_parser->getSrcOffset(), ## __VA_ARGS__) +#if !defined(__OSX__) + #define XMLLog(level, fmt, ...) Thread::getThread()->getLogger()->log(\ + level, NULL, __FILE__, __LINE__, "Near file offset %i: " fmt, \ + (int) m_parser->getSrcOffset(), ## __VA_ARGS__) +#else + #define XMLLog(level, fmt, ...) Thread::getThread()->getLogger()->log(\ + level, NULL, __FILE__, __LINE__, fmt, ## __VA_ARGS__) +#endif SceneHandler::SceneHandler(const SAXParser *parser, const ParameterMap ¶ms, NamedObjectMap *namedObjects, @@ -390,7 +395,10 @@ void SceneHandler::endElement(const XMLCh* const xmlName) { parser->setDoNamespaces(true); parser->setDocumentHandler(handler); parser->setErrorHandler(handler); - parser->setCalculateSrcOfs(true); + #if !defined(__OSX__) + /// Not supported on OSX + parser->setCalculateSrcOfs(true); + #endif fs::path path = resolver->resolve(context.attributes["filename"]); XMLLog(EInfo, "Parsing included file \"%s\" ..", path.filename().c_str()); parser->parse(path.file_string().c_str()); diff --git a/src/mitsuba/mitsuba.cpp b/src/mitsuba/mitsuba.cpp index 753ffe5a..44ea53aa 100644 --- a/src/mitsuba/mitsuba.cpp +++ b/src/mitsuba/mitsuba.cpp @@ -311,7 +311,10 @@ int ubi_main(int argc, char **argv) { parser->setValidationSchemaFullChecking(true); parser->setValidationScheme(SAXParser::Val_Always); parser->setExternalNoNamespaceSchemaLocation(schemaPath.file_string().c_str()); - parser->setCalculateSrcOfs(true); + #if !defined(__OSX__) + /// Not supported on OSX + parser->setCalculateSrcOfs(true); + #endif /* Set the handler */ SceneHandler *handler = new SceneHandler(parser, parameters); diff --git a/src/qtgui/sceneloader.cpp b/src/qtgui/sceneloader.cpp index 8e635973..821def95 100644 --- a/src/qtgui/sceneloader.cpp +++ b/src/qtgui/sceneloader.cpp @@ -74,7 +74,10 @@ void SceneLoader::run() { parser->setValidationSchemaFullChecking(true); parser->setValidationScheme(SAXParser::Val_Always); parser->setExternalNoNamespaceSchemaLocation(schemaPath.file_string().c_str()); - parser->setCalculateSrcOfs(true); + #if !defined(__OSX__) + /// Not supported on OSX + parser->setCalculateSrcOfs(true); + #endif /* Set the SAX handler */ parser->setDoNamespaces(true);