qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1590505 - in /qpid/trunk/qpid/cpp/src: qpid/broker/Message.cpp tests/MessageTest.cpp
Date Sun, 27 Apr 2014 22:22:08 GMT
Author: astitcher
Date: Sun Apr 27 22:22:08 2014
New Revision: 1590505

URL: http://svn.apache.org/r1590505
Log:
QPID-5725: Use correct comparison function to match property keys

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp
    qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp?rev=1590505&r1=1590504&r2=1590505&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Message.cpp Sun Apr 27 22:22:08 2014
@@ -295,7 +295,8 @@ class PropertyRetriever : public MapHand
 
     bool matches(const CharSequence& key)
     {
-        return ::strncmp(key.data, name.data(), std::min(key.size, name.size())) == 0;
+        return name.size()==key.size &&
+            ::strncmp(key.data, name.data(), key.size) == 0;
     }
 
     template <typename T> void handle(const CharSequence& key, T value)

Modified: qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp?rev=1590505&r1=1590504&r2=1590505&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/MessageTest.cpp Sun Apr 27 22:22:08 2014
@@ -72,6 +72,18 @@ QPID_AUTO_TEST_CASE(testEncodeDecode)
     BOOST_CHECK(msg.isPersistent());
 }
 
+QPID_AUTO_TEST_CASE(testMessageProperties)
+{
+  string data("abcdefghijklmn");
+
+  qpid::types::Variant::Map properties;
+  properties["abc"] = "xyz";
+  Message msg = MessageUtils::createMessage(properties, data);
+
+  // Regression test that looking up a property doesn't return a prefix
+  BOOST_CHECK_EQUAL(msg.getProperty("abcdef").getType(), qpid::types::VAR_VOID);
+}
+
 QPID_AUTO_TEST_SUITE_END()
 
 }} // namespace qpid::tests



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


Mime
View raw message