summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AtomReader.cpp6
-rw-r--r--src/AtomWriter.cpp12
-rw-r--r--src/gui/ConnectWindow.cpp2
-rw-r--r--src/server/Event.hpp4
-rw-r--r--src/server/EventWriter.cpp2
5 files changed, 9 insertions, 17 deletions
diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp
index 2f3cf695..ca083497 100644
--- a/src/AtomReader.cpp
+++ b/src/AtomReader.cpp
@@ -134,11 +134,7 @@ AtomReader::write(const LV2_Atom* msg)
const int32_t seq_id = ((number && number->type == _uris.atom_Int)
? ((const LV2_Atom_Int*)number)->body
: 0);
- if (seq_id) {
- _iface.set_response_id(seq_id);
- } else {
- _iface.set_response_id(-1);
- }
+ _iface.set_response_id(seq_id);
if (obj->body.otype == _uris.patch_Get) {
_iface.get(Raul::URI(subject_uri));
diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp
index 99cd1492..78e54ffa 100644
--- a/src/AtomWriter.cpp
+++ b/src/AtomWriter.cpp
@@ -48,7 +48,7 @@ AtomWriter::AtomWriter(URIMap& map, URIs& uris, AtomSink& sink)
: _map(map)
, _uris(uris)
, _sink(sink)
- , _id(1)
+ , _id(0)
{
_out.buf = NULL;
_out.len = 0;
@@ -67,11 +67,7 @@ AtomWriter::finish_msg()
int32_t
AtomWriter::next_id()
{
- if (_id == -1) {
- return 0;
- } else {
- return ++_id;
- }
+ return _id ? ++_id : 0;
}
void
@@ -126,7 +122,7 @@ AtomWriter::forge_request(LV2_Atom_Forge_Frame* frame, LV2_URID type)
lv2_atom_forge_object(&_forge, frame, 0, type);
const int32_t id = next_id();
- if (id != 0) {
+ if (id) {
lv2_atom_forge_key(&_forge, _uris.patch_sequenceNumber);
lv2_atom_forge_int(&_forge, id);
}
@@ -289,7 +285,7 @@ AtomWriter::get(const Raul::URI& uri)
void
AtomWriter::response(int32_t id, Status status, const std::string& subject)
{
- if (id == -1) {
+ if (!id) {
return;
}
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 6c1b5827..fd85316c 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -452,7 +452,7 @@ ConnectWindow::gtk_callback()
_progress_label->set_text("Connected to engine");
_connect_stage = 0; // set ourselves up for next time (if there is one)
_finished_connecting = true;
- _app->interface()->set_response_id(-1);
+ _app->interface()->set_response_id(0);
return false; // deregister this callback
}
diff --git a/src/server/Event.hpp b/src/server/Event.hpp
index 21af45c5..29a20c18 100644
--- a/src/server/Event.hpp
+++ b/src/server/Event.hpp
@@ -94,7 +94,7 @@ protected:
explicit Event(Engine& engine)
: _engine(engine)
, _next(NULL)
- , _request_id(-1)
+ , _request_id(0)
, _time(0)
, _status(Status::NOT_PREPARED)
{}
@@ -116,7 +116,7 @@ protected:
/** Respond to the originating client. */
inline Status respond() {
- if (_request_client) {
+ if (_request_client && _request_id) {
_request_client->response(_request_id, _status, _err_subject);
}
return _status;
diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp
index 60096d85..8508fab3 100644
--- a/src/server/EventWriter.cpp
+++ b/src/server/EventWriter.cpp
@@ -27,7 +27,7 @@ namespace Server {
EventWriter::EventWriter(Engine& engine)
: _engine(engine)
- , _request_id(-1)
+ , _request_id(0)
{
}