You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2016/09/01 16:59:52 UTC

qpid-proton git commit: PROTON-1294: c++ examples: remove un-necessary 64-bit integers

Repository: qpid-proton
Updated Branches:
  refs/heads/master 168dfe946 -> 722226285


PROTON-1294: c++ examples: remove un-necessary 64-bit integers

64 bit integers cause portability problems on some platforms (e.g. need extra
atomic library support on ppc 32 bit) and do not enhance the examples, keep them simple.


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

Branch: refs/heads/master
Commit: 722226285f04e36cdbff68e98877cbc01bf4fb53
Parents: 168dfe9
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Sep 1 12:51:55 2016 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Sep 1 12:57:53 2016 -0400

----------------------------------------------------------------------
 examples/cpp/broker.cpp             | 2 +-
 examples/cpp/broker.hpp             | 2 +-
 examples/cpp/direct_recv.cpp        | 6 +++---
 examples/cpp/mt/broker.cpp          | 2 +-
 examples/cpp/mt/epoll_container.cpp | 2 +-
 examples/cpp/simple_recv.cpp        | 6 +++---
 6 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/72222628/examples/cpp/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.cpp b/examples/cpp/broker.cpp
index 2749966..232839b 100644
--- a/examples/cpp/broker.cpp
+++ b/examples/cpp/broker.cpp
@@ -147,7 +147,7 @@ class queues {
   protected:
     typedef std::map<std::string, queue *> queue_map;
     queue_map queues_;
-    uint64_t next_id_; // Use to generate unique queue IDs.
+    int next_id_; // Use to generate unique queue IDs.
 };
 
 // A handler to implement broker logic

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/72222628/examples/cpp/broker.hpp
----------------------------------------------------------------------
diff --git a/examples/cpp/broker.hpp b/examples/cpp/broker.hpp
index 184ddc7..953713f 100644
--- a/examples/cpp/broker.hpp
+++ b/examples/cpp/broker.hpp
@@ -151,7 +151,7 @@ class queues {
   protected:
     typedef std::map<std::string, queue *> queue_map;
     queue_map queues_;
-    uint64_t next_id_; // Use to generate unique queue IDs.
+    int next_id_; // Use to generate unique queue IDs.
 };
 
 #include <proton/config.hpp>

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/72222628/examples/cpp/direct_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/direct_recv.cpp b/examples/cpp/direct_recv.cpp
index edbc8b6..d2d3939 100644
--- a/examples/cpp/direct_recv.cpp
+++ b/examples/cpp/direct_recv.cpp
@@ -37,8 +37,8 @@ class direct_recv : public proton::messaging_handler {
   private:
     std::string url;
     proton::listener listener;
-    uint64_t expected;
-    uint64_t received;
+    int expected;
+    int received;
 
   public:
     direct_recv(const std::string &s, int c) : url(s), expected(c), received(0) {}
@@ -49,7 +49,7 @@ class direct_recv : public proton::messaging_handler {
     }
 
     void on_message(proton::delivery &d, proton::message &msg) OVERRIDE {
-        if (proton::coerce<uint64_t>(msg.id()) < received) {
+        if (proton::coerce<int>(msg.id()) < received) {
             return; // Ignore duplicate
         }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/72222628/examples/cpp/mt/broker.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/mt/broker.cpp b/examples/cpp/mt/broker.cpp
index f100972..39d7132 100644
--- a/examples/cpp/mt/broker.cpp
+++ b/examples/cpp/mt/broker.cpp
@@ -105,7 +105,7 @@ class queues {
 
     std::mutex lock_;
     queue_map queues_;
-    std::atomic<uint64_t> next_id_; // Use to generate unique queue IDs.
+    std::atomic<int> next_id_; // Use to generate unique queue IDs.
 };
 
 /// Broker connection handler. Things to note:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/72222628/examples/cpp/mt/epoll_container.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/mt/epoll_container.cpp b/examples/cpp/mt/epoll_container.cpp
index 5432559..d9b9f08 100644
--- a/examples/cpp/mt/epoll_container.cpp
+++ b/examples/cpp/mt/epoll_container.cpp
@@ -137,7 +137,7 @@ class epoll_container : public proton::io::container_impl_base {
             return o.str();
         }
       private:
-        std::atomic<uint64_t> count_;
+        std::atomic<int> count_;
     };
 
      // FIXME aconway 2016-06-07: Unfinished

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/72222628/examples/cpp/simple_recv.cpp
----------------------------------------------------------------------
diff --git a/examples/cpp/simple_recv.cpp b/examples/cpp/simple_recv.cpp
index 10a8ee7..1f077d6 100644
--- a/examples/cpp/simple_recv.cpp
+++ b/examples/cpp/simple_recv.cpp
@@ -40,8 +40,8 @@ class simple_recv : public proton::messaging_handler {
     std::string user;
     std::string password;
     proton::receiver receiver;
-    uint64_t expected;
-    uint64_t received;
+    int expected;
+    int received;
 
   public:
     simple_recv(const std::string &s, const std::string &u, const std::string &p, int c) :
@@ -56,7 +56,7 @@ class simple_recv : public proton::messaging_handler {
     }
 
     void on_message(proton::delivery &d, proton::message &msg) OVERRIDE {
-        if (proton::get<uint64_t>(msg.id()) < received) {
+        if (proton::coerce<int>(msg.id()) < received) {
             return; // Ignore duplicate
         }
 


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