diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-23 10:50:59 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-05-23 10:50:59 (GMT) |
commit | 9f3dfcd9982cff90cf0466413d17fc1061c43f00 (patch) | |
tree | e29d0f70ecdfb742e3bbbc522e87281c8bbd58e7 /src/uscxml/plugins/datamodel/ecmascript | |
parent | 216e8efb0f1aff9afd3881ab89b49e017e255228 (diff) | |
download | uscxml-9f3dfcd9982cff90cf0466413d17fc1061c43f00.zip uscxml-9f3dfcd9982cff90cf0466413d17fc1061c43f00.tar.gz uscxml-9f3dfcd9982cff90cf0466413d17fc1061c43f00.tar.bz2 |
Fixed the 100% CPU utilization bug and replaced the bool() cast operator for data by empty()
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript')
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp | 4 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index a064394..a6909b5 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -222,7 +222,7 @@ void JSCDataModel::setEvent(const Event& event) { } else if (event.content.length() > 0) { // _event.data is a string or JSON Data json = Data::fromJSON(event.content); - if (json) { + if (!json.empty()) { JSStringRef propName = JSStringCreateWithUTF8CString("data"); JSObjectSetProperty(_ctx, eventObj, propName, getDataAsValue(json), 0, &exception); JSStringRelease(propName); @@ -255,7 +255,7 @@ void JSCDataModel::setEvent(const Event& event) { nameListIter++; } } - if (eventCopy.data > 0) { + if (!eventCopy.data.empty()) { JSStringRef propName = JSStringCreateWithUTF8CString("data"); JSObjectSetProperty(_ctx, eventObj, propName, getDataAsValue(eventCopy.data), 0, &exception); JSStringRelease(propName); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index ec9557e..2bdd796 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -233,7 +233,7 @@ void V8DataModel::setEvent(const Event& event) { } else if (event.content.length() > 0) { // _event.data is a string or JSON Data json = Data::fromJSON(event.content); - if (json) { + if (!json.empty()) { eventObj->Set(v8::String::New("data"), getDataAsValue(json)); } else { eventObj->Set(v8::String::New("data"), v8::String::New(InterpreterImpl::spaceNormalize(event.content).c_str())); @@ -255,7 +255,7 @@ void V8DataModel::setEvent(const Event& event) { nameListIter++; } } - if (eventCopy.data) { + if (!eventCopy.data.empty()) { // std::cout << Data::toJSON(eventCopy.data); eventObj->Set(v8::String::New("data"), getDataAsValue(eventCopy.data)); // set data part of _event } else { |