]> WPIA git - cassiopeia.git/commitdiff
upd: cleanups; 'std::swap' and '= {}'
authorFelix Dörre <felix@dogcraft.de>
Thu, 15 Dec 2016 09:14:38 +0000 (10:14 +0100)
committerFelix Dörre <felix@dogcraft.de>
Tue, 3 Jan 2017 10:58:11 +0000 (11:58 +0100)
Change-Id: Iec5605a0618debb539aef1924b02e4ccfb444f8d

src/crypto/CRL.cpp
src/util.cpp

index a26c7862d00d192ba61a9f8cd170f1767f02b508..d48bc89315f8445fd1c3d865fdc9b85adc5b3b77 100644 (file)
@@ -139,12 +139,8 @@ void CRL::setSignature( std::string signature ) {
     ASN1_BIT_STRING *sig = d2i_ASN1_BIT_STRING( NULL, &buffer, signature.size() + data - buffer );
     ASN1_TIME *a1 = d2i_ASN1_TIME( NULL, &buffer, signature.size() + data - buffer );
     ASN1_TIME *a2 = d2i_ASN1_TIME( NULL, &buffer, signature.size() + data - buffer );
-    auto tmp = *palg;
-    *palg = *alg;
-    *alg = tmp;
-    auto tmp2 = *psig;
-    *psig = *sig;
-    *sig = tmp2;
+    std::swap(*palg, *alg);
+    std::swap(*psig, *sig);
     X509_CRL_set1_lastUpdate( crl.get(), a1);
     X509_CRL_set1_nextUpdate( crl.get(), a2);
 
index 870359474b087098887d8c83179412a38c00440e..95d1007695bafcfd040f1771a4de1801da1d8552 100644 (file)
@@ -89,16 +89,12 @@ std::pair<bool, time_t> parseDate( const std::string& date ) {
         return std::pair<bool, time_t>( false, 0 );
     }
 
-    std::tm t;
-    t.tm_sec = 0;
-    t.tm_min = 0;
-    t.tm_hour = 0;
-    t.tm_year = std::stoi( date.substr( 0, 4 ) ) - 1900;
-    t.tm_mon = std::stoi( date.substr( 5, 2 ) ) - 1;
-    t.tm_mday = std::stoi( date.substr( 8, 2 ) );
-    t.tm_wday = 0;   /* Day of the week (0-6, Sunday = 0) */
-    t.tm_yday = 0;   /* Day in the year (0-365, 1 Jan = 0) */
-    t.tm_isdst = 0;  /* Daylight saving time */
+    std::tm t = {
+      .tm_sec = 0, .tm_min = 0, .tm_hour = 0,
+      .tm_mday = std::stoi( date.substr( 8, 2 ) ),
+      .tm_mon = std::stoi( date.substr( 5, 2 ) ) - 1,
+      .tm_year = std::stoi( date.substr( 0, 4 ) ) - 1900
+    };
 
     setenv( "TZ", "UTC", 1 );
     tzset();