From e4631003a99e130dd0746be8a24fd49fd060aa6d Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Fri, 21 Mar 2014 20:55:36 +0100 Subject: [PATCH] face: silence silly warning thrown by clang. Clang 3.3 complains about a "missing field initializer" for struct ifreq. However, according to the standard, if there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, the remainder of the aggregate shall be initialized implicitly as if they were declared static, i.e. with zero or default-constructed value. Therefore using "= {0}" is correct (and common practice in C). Emitting a warning doesn't make sense. As a matter of fact recent GCC releases disabled it. Luckily this is C++ and we can simply use the "empty braces" initializer (which wouldn't be valid C99 syntax) to silence the compiler. Change-Id: Ibee8d17cc9b5d0eaa5270c52f3596b7994b5e911 --- daemon/face/ethernet-face.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/face/ethernet-face.cpp b/daemon/face/ethernet-face.cpp index 2ea6ca90..7d87c0f6 100644 --- a/daemon/face/ethernet-face.cpp +++ b/daemon/face/ethernet-face.cpp @@ -152,6 +152,7 @@ EthernetFace::sendPacket(const ndn::Block& block) /// we should reserve some space at the beginning and at the end ndn::EncodingBuffer buffer(block); + // pad with zeroes if the payload is too short if (block.size() < ethernet::MIN_DATA_LEN) { static const uint8_t padding[ethernet::MIN_DATA_LEN] = {0}; @@ -271,7 +272,7 @@ EthernetFace::getInterfaceMtu() const size_t mtu = ethernet::MAX_DATA_LEN; #ifdef SIOCGIFMTU - ifreq ifr = {0}; + ifreq ifr = {}; std::strncpy(ifr.ifr_name, m_interfaceName.c_str(), sizeof(ifr.ifr_name) - 1); if (::ioctl(m_socket->native_handle(), SIOCGIFMTU, &ifr) < 0)