From 2000443db1bac14922c7098abd3d8da648fd315b Mon Sep 17 00:00:00 2001
From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
Date: Tue, 10 Jun 2014 14:01:04 -0400
Subject: [PATCH] daemon: remove some compilation warnings

Refs #49444

Change-Id: I7fc77a9f76bcc947b810b33bab5b0007aad89495
---
 daemon/src/sip/sip_utils.cpp         |  3 ++-
 daemon/src/video/v4l2/video_v4l2.cpp | 18 +++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/daemon/src/sip/sip_utils.cpp b/daemon/src/sip/sip_utils.cpp
index 650916d40d..e81d38753e 100644
--- a/daemon/src/sip/sip_utils.cpp
+++ b/daemon/src/sip/sip_utils.cpp
@@ -211,7 +211,8 @@ sip_utils::getIPList(const std::string &name)
     //ERROR("sip_utils::getIPList %s", name.c_str());
 
     struct addrinfo *result;
-    struct addrinfo hints = {};
+    struct addrinfo hints;
+    memset(&hints, 0, sizeof(hints));
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_DGRAM;
     hints.ai_flags = AI_ADDRCONFIG;
diff --git a/daemon/src/video/v4l2/video_v4l2.cpp b/daemon/src/video/v4l2/video_v4l2.cpp
index b0daf86fe0..3385c6816e 100644
--- a/daemon/src/video/v4l2/video_v4l2.cpp
+++ b/daemon/src/video/v4l2/video_v4l2.cpp
@@ -34,6 +34,7 @@
 #include <vector>
 #include <climits>
 #include <stdexcept>
+#include <cstring>
 
 #include "logger.h"
 
@@ -45,6 +46,8 @@ extern "C" {
 
 #include "video_v4l2.h"
 
+#define ZEROVAR(x) memset(&(x), 0, sizeof(x))
+
 namespace sfl_video
 {
 using std::vector;
@@ -148,7 +151,8 @@ vector<string> VideoV4l2Size::getRateList()
 
 void VideoV4l2Size::getFrameRates(int fd, unsigned int pixel_format)
 {
-    v4l2_frmivalenum frmival = {0};
+    v4l2_frmivalenum frmival;
+    ZEROVAR(frmival);
     frmival.pixel_format = pixel_format;
     frmival.width = width;
     frmival.height = height;
@@ -213,7 +217,8 @@ vector<string> VideoV4l2Channel::getSizeList() const
 unsigned int
 VideoV4l2Channel::getSizes(int fd, unsigned int pixelformat)
 {
-    v4l2_frmsizeenum frmsize = {0};
+    v4l2_frmsizeenum frmsize;
+    ZEROVAR(frmsize);
     frmsize.index = 0;
     frmsize.pixel_format = pixelformat;
     if (!ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frmsize)) {
@@ -241,7 +246,8 @@ VideoV4l2Channel::getSizes(int fd, unsigned int pixelformat)
         }
     }
 
-    v4l2_format fmt = {(v4l2_buf_type) 0};
+    v4l2_format fmt;
+    ZEROVAR(fmt);
     fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
     if (ioctl(fd, VIDIOC_G_FMT, &fmt) < 0)
         throw std::runtime_error("Could not get format");
@@ -276,7 +282,8 @@ void VideoV4l2Channel::getFormat(int fd)
     if (ioctl(fd, VIDIOC_S_INPUT, &idx))
         throw std::runtime_error("VIDIOC_S_INPUT failed");
 
-    v4l2_fmtdesc fmt = {0};
+    v4l2_fmtdesc fmt;
+    ZEROVAR(fmt);
     unsigned fmt_index;
     fmt.index = fmt_index = 0;
     fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -333,7 +340,8 @@ VideoV4l2Device::VideoV4l2Device(int fd, const string &device) :
 
     name = string(reinterpret_cast<const char*>(cap.card));
 
-    v4l2_input input = {0};
+    v4l2_input input;
+    ZEROVAR(input);
     unsigned idx;
     input.index = idx = 0;
     while (!ioctl(fd, VIDIOC_ENUMINPUT, &input)) {
-- 
GitLab