libsysutils: const correctness fixes + remove some debugging

Signed-off-by: San Mehat <san@google.com>
diff --git a/include/sysutils/FrameworkClient.h b/include/sysutils/FrameworkClient.h
index 1eb112a..0ef0753 100644
--- a/include/sysutils/FrameworkClient.h
+++ b/include/sysutils/FrameworkClient.h
@@ -13,8 +13,8 @@
     FrameworkClient(int sock);
     virtual ~FrameworkClient() {}
 
-    int sendMsg(char *msg);
-    int sendMsg(char *msg, char *data);
+    int sendMsg(const char *msg);
+    int sendMsg(const char *msg, const char *data);
 };
 
 typedef android::List<FrameworkClient *> FrameworkClientCollection;
diff --git a/include/sysutils/SocketClient.h b/include/sysutils/SocketClient.h
index cde64a5..469dd9d 100644
--- a/include/sysutils/SocketClient.h
+++ b/include/sysutils/SocketClient.h
@@ -15,8 +15,8 @@
 
     int getSocket() { return mSocket; }
 
-    int sendMsg(int code, char *msg, bool addErrno);
-    int sendMsg(char *msg);
+    int sendMsg(int code, const char *msg, bool addErrno);
+    int sendMsg(const char *msg);
 };
 
 typedef android::List<SocketClient *> SocketClientCollection;
diff --git a/include/sysutils/SocketListener.h b/include/sysutils/SocketListener.h
index 30d050d..68dcb8f 100644
--- a/include/sysutils/SocketListener.h
+++ b/include/sysutils/SocketListener.h
@@ -37,8 +37,8 @@
     int startListener();
     int stopListener();
 
-    void sendBroadcast(int code, char *msg, bool addErrno);
-    void sendBroadcast(char *msg);
+    void sendBroadcast(int code, const char *msg, bool addErrno);
+    void sendBroadcast(const char *msg);
 
 protected:
     virtual bool onDataAvailable(SocketClient *c) = 0;
diff --git a/libsysutils/src/FrameworkClient.cpp b/libsysutils/src/FrameworkClient.cpp
index 237bb60..1686996 100644
--- a/libsysutils/src/FrameworkClient.cpp
+++ b/libsysutils/src/FrameworkClient.cpp
@@ -13,8 +13,7 @@
     pthread_mutex_init(&mWriteMutex, NULL);
 }
 
-int FrameworkClient::sendMsg(char *msg) {
-    LOGD("FrameworkClient::sendMsg(%s)", msg);
+int FrameworkClient::sendMsg(const char *msg) {
     if (mSocket < 0) {
         errno = EHOSTUNREACH;
         return -1;
@@ -28,7 +27,7 @@
     return 0;
 }
 
-int FrameworkClient::sendMsg(char *msg, char *data) {
+int FrameworkClient::sendMsg(const char *msg, const char *data) {
     char *buffer = (char *) alloca(strlen(msg) + strlen(data) + 1);
     if (!buffer) {
         errno = -ENOMEM;
diff --git a/libsysutils/src/SocketClient.cpp b/libsysutils/src/SocketClient.cpp
index ab020ca..b229627 100644
--- a/libsysutils/src/SocketClient.cpp
+++ b/libsysutils/src/SocketClient.cpp
@@ -14,7 +14,7 @@
     pthread_mutex_init(&mWriteMutex, NULL);
 }
 
-int SocketClient::sendMsg(int code, char *msg, bool addErrno) {
+int SocketClient::sendMsg(int code, const char *msg, bool addErrno) {
     char *buf;
     
     if (addErrno) {
@@ -27,23 +27,24 @@
     return sendMsg(buf);
 }
 
-int SocketClient::sendMsg(char *msg) {
+int SocketClient::sendMsg(const char *msg) {
     if (mSocket < 0) {
         errno = EHOSTUNREACH;
         return -1;
     }
 
-    char *bp;
-  
+    char *tmp;
+    const char *bp = msg;
+
     if (msg[strlen(msg)] != '\n') {
-        bp = (char *) alloca(strlen(msg) + 1);
-        strcpy(bp, msg);
-        strcat(bp, "\n");
-    } else
-        bp = msg;
+        tmp = (char *) alloca(strlen(msg) + 1);
+        strcpy(tmp, msg);
+        strcat(tmp, "\n");
+        bp = tmp;
+    }
        
     int rc = 0;
-    char *p = bp;
+    const char *p = bp;
     int brtw = strlen(bp);
 
     pthread_mutex_lock(&mWriteMutex);
diff --git a/libsysutils/src/SocketListener.cpp b/libsysutils/src/SocketListener.cpp
index acc4a67..cb7dd80 100644
--- a/libsysutils/src/SocketListener.cpp
+++ b/libsysutils/src/SocketListener.cpp
@@ -173,7 +173,7 @@
     }
 }
 
-void SocketListener::sendBroadcast(int code, char *msg, bool addErrno) {
+void SocketListener::sendBroadcast(int code, const char *msg, bool addErrno) {
     pthread_mutex_lock(&mClientsLock);
     SocketClientCollection::iterator i;
 
@@ -185,7 +185,7 @@
     pthread_mutex_unlock(&mClientsLock);
 }
 
-void SocketListener::sendBroadcast(char *msg) {
+void SocketListener::sendBroadcast(const char *msg) {
     pthread_mutex_lock(&mClientsLock);
     SocketClientCollection::iterator i;