From 5110a83efa8961c31b245f556c9bef7cad2ce50f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 16 Oct 2015 08:22:03 -0400 Subject: [PATCH] Cleanup: Corrected object initialization using {} --- src/FS.cpp | 4 ++-- src/ISO8601.cpp | 6 +++--- src/Nibbler.cpp | 4 ++-- src/TLSClient.cpp | 4 ++-- src/utf8.cpp | 2 +- src/util.cpp | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/FS.cpp b/src/FS.cpp index 220283162..d73dd872b 100644 --- a/src/FS.cpp +++ b/src/FS.cpp @@ -168,7 +168,7 @@ bool Path::exists () const //////////////////////////////////////////////////////////////////////////////// bool Path::is_directory () const { - struct stat s = {0}; + struct stat s {}; if (! stat (_data.c_str (), &s) && S_ISDIR (s.st_mode)) return true; @@ -188,7 +188,7 @@ bool Path::is_absolute () const //////////////////////////////////////////////////////////////////////////////// bool Path::is_link () const { - struct stat s = {0}; + struct stat s {}; if (! lstat (_data.c_str (), &s) && S_ISLNK (s.st_mode)) return true; diff --git a/src/ISO8601.cpp b/src/ISO8601.cpp index e7d30875d..8bbfabc36 100644 --- a/src/ISO8601.cpp +++ b/src/ISO8601.cpp @@ -145,7 +145,7 @@ ISO8601d::ISO8601d (const int m, const int d, const int y) clear (); // Error if not valid. - struct tm t = {0}; + struct tm t {}; t.tm_isdst = -1; // Requests that mktime determine summer time effect. t.tm_mday = d; t.tm_mon = m - 1; @@ -161,7 +161,7 @@ ISO8601d::ISO8601d (const int m, const int d, const int y, clear (); // Error if not valid. - struct tm t = {0}; + struct tm t {}; t.tm_isdst = -1; // Requests that mktime determine summer time effect. t.tm_mday = d; t.tm_mon = m - 1; @@ -983,7 +983,7 @@ void ISO8601d::resolve () day = julian; } - struct tm t = {0}; + struct tm t {}; t.tm_isdst = -1; // Requests that mktime/gmtime determine summer time effect. t.tm_year = year - 1900; t.tm_mon = month - 1; diff --git a/src/Nibbler.cpp b/src/Nibbler.cpp index 3261fa2d7..129a9dcd5 100644 --- a/src/Nibbler.cpp +++ b/src/Nibbler.cpp @@ -684,7 +684,7 @@ bool Nibbler::getDateISO (time_t& t) + ((*_input)[i + 14] - '0'); // Convert to epoch. - struct tm tms = {0}; + struct tm tms {}; tms.tm_isdst = -1; // Requests that mktime determine summer time effect. tms.tm_mon = month - 1; tms.tm_mday = day; @@ -894,7 +894,7 @@ bool Nibbler::getDate (const std::string& format, time_t& t) return false; // Convert to epoch. - struct tm tms = {0}; + struct tm tms {}; tms.tm_isdst = -1; // Requests that mktime determine summer time effect. tms.tm_mon = month - 1; tms.tm_mday = day; diff --git a/src/TLSClient.cpp b/src/TLSClient.cpp index 3651c190c..c67ed44be 100644 --- a/src/TLSClient.cpp +++ b/src/TLSClient.cpp @@ -203,7 +203,7 @@ void TLSClient::connect (const std::string& host, const std::string& port) gnutls_session_set_ptr (_session, (void*) this); // use IPv4 or IPv6, does not matter. - struct addrinfo hints = {0}; + struct addrinfo hints {}; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; // use my IP @@ -434,7 +434,7 @@ void TLSClient::recv (std::string& data) int received = 0; // Get the encoded length. - unsigned char header[4] = {0}; + unsigned char header[4] {}; do { received = gnutls_record_recv (_session, header, 4); diff --git a/src/utf8.cpp b/src/utf8.cpp index c2a5baccd..1e2276e30 100644 --- a/src/utf8.cpp +++ b/src/utf8.cpp @@ -113,7 +113,7 @@ unsigned int utf8_next_char (const std::string& input, std::string::size_type& i // http://en.wikipedia.org/wiki/UTF-8 std::string utf8_character (unsigned int codepoint) { - char sequence[5] = {0}; + char sequence[5] {}; // 0xxxxxxx -> 0xxxxxxx if (codepoint < 0x80) diff --git a/src/util.cpp b/src/util.cpp index b83249eb1..a05dcc94e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -235,7 +235,7 @@ const std::string uuid () { uuid_t id; uuid_generate (id); - char buffer[100] = {0}; + char buffer[100] {}; uuid_unparse_lower (id, buffer); // Bug found by Steven de Brouwer.