From 320d3750c508752337e95d9d2ff67f31d7675023 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Mar 2012 09:11:20 +0100 Subject: Update Tasks directly in the tasklist, not just local copies. --- src/task_proto.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/task_proto.cc b/src/task_proto.cc index 39232dd..10cfe35 100644 --- a/src/task_proto.cc +++ b/src/task_proto.cc @@ -98,7 +98,7 @@ int callback_lws_task(struct libwebsocket_context * context, std::string init_str; TaskList::iterator it; for(it = tasklist.begin(); it != tasklist.end(); it++) { - task_t t = *it; + task_t &t = *it; sprintf(buf, "add %d %s %s %d %d;", t.id, t.title.c_str(), t.desc.c_str(), t.x, t.y); @@ -180,8 +180,8 @@ int callback_lws_task(struct libwebsocket_context * context, case cmd::add: { printf("Handling add cmd:\n"); - task_t t =create_task(m.add.title, m.add.desc, - m.add.x, m.add.y); + task_t t = create_task(m.add.title, m.add.desc, + m.add.x, m.add.y); tasklist.push_back(t); buf_len = sprintf(buf, "add %d %s %s %d %d;", t.id, t.title.c_str(), t.desc.c_str(), @@ -197,7 +197,7 @@ int callback_lws_task(struct libwebsocket_context * context, bool id_found = false; TaskList::iterator it; for(it = tasklist.begin(); it != tasklist.end(); it++) { - task_t t = *it; + task_t &t = *it; if(t.id == m.del.id) { id_found = true; tasklist.erase(it); @@ -224,7 +224,7 @@ int callback_lws_task(struct libwebsocket_context * context, int x = m.move.x / 300 * 300; for(it = tasklist.begin(); it != tasklist.end(); it++) { - task_t t = *it; + task_t &t = *it; if(t.id == m.move.id) { id_found = true; t.x = x; -- cgit v1.2.3 From 27c945b501562d8261eddf8dc7754ea9c2d1f502 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 2 Mar 2012 09:01:18 +0100 Subject: Fix signed/unsigned comparison mismatch. --- src/msgparser.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msgparser.cc b/src/msgparser.cc index c05a9ee..68de487 100644 --- a/src/msgparser.cc +++ b/src/msgparser.cc @@ -88,7 +88,7 @@ MsgVector parse_msg(std::string data) { std::string token; bool inside_quote = false; char prev_ch = '0'; - for(int i = 0; i < data.length(); i++) { + for(size_t i = 0; i < data.length(); i++) { char ch = data[i]; switch(ch) { -- cgit v1.2.3