From: Junghyun Yeon Date: Tue, 15 Nov 2016 08:53:39 +0000 (+0900) Subject: Fix coding rules X-Git-Tag: accepted/tizen/3.0/common/20161116.143515~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F97901%2F1;p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git Fix coding rules Change-Id: Ie777703854533a13c216cdf0087aa4169c054050 Signed-off-by: Junghyun Yeon --- diff --git a/include/pkgmgr-info.h b/include/pkgmgr-info.h index 30f1c79..e789b15 100644 --- a/include/pkgmgr-info.h +++ b/include/pkgmgr-info.h @@ -5585,7 +5585,7 @@ static int set_app_installed_storage(const char *appid, INSTALL_LOCATION locatio * @endcode */ int pkgmgrinfo_pkginfo_set_installed_storage(const char *pkgid, INSTALL_LOCATION location, const char *external_pkg_path); -int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char * pkgid, INSTALL_LOCATION location, const char *external_pkg_path, uid_t uid); +int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char *pkgid, INSTALL_LOCATION location, const char *external_pkg_path, uid_t uid); /** * @pkgmgrinfo client API diff --git a/include/pkgmgrinfo_type.h b/include/pkgmgrinfo_type.h index 30524e6..ba7e3c1 100644 --- a/include/pkgmgrinfo_type.h +++ b/include/pkgmgrinfo_type.h @@ -56,7 +56,7 @@ typedef struct { /** * @brief A handle to insert certificate information */ -typedef void* pkgmgrinfo_instcertinfo_h; +typedef void *pkgmgrinfo_instcertinfo_h; /** * @brief Certificate Types to be used for setting information @@ -148,37 +148,37 @@ typedef enum { /** * @brief A handle to get package information */ -typedef void* pkgmgrinfo_pkginfo_h; +typedef void *pkgmgrinfo_pkginfo_h; /** * @brief A handle to get application information */ -typedef void* pkgmgrinfo_appinfo_h; +typedef void *pkgmgrinfo_appinfo_h; /** * @brief A handle to get certificate information */ -typedef void* pkgmgrinfo_certinfo_h; +typedef void *pkgmgrinfo_certinfo_h; /** * @brief A handle to filter package information */ -typedef void* pkgmgrinfo_pkginfo_filter_h; +typedef void *pkgmgrinfo_pkginfo_filter_h; /** * @brief A handle to filter application information */ -typedef void* pkgmgrinfo_appinfo_filter_h; +typedef void *pkgmgrinfo_appinfo_filter_h; /** * @brief A handle to filter application metadata information */ -typedef void* pkgmgrinfo_appinfo_metadata_filter_h; +typedef void *pkgmgrinfo_appinfo_metadata_filter_h; /** * @brief A handle to get appcontrol information */ -typedef void* pkgmgrinfo_appcontrol_h; +typedef void *pkgmgrinfo_appcontrol_h; /** * @brief type definition. diff --git a/parser/src/pkgmgr_parser.c b/parser/src/pkgmgr_parser.c index fcaa064..cb5a204 100644 --- a/parser/src/pkgmgr_parser.c +++ b/parser/src/pkgmgr_parser.c @@ -1256,13 +1256,13 @@ static int __ps_process_privileges(xmlTextReaderPtr reader, GList **privileges) return -1; } ret = __ps_process_privilege(reader, privilege); - if (ret < 0) { + if (ret < 0) free(privilege); - } else { + else *privileges = g_list_append(*privileges, (gpointer)privilege); - } - } else + } else { return -1; + } if (ret < 0) { _LOGD("Processing privileges failed\n"); return ret; diff --git a/parser/src/pkgmgr_parser_db.c b/parser/src/pkgmgr_parser_db.c index 4b01c17..8955a8b 100644 --- a/parser/src/pkgmgr_parser_db.c +++ b/parser/src/pkgmgr_parser_db.c @@ -625,7 +625,7 @@ static GList *__create_image_list(GList *appimage, GList *imgs) return appimage; } -static void __trimfunc(GList* trim_list) +static void __trimfunc(GList *trim_list) { char *trim_data = NULL; char *prev = NULL; @@ -656,11 +656,11 @@ static gint __comparefunc(gconstpointer a, gconstpointer b, gpointer userdata) { if (a == NULL || b == NULL) return 0; - if (strcmp((char*)a, (char*)b) == 0) + if (strcmp((char *)a, (char *)b) == 0) return 0; - if (strcmp((char*)a, (char*)b) < 0) + if (strcmp((char *)a, (char *)b) < 0) return -1; - if (strcmp((char*)a, (char*)b) > 0) + if (strcmp((char *)a, (char *)b) > 0) return 1; return 0; } @@ -883,7 +883,7 @@ static void __extract_data(gpointer data, GList *lbls, GList *lcns, GList *icns, continue; if (lbl->lang) { if (strcmp(lbl->lang, (char *)data) == 0) { - *label = (char*)lbl->text; + *label = (char *)lbl->text; break; } } @@ -894,7 +894,7 @@ static void __extract_data(gpointer data, GList *lbls, GList *lcns, GList *icns, continue; if (lcn->lang) { if (strcmp(lcn->lang, (char *)data) == 0) { - *license = (char*)lcn->text; + *license = (char *)lcn->text; break; } } @@ -908,7 +908,7 @@ static void __extract_data(gpointer data, GList *lbls, GList *lcns, GList *icns, continue; if (dcn->lang) { if (strcmp(dcn->lang, (char *)data) == 0) { - *description = (char*)dcn->text; + *description = (char *)dcn->text; break; } } @@ -919,7 +919,7 @@ static void __extract_data(gpointer data, GList *lbls, GList *lcns, GList *icns, continue; if (ath->lang) { if (strcmp(ath->lang, (char *)data) == 0) { - *author = (char*)ath->text; + *author = (char *)ath->text; break; } } @@ -937,8 +937,8 @@ static void __extract_icon_data(gpointer data, GList *icns, char **icon, char ** continue; if (icn->section) { if (strcmp(icn->section, (char *)data) == 0) { - *icon = (char*)icn->text; - *resolution = (char*)icn->resolution; + *icon = (char *)icn->text; + *resolution = (char *)icn->resolution; break; } } @@ -955,8 +955,8 @@ static void __extract_image_data(gpointer data, GList *imgs, char **lang, char * continue; if (img->section) { if (strcmp(img->section, (char *)data) == 0) { - *lang = (char*)img->lang; - *image = (char*)img->text; + *lang = (char *)img->lang; + *image = (char *)img->text; break; } } @@ -988,7 +988,7 @@ static void __insert_pkglocale_info(gpointer data, gpointer userdata) "package_label, package_icon, package_description, package_license, package_author) VALUES" \ "(%Q, %Q, %Q, %Q, %Q, %Q, %Q)", mfx->package, - (char*)data, + (char *)data, label, icon, description, @@ -1010,7 +1010,7 @@ static void __insert_application_locale_info(gpointer data, gpointer userdata) char *query = NULL; char *locale = (char *)data; - application_x *app = (application_x*)userdata; + application_x *app = (application_x *)userdata; GList *lbl = app->label; GList *icn = app->icon; @@ -1020,7 +1020,7 @@ static void __insert_application_locale_info(gpointer data, gpointer userdata) query = sqlite3_mprintf("INSERT INTO package_app_localized_info(app_id, app_locale, " \ "app_label, app_icon) VALUES" \ - "(%Q, %Q, %Q, %Q)", app->appid, (char*)data, + "(%Q, %Q, %Q, %Q)", app->appid, (char *)data, label, icon); ret = __exec_query(query); if (ret == -1) @@ -1059,7 +1059,7 @@ static void __insert_application_icon_section_info(gpointer data, gpointer userd char *resolution = NULL; char query[MAX_QUERY_LEN] = {'\0'}; - application_x *app = (application_x*)userdata; + application_x *app = (application_x *)userdata; GList *icn = app->icon; __extract_icon_data(data, icn, &icon, &resolution); @@ -1068,7 +1068,7 @@ static void __insert_application_icon_section_info(gpointer data, gpointer userd sqlite3_snprintf(MAX_QUERY_LEN, query, "INSERT INTO package_app_icon_section_info(app_id, " \ "app_icon, app_icon_section, app_icon_resolution) VALUES " \ "(%Q, %Q, %Q, %Q)", app->appid, - icon, (char*)data, resolution); + icon, (char *)data, resolution); ret = __exec_query(query); if (ret == -1) @@ -1083,7 +1083,7 @@ static void __insert_application_image_info(gpointer data, gpointer userdata) char *img = NULL; char query[MAX_QUERY_LEN] = {'\0'}; - application_x *app = (application_x*)userdata; + application_x *app = (application_x *)userdata; GList *image = app->image; __extract_image_data(data, image, &lang, &img); @@ -1092,7 +1092,7 @@ static void __insert_application_image_info(gpointer data, gpointer userdata) sqlite3_snprintf(MAX_QUERY_LEN, query, "INSERT INTO package_app_image_info(app_id, app_locale, " \ "app_image_section, app_image) VALUES" \ - "(%Q, %Q, %Q, %Q)", app->appid, lang, (char*)data, img); + "(%Q, %Q, %Q, %Q)", app->appid, lang, (char *)data, img); ret = __exec_query(query); if (ret == -1) diff --git a/src/pkgmgrinfo_appinfo.c b/src/pkgmgrinfo_appinfo.c index 09bc4d7..c243192 100644 --- a/src/pkgmgrinfo_appinfo.c +++ b/src/pkgmgrinfo_appinfo.c @@ -1630,7 +1630,7 @@ API int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const if (metadata->value == NULL) *metadata_value = ""; else - *metadata_value = (char*)metadata->value; + *metadata_value = (char *)metadata->value; return PMINFO_R_OK; } } @@ -2716,8 +2716,8 @@ API int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle) static gint __compare_func(gconstpointer data1, gconstpointer data2) { - pkgmgrinfo_node_x *node1 = (pkgmgrinfo_node_x*)data1; - pkgmgrinfo_node_x *node2 = (pkgmgrinfo_node_x*)data2; + pkgmgrinfo_node_x *node1 = (pkgmgrinfo_node_x *)data1; + pkgmgrinfo_node_x *node2 = (pkgmgrinfo_node_x *)data2; if (node1->prop == node2->prop) return 0; else if (node1->prop > node2->prop) @@ -2741,8 +2741,8 @@ API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle, _LOGE("Invalid Integer Property\n"); return PMINFO_R_EINVAL; } - pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle; - pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x)); + pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle; + pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)calloc(1, sizeof(pkgmgrinfo_node_x)); if (node == NULL) { _LOGE("Out of Memory!!!\n"); return PMINFO_R_ERROR; @@ -2781,8 +2781,8 @@ API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle, _LOGE("Invalid Boolean Property\n"); return PMINFO_R_EINVAL; } - pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle; - pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x)); + pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle; + pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)calloc(1, sizeof(pkgmgrinfo_node_x)); if (node == NULL) { _LOGE("Out of Memory!!!\n"); return PMINFO_R_ERROR; @@ -2827,8 +2827,8 @@ API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle, _LOGE("Invalid String Property\n"); return PMINFO_R_EINVAL; } - pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle; - pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x)); + pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle; + pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)calloc(1, sizeof(pkgmgrinfo_node_x)); if (node == NULL) { _LOGE("Out of Memory!!!\n"); return PMINFO_R_ERROR; @@ -2941,7 +2941,7 @@ API int pkgmgrinfo_appinfo_usr_filter_foreach_appinfo( } API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle, - pkgmgrinfo_app_list_cb app_cb, void * user_data) + pkgmgrinfo_app_list_cb app_cb, void *user_data) { return pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle, app_cb, user_data, _getuid()); } diff --git a/src/pkgmgrinfo_basic.c b/src/pkgmgrinfo_basic.c index d0774e6..5c083e8 100644 --- a/src/pkgmgrinfo_basic.c +++ b/src/pkgmgrinfo_basic.c @@ -12,7 +12,7 @@ static void __ps_free_metadata(gpointer data) free((void *)metadata->key); if (metadata->value) free((void *)metadata->value); - free((void*)metadata); + free((void *)metadata); } static void __ps_free_permission(gpointer data) @@ -24,7 +24,7 @@ static void __ps_free_permission(gpointer data) free((void *)permission->type); if (permission->value) free((void *)permission->value); - free((void*)permission); + free((void *)permission); } static void __ps_free_icon(gpointer data) @@ -44,7 +44,7 @@ static void __ps_free_icon(gpointer data) free((void *)icon->resolution); if (icon->dpi) free((void *)icon->dpi); - free((void*)icon); + free((void *)icon); } static void __ps_free_image(gpointer data) @@ -58,7 +58,7 @@ static void __ps_free_image(gpointer data) free((void *)image->lang); if (image->section) free((void *)image->section); - free((void*)image); + free((void *)image); } static void __ps_free_notification(gpointer data) @@ -70,7 +70,7 @@ static void __ps_free_notification(gpointer data) free((void *)notification->text); if (notification->name) free((void *)notification->name); - free((void*)notification); + free((void *)notification); } static void __ps_free_compatibility(gpointer data) @@ -82,7 +82,7 @@ static void __ps_free_compatibility(gpointer data) free((void *)compatibility->text); if (compatibility->name) free((void *)compatibility->name); - free((void*)compatibility); + free((void *)compatibility); } static void __ps_free_datacontrol(gpointer data) @@ -96,7 +96,7 @@ static void __ps_free_datacontrol(gpointer data) free((void *)datacontrol->access); if (datacontrol->type) free((void *)datacontrol->type); - free((void*)datacontrol); + free((void *)datacontrol); } static void __ps_free_appcontrol(gpointer data) @@ -113,7 +113,7 @@ static void __ps_free_appcontrol(gpointer data) /*Free Mime*/ if (appcontrol->mime) free((void *)appcontrol->mime); - free((void*)appcontrol); + free((void *)appcontrol); } static void __ps_free_define(gpointer data) @@ -128,7 +128,7 @@ static void __ps_free_define(gpointer data) g_list_free_full(define->request, free); /*Free Allowed*/ g_list_free_full(define->allowed, free); - free((void*)define); + free((void *)define); } static void __ps_free_datashare(gpointer data) @@ -140,7 +140,7 @@ static void __ps_free_datashare(gpointer data) g_list_free_full(datashare->define, __ps_free_define); /*Free Request*/ g_list_free_full(datashare->request, free); - free((void*)datashare); + free((void *)datashare); } static void __ps_free_label(gpointer data) @@ -154,7 +154,7 @@ static void __ps_free_label(gpointer data) free((void *)label->text); if (label->lang) free((void *)label->lang); - free((void*)label); + free((void *)label); } static void __ps_free_author(gpointer data) @@ -170,7 +170,7 @@ static void __ps_free_author(gpointer data) free((void *)author->href); if (author->lang) free((void *)author->lang); - free((void*)author); + free((void *)author); } static void __ps_free_description(gpointer data) @@ -184,7 +184,7 @@ static void __ps_free_description(gpointer data) free((void *)description->text); if (description->lang) free((void *)description->lang); - free((void*)description); + free((void *)description); } static void __ps_free_license(gpointer data) @@ -196,7 +196,7 @@ static void __ps_free_license(gpointer data) free((void *)license->text); if (license->lang) free((void *)license->lang); - free((void*)license); + free((void *)license); } static void __ps_free_splashscreen(gpointer data) @@ -459,7 +459,6 @@ API void pkgmgrinfo_basic_free_package(package_x *package) g_list_free_full(package->compatibility, __ps_free_compatibility); /*Free Device profiles*/ g_list_free_full(package->deviceprofile, free); - free((void*)package); - return; + free((void *)package); } diff --git a/src/pkgmgrinfo_db.c b/src/pkgmgrinfo_db.c index 7f4d43f..ebf2879 100644 --- a/src/pkgmgrinfo_db.c +++ b/src/pkgmgrinfo_db.c @@ -314,7 +314,7 @@ API char *getUserPkgParserDBPathUID(uid_t uid) tzplatform_reset_user(); } - // just allow certain users to create the dbspace directory if needed. + /* just allow certain users to create the dbspace directory if needed. */ if (uid_caller == ROOT_UID || uid_caller == APPFW_UID || uid_caller == uid) _mkdir_for_user(db_path, uid, gid); @@ -349,7 +349,7 @@ API char *getUserPkgCertDBPathUID(uid_t uid) tzplatform_reset_user(); } - // just allow certain users to create the dbspace directory if needed. + /* just allow certain users to create the dbspace directory if needed. */ if (uid_caller == ROOT_UID || uid_caller == APPFW_UID || uid_caller == uid) _mkdir_for_user(db_path, uid, gid); diff --git a/src/pkgmgrinfo_pkginfo.c b/src/pkgmgrinfo_pkginfo.c index 4bb259d..ca0d464 100644 --- a/src/pkgmgrinfo_pkginfo.c +++ b/src/pkgmgrinfo_pkginfo.c @@ -53,8 +53,8 @@ static bool _get_bool_value(const char *str) static gint __compare_func(gconstpointer data1, gconstpointer data2) { - pkgmgrinfo_node_x *node1 = (pkgmgrinfo_node_x*)data1; - pkgmgrinfo_node_x *node2 = (pkgmgrinfo_node_x*)data2; + pkgmgrinfo_node_x *node1 = (pkgmgrinfo_node_x *)data1; + pkgmgrinfo_node_x *node2 = (pkgmgrinfo_node_x *)data2; if (node1->prop == node2->prop) return 0; else if (node1->prop > node2->prop) @@ -66,7 +66,7 @@ static gint __compare_func(gconstpointer data1, gconstpointer data2) static void __destroy_each_node(gpointer data, gpointer user_data) { ret_if(data == NULL); - pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)data; + pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)data; if (node->value) { free(node->value); node->value = NULL; diff --git a/src/pkgmgrinfo_private.c b/src/pkgmgrinfo_private.c index 4696af7..2889ce5 100644 --- a/src/pkgmgrinfo_private.c +++ b/src/pkgmgrinfo_private.c @@ -235,7 +235,7 @@ inline pkgmgrinfo_appinfo_filter_prop_bool _pminfo_appinfo_convert_to_prop_bool( int __get_filter_condition(gpointer data, char **condition, GList **params) { - pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)data; + pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)data; char buf[MAX_QUERY_LEN] = {'\0'}; int flag = 0; char *ptr = NULL;