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 2016/06/02 06:48:52 UTC
qpid-proton git commit: PROTON-1222: Small fixes for bugs spotted by
Coverity
Repository: qpid-proton
Updated Branches:
refs/heads/master 5cd3d4ee5 -> da8b50a65
PROTON-1222: Small fixes for bugs spotted by Coverity
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/da8b50a6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/da8b50a6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/da8b50a6
Branch: refs/heads/master
Commit: da8b50a65b246866436fbc4dc5988299a8fc7ec6
Parents: 5cd3d4e
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Jun 2 02:47:55 2016 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Jun 2 02:47:55 2016 -0400
----------------------------------------------------------------------
examples/cpp/flow_control.cpp | 2 +-
examples/cpp/mt/epoll_container.cpp | 2 +-
proton-c/bindings/cpp/src/codec_test.cpp | 3 +--
proton-c/bindings/cpp/src/ssl_domain.cpp | 11 ++++++-----
proton-c/src/codec/encoder.c | 1 +
proton-c/src/messenger/transform.c | 1 +
proton-c/src/tests/object.c | 2 +-
7 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/da8b50a6/examples/cpp/flow_control.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/flow_control.cpp b/examples/cpp/flow_control.cpp
index 2eedd65..24776d7 100644
--- a/examples/cpp/flow_control.cpp
+++ b/examples/cpp/flow_control.cpp
@@ -89,7 +89,7 @@ class flow_receiver : public proton::messaging_handler {
int received;
flow_sender &sender;
- flow_receiver(flow_sender &s) : stage(0), sender(s) {}
+ flow_receiver(flow_sender &s) : stage(0), received(0), sender(s) {}
void example_setup(int n) {
received = 0;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/da8b50a6/examples/cpp/mt/epoll_container.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/mt/epoll_container.cpp b/examples/cpp/mt/epoll_container.cpp
index fe516e9..feea300 100644
--- a/examples/cpp/mt/epoll_container.cpp
+++ b/examples/cpp/mt/epoll_container.cpp
@@ -284,7 +284,7 @@ class pollable_engine : public pollable {
uint32_t work(uint32_t events) {
try {
- bool can_read = events & EPOLLIN, can_write = events && EPOLLOUT;
+ bool can_read = events & EPOLLIN, can_write = events & EPOLLOUT;
do {
can_write = can_write && write();
can_read = can_read && read();
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/da8b50a6/proton-c/bindings/cpp/src/codec_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/codec_test.cpp b/proton-c/bindings/cpp/src/codec_test.cpp
index 5b8d560..b2b40ac 100644
--- a/proton-c/bindings/cpp/src/codec_test.cpp
+++ b/proton-c/bindings/cpp/src/codec_test.cpp
@@ -99,8 +99,7 @@ int main(int, char**) {
// value and scalar types, more tests in value_test and scalar_test.
RUN_TEST(failed, simple_type_test(value("foo")));
- value v(23); // Make sure we can take a non-const ref also
- RUN_TEST(failed, simple_type_test(v));
+ RUN_TEST(failed, value v(23); simple_type_test(v));
RUN_TEST(failed, simple_type_test(scalar(23)));
RUN_TEST(failed, simple_type_test(annotation_key(42)));
RUN_TEST(failed, simple_type_test(message_id(42)));
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/da8b50a6/proton-c/bindings/cpp/src/ssl_domain.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/ssl_domain.cpp b/proton-c/bindings/cpp/src/ssl_domain.cpp
index db27f64..bb95bec 100644
--- a/proton-c/bindings/cpp/src/ssl_domain.cpp
+++ b/proton-c/bindings/cpp/src/ssl_domain.cpp
@@ -26,16 +26,17 @@
namespace proton {
+/// TODO: This whole class isn't really needed as pn_ssl_domain_t is already refcounted, with shared ownership for all pn_ssl_t objects
+/// that hold one
class ssl_domain_impl {
public:
- ssl_domain_impl(bool is_server) : refcount_(1) {
- pn_domain_ = pn_ssl_domain(is_server ? PN_SSL_MODE_SERVER : PN_SSL_MODE_CLIENT);
+ ssl_domain_impl(bool is_server) : refcount_(1), pn_domain_(pn_ssl_domain(is_server ? PN_SSL_MODE_SERVER : PN_SSL_MODE_CLIENT)) {
if (!pn_domain_) throw error(MSG("SSL/TLS unavailable"));
}
+ ~ssl_domain_impl() { pn_ssl_domain_free(pn_domain_); }
void incref() { refcount_++; }
void decref() {
if (--refcount_ == 0) {
- pn_ssl_domain_free(pn_domain_);
delete this;
}
}
@@ -50,14 +51,14 @@ class ssl_domain_impl {
namespace internal {
ssl_domain::ssl_domain(bool is_server) : impl_(0), server_type_(is_server) {}
-ssl_domain::ssl_domain(const ssl_domain &x) {
- impl_ = x.impl_;
+ssl_domain::ssl_domain(const ssl_domain &x) : impl_(x.impl_), server_type_(x.server_type_) {
if (impl_) impl_->incref();
}
ssl_domain& internal::ssl_domain::operator=(const ssl_domain&x) {
if (impl_) impl_->decref();
impl_ = x.impl_;
+ server_type_ = x.server_type_;
if (impl_) impl_->incref();
return *this;
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/da8b50a6/proton-c/src/codec/encoder.c
----------------------------------------------------------------------
diff --git a/proton-c/src/codec/encoder.c b/proton-c/src/codec/encoder.c
index 082bb21..f8145fc 100644
--- a/proton-c/src/codec/encoder.c
+++ b/proton-c/src/codec/encoder.c
@@ -331,6 +331,7 @@ static int pni_encoder_exit(void *ctx, pn_data_t *data, pni_node_t *node)
if ((node->described && node->children == 1) || (!node->described && node->children == 0)) {
pn_encoder_writef8(encoder, pn_type2code(encoder, node->type));
}
+ // Fallthrough
case PN_LIST:
case PN_MAP:
pos = encoder->position;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/da8b50a6/proton-c/src/messenger/transform.c
----------------------------------------------------------------------
diff --git a/proton-c/src/messenger/transform.c b/proton-c/src/messenger/transform.c
index 8f18667..9b726f8 100644
--- a/proton-c/src/messenger/transform.c
+++ b/proton-c/src/messenger/transform.c
@@ -130,6 +130,7 @@ static bool pni_match_r(pn_matcher_t *matcher, const char *pattern, const char *
if (match) pni_sub(matcher, group, text, matched);
return match;
}
+ // Fallthrough
default:
match = pni_match_r(matcher, pattern, text + 1, group, matched + 1);
if (!match) {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/da8b50a6/proton-c/src/tests/object.c
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/object.c b/proton-c/src/tests/object.c
index c0e9dd0..4008fc6 100644
--- a/proton-c/src/tests/object.c
+++ b/proton-c/src/tests/object.c
@@ -160,7 +160,7 @@ static void test_finalize(void)
{
static pn_class_t clazz = PN_CLASS(finalizer);
- int **obj = (int **) pn_class_new(&clazz, sizeof(int **));
+ int **obj = (int **) pn_class_new(&clazz, sizeof(int *));
assert(obj);
int called = 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org