audiohal source changes to support GCC5.2

Change-Id: Iec41af00e07fabb070ae51daa8d4f2ffd7ffae49
diff --git a/qahw_api/Makefile.am b/qahw_api/Makefile.am
index f2c1060..ca1839a 100644
--- a/qahw_api/Makefile.am
+++ b/qahw_api/Makefile.am
@@ -17,8 +17,8 @@
 lib_LTLIBRARIES = libqahw.la
 libqahw_la_SOURCES = src/qahw.c \
                      src/qahw_effect.c
-libqahw_la_CFLAGS = $(AM_CFLAGS) -include stddef.h
+libqahw_la_CFLAGS = -Dstrlcpy=g_strlcpy $(GLIB_CFLAGS) -include glib.h $(AM_CFLAGS) -include stddef.h
 libqahw_la_CFLAGS += -D__unused=__attribute__\(\(__unused__\)\)
 libqahw_la_CFLAGS += -Wno-sign-compare -Werror
-libqahw_la_LIBADD = -llog -lcutils -lhardware
+libqahw_la_LIBADD = $(GLIB_LIBS) -llog -lcutils -lhardware
 libqahw_la_LDFLAGS = -module -shared -avoid-version
diff --git a/qahw_api/test/trans_loopback_test.c b/qahw_api/test/trans_loopback_test.c
index 009e288..0ecbdcb 100644
--- a/qahw_api/test/trans_loopback_test.c
+++ b/qahw_api/test/trans_loopback_test.c
@@ -138,6 +138,34 @@
    stop_loopback = true;
 }
 
+int poll_data_event_init()
+{
+    struct sockaddr_nl sock_addr;
+    int sz = (64*1024);
+    int soc;
+
+    memset(&sock_addr, 0, sizeof(sock_addr));
+    sock_addr.nl_family = AF_NETLINK;
+    sock_addr.nl_pid = getpid();
+    sock_addr.nl_groups = 0xffffffff;
+
+    soc = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
+    if (soc < 0) {
+        return 0;
+    }
+
+    setsockopt(soc, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz));
+
+    if (bind(soc, (struct sockaddr*) &sock_addr, sizeof(sock_addr)) < 0) {
+        close(soc);
+        return 0;
+    }
+
+    sock_event_fd = soc;
+
+    return (soc > 0);
+}
+
 void init_transcode_loopback_config(transcode_loopback_config_t **p_transcode_loopback_config)
 {
     fprintf(log_file,"\nInitializing global transcode loopback config\n");
@@ -396,34 +424,6 @@
 }
 
 
-int poll_data_event_init()
-{
-    struct sockaddr_nl sock_addr;
-    int sz = (64*1024);
-    int soc;
-
-    memset(&sock_addr, 0, sizeof(sock_addr));
-    sock_addr.nl_family = AF_NETLINK;
-    sock_addr.nl_pid = getpid();
-    sock_addr.nl_groups = 0xffffffff;
-
-    soc = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
-    if (soc < 0) {
-        return 0;
-    }
-
-    setsockopt(soc, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz));
-
-    if (bind(soc, (struct sockaddr*) &sock_addr, sizeof(sock_addr)) < 0) {
-        close(soc);
-        return 0;
-    }
-
-    sock_event_fd = soc;
-
-    return (soc > 0);
-}
-
 void source_data_event_handler(transcode_loopback_config_t *transcode_loopback_config)
 {
     int status =0;