Cleanup: Corrected object initialization using {}

This commit is contained in:
Paul Beckingham 2015-10-16 08:22:03 -04:00
parent 9b5d0a7cdd
commit 5110a83efa
6 changed files with 11 additions and 11 deletions

View file

@ -168,7 +168,7 @@ bool Path::exists () const
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Path::is_directory () const bool Path::is_directory () const
{ {
struct stat s = {0}; struct stat s {};
if (! stat (_data.c_str (), &s) && if (! stat (_data.c_str (), &s) &&
S_ISDIR (s.st_mode)) S_ISDIR (s.st_mode))
return true; return true;
@ -188,7 +188,7 @@ bool Path::is_absolute () const
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Path::is_link () const bool Path::is_link () const
{ {
struct stat s = {0}; struct stat s {};
if (! lstat (_data.c_str (), &s) && if (! lstat (_data.c_str (), &s) &&
S_ISLNK (s.st_mode)) S_ISLNK (s.st_mode))
return true; return true;

View file

@ -145,7 +145,7 @@ ISO8601d::ISO8601d (const int m, const int d, const int y)
clear (); clear ();
// Error if not valid. // Error if not valid.
struct tm t = {0}; struct tm t {};
t.tm_isdst = -1; // Requests that mktime determine summer time effect. t.tm_isdst = -1; // Requests that mktime determine summer time effect.
t.tm_mday = d; t.tm_mday = d;
t.tm_mon = m - 1; t.tm_mon = m - 1;
@ -161,7 +161,7 @@ ISO8601d::ISO8601d (const int m, const int d, const int y,
clear (); clear ();
// Error if not valid. // Error if not valid.
struct tm t = {0}; struct tm t {};
t.tm_isdst = -1; // Requests that mktime determine summer time effect. t.tm_isdst = -1; // Requests that mktime determine summer time effect.
t.tm_mday = d; t.tm_mday = d;
t.tm_mon = m - 1; t.tm_mon = m - 1;
@ -983,7 +983,7 @@ void ISO8601d::resolve ()
day = julian; day = julian;
} }
struct tm t = {0}; struct tm t {};
t.tm_isdst = -1; // Requests that mktime/gmtime determine summer time effect. t.tm_isdst = -1; // Requests that mktime/gmtime determine summer time effect.
t.tm_year = year - 1900; t.tm_year = year - 1900;
t.tm_mon = month - 1; t.tm_mon = month - 1;

View file

@ -684,7 +684,7 @@ bool Nibbler::getDateISO (time_t& t)
+ ((*_input)[i + 14] - '0'); + ((*_input)[i + 14] - '0');
// Convert to epoch. // Convert to epoch.
struct tm tms = {0}; struct tm tms {};
tms.tm_isdst = -1; // Requests that mktime determine summer time effect. tms.tm_isdst = -1; // Requests that mktime determine summer time effect.
tms.tm_mon = month - 1; tms.tm_mon = month - 1;
tms.tm_mday = day; tms.tm_mday = day;
@ -894,7 +894,7 @@ bool Nibbler::getDate (const std::string& format, time_t& t)
return false; return false;
// Convert to epoch. // Convert to epoch.
struct tm tms = {0}; struct tm tms {};
tms.tm_isdst = -1; // Requests that mktime determine summer time effect. tms.tm_isdst = -1; // Requests that mktime determine summer time effect.
tms.tm_mon = month - 1; tms.tm_mon = month - 1;
tms.tm_mday = day; tms.tm_mday = day;

View file

@ -203,7 +203,7 @@ void TLSClient::connect (const std::string& host, const std::string& port)
gnutls_session_set_ptr (_session, (void*) this); gnutls_session_set_ptr (_session, (void*) this);
// use IPv4 or IPv6, does not matter. // use IPv4 or IPv6, does not matter.
struct addrinfo hints = {0}; struct addrinfo hints {};
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE; // use my IP hints.ai_flags = AI_PASSIVE; // use my IP
@ -434,7 +434,7 @@ void TLSClient::recv (std::string& data)
int received = 0; int received = 0;
// Get the encoded length. // Get the encoded length.
unsigned char header[4] = {0}; unsigned char header[4] {};
do do
{ {
received = gnutls_record_recv (_session, header, 4); received = gnutls_record_recv (_session, header, 4);

View file

@ -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 // http://en.wikipedia.org/wiki/UTF-8
std::string utf8_character (unsigned int codepoint) std::string utf8_character (unsigned int codepoint)
{ {
char sequence[5] = {0}; char sequence[5] {};
// 0xxxxxxx -> 0xxxxxxx // 0xxxxxxx -> 0xxxxxxx
if (codepoint < 0x80) if (codepoint < 0x80)

View file

@ -235,7 +235,7 @@ const std::string uuid ()
{ {
uuid_t id; uuid_t id;
uuid_generate (id); uuid_generate (id);
char buffer[100] = {0}; char buffer[100] {};
uuid_unparse_lower (id, buffer); uuid_unparse_lower (id, buffer);
// Bug found by Steven de Brouwer. // Bug found by Steven de Brouwer.