aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-26 11:18:01 +0200
committerSimon Warta <[email protected]>2015-06-27 11:15:12 +0200
commit922336151782c42455d08cca787215b0a4e7b617 (patch)
treec8370e154689d22133d5c87c7d08fa185f7c5dd6
parentacb8254284f6251291e4ae25ee5e3ee6302d3029 (diff)
lib/cert: Convert &vec[0] to vec.data()
-rw-r--r--src/lib/cert/cvc/asn1_eac_tm.cpp14
-rw-r--r--src/lib/cert/x509/x509_obj.cpp2
2 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/cert/cvc/asn1_eac_tm.cpp b/src/lib/cert/cvc/asn1_eac_tm.cpp
index 6aad1067c..83a6ef391 100644
--- a/src/lib/cert/cvc/asn1_eac_tm.cpp
+++ b/src/lib/cert/cvc/asn1_eac_tm.cpp
@@ -13,6 +13,8 @@
#include <botan/parsing.h>
#include <botan/internal/rounding.h>
#include <botan/calendar.h>
+#include <sstream>
+#include <iomanip>
namespace Botan {
@@ -153,11 +155,13 @@ std::string EAC_Time::readable_string() const
if(time_is_set() == false)
throw Invalid_State("EAC_Time::readable_string: No time set");
- std::string output(11, 0);
-
- std::sprintf(&output[0], "%04d/%02d/%02d", year, month, day);
-
- return output;
+ // desired format: "%04d/%02d/%02d"
+ std::stringstream output;
+ output << std::setfill('0')
+ << std::setw(4) << year << "/"
+ << std::setw(2) << month << "/"
+ << std::setw(2) << day;
+ return output.str();
}
/*
diff --git a/src/lib/cert/x509/x509_obj.cpp b/src/lib/cert/x509/x509_obj.cpp
index 71449098e..0f5999b5b 100644
--- a/src/lib/cert/x509/x509_obj.cpp
+++ b/src/lib/cert/x509/x509_obj.cpp
@@ -39,7 +39,7 @@ X509_Object::X509_Object(const std::string& file, const std::string& labels)
*/
X509_Object::X509_Object(const std::vector<byte>& vec, const std::string& labels)
{
- DataSource_Memory stream(&vec[0], vec.size());
+ DataSource_Memory stream(vec.data(), vec.size());
init(stream, labels);
}