Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-1559

Typo in some proactor examples

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • proton-c-0.18.0
    • None
    • examples, proton-c
    • Patch

    Description

      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.

      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;
      

      Attachments

        Activity

          People

            jross Justin Ross
            jdanek Jiri Daněk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: