qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jiri Danek (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PROTON-1572) CppCheck 1.8 warnings
Date Tue, 05 Sep 2017 20:40:03 GMT

    [ https://issues.apache.org/jira/browse/PROTON-1572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16154262#comment-16154262
] 

Jiri Danek commented on PROTON-1572:
------------------------------------

I think this should not be closed yet, there are (at least) these following messages that
should be investigated.

{code}
diff --git a/examples/c/proactor/broker.c b/examples/c/proactor/broker.c
index e0d96720..84b8528a 100644
--- a/examples/c/proactor/broker.c
+++ b/examples/c/proactor/broker.c
@@ -364,8 +364,6 @@ static void handle(broker_t* b, pn_event_t* e) {
     broker_stop(b);
     break;
 
- break;
-
    case PN_PROACTOR_INACTIVE:   /* listener and all connections closed */
     broker_stop(b);
     break;
diff --git a/proton-c/src/core/codec.c b/proton-c/src/core/codec.c
index 3417c94f..664a57e4 100644
--- a/proton-c/src/core/codec.c
+++ b/proton-c/src/core/codec.c
@@ -1360,7 +1360,7 @@ void pn_data_dump(pn_data_t *data)
     pni_node_t *node = &data->nodes[i];
     pn_string_set(data->str, "");
     pni_inspect_atom((pn_atom_t *) &node->atom, data->str);
-    printf("Node %i: prev=%" PN_ZI ", next=%" PN_ZI ", parent=%" PN_ZI ", down=%" PN_ZI 
+    printf("Node %u: prev=%" PN_ZI ", next=%" PN_ZI ", parent=%" PN_ZI ", down=%" PN_ZI 
            ", children=%" PN_ZI ", type=%s (%s)\n",
            i + 1, (size_t) node->prev,
            (size_t) node->next,
diff --git a/proton-c/src/tests/proactor.c b/proton-c/src/tests/proactor.c
index 49d753ae..95c6fbe0 100644
--- a/proton-c/src/tests/proactor.c
+++ b/proton-c/src/tests/proactor.c
@@ -729,7 +729,7 @@ static pn_event_type_t ssl_handler(test_handler_t *th, pn_event_t *e)
{
    }
 
    case PN_CONNECTION_REMOTE_OPEN: {
-     if (pn_connection_state(c) | PN_LOCAL_ACTIVE) {
+     if (pn_connection_state(c) & PN_LOCAL_ACTIVE) {
        /* Outgoing connection is complete, close it */
        pn_connection_close(c);
      } else {
{code}

Code 'C++ cast <...' is invalid C code. Use --std or --language to configure the language.
https://github.com/apache/qpid-proton/blob/b2e1acd97c4d66d0f62618aa715d408a0e01e3d1/proton-c/src/ssl/schannel.c#L981

Code 'namespacepn_experimental{' is invalid C code. Use --std or --language to configure the
language.
https://github.com/apache/qpid-proton/blob/d3f92738ca28ba66c12fd1caa0707490e1911192/proton-c/src/proactor/win_iocp.c#L84

Memory leak: cc.work_queue_
https://github.com/apache/qpid-proton/blob/d3f92738ca28ba66c12fd1caa0707490e1911192/proton-c/bindings/cpp/src/proactor_container_impl.cpp#L188
https://github.com/apache/qpid-proton/blob/d3f92738ca28ba66c12fd1caa0707490e1911192/proton-c/bindings/cpp/src/proactor_container_impl.cpp#L507
(could not find where it is later freed)

%u in format string (no. 4) requires 'unsigned int' but the argument type is 'signed char'
https://github.com/apache/qpid-proton/blob/d3f92738ca28ba66c12fd1caa0707490e1911192/proton-c/src/core/engine.c#L1628
(no idea how to print a C99 bool so that cppcheck is happy...)

Either the condition 'if(iocpd)' is redundant or there is possible null pointer dereference:
iocpd
https://github.com/apache/qpid-proton/blob/d3f92738ca28ba66c12fd1caa0707490e1911192/proton-c/src/reactor/io/windows/iocp.c#L778

Possible null pointer dereference: result
https://github.com/apache/qpid-proton/blob/d3f92738ca28ba66c12fd1caa0707490e1911192/proton-c/src/reactor/io/windows/iocp.c#L253


> CppCheck 1.8 warnings
> ---------------------
>
>                 Key: PROTON-1572
>                 URL: https://issues.apache.org/jira/browse/PROTON-1572
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-c
>            Reporter: Michael Andre Pearce
>            Assignee: Andrew Stitcher
>             Fix For: proton-c-0.18.0
>
>         Attachments: cppcheck3.txt
>
>
> Using cppcheck 1.8 there are a number or warnings an errors detected.
> Attaching output of check run against master earlier today.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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


Mime
View raw message