libmemif: fix clang compilation errors/warnings

Change-Id: I09444281a932d367162a10b90c3759db71c03350
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c
index 5645851..d0c1087 100644
--- a/extras/libmemif/src/main.c
+++ b/extras/libmemif/src/main.c
@@ -686,9 +686,8 @@
 	       MEMIF_DEFAULT_SOCKET_FILENAME, sfl);
     }
 
-  if (args->secret)
+  if ((l = strlen ((char *) args->secret)) > 0)
     {
-      l = strlen ((char *) args->secret);
       strncpy ((char *) conn->args.secret, (char *) args->secret, l);
     }
 
@@ -886,7 +885,7 @@
 
 	      sun.sun_family = AF_UNIX;
 
-	      strncpy (sun.sun_path, conn->args.socket_filename,
+	      strncpy (sun.sun_path, (char*) conn->args.socket_filename,
 		       sizeof (sun.sun_path) - 1);
 
 	      if (connect (sockfd, (struct sockaddr *) &sun,
@@ -1090,7 +1089,7 @@
 
   if (c->fd > 0)
     {
-      memif_msg_send_disconnect (c->fd, "interface deleted", 0);
+      memif_msg_send_disconnect (c->fd, (uint8_t *) "interface deleted", 0);
       lm->control_fd_update (c->fd, MEMIF_FD_EVENT_DEL);
       close (c->fd);
     }
@@ -1882,7 +1881,7 @@
   l1 = strlen ((char *) c->args.interface_name);
   if (l0 + l1 < buflen)
     {
-      md->if_name = strcpy (buf + l0, (char *) c->args.interface_name);
+      md->if_name = (uint8_t *) strcpy (buf + l0, (char *) c->args.interface_name);
       l0 += l1 + 1;
     }
   else
@@ -1891,7 +1890,7 @@
   l1 = strlen ((char *) lm->app_name);
   if (l0 + l1 < buflen)
     {
-      md->inst_name = strcpy (buf + l0, (char *) lm->app_name);
+      md->inst_name = (uint8_t *) strcpy (buf + l0, (char *) lm->app_name);
       l0 += l1 + 1;
     }
   else
@@ -1900,7 +1899,7 @@
   l1 = strlen ((char *) c->remote_if_name);
   if (l0 + l1 < buflen)
     {
-      md->remote_if_name = strcpy (buf + l0, (char *) c->remote_if_name);
+      md->remote_if_name = (uint8_t *) strcpy (buf + l0, (char *) c->remote_if_name);
       l0 += l1 + 1;
     }
   else
@@ -1909,7 +1908,7 @@
   l1 = strlen ((char *) c->remote_name);
   if (l0 + l1 < buflen)
     {
-      md->remote_inst_name = strcpy (buf + l0, (char *) c->remote_name);
+      md->remote_inst_name = (uint8_t *) strcpy (buf + l0, (char *) c->remote_name);
       l0 += l1 + 1;
     }
   else
@@ -1917,12 +1916,12 @@
 
   md->id = c->args.interface_id;
 
-  if (c->args.secret)
+  if (strlen((char *) c->args.secret) > 0)
     {
       l1 = strlen ((char *) c->args.secret);
       if (l0 + l1 < buflen)
 	{
-	  md->secret = strcpy (buf + l0, (char *) c->args.secret);
+	  md->secret = (uint8_t *) strcpy (buf + l0, (char *) c->args.secret);
 	  l0 += l1 + 1;
 	}
       else
@@ -1936,7 +1935,7 @@
   if (l0 + l1 < buflen)
     {
       md->socket_filename =
-	strcpy (buf + l0, (char *) c->args.socket_filename);
+	(uint8_t *) strcpy (buf + l0, (char *) c->args.socket_filename);
       l0 += l1 + 1;
     }
   else
diff --git a/extras/libmemif/src/socket.c b/extras/libmemif/src/socket.c
index e568079..e8b14c9 100644
--- a/extras/libmemif/src/socket.c
+++ b/extras/libmemif/src/socket.c
@@ -112,7 +112,7 @@
   h->max_region = MEMIF_MAX_REGION;
   h->max_log2_ring_size = MEMIF_MAX_LOG2_RING_SIZE;
 
-  strncpy ((char *) h->name, lm->app_name, strlen (lm->app_name));
+  strncpy ((char *) h->name, (char *) lm->app_name, strlen ((char *) lm->app_name));
 
   /* msg hello is not enqueued but sent directly,
      because it is the first msg to be sent */
@@ -141,7 +141,7 @@
 
   strncpy ((char *) i->name, (char *) lm->app_name,
 	   strlen ((char *) lm->app_name));
-  if (c->args.secret)
+  if (strlen((char *) c->args.secret) > 0)
     strncpy ((char *) i->secret, (char *) c->args.secret, sizeof (i->secret));
 
   e->next = NULL;
@@ -424,10 +424,10 @@
   strncpy ((char *) c->remote_name, (char *) i->name,
 	   strlen ((char *) i->name));
 
-  if (c->args.secret)
+  if (strlen((char *) c->args.secret) > 0)
     {
       int r;
-      if (i->secret)
+      if (strlen((char *) i->secret) > 0)
 	{
 	  if (strlen ((char *) c->args.secret) != strlen ((char *) i->secret))
 	    {
diff --git a/extras/libmemif/src/socket.h b/extras/libmemif/src/socket.h
index a8e9fbc..e079227 100644
--- a/extras/libmemif/src/socket.h
+++ b/extras/libmemif/src/socket.h
@@ -16,7 +16,7 @@
  */
 
 #ifndef _SOCKET_H_
-#define _SOCKET_H
+#define _SOCKET_H_
 
 #include <memif_private.h>