Change wire encoding to return a Blob.
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 1e4c165..616b4b0 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -155,7 +155,7 @@
dumpData(data);
cout << "Decoded Data signature verification: " << (KeyChain::selfVerifyData(Data1, sizeof(Data1)) ? "VERIFIED" : "FAILED") << endl;
- ptr_lib::shared_ptr<vector<unsigned char> > encoding = data.wireEncode();
+ Blob encoding = data.wireEncode();
Data reDecodedData;
reDecodedData.wireDecode(*encoding);
@@ -171,7 +171,7 @@
KeyChain::defaultSign(freshData);
cout << endl << "Freshly-signed Data:" << endl;
dumpData(freshData);
- ptr_lib::shared_ptr<vector<unsigned char> > freshEncoding = freshData.wireEncode();
+ Blob freshEncoding = freshData.wireEncode();
cout << "Freshly-signed Data signature verification: " << (KeyChain::selfVerifyData(&freshEncoding->front(), freshEncoding->size()) ? "VERIFIED" : "FAILED") << endl;
} catch (exception& e) {
cout << "exception: " << e.what() << endl;
diff --git a/tests/test-encode-decode-forwarding-entry.cpp b/tests/test-encode-decode-forwarding-entry.cpp
index dfa780e..1ee801a 100644
--- a/tests/test-encode-decode-forwarding-entry.cpp
+++ b/tests/test-encode-decode-forwarding-entry.cpp
@@ -59,6 +59,9 @@
static inline string toString(const vector<unsigned char>& v)
{
+ if (!&v)
+ return "";
+
return string(&v[0], &v[0] + v.size());
}
@@ -67,7 +70,7 @@
cout << "action: " << forwardingEntry.getAction() << endl;
cout << "prefix: " << forwardingEntry.getPrefix().to_uri() << endl;
cout << "publisherPublicKeyDigest: "
- << (forwardingEntry.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0 ? toHex(forwardingEntry.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest()) : "<none>") << endl;
+ << (forwardingEntry.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0 ? toHex(*forwardingEntry.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest()) : "<none>") << endl;
cout << "faceId: ";
if (forwardingEntry.getFaceId() >= 0)
cout << forwardingEntry.getFaceId() << endl;
@@ -101,16 +104,16 @@
cout << interest.getScope() << endl;
else
cout << "<none>" << endl;
- cout << "name[0]: " << toString(interest.getName().getComponent(0).getValue()) << endl;
- cout << "name[1]: " << toHex(interest.getName().getComponent(1).getValue()) << endl;
- cout << "name[2]: " << toString(interest.getName().getComponent(2).getValue()) << endl;
+ cout << "name[0]: " << toString(*interest.getName().getComponent(0).getValue()) << endl;
+ cout << "name[1]: " << toHex(*interest.getName().getComponent(1).getValue()) << endl;
+ cout << "name[2]: " << toString(*interest.getName().getComponent(2).getValue()) << endl;
cout << "name[3] decoded as Data, showing content as ForwardingEntry: " << endl;
Data data;
- data.wireDecode(interest.getName().getComponent(3).getValue());
+ data.wireDecode(*interest.getName().getComponent(3).getValue());
ForwardingEntry forwardingEntry;
- forwardingEntry.wireDecode(data.getContent());
+ forwardingEntry.wireDecode(*data.getContent());
dumpForwardingEntry(forwardingEntry);
}
@@ -122,7 +125,7 @@
cout << "Interest:" << endl;
dumpInterestWithForwardingEntry(interest);
- ptr_lib::shared_ptr<vector<unsigned char> > encoding = interest.wireEncode();
+ Blob encoding = interest.wireEncode();
cout << endl << "Re-encoded interest " << toHex(*encoding) << endl;
Interest reDecodedInterest;
diff --git a/tests/test-encode-decode-interest.cpp b/tests/test-encode-decode-interest.cpp
index ad638ce..9326893 100644
--- a/tests/test-encode-decode-interest.cpp
+++ b/tests/test-encode-decode-interest.cpp
@@ -44,7 +44,7 @@
else
cout << "<none>" << endl;
cout << "publisherPublicKeyDigest: "
- << (interest.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0 ? toHex(interest.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest()) : "<none>") << endl;
+ << (interest.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0 ? toHex(*interest.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest()) : "<none>") << endl;
cout << "exclude: "
<< (interest.getExclude().getEntryCount() > 0 ? interest.getExclude().toUri() : "<none>") << endl;
cout << "lifetimeMilliseconds: ";
@@ -79,7 +79,7 @@
cout << "Interest:" << endl;
dumpInterest(interest);
- ptr_lib::shared_ptr<vector<unsigned char> > encoding = interest.wireEncode();
+ Blob encoding = interest.wireEncode();
cout << endl << "Re-encoded interest " << toHex(*encoding) << endl;
Interest reDecodedInterest;
diff --git a/tests/test-get-async.cpp b/tests/test-get-async.cpp
index 3c55b31..7c92997 100644
--- a/tests/test-get-async.cpp
+++ b/tests/test-get-async.cpp
@@ -29,7 +29,7 @@
++callbackCount_;
cout << "Got data packet with name " << data->getName().to_uri() << endl;
for (unsigned int i = 0; i < data->getContent().size(); ++i)
- cout << data->getContent()[i];
+ cout << (*data->getContent())[i];
cout << endl;
}
diff --git a/tests/test-publish-async.cpp b/tests/test-publish-async.cpp
index 49129c8..87fad40 100644
--- a/tests/test-publish-async.cpp
+++ b/tests/test-publish-async.cpp
@@ -32,7 +32,7 @@
data.setContent((const unsigned char *)&content[0], content.size());
data.getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
KeyChain::defaultSign(data);
- shared_ptr<vector<unsigned char> > encodedData = data.wireEncode();
+ Blob encodedData = data.wireEncode();
cout << "Sent content " << content << endl;
transport.send(*encodedData);