diff options
author | Stefan Radomski <github@mintwerk.de> | 2017-01-23 22:31:54 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2017-01-23 22:31:54 (GMT) |
commit | 24ac6c39a89f5b94ede80b745f68ea5f0b762640 (patch) | |
tree | 2a32c53a43caab1358cf9b66ff3bb0819c3d1b60 /src/uscxml/plugins | |
parent | b8a20c656537e4be748c3485d2c9541bd51e2b3d (diff) | |
download | uscxml-24ac6c39a89f5b94ede80b745f68ea5f0b762640.zip uscxml-24ac6c39a89f5b94ede80b745f68ea5f0b762640.tar.gz uscxml-24ac6c39a89f5b94ede80b745f68ea5f0b762640.tar.bz2 |
Made GCC/CLang pedantic and fixed warnings
Diffstat (limited to 'src/uscxml/plugins')
-rw-r--r-- | src/uscxml/plugins/ExecutableContentImpl.h | 1 | ||||
-rw-r--r-- | src/uscxml/plugins/Factory.h | 6 | ||||
-rw-r--r-- | src/uscxml/plugins/IOProcessor.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/Invoker.h | 2 | ||||
-rw-r--r-- | src/uscxml/plugins/InvokerImpl.h | 22 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp | 37 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp | 40 |
7 files changed, 62 insertions, 48 deletions
diff --git a/src/uscxml/plugins/ExecutableContentImpl.h b/src/uscxml/plugins/ExecutableContentImpl.h index 3f987bb..f186e84 100644 --- a/src/uscxml/plugins/ExecutableContentImpl.h +++ b/src/uscxml/plugins/ExecutableContentImpl.h @@ -27,6 +27,7 @@ #include <sstream> namespace XERCESC_NS { +class DOMElement; class DOMDocument; class DOMNode; } diff --git a/src/uscxml/plugins/Factory.h b/src/uscxml/plugins/Factory.h index 50df6ed..48bfae8 100644 --- a/src/uscxml/plugins/Factory.h +++ b/src/uscxml/plugins/Factory.h @@ -44,7 +44,7 @@ class DataModelCallbacks; class InvokerImpl; class InvokerCallbacks; class ExecutableContentImpl; - + class USCXML_API Factory { public: Factory(Factory* parentFactory); @@ -53,7 +53,7 @@ public: void registerIOProcessor(IOProcessorImpl* ioProcessor); void registerDataModel(DataModelImpl* dataModel); void registerInvoker(InvokerImpl* invoker); - void registerExecutableContent(ExecutableContentImpl* executableContent); + void registerExecutableContent(ExecutableContentImpl* executableContent); std::shared_ptr<DataModelImpl> createDataModel(const std::string& type, DataModelCallbacks* callbacks); std::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, IOProcessorCallbacks* callbacks); @@ -83,7 +83,7 @@ protected: std::map<std::string, std::string> _invokerAliases; std::map<std::pair<std::string, std::string>, ExecutableContentImpl*> _executableContent; - + #ifdef BUILD_AS_PLUGINS pluma::Pluma pluma; #endif diff --git a/src/uscxml/plugins/IOProcessor.h b/src/uscxml/plugins/IOProcessor.h index c2b6e30..55c7109 100644 --- a/src/uscxml/plugins/IOProcessor.h +++ b/src/uscxml/plugins/IOProcessor.h @@ -37,7 +37,7 @@ class InterpreterImpl; class USCXML_API IOProcessor : public EventHandler { public: - PIMPL_OPERATORS_INHERIT(IOProcessor, EventHandler); + PIMPL_OPERATORS_INHERIT(IOProcessor, EventHandler) /// @copydoc IOProcessorImpl::eventFromSCXML virtual void eventFromSCXML(const std::string& target, const Event& event); diff --git a/src/uscxml/plugins/Invoker.h b/src/uscxml/plugins/Invoker.h index bb01ddd..c61900e 100644 --- a/src/uscxml/plugins/Invoker.h +++ b/src/uscxml/plugins/Invoker.h @@ -42,7 +42,7 @@ class InvokerImpl; */ class USCXML_API Invoker : public EventHandler { public: - PIMPL_OPERATORS_INHERIT(Invoker, EventHandler); + PIMPL_OPERATORS_INHERIT(Invoker, EventHandler) /// @copydoc InvokerImpl::invoke virtual void invoke(const std::string& source, const Event& invokeEvent); diff --git a/src/uscxml/plugins/InvokerImpl.h b/src/uscxml/plugins/InvokerImpl.h index 9d159a8..96a6492 100644 --- a/src/uscxml/plugins/InvokerImpl.h +++ b/src/uscxml/plugins/InvokerImpl.h @@ -29,9 +29,9 @@ #include <set> namespace XERCESC_NS { - class DOMElement; - class DOMDocument; - class DOMNode; +class DOMElement; +class DOMDocument; +class DOMNode; } namespace uscxml { @@ -40,7 +40,7 @@ class Interpreter; class InterpreterMonitor; class ActionLanguage; class Logger; - + /** * @ingroup invoker * @ingroup callback @@ -48,13 +48,13 @@ class Logger; */ class USCXML_API InvokerCallbacks { public: - virtual ~InvokerCallbacks() {} ///< silence virtual destructor warning from swig - virtual void enqueueInternal(const Event& event) = 0; - virtual void enqueueExternal(const Event& event) = 0; - virtual ActionLanguage getActionLanguage() = 0; - virtual std::set<InterpreterMonitor*> getMonitors() = 0; - virtual std::string getBaseURL() = 0; - virtual Logger getLogger() = 0; + virtual ~InvokerCallbacks() {} ///< silence virtual destructor warning from swig + virtual void enqueueInternal(const Event& event) = 0; + virtual void enqueueExternal(const Event& event) = 0; + virtual ActionLanguage getActionLanguage() = 0; + virtual std::set<InterpreterMonitor*> getMonitors() = 0; + virtual std::string getBaseURL() = 0; + virtual Logger getLogger() = 0; }; /** diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index bcde9c9..5ce6128 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -28,6 +28,8 @@ #include "uscxml/util/DOM.h" #include "uscxml/interpreter/Logging.h" +#include <vector> +#include <string> #include <boost/algorithm/string.hpp> #define EVENT_STRING_OR_UNDEF(field, cond) \ @@ -451,14 +453,15 @@ JSValueRef JSCDataModel::getDataAsValue(const Data& data) { return value; } if (data.array.size() > 0) { - JSValueRef elements[data.array.size()]; + std::vector<JSValueRef> elements(data.array.size()); +// JSValueRef elements[data.array.size()]; std::list<Data>::const_iterator arrayIter = data.array.begin(); uint32_t index = 0; while(arrayIter != data.array.end()) { elements[index++] = getDataAsValue(*arrayIter); arrayIter++; } - JSObjectRef value = JSObjectMakeArray(_ctx, data.array.size(), elements, &exception); + JSObjectRef value = JSObjectMakeArray(_ctx, data.array.size(), &elements[0], &exception); if (exception) handleException(exception); return value; @@ -736,8 +739,10 @@ void JSCDataModel::init(const std::string& location, const Data& data, const std void JSCDataModel::handleException(JSValueRef exception) { JSStringRef exceptionStringRef = JSValueToStringCopy(_ctx, exception, NULL); size_t maxSize = JSStringGetMaximumUTF8CStringSize(exceptionStringRef); - char buffer[maxSize]; - JSStringGetUTF8CString(exceptionStringRef, buffer, maxSize); +// char buffer[maxSize]; + std::string buffer; + buffer.resize(maxSize); + JSStringGetUTF8CString(exceptionStringRef, &buffer[0], maxSize); JSStringRelease(exceptionStringRef); std::string exceptionMsg(buffer); @@ -799,8 +804,10 @@ bool JSCDataModel::jsIOProcessorHasProp(JSContextRef ctx, JSObjectRef object, JS std::map<std::string, IOProcessor> ioProcessors = INSTANCE->_callbacks->getIOProcessors(); size_t maxSize = JSStringGetMaximumUTF8CStringSize(propertyName); - char buffer[maxSize]; - JSStringGetUTF8CString(propertyName, buffer, maxSize); +// char buffer[maxSize]; + std::string buffer; + buffer.resize(maxSize); + JSStringGetUTF8CString(propertyName, &buffer[0], maxSize); std::string prop(buffer); return ioProcessors.find(prop) != ioProcessors.end(); @@ -811,8 +818,10 @@ JSValueRef JSCDataModel::jsIOProcessorGetProp(JSContextRef ctx, JSObjectRef obje std::map<std::string, IOProcessor> ioProcessors = INSTANCE->_callbacks->getIOProcessors(); size_t maxSize = JSStringGetMaximumUTF8CStringSize(propertyName); - char buffer[maxSize]; - JSStringGetUTF8CString(propertyName, buffer, maxSize); +// char buffer[maxSize]; + std::string buffer; + buffer.resize(maxSize); + JSStringGetUTF8CString(propertyName, &buffer[0], maxSize); std::string prop(buffer); if (ioProcessors.find(prop) != ioProcessors.end()) { @@ -839,8 +848,10 @@ bool JSCDataModel::jsInvokerHasProp(JSContextRef ctx, JSObjectRef object, JSStri std::map<std::string, Invoker> invokers = INSTANCE->_callbacks->getInvokers(); size_t maxSize = JSStringGetMaximumUTF8CStringSize(propertyName); - char buffer[maxSize]; - JSStringGetUTF8CString(propertyName, buffer, maxSize); +// char buffer[maxSize]; + std::string buffer; + buffer.resize(maxSize); + JSStringGetUTF8CString(propertyName, &buffer[0], maxSize); std::string prop(buffer); return invokers.find(prop) != invokers.end(); @@ -851,8 +862,10 @@ JSValueRef JSCDataModel::jsInvokerGetProp(JSContextRef ctx, JSObjectRef object, std::map<std::string, Invoker> invokers = INSTANCE->_callbacks->getInvokers(); size_t maxSize = JSStringGetMaximumUTF8CStringSize(propertyName); - char buffer[maxSize]; - JSStringGetUTF8CString(propertyName, buffer, maxSize); +// char buffer[maxSize]; + std::string buffer; + buffer.resize(maxSize); + JSStringGetUTF8CString(propertyName, &buffer[0], maxSize); std::string prop(buffer); if (invokers.find(prop) != invokers.end()) { diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index e776022..44b975e 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -176,30 +176,30 @@ void USCXMLInvoker::invoke(const std::string& source, const Event& invokeEvent) if (_invokedInterpreter) { _invokedInterpreter.getImpl()->_parentQueue = _parentQueue; _invokedInterpreter.getImpl()->_invokeId = invokeEvent.invokeid; - - // test240 assumes that invoke request params will carry over to the datamodel + + // test240 assumes that invoke request params will carry over to the datamodel _invokedInterpreter.getImpl()->_invokeReq = invokeEvent; // create new instances from the parent's ActionLanguage InterpreterImpl* invoked = _invokedInterpreter.getImpl().get(); - ActionLanguage al = _callbacks->getActionLanguage(); - - al.execContent = al.execContent.getImpl()->create(invoked); - al.delayQueue = al.delayQueue.getImplDelayed()->create(invoked); - al.internalQueue = al.internalQueue.getImplBase()->create(); - al.externalQueue = al.externalQueue.getImplBase()->create(); - al.microStepper = al.microStepper.getImpl()->create(invoked); - - _invokedInterpreter.setActionLanguage(al); - // TODO: setup invokers dom, check datamodel attribute and create new instance from parent if matching? - - // copy monitors - std::set<InterpreterMonitor*> monitors = _callbacks->getMonitors(); - for (auto monitor : monitors) { - if (monitor->copyToInvokers()) { - _invokedInterpreter.getImpl()->_monitors.insert(monitor); - } - } + ActionLanguage al = _callbacks->getActionLanguage(); + + al.execContent = al.execContent.getImpl()->create(invoked); + al.delayQueue = al.delayQueue.getImplDelayed()->create(invoked); + al.internalQueue = al.internalQueue.getImplBase()->create(); + al.externalQueue = al.externalQueue.getImplBase()->create(); + al.microStepper = al.microStepper.getImpl()->create(invoked); + + _invokedInterpreter.setActionLanguage(al); + // TODO: setup invokers dom, check datamodel attribute and create new instance from parent if matching? + + // copy monitors + std::set<InterpreterMonitor*> monitors = _callbacks->getMonitors(); + for (auto monitor : monitors) { + if (monitor->copyToInvokers()) { + _invokedInterpreter.getImpl()->_monitors.insert(monitor); + } + } _isActive = true; |