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

Justin Ross commented on PROTON-1559:
-------------------------------------

The arg parsing has since been changed, and it no longer has this defect.

> Typo in some proactor examples
> ------------------------------
>
>                 Key: PROTON-1559
>                 URL: https://issues.apache.org/jira/browse/PROTON-1559
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: examples, proton-c
>    Affects Versions: proton-c-0.18.0
>            Reporter: Jiri Daněk
>            Assignee: Justin Ross
>            Priority: Minor
>              Labels: patch
>             Fix For: proton-c-0.18.0
>
>
> Some proactor examples have a typo in the code that reads CLI options. It 
> does not seem to have effect on functionality, because the {{argv[argc]}} 
> element is always a NULL.
> {code}
> diff --git a/examples/c/proactor/direct.c b/examples/c/proactor/direct.c
> index 15550e6b..d33010f0 100644
> --- a/examples/c/proactor/direct.c
> +++ b/examples/c/proactor/direct.c
> @@ -308,8 +308,8 @@ int main(int argc, char **argv) {
>    struct app_data_t app = {0};
>    int i = 0;
>    app.container_id = argv[i++];   /* Should be unique */
> -  app.host = (argc > 1) ? argv[i++] : "";
> -  app.port = (argc > 1) ? argv[i++] : "amqp";
> +  app.host = (argc > i) ? argv[i++] : "";
> +  app.port = (argc > i) ? argv[i++] : "amqp";
>    app.amqp_address = (argc > i) ? argv[i++] : "examples";
>    app.message_count = (argc > i) ? atoi(argv[i++]) : 10;
>  
> diff --git a/examples/c/proactor/receive.c b/examples/c/proactor/receive.c
> index 6fd74a51..3f059f56 100644
> --- a/examples/c/proactor/receive.c
> +++ b/examples/c/proactor/receive.c
> @@ -172,8 +172,8 @@ int main(int argc, char **argv) {
>    struct app_data_t app = {0};
>    int i = 0;
>    app.container_id = argv[i++];   /* Should be unique */
> -  app.host = (argc > 1) ? argv[i++] : "";
> -  app.port = (argc > 1) ? argv[i++] : "amqp";
> +  app.host = (argc > i) ? argv[i++] : "";
> +  app.port = (argc > i) ? argv[i++] : "amqp";
>    app.amqp_address = (argc > i) ? argv[i++] : "examples";
>    app.message_count = (argc > i) ? atoi(argv[i++]) : 10;
>  
> diff --git a/examples/c/proactor/send.c b/examples/c/proactor/send.c
> index 43da8b04..a80fbcb5 100644
> --- a/examples/c/proactor/send.c
> +++ b/examples/c/proactor/send.c
> @@ -180,8 +180,8 @@ int main(int argc, char **argv) {
>    struct app_data_t app = {0};
>    int i = 0;
>    app.container_id = argv[i++];   /* Should be unique */
> -  app.host = (argc > 1) ? argv[i++] : "";
> -  app.port = (argc > 1) ? argv[i++] : "amqp";
> +  app.host = (argc > i) ? argv[i++] : "";
> +  app.port = (argc > i) ? argv[i++] : "amqp";
>    app.amqp_address = (argc > i) ? argv[i++] : "examples";
>    app.message_count = (argc > i) ? atoi(argv[i++]) : 10;
> {code}



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

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

Reply via email to