Fix mbtk_logd warning.
Change-Id: I3df4bbbfb0e8d865fd23e8beb0752b1226410cc9
diff --git a/mbtk/mbtk_logd/main.c b/mbtk/mbtk_logd/main.c
index ef750e8..5dde3b8 100755
--- a/mbtk/mbtk_logd/main.c
+++ b/mbtk/mbtk_logd/main.c
@@ -10,6 +10,9 @@
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <string.h>
+#include <pthread.h>
+
#include "json-c/json.h"
#include "json-c/printbuf.h"
#include "log_config.h"
@@ -69,7 +72,7 @@
json_object* fileter_listjson = NULL;
log_config_entry* entry;
int i, n, ret, array_length;
- const char* cmdval = NULL;
+ char* cmdval = NULL;
printf("MBTK_LOGD: in parse_config\n");
jsonobj = json_object_from_file(LOG_CONFIG_PATH);
@@ -86,7 +89,7 @@
printf("the tmpjson : [%s]\n", json_object_to_json_string(tmpjson));
}
/**获取total***/
- cmdval = json_object_get_string(tmpjson);
+ cmdval = (char*)json_object_get_string(tmpjson);
printf("logd enable : %s\n", cmdval);
json_object_put(tmpjson);
@@ -107,16 +110,16 @@
mbtk_log("enable: %d\n", entry->enable);
json_object_object_get_ex(datajson, "name", &listjson);
- entry->name = json_object_get_string(listjson);
+ entry->name = (char*)json_object_get_string(listjson);
printf("cmdval: %s\n", entry->name);
json_object_object_get_ex(datajson, "log_file", &listjson);
- entry->out_path = json_object_get_string(listjson);
+ entry->out_path = (char*)json_object_get_string(listjson);
mbtk_log("cmdval: %s\n", entry->out_path);
json_object_object_get_ex(datajson, "log_stream", &listjson);
if (listjson) {
- entry->ip = json_object_get_string(listjson);
+ entry->ip = (char*)json_object_get_string(listjson);
cmdval = strstr(entry->ip, ":");
if (cmdval) {
@@ -157,7 +160,7 @@
}
memset(_filter_list, 0, sizeof(struct filter_list_t));
json_object_object_get_ex(fileterjson, "priority", &fileter_listjson);
- char* str = json_object_get_string(fileter_listjson);
+ const char* str = json_object_get_string(fileter_listjson);
if (str) {
_filter_list->priority = str[0];
mbtk_log("fileter_listjson: %c\n", _filter_list->priority);
@@ -194,7 +197,7 @@
}
#define LOGD_PID "/var/run/mbtk_logd.pid"
-
+#if 0
static int save_pid(void)
{
pid_t process_id;
@@ -221,7 +224,7 @@
else
return -2;
}
-
+#endif
int main(int argc, char* argv[])
{
@@ -229,7 +232,7 @@
pthread_t pid[5] = {0};
int i, ret;
void* tret;
- struct filter_list_t* _filter_list = NULL;
+// struct filter_list_t* _filter_list = NULL;
#ifdef MBTK_DUMP_SUPPORT
mbtk_debug_open(NULL, TRUE);
@@ -292,7 +295,7 @@
}
if (pid[i]) {
if (pthread_join(pid[i], &tret) != 0) {
- printf("Join thread %d : %d error!\n", i, pid[i]);
+ printf("Join thread %d : %ld error!\n", i, pid[i]);
exit(1);
}
}