From: dyamy-lee Date: Fri, 28 Aug 2020 01:09:44 +0000 (+0900) Subject: fix the warning issues X-Git-Tag: accepted/tizen/unified/20200901.160655~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a000fb324467a028fbf0bc25b3cfea3fee06a97;p=platform%2Fcore%2Fuifw%2Flibds.git fix the warning issues Change-Id: I7638271160cc6a31201b0c98a0e66ff0159b29c6 --- diff --git a/src/DSWaylandServer/DSWaylandProtocolTrace.cpp b/src/DSWaylandServer/DSWaylandProtocolTrace.cpp index 1d4194f..75d8583 100644 --- a/src/DSWaylandServer/DSWaylandProtocolTrace.cpp +++ b/src/DSWaylandServer/DSWaylandProtocolTrace.cpp @@ -226,7 +226,7 @@ DSWaylandProtocolTracePrivate::~DSWaylandProtocolTracePrivate() bool DSWaylandProtocolTracePrivate::protocol_rule_init(char *rule_path) { bool ret = false; - char *argv[2]; + const char *argv[2]; int argc = 2; if(!rule_path || strlen(rule_path) <= 0) @@ -330,7 +330,7 @@ bool DSWaylandProtocolTracePrivate::protocol_rule_set(const int argc, const char ProtocolTrace_Rule_Set_Result result; const char * policy = argv[1]; //allow, deny char merge[8192] = {0,}, rule[8192] = {0,}; - int i, index=0, size_rule, apply = 0; + int i, index=0, size_rule, apply = 0, size_merge; if(argc <3) { @@ -354,8 +354,9 @@ bool DSWaylandProtocolTracePrivate::protocol_rule_set(const int argc, const char protocol_arguments_merge(merge, sizeof(merge), argc -2, &(argv[2])); size_rule = sizeof(rule) -1; + size_merge = strlen(merge); - for(i=0; isize_rule) return false; @@ -506,7 +508,7 @@ bool DSWaylandProtocolTracePrivate::protocol_rule_file_set(const char *filename) while(pfs -fs < rule_len) { int i, new_argc =3; - char *new_argv[3] = {"add", }; + const char *new_argv[3] = {"add", }; char policy[64] = {0,}; char rule[1024] = {0,}; @@ -543,7 +545,7 @@ bool DSWaylandProtocolTracePrivate::protocol_rule_file_set(const char *filename) bool DSWaylandProtocolTracePrivate::protocol_rule_validate(ProtocolTrace_Protocol_Log *log) { - char *cmd = ""; + const char *cmd = ""; if(!rc) return false; @@ -1262,7 +1264,7 @@ ProtocolTrace_Rule_Set_Result DSWaylandProtocolTracePrivate::rulechecker_rule_re return PROTOCOLTRACE_RULE_SET_OK; } -int DSWaylandProtocolTracePrivate::rulechecker_rule_validate(ProtocolTrace_Rule_Checker *rc, int type, int target_id, const char *name, int pid, char *cmd) +int DSWaylandProtocolTracePrivate::rulechecker_rule_validate(ProtocolTrace_Rule_Checker *rc, int type, int target_id, const char *name, int pid, const char *cmd) { ProtocolTrace_Validate_Args args = {type, target_id, name, pid, cmd}; ProtocolTrace_Tree_Node *node; @@ -1284,7 +1286,7 @@ int DSWaylandProtocolTracePrivate::rulechecker_rule_validate(ProtocolTrace_Rule_ return default_policy == PROTOCOLTRACE_TYPE_ALLOW; } -int DSWaylandProtocolTracePrivate::rulechecker_string_compare(ProtocolTrace_Comparer comparer, char *str2, char *str1) +int DSWaylandProtocolTracePrivate::rulechecker_string_compare(ProtocolTrace_Comparer comparer, char *str2, const char *str1) { int result = strcasecmp(str2, str1); @@ -1344,8 +1346,8 @@ int DSWaylandProtocolTracePrivate::rule_print_func(ProtocolTrace_Tree *tree, Pro { ProtocolTrace_Reply_Buffer *buffer = (ProtocolTrace_Reply_Buffer *)arg; char *reply = *buffer->reply; - int *len = buffer->len; - char *operators[] = {"==", "<", ">", "<=", ">=", "!=" }; + //int *len = buffer->len; + const char *operators[] = {"==", "<", ">", "<=", ">=", "!=" }; ProtocolTrace_Rule_Node *data; data = (ProtocolTrace_Rule_Node *)bintree_get_node_data(node); @@ -1415,14 +1417,15 @@ int DSWaylandProtocolTracePrivate::rule_validate_func(ProtocolTrace_Tree *tree, } if(msg) { - int min = MIN(sizeof(iface)-1, msg-args->name); + int size_iface = sizeof(iface) -1; + int min = MIN(size_iface, msg-args->name); strncpy(iface, args->name, min); iface[min] = '\0'; msg++; } if(!strcasecmp(data->variable_name, "TYPE")) { - char *type_string; + const char *type_string; if(args->type == 0) type_string = "REQUEST"; else if(args->type == 1) @@ -1440,7 +1443,7 @@ int DSWaylandProtocolTracePrivate::rule_validate_func(ProtocolTrace_Tree *tree, } else if(!strcasecmp(data->variable_name, "IFACE")) { - if(msg && iface[0] && rulechecker_string_compare(data->comparer, data->value.string, iface)) + if(msg && iface[0] && rulechecker_string_compare(data->comparer, data->value.string, (const char *)iface)) data->result = PROTOCOLTRACE_RESULT_TRUE; else data->result = PROTOCOLTRACE_RESULT_FALSE; diff --git a/src/DSWaylandServer/DSWaylandProtocolTracePrivate.h b/src/DSWaylandServer/DSWaylandProtocolTracePrivate.h index 569b462..d387a9f 100644 --- a/src/DSWaylandServer/DSWaylandProtocolTracePrivate.h +++ b/src/DSWaylandServer/DSWaylandProtocolTracePrivate.h @@ -31,7 +31,7 @@ #include #include -#define PATH_MAX 255 //tmp 255 +#define PATH_MAX 512 #ifndef MAX #define MAX(x, y) (((x) > (y)) ? (x) : (y)) @@ -210,7 +210,7 @@ typedef struct int target_id; const char *name; int pid; - char *cmd; + const char *cmd; } ProtocolTrace_Validate_Args; typedef struct @@ -278,8 +278,8 @@ private: ProtocolTrace_Rule_Set_Result rulechecker_rule_add(_ProtocolTrace_Rule_Checker *rc, ProtocolTrace_Policy_Type policy, const char *rule_string); void rulechecker_rule_print(ProtocolTrace_Rule_Checker *rc); ProtocolTrace_Rule_Set_Result rulechecker_rule_remove(ProtocolTrace_Rule_Checker *rc, int index); - static int rulechecker_rule_validate(ProtocolTrace_Rule_Checker *rc, int type, int target_id, const char *name, int pid, char *cmd); - static int rulechecker_string_compare(ProtocolTrace_Comparer comparer, char *str2, char *str1); + static int rulechecker_rule_validate(ProtocolTrace_Rule_Checker *rc, int type, int target_id, const char *name, int pid, const char *cmd); + static int rulechecker_string_compare(ProtocolTrace_Comparer comparer, char *str2, const char *str1); const char * rulechecker_usage_print(); static int rule_print_func(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, void *arg); static int rule_validate_func(ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, void *arg); diff --git a/tests/DSWaylandProtocolTrace-test.cpp b/tests/DSWaylandProtocolTrace-test.cpp index 31201ff..3139fd4 100644 --- a/tests/DSWaylandProtocolTrace-test.cpp +++ b/tests/DSWaylandProtocolTrace-test.cpp @@ -67,7 +67,7 @@ TEST_F(DSWaylandProtocolTraceTest, DSWaylandProtocolTraceUpdateRule) pTrace->init(); int argc = 3; - char *argv[3]; + const char *argv[3]; argv[0] = "add"; argv[1] = "ALLOW"; argv[2] = "all";