From f7a25651fb7726d61943c1d8ddbf13564b6dcffb Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 10 Mar 2016 07:44:22 +0900 Subject: [PATCH] Remove compile warning messages Change-Id: Ia12c7317158f5df7b8339842568b3f016a988b56 Signed-off-by: Hwankyu Jhun --- include/pkgmgrinfo_basic.h | 220 +++++++++++++++++++++---------------------- include/pkgmgrinfo_private.h | 2 +- parser/pkgmgr_parser.c | 46 ++++----- parser/pkgmgr_parser_db.c | 2 +- src/pkgmgrinfo_appinfo.c | 14 +-- src/pkgmgrinfo_certinfo.c | 4 +- src/pkgmgrinfo_db.c | 2 +- src/pkgmgrinfo_pkginfo.c | 4 +- 8 files changed, 148 insertions(+), 146 deletions(-) diff --git a/include/pkgmgrinfo_basic.h b/include/pkgmgrinfo_basic.h index 915a8a5..0cd0059 100644 --- a/include/pkgmgrinfo_basic.h +++ b/include/pkgmgrinfo_basic.h @@ -4,32 +4,32 @@ #include typedef struct metadata_x { - const char *key; - const char *value; + char *key; + char *value; } metadata_x; typedef struct permission_x { - const char *type; - const char *value; + char *type; + char *value; } permission_x; typedef struct icon_x { - const char *text; - const char *lang; - const char *section; - const char *size; - const char *resolution; - const char *dpi; + char *text; + char *lang; + char *section; + char *size; + char *resolution; + char *dpi; } icon_x; typedef struct image_x { - const char *text; - const char *lang; - const char *section; + char *text; + char *lang; + char *section; } image_x; typedef struct define_x { - const char *path; + char *path; GList *allowed; GList *request; } define_x; @@ -40,107 +40,107 @@ typedef struct datashare_x { } datashare_x; typedef struct description_x { - const char *name; - const char *text; - const char *lang; + char *name; + char *text; + char *lang; } description_x; typedef struct label_x { - const char *name; - const char *text; - const char *lang; + char *name; + char *text; + char *lang; } label_x; typedef struct author_x { - const char *email; - const char *href; - const char *text; - const char *lang; + char *email; + char *href; + char *text; + char *lang; } author_x; typedef struct license_x { - const char *text; - const char *lang; + char *text; + char *lang; } license_x; typedef struct condition_x { - const char *name; - const char *text; + char *name; + char *text; } condition_x; typedef struct notification_x { - const char *name; - const char *text; + char *name; + char *text; } notification_x; typedef struct appcontrol_x { - const char *operation; - const char *uri; - const char *mime; + char *operation; + char *uri; + char *mime; } appcontrol_x; typedef struct compatibility_x { - const char *name; - const char *text; + char *name; + char *text; } compatibility_x; typedef struct datacontrol_x { - const char *providerid; - const char *access; - const char *type; + char *providerid; + char *access; + char *type; } datacontrol_x; typedef struct splashscreen_x { - const char *src; - const char *type; - const char *dpi; - const char *orientation; - const char *indicatordisplay; - const char *operation; + char *src; + char *type; + char *dpi; + char *orientation; + char *indicatordisplay; + char *operation; } splashscreen_x; typedef struct application_x { - const char *appid; /*attr*/ - const char *exec; /*attr*/ - const char *nodisplay; /*attr, default: "false"*/ - const char *multiple; /*attr, default: "false"*/ - const char *taskmanage; /*attr, default: "true"*/ - const char *enabled; /*attr, default: "true"*/ - const char *type; /*attr*/ - const char *categories; /*attr*/ - const char *extraid; /*attr*/ - const char *hwacceleration; /*attr, default: "default"*/ - const char *screenreader; /*attr, default: "use-system-setting"*/ - const char *mainapp; /*attr, default: "false"*/ - const char *package; /*set from package_x*/ - const char *recentimage; /*attr, default: "false"*/ - const char *launchcondition; /*attr, default: "false"*/ - const char *indicatordisplay; /*attr, default: "true"*/ - const char *portraitimg; /*attr*/ - const char *landscapeimg; /*attr*/ - const char *effectimage_type; /*attr, default: "image"*/ - const char *guestmode_visibility; /*attr, default: "true"*/ - const char *component; /*no xml part*/ - const char *permission_type; /*attr, default: "normal"*/ - const char *component_type; /*attr, default: "uiapp"*/ - const char *preload; /*no xml part*/ - const char *submode; /*attr, default: "false"*/ - const char *submode_mainid; /*attr, default: "false"*/ - const char *process_pool; /*attr, default: "false"*/ - const char *installed_storage; - const char *autorestart; /*attr, default: "false"*/ - const char *onboot; /*attr, default: "false"*/ - const char *support_disable; /*set from package_x*/ - const char *ui_gadget; /*attr, default: "false"*/ - const char *launch_mode; /*attr, default: "single"*/ - const char *ambient_support; /*attr, default: "false"*/ - const char *alias_appid; /*attr*/ - const char *effective_appid; /*attr*/ - const char *package_type; /*set from package_x*/ - const char *tep_name; /*set from package_x*/ - const char *root_path; /*set from package_x*/ - const char *api_version; /*set from package_x*/ - const char *for_all_users; /**< Flag that indicates if the package is available for everyone or for current user only, no xml part*/ + char *appid; /*attr*/ + char *exec; /*attr*/ + char *nodisplay; /*attr, default: "false"*/ + char *multiple; /*attr, default: "false"*/ + char *taskmanage; /*attr, default: "true"*/ + char *enabled; /*attr, default: "true"*/ + char *type; /*attr*/ + char *categories; /*attr*/ + char *extraid; /*attr*/ + char *hwacceleration; /*attr, default: "default"*/ + char *screenreader; /*attr, default: "use-system-setting"*/ + char *mainapp; /*attr, default: "false"*/ + char *package; /*set from package_x*/ + char *recentimage; /*attr, default: "false"*/ + char *launchcondition; /*attr, default: "false"*/ + char *indicatordisplay; /*attr, default: "true"*/ + char *portraitimg; /*attr*/ + char *landscapeimg; /*attr*/ + char *effectimage_type; /*attr, default: "image"*/ + char *guestmode_visibility; /*attr, default: "true"*/ + char *component; /*no xml part*/ + char *permission_type; /*attr, default: "normal"*/ + char *component_type; /*attr, default: "uiapp"*/ + char *preload; /*no xml part*/ + char *submode; /*attr, default: "false"*/ + char *submode_mainid; /*attr, default: "false"*/ + char *process_pool; /*attr, default: "false"*/ + char *installed_storage; + char *autorestart; /*attr, default: "false"*/ + char *onboot; /*attr, default: "false"*/ + char *support_disable; /*set from package_x*/ + char *ui_gadget; /*attr, default: "false"*/ + char *launch_mode; /*attr, default: "single"*/ + char *ambient_support; /*attr, default: "false"*/ + char *alias_appid; /*attr*/ + char *effective_appid; /*attr*/ + char *package_type; /*set from package_x*/ + char *tep_name; /*set from package_x*/ + char *root_path; /*set from package_x*/ + char *api_version; /*set from package_x*/ + char *for_all_users; /**< Flag that indicates if the package is available for everyone or for current user only, no xml part*/ GList *label; /*element*/ GList *icon; /*element*/ GList *image; /*element*/ @@ -157,31 +157,31 @@ typedef struct application_x { } application_x; typedef struct package_x { - const char *for_all_users; /**< Flag that indicates if the package is available for everyone or for current user only, no xml part*/ - const char *package; /**< package name, attr*/ - const char *version; /**< package version, attr*/ - const char *installlocation; /**< package install location, attr, default: "internal-only"*/ - const char *ns; /**path, NULL); @@ -1237,7 +1237,7 @@ static int __ps_process_appcontrol(xmlTextReaderPtr reader, GList **appcontrol) const xmlChar *node; int ret = -1; int depth = -1; - const char *val; + char *val; GList *operations = NULL; GList *uris = NULL; GList *mimes = NULL; @@ -1300,7 +1300,7 @@ static int __ps_process_privileges(xmlTextReaderPtr reader, GList **privileges) const xmlChar *node; int ret = -1; int depth = -1; - const char *val; + char *val; depth = xmlTextReaderDepth(reader); while ((ret = __next_child_element(reader, depth))) { @@ -1330,7 +1330,7 @@ static int __ps_process_launchconditions(xmlTextReaderPtr reader, GList **launch const xmlChar *node; int ret = -1; int depth = -1; - const char *val; + char *val; depth = xmlTextReaderDepth(reader); while ((ret = __next_child_element(reader, depth))) { @@ -1361,7 +1361,7 @@ static int __ps_process_datashare(xmlTextReaderPtr reader, datashare_x *datashar const xmlChar *node; int ret = -1; int depth = -1; - const char *val; + char *val; depth = xmlTextReaderDepth(reader); while ((ret = __next_child_element(reader, depth))) { node = xmlTextReaderConstName(reader); @@ -1537,10 +1537,10 @@ static int __ps_process_icon(xmlTextReaderPtr reader, icon_x *icon, uid_t uid) __save_xml_lang(reader, &icon->lang); xmlTextReaderRead(reader); - const char *text = ASCII(xmlTextReaderValue(reader)); + char *text = ASCII(xmlTextReaderValue(reader)); if (text) { - icon->text = (const char *)__get_icon_with_path(text, uid); - free((void *)text); + icon->text = __get_icon_with_path(text, uid); + free(text); } return 0; @@ -1644,7 +1644,7 @@ static int __ps_process_application(xmlTextReaderPtr reader, application_x *appl const xmlChar *node; int ret = -1; int depth = -1; - const char *val; + char *val; __save_xml_attribute(reader, "appid", &application->appid, NULL); retvm_if(application->appid == NULL, PM_PARSER_R_ERROR, "appid cant be NULL, appid field is mandatory\n"); diff --git a/parser/pkgmgr_parser_db.c b/parser/pkgmgr_parser_db.c index 7215c92..4c010ab 100644 --- a/parser/pkgmgr_parser_db.c +++ b/parser/pkgmgr_parser_db.c @@ -693,7 +693,7 @@ static gint __check_icon_folder(const char *orig_icon_path, char **new_icon_path if (icon_filename == NULL) return -1; - snprintf(icon_path, strlen(orig_icon_path) - (strlen(icon_filename) - 1), orig_icon_path); + snprintf(icon_path, strlen(orig_icon_path) - (strlen(icon_filename) - 1), "%s", orig_icon_path); for (i = 0; i < 2; i++) { snprintf(modified_iconpath, BUFSIZE - 1, "%s/%s%s", icon_path, dpi_path[i], icon_filename); if (access(modified_iconpath, F_OK) != -1) { diff --git a/src/pkgmgrinfo_appinfo.c b/src/pkgmgrinfo_appinfo.c index 79dc42e..5003e2f 100644 --- a/src/pkgmgrinfo_appinfo.c +++ b/src/pkgmgrinfo_appinfo.c @@ -124,7 +124,7 @@ static gint _appinfo_get_list(sqlite3 *db, const char *locale, } while (sqlite3_step(stmt) == SQLITE_ROW) { - _save_column_str(stmt, 0, (const char **)&appid); + _save_column_str(stmt, 0, &appid); if (appid != NULL) *list = g_list_insert_sorted(*list, appid, __list_strcmp); @@ -309,7 +309,7 @@ static int _appinfo_get_category(sqlite3 *db, const char *appid, int ret; char *query; sqlite3_stmt *stmt; - const char *val; + char *val; query = sqlite3_mprintf(query_raw, appid); if (query == NULL) { @@ -394,7 +394,7 @@ static int _appinfo_get_app_control(sqlite3 *db, const char *appid, while (sqlite3_step(stmt) == SQLITE_ROW) { str = NULL; - _save_column_str(stmt, 0, (const char **)&str); + _save_column_str(stmt, 0, &str); /* TODO: revise */ __parse_appcontrol(appcontrol, str); free(str); @@ -539,7 +539,7 @@ static int _appinfo_get_splashscreens(sqlite3 *db, const char *appid, return PMINFO_R_OK; } -static GList *__get_background_category(char *value) +static GList *__get_background_category(const char *value) { GList *category_list = NULL; int convert_value = 0; @@ -672,6 +672,7 @@ static int _appinfo_get_application(sqlite3 *db, const char *appid, _save_column_str(stmt, idx++, &info->api_version); info->background_category = __get_background_category(bg_category_str); + free(bg_category_str); if (_appinfo_get_label(db, info->appid, locale, &info->label)) { pkgmgrinfo_basic_free_application(info); @@ -857,6 +858,7 @@ int _appinfo_get_applist(uid_t uid, const char *locale, GHashTable **appinfo_tab _save_column_str(stmt, idx++, &appinfo->api_version); appinfo->background_category = __get_background_category(bg_category_str); + free(bg_category_str); if (_appinfo_get_splashscreens(db, appinfo->appid, &appinfo->splashscreens)) { pkgmgrinfo_basic_free_application(appinfo); @@ -941,7 +943,7 @@ API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h * static gpointer __copy_str(gconstpointer src, gpointer data) { const char *tmp = (const char *)src; - const char *buffer; + char *buffer; buffer = strdup(tmp); if (buffer == NULL) { @@ -1417,7 +1419,7 @@ API int pkgmgrinfo_appinfo_get_usr_applist_for_amd(pkgmgrinfo_app_list_cb app_fu } g_hash_table_iter_init(&iter, appinfo_table); - while (g_hash_table_iter_next(&iter, &key, &val)) { + while (g_hash_table_iter_next(&iter, (gpointer)&key, (gpointer)&val)) { ret = app_func((void *)val, user_data); if (ret != PMINFO_R_OK) { LOGE("callback is stopped"); diff --git a/src/pkgmgrinfo_certinfo.c b/src/pkgmgrinfo_certinfo.c index 091d898..367a428 100644 --- a/src/pkgmgrinfo_certinfo.c +++ b/src/pkgmgrinfo_certinfo.c @@ -189,7 +189,7 @@ static int _pkginfo_get_pkgid_from_appid(uid_t uid, const char *appid, ret = sqlite3_step(stmt); if (ret == SQLITE_ROW) { - _save_column_str(stmt, 0, (const char **)pkgid); + _save_column_str(stmt, 0, pkgid); ret = PMINFO_R_OK; } else if (ret == SQLITE_DONE) { _LOGE("cannot find pkgid of app %s", appid); @@ -288,7 +288,7 @@ static int _pkginfo_get_cert(sqlite3 *db, int cert_id[], return PMINFO_R_ERROR; } - _save_column_str(stmt, 0, (const char **)&cert_info[i]); + _save_column_str(stmt, 0, &cert_info[i]); sqlite3_reset(stmt); sqlite3_clear_bindings(stmt); } diff --git a/src/pkgmgrinfo_db.c b/src/pkgmgrinfo_db.c index 7c02c30..805d2ed 100644 --- a/src/pkgmgrinfo_db.c +++ b/src/pkgmgrinfo_db.c @@ -448,7 +448,7 @@ void _save_column_int(sqlite3_stmt *stmt, int idx, int *i) *i = sqlite3_column_int(stmt, idx); } -void _save_column_str(sqlite3_stmt *stmt, int idx, const char **str) +void _save_column_str(sqlite3_stmt *stmt, int idx, char **str) { const char *val; diff --git a/src/pkgmgrinfo_pkginfo.c b/src/pkgmgrinfo_pkginfo.c index 9cdc260..12642e8 100644 --- a/src/pkgmgrinfo_pkginfo.c +++ b/src/pkgmgrinfo_pkginfo.c @@ -227,7 +227,7 @@ static int _pkginfo_get_list(sqlite3 *db, const char *locale, } while (sqlite3_step(stmt) == SQLITE_ROW) { - _save_column_str(stmt, 0, (const char **)&pkgid); + _save_column_str(stmt, 0, &pkgid); if (pkgid != NULL) *list = g_list_insert_sorted(*list, pkgid, __list_strcmp); @@ -565,7 +565,7 @@ static int _pkginfo_get_privilege(sqlite3 *db, const char *pkgid, int ret; char *query; sqlite3_stmt *stmt; - const char *privilege; + char *privilege; query = sqlite3_mprintf(query_raw, pkgid); if (query == NULL) { -- 2.7.4