ccnx: Rename Key to Cert; fix bug with the usage of Hash
Change-Id: Ic7656e6d8d46729d663ccfa5412e78443aff76bc
diff --git a/ccnx/ccnx-pco.cpp b/ccnx/ccnx-pco.cpp
index 4ca46c7..700e1e5 100644
--- a/ccnx/ccnx-pco.cpp
+++ b/ccnx/ccnx-pco.cpp
@@ -106,11 +106,17 @@
Name
ParsedContentObject::keyName() const
{
- CcnxCharbufPtr ptr = boost::make_shared<CcnxCharbuf>();
- ccn_charbuf_append(ptr->getBuf(), head(m_bytes) + m_pco.offset[CCN_PCO_B_KeyName_Name], m_pco.offset[CCN_PCO_E_KeyName_Name] - m_pco.offset[CCN_PCO_B_KeyName_Name]);
+ if (m_pco.offset[CCN_PCO_E_KeyName_Name] > m_pco.offset[CCN_PCO_B_KeyName_Name])
+ {
+ CcnxCharbufPtr ptr = boost::make_shared<CcnxCharbuf>();
+ ccn_charbuf_append(ptr->getBuf(), head(m_bytes) + m_pco.offset[CCN_PCO_B_KeyName_Name], m_pco.offset[CCN_PCO_E_KeyName_Name] - m_pco.offset[CCN_PCO_B_KeyName_Name]);
- return Name(*ptr);
-
+ return Name(*ptr);
+ }
+ else
+ {
+ return Name();
+ }
}
HashPtr