summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins
diff options
context:
space:
mode:
authorStefan Radomski <sradomski@mintwerk.de>2016-02-24 10:50:32 (GMT)
committerStefan Radomski <sradomski@mintwerk.de>2016-02-24 10:50:32 (GMT)
commitcf19f11b8d2bd6d9566c7528fbed40af06928abf (patch)
treea373b8e934fa78a1bf9db8afca2e9854437e45da /src/uscxml/plugins
parent7212d5a3dbbd2845d09df96b2c345132c8a24931 (diff)
downloaduscxml-cf19f11b8d2bd6d9566c7528fbed40af06928abf.zip
uscxml-cf19f11b8d2bd6d9566c7528fbed40af06928abf.tar.gz
uscxml-cf19f11b8d2bd6d9566c7528fbed40af06928abf.tar.bz2
Some more refactoring and VHDL transformation
Diffstat (limited to 'src/uscxml/plugins')
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp2
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp18
-rw-r--r--src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp2
-rw-r--r--src/uscxml/plugins/datamodel/promela/PromelaParser.cpp4
-rw-r--r--src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp34
-rw-r--r--src/uscxml/plugins/element/respond/RespondElement.cpp2
-rw-r--r--src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp8
-rw-r--r--src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp2
8 files changed, 36 insertions, 36 deletions
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
index c23b483..63314e1 100644
--- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
@@ -127,7 +127,7 @@ static int luaInFunction(lua_State * l) {
InterpreterInfo* interpreter = ref.cast<InterpreterInfo*>();
int stackSize = lua_gettop(l);
- for (int i = 0; i < stackSize; i++) {
+ for (size_t i = 0; i < stackSize; i++) {
if (!lua_isstring(l, -1 - i))
continue;
std::string stateName = lua_tostring(l, -1 - i);
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
index 9a59a20..2ec9fea 100644
--- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp
@@ -308,7 +308,7 @@ void SWIDataModel::setEvent(const Event& event) {
paramArray << paramIter->first << "([";
std::string termSep = "";
- for (int j = 0; paramIter != lastValueIter; j++) {
+ for (size_t j = 0; paramIter != lastValueIter; j++) {
paramArray << termSep << "'" << paramIter->second << "'";
termSep = ", ";
paramIter++;
@@ -405,7 +405,7 @@ std::list<PlCompound> SWIDataModel::getSolutions(PlCompound compound) {
std::list<PlCompound> solutions;
PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
+ for (size_t i = 0; i < compound.arity(); i++) {
termv[i] = compound[i + 1];
}
PlQuery query(compound.name(), termv);
@@ -425,7 +425,7 @@ Data SWIDataModel::getStringAsData(const std::string& content) {
Data data;
PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
+ for (size_t i = 0; i < compound.arity(); i++) {
termv[i] = compound[i + 1];
}
PlQuery query(compound.name(), termv);
@@ -460,7 +460,7 @@ Data SWIDataModel::termAsData(PlTerm term) {
switch (term.type()) {
case PL_TERM:
- for (int i = 1; i <= term.arity(); i++) { // arguments start at 1
+ for (size_t i = 1; i <= term.arity(); i++) { // arguments start at 1
data.compound[term.name()] = termAsData(term[i]);
}
break;
@@ -618,7 +618,7 @@ uint32_t SWIDataModel::getLength(const std::string& expr) {
try {
PlCompound compound(expr.c_str());
PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
+ for (size_t i = 0; i < compound.arity(); i++) {
termv[i] = compound[i + 1];
}
PlQuery query(compound.name(), termv);
@@ -639,7 +639,7 @@ void SWIDataModel::setForeach(const std::string& item,
PlCompound compound(array.c_str());
PlCompound orig(array.c_str());
PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
+ for (size_t i = 0; i < compound.arity(); i++) {
termv[i] = compound[i + 1];
}
{
@@ -686,7 +686,7 @@ bool SWIDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, co
try {
PlCompound compound(expr.c_str());
PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
+ for (size_t i = 0; i < compound.arity(); i++) {
termv[i] = compound[i + 1];
}
PlQuery query(compound.name(), termv);
@@ -708,7 +708,7 @@ std::string SWIDataModel::evalAsString(const std::string& expr) {
PlCompound orig(expr.c_str());
PlTermv termv(compound.arity());
- for (int i = 0; i < compound.arity(); i++) {
+ for (size_t i = 0; i < compound.arity(); i++) {
termv[i] = compound[i + 1];
}
PlQuery query(compound.name(), termv);
@@ -760,7 +760,7 @@ std::map<std::string, PlTerm> SWIDataModel::resolveAtoms(PlTerm& term, PlTerm& o
case PL_INTEGER:
break;
case PL_TERM:
- for (int i = 1; i <= orig.arity(); i++) {
+ for (size_t i = 1; i <= orig.arity(); i++) {
PlTerm newTerm = term[i];
PlTerm newOrig = orig[i];
std::map<std::string, PlTerm> result = resolveAtoms(newTerm, newOrig);
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp
index 02df56d..d65e9c7 100644
--- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp
@@ -391,7 +391,7 @@ void PromelaDataModel::evaluateDecl(void* ast) {
int size = dataToInt(evaluateExpr(*opIterAsgn++));
variable.compound["size"] = size;
- for (int i = 0; i < size; i++) {
+ for (size_t i = 0; i < size; i++) {
variable.compound["value"].array.push_back(Data(0, Data::INTERPRETED));
}
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp b/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp
index c07fca2..3467598 100644
--- a/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp
+++ b/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp
@@ -42,7 +42,7 @@ void promela_error (void* yylloc_param, uscxml::PromelaParser* ctx, void* yyscan
excEvent.data.compound["col"] = uscxml::Data(yylloc->first_column, uscxml::Data::VERBATIM);
std::stringstream ssUnderline;
- for (int i = 0; i < yylloc->first_column; i++)
+ for (size_t i = 0; i < yylloc->first_column; i++)
ssUnderline << " ";
ssUnderline << "^";
excEvent.data.compound["sourcemark"] = uscxml::Data(ssUnderline.str(), uscxml::Data::VERBATIM);
@@ -197,7 +197,7 @@ void PromelaParserNode::push(PromelaParserNode* node) {
void PromelaParserNode::dump(int indent) {
std::string padding;
- for (int i = 0; i < indent; i++) {
+ for (size_t i = 0; i < indent; i++) {
padding += " ";
}
std::cout << padding << typeToDesc(type) << ": " << value;
diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
index 3bb22cc..282e8c6 100644
--- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
@@ -269,7 +269,7 @@ Data XPathDataModel::getStringAsData(const std::string& content) {
break;
case NODE_SET:
NodeSet<std::string> ns = result.asNodeSet();
- for (int i = 0; i < ns.size(); i++) {
+ for (size_t i = 0; i < ns.size(); i++) {
ss.str("");
ss << i;
std::string idx = ss.str();
@@ -321,7 +321,7 @@ void XPathDataModel::setForeach(const std::string& item,
#if 0
std::cout << "Array Size: " << arrayResult.asNodeSet().size() << std::endl;
- for (int i = 0; i < arrayResult.asNodeSet().size(); i++) {
+ for (size_t i = 0; i < arrayResult.asNodeSet().size(); i++) {
std::cout << arrayResult.asNodeSet()[i] << std::endl;
}
#endif
@@ -367,7 +367,7 @@ void XPathDataModel::setForeach(const std::string& item,
#if 0
std::cout << _datamodel << std::endl << std::endl;
std::cout << "Index: " << indexResult.asNodeSet().size() << std::endl;
- for (int i = 0; i < indexResult.asNodeSet().size(); i++) {
+ for (size_t i = 0; i < indexResult.asNodeSet().size(); i++) {
std::cout << indexResult.asNodeSet()[i] << std::endl;
}
std::cout << std::endl;
@@ -438,7 +438,7 @@ std::string XPathDataModel::evalAsString(const std::string& expr) {
case NODE_SET: {
NodeSet<std::string> nodeSet = result.asNodeSet();
std::stringstream ss;
- for (int i = 0; i < nodeSet.size(); i++) {
+ for (size_t i = 0; i < nodeSet.size(); i++) {
ss << nodeSet[i];
if (nodeSet[i].getNodeType() != Node_base::TEXT_NODE) {
ss << std::endl;
@@ -477,7 +477,7 @@ void XPathDataModel::assign(const Element<std::string>& assignElem,
#if 0
if (key.type() == NODE_SET) {
try {
- for (int i = 0; i < key.asNodeSet().size(); i++) {
+ for (size_t i = 0; i < key.asNodeSet().size(); i++) {
Node<std::string> node = key.asNodeSet()[i];
if (node == _varResolver.resolveVariable("", "_ioprocessors").asNodeSet()[0])
ERROR_EXECUTION_THROW("Cannot assign _ioProcessors");
@@ -561,7 +561,7 @@ void XPathDataModel::init(const Element<std::string>& dataElem,
XPathValue<std::string> expr = _xpath.evaluate_expr(ATTR(dataElem, "expr"), _doc);
switch (expr.type()) {
case NODE_SET: {
- for (int i = 0; i < expr.asNodeSet().size(); i++) {
+ for (size_t i = 0; i < expr.asNodeSet().size(); i++) {
container.appendChild(expr.asNodeSet()[i].cloneNode(true));
nodeSet.push_back(expr.asNodeSet()[i].cloneNode(true));
}
@@ -654,7 +654,7 @@ void XPathDataModel::assign(const NodeSet<std::string>& key,
const Element<std::string>& assignElem) {
if (key.size() == 0)
return;
- for (int i = 0; i < key.size(); i++) {
+ for (size_t i = 0; i < key.size(); i++) {
Node<std::string> node = key[i];
switch (node.getNodeType()) {
case Node_base::ATTRIBUTE_NODE: {
@@ -710,7 +710,7 @@ void XPathDataModel::assign(const NodeSet<std::string>& key,
if (value.size() == 0 || !value[0])
return;
- for (int i = 0; i < key.size(); i++) {
+ for (size_t i = 0; i < key.size(); i++) {
switch (key[i].getNodeType())
case Node_base::ELEMENT_NODE: {
assign(Element<std::string>(key[i]), value, assignElem);
@@ -733,13 +733,13 @@ void XPathDataModel::assign(const Element<std::string>& key,
if (false) {
} else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "firstchild")) {
// firstchild: Insert the value specified by 'expr' before all of the children at 'location'.
- for (int i = value.size(); i; i--) {
+ for (size_t i = value.size(); i; i--) {
Node<std::string> importedNode = (value[i-1].getOwnerDocument() == _doc ? value[i-1].cloneNode(true) : _doc.importNode(value[i-1], true));
element.insertBefore(importedNode, element.getFirstChild());
}
} else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "lastchild")) {
// lastchild: Insert the value specified by 'expr' after all of the children at 'location'.
- for (int i = 0; i < value.size(); i++) {
+ for (size_t i = 0; i < value.size(); i++) {
Node<std::string> importedNode = (value[i].getOwnerDocument() == _doc ? value[i].cloneNode(true) : _doc.importNode(value[i], true));
element.appendChild(importedNode);
}
@@ -749,7 +749,7 @@ void XPathDataModel::assign(const Element<std::string>& key,
Node<std::string> parent = element.getParentNode();
if (!parent)
ERROR_EXECUTION_THROW("Node has no parent");
- for (int i = 0; i < value.size(); i++) {
+ for (size_t i = 0; i < value.size(); i++) {
Node<std::string> importedNode = (value[i].getOwnerDocument() == _doc ? value[i].cloneNode(true) : _doc.importNode(value[i], true));
parent.insertBefore(importedNode, element);
}
@@ -759,7 +759,7 @@ void XPathDataModel::assign(const Element<std::string>& key,
Node<std::string> parent = element.getParentNode();
if (!parent)
ERROR_EXECUTION_THROW("Node has no parent");
- for (int i = value.size(); i; i--) {
+ for (size_t i = value.size(); i; i--) {
Node<std::string> importedNode = (value[i-1].getOwnerDocument() == _doc ? value[i-1].cloneNode(true) : _doc.importNode(value[i-1], true));
Node<std::string> nextSibling = element.getNextSibling();
if (nextSibling) {
@@ -787,7 +787,7 @@ void XPathDataModel::assign(const Element<std::string>& key,
// replacechildren: Replace all the children at 'location' with the value specified by 'expr'.
while(element.hasChildNodes())
element.removeChild(element.getChildNodes().item(0));
- for (int i = 0; i < value.size(); i++) {
+ for (size_t i = 0; i < value.size(); i++) {
Node<std::string> importedNode = element.getOwnerDocument().importNode(value[i], true);
element.appendChild(importedNode);
}
@@ -803,7 +803,7 @@ NodeSetVariableResolver::resolveVariable(const std::string& namepaceUri,
}
#if VERBOSE
std::cout << std::endl << "Getting " << name << ":" << std::endl;
- for (int i = 0; i < n->second.size(); i++) {
+ for (size_t i = 0; i < n->second.size(); i++) {
std::cout << n->second[i].getNodeType() << " | " << n->second[i] << std::endl;
}
std::cout << std::endl;
@@ -814,7 +814,7 @@ NodeSetVariableResolver::resolveVariable(const std::string& namepaceUri,
void NodeSetVariableResolver::setVariable(const std::string& name, const NodeSet<std::string>& value) {
#if VERBOSE
std::cout << std::endl << "Setting " << name << ":" << std::endl;
- for (int i = 0; i < value.size(); i++) {
+ for (size_t i = 0; i < value.size(); i++) {
std::cout << value[i].getNodeType() << " | " << value[i] << std::endl;
}
std::cout << std::endl;
@@ -824,7 +824,7 @@ void NodeSetVariableResolver::setVariable(const std::string& name, const NodeSet
std::map<std::string, Arabica::XPath::NodeSet<std::string> >::iterator varIter = _variables.begin();
while (varIter != _variables.end()) {
std::cout << varIter->first << ":" << std::endl;
- for (int i = 0; i < varIter->second.size(); i++) {
+ for (size_t i = 0; i < varIter->second.size(); i++) {
std::cout << varIter->second[i].getNodeType() << " | " << varIter->second[i] << std::endl;
}
varIter++;
@@ -861,7 +861,7 @@ std::vector<std::pair<std::string, std::string> > XPathFunctionResolver::validNa
bool XPathFunctionIn::doEvaluate(const Node<std::string>& context,
const ExecutionContext<std::string>& executionContext) const {
- for (int i = 0; i < argCount(); i++) {
+ for (size_t i = 0; i < argCount(); i++) {
XPathValue<std::string> stateName = arg(i, context, executionContext);
if (stateName.type() == STRING) {
if (_interpreter->isInState(stateName.asString())) {
diff --git a/src/uscxml/plugins/element/respond/RespondElement.cpp b/src/uscxml/plugins/element/respond/RespondElement.cpp
index 65babd7..032f74e 100644
--- a/src/uscxml/plugins/element/respond/RespondElement.cpp
+++ b/src/uscxml/plugins/element/respond/RespondElement.cpp
@@ -144,7 +144,7 @@ void RespondElement::enterElement(const Arabica::DOM::Element<std::string>& node
// process headers
Arabica::XPath::NodeSet<std::string> headers = DOMUtils::filterChildElements(_interpreter->getNameSpaceInfo().getXMLPrefixForNS(getNamespace()) + "header", node);
- for (int i = 0; i < headers.size(); i++) {
+ for (size_t i = 0; i < headers.size(); i++) {
Arabica::DOM::Element<std::string> headerElem = Arabica::DOM::Element<std::string>(headers[i]);
std::string name;
diff --git a/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp b/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp
index 5833e2b..3aaeddf 100644
--- a/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp
+++ b/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp
@@ -96,12 +96,12 @@ OpenALPlayer::~OpenALPlayer() {
if (alIsSource(_alId)) {
throw std::runtime_error("openal source id still valid");
}
- for (int i = 0; i < _nrBuffers; i++) {
+ for (size_t i = 0; i < _nrBuffers; i++) {
assert(alIsBuffer(_bufferIds[i]));
free(_buffers[i]);
}
alDeleteBuffers(_nrBuffers, _bufferIds);
- for (int i = 0; i < _nrBuffers; i++) {
+ for (size_t i = 0; i < _nrBuffers; i++) {
// assert(!alIsBuffer(_bufferIds[i]));
}
free(_buffers);
@@ -134,7 +134,7 @@ void OpenALPlayer::init() {
_buffers = (char**)malloc(_nrBuffers * sizeof(char*));
_bufferIds = (ALuint*)malloc(_nrBuffers * sizeof(ALuint));
- for (int i = 0; i < _nrBuffers; i++) {
+ for (size_t i = 0; i < _nrBuffers; i++) {
_buffers[i] = 0; //(char*)malloc(_bufferSize);
}
@@ -384,7 +384,7 @@ void OpenALPlayer::updateBuffers() {
alSourceUnqueueBuffers(_alId, processed, bufferIds);
checkOpenALError(__LINE__);
- for (int id = 0; id < processed; id++) {
+ for (size_t id = 0; id < processed; id++) {
int bufferIdx = bufferIndex(bufferIds[id]);
// refill the buffer with data from the callback
diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp
index 5e2d8eb..f67e58f 100644
--- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp
+++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp
@@ -95,7 +95,7 @@ void FFMPEGInvoker::invoke(const InvokeRequest& req) {
Event::getParam(req.params, "threads", nrThreads);
_isRunning = true;
- for (int i = 0; i < nrThreads; i++) {
+ for (size_t i = 0; i < nrThreads; i++) {
_threads.insert(new tthread::thread(FFMPEGInvoker::run, this));
}
}