From 922336151782c42455d08cca787215b0a4e7b617 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Fri, 26 Jun 2015 11:18:01 +0200 Subject: lib/cert: Convert &vec[0] to vec.data() --- src/lib/cert/cvc/asn1_eac_tm.cpp | 14 +++++++++----- src/lib/cert/x509/x509_obj.cpp | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/lib') 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 #include #include +#include +#include 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& vec, const std::string& labels) { - DataSource_Memory stream(&vec[0], vec.size()); + DataSource_Memory stream(vec.data(), vec.size()); init(stream, labels); } -- cgit v1.2.3