SINGA-21 Code review 3

fix a bug in Msg::ParseFormatFrame().


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/d0438b42
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/d0438b42
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/d0438b42

Branch: refs/heads/master
Commit: d0438b42c9649a480789b5cbd1bdc4dfabf2b63e
Parents: 04b24e7
Author: Wei Wang <[email protected]>
Authored: Tue Aug 18 21:59:26 2015 +0800
Committer: Wei Wang <[email protected]>
Committed: Tue Aug 18 21:59:26 2015 +0800

----------------------------------------------------------------------
 src/communication/msg.cc | 2 +-
 src/test/test_cluster.cc | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0438b42/src/communication/msg.cc
----------------------------------------------------------------------
diff --git a/src/communication/msg.cc b/src/communication/msg.cc
index 41a8ecc..21d11bb 100644
--- a/src/communication/msg.cc
+++ b/src/communication/msg.cc
@@ -170,8 +170,8 @@ int Msg::ParseFormatFrame(const char *format, ...) {
       size += sizeof(*x);
     } else if (*format == 's') {
       char* x = va_arg(argptr, char *);
-      int len = strlen(src + size);
       CHECK_EQ(src[size++], 's');
+      int len = strlen(src + size);
       memcpy(x, src + size, len);
       x[len] = 0;
       size += len + 1;

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0438b42/src/test/test_cluster.cc
----------------------------------------------------------------------
diff --git a/src/test/test_cluster.cc b/src/test/test_cluster.cc
index a51126d..cfda3b4 100644
--- a/src/test/test_cluster.cc
+++ b/src/test/test_cluster.cc
@@ -8,7 +8,7 @@ std::string host = "localhost:2181";
 void zk_cb(void *contest) {
   LOG(INFO) << "zk callback: " << static_cast<char *>(contest);
 }
-
+/*
 TEST(CluserRuntimeTest, GroupManagement) {
   ClusterRuntime* rt = new ZKClusterRT(host);
   ASSERT_EQ(rt->Init(), true);
@@ -34,7 +34,6 @@ TEST(CluserRuntimeTest, ProcessManagement) {
   delete rt;
 }
 
-/**
 ClusterProto GenClusterProto(){
   ClusterProto proto;
   int nworker=6, nserver=4;

Reply via email to