You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2017/09/05 19:39:51 UTC

qpid-proton git commit: PROTON-1572: Fix CppCheck warnings

Repository: qpid-proton
Updated Branches:
  refs/heads/master cf5841a71 -> d3f92738c


PROTON-1572: Fix CppCheck warnings


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d3f92738
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d3f92738
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d3f92738

Branch: refs/heads/master
Commit: d3f92738ca28ba66c12fd1caa0707490e1911192
Parents: cf5841a
Author: Jiri Danek <jd...@redhat.com>
Authored: Mon Sep 4 21:39:11 2017 +0200
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Sep 5 15:34:38 2017 -0400

----------------------------------------------------------------------
 examples/cpp/ssl.cpp                      | 2 +-
 proton-c/src/proactor/libuv.c             | 5 ++++-
 proton-c/src/proactor/proactor-internal.h | 2 +-
 proton-c/src/tests/test_handler.h         | 1 +
 4 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3f92738/examples/cpp/ssl.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/ssl.cpp b/examples/cpp/ssl.cpp
index 32eaca7..388f05b 100644
--- a/examples/cpp/ssl.cpp
+++ b/examples/cpp/ssl.cpp
@@ -136,7 +136,7 @@ class hello_world_direct : public proton::messaging_handler {
 
     void on_transport_error(proton::transport &t) OVERRIDE {
         std::string err = t.error().what();
-        if (err.find("certificate")) {
+        if (err.find("certificate") != std::string::npos) {
             verify_failed = true;
             throw example_cert_error(err);
         }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3f92738/proton-c/src/proactor/libuv.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/libuv.c b/proton-c/src/proactor/libuv.c
index c70dbe7..94653c9 100644
--- a/proton-c/src/proactor/libuv.c
+++ b/proton-c/src/proactor/libuv.c
@@ -1178,8 +1178,11 @@ static void work_free(work_t *w) {
 pn_proactor_t *pn_proactor() {
   pn_proactor_t *p = (pn_proactor_t*)calloc(1, sizeof(pn_proactor_t));
   p->collector = pn_collector();
+  if (!p->collector) {
+    free(p);
+    return NULL;
+  }
   p->batch.next_event = &proactor_batch_next;
-  if (!p->collector) return NULL;
   uv_loop_init(&p->loop);
   uv_mutex_init(&p->lock);
   uv_cond_init(&p->cond);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3f92738/proton-c/src/proactor/proactor-internal.h
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/proactor-internal.h b/proton-c/src/proactor/proactor-internal.h
index 5307a45..7cc7363 100644
--- a/proton-c/src/proactor/proactor-internal.h
+++ b/proton-c/src/proactor/proactor-internal.h
@@ -46,6 +46,6 @@ extern const char *PNI_IO_CONDITION;
  * Format a proactor error condition with message "<what> (<host>:<port>): <msg>"
  */
 void pni_proactor_set_cond(
-  pn_condition_t *cond, const char *what, const char *msg, const char *host, const char *port);
+  pn_condition_t *cond, const char *what, const char *host, const char *port, const char *msg);
 
 #endif // PROACTOR_NETADDR_INTERNAL_H

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d3f92738/proton-c/src/tests/test_handler.h
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/test_handler.h b/proton-c/src/tests/test_handler.h
index 467f6d8..7bdab89 100644
--- a/proton-c/src/tests/test_handler.h
+++ b/proton-c/src/tests/test_handler.h
@@ -87,6 +87,7 @@ void test_etypes_expect_(test_t *t, pn_event_type_t *etypes, size_t size, const
     }
     fprintf(stderr, "\n");
   }
+  va_end(ap);
 }
 
 #define TEST_HANDLER_EXPECT(TH, ...) do {                               \


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org