"type TEXT NOT NULL, " \
"orientation TEXT NOT NULL, " \
"indicatordisplay TEXT, " \
- "operation TEXT, " \
+ "operation TEXT NOT NULL, " \
"color_depth TEXT NOT NULL DEFAULT '24', " \
- "PRIMARY KEY(app_id, orientation) " \
+ "PRIMARY KEY(app_id, orientation, operation) " \
"FOREIGN KEY(app_id) " \
"REFERENCES package_app_info(app_id) " \
"ON DELETE CASCADE)"
if (mfx->application == NULL)
return -1;
app = (application_x *)mfx->application->data;
- for(i = 0; i < ncols; i++)
- {
+ for (i = 0; i < ncols; i++) {
if (strcmp(colname[i], "app_id") == 0) {
if (coltxt[i])
appid = strdup(coltxt[i]);
}
}
if (appid == NULL) {
- if(status != NULL)
+ if (status != NULL)
free(status);
_LOGD("app id is NULL\n");
return -1;
return 0;
}
-static int __exec_query_no_msg(char *query)
-{
- char *error_message = NULL;
- if (SQLITE_OK !=
- sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, &error_message)) {
- sqlite3_free(error_message);
- return -1;
- }
- sqlite3_free(error_message);
- return 0;
-}
-
static GList *__create_locale_list(GList *locale, GList *lbls, GList *lcns, GList *icns, GList *dcns, GList *aths)
{
GList *tmp;
continue;
} else
prev = trim_data;
- }
- else
+ } else {
prev = trim_data;
+ }
}
list = g_list_next(list);
}
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) {
- // if exists, return modified icon path
+ /* if exists, return modified icon path */
*new_icon_path = strdup(modified_iconpath);
return 0;
}
if (strcasecmp(icon->lang, lang) == 0) {
if (strcasecmp(icon->lang, DEFAULT_LOCALE) == 0) {
- //icon for no locale. check existance of folder-hierachied default icons
+ /* icon for no locale. check existance of folder-hierachied default icons */
if (__check_icon_folder(icon->text, &icon_folder_path) == 0) {
free(icon->text);
icon->text = icon_folder_path;
int dpi = 0;
int ret;
- // first, find icon whose locale and dpi with given lang and system's dpi has matched
+ /* first, find icon whose locale and dpi with given lang and system's dpi has matched */
tmp = g_list_find_custom(icons, lang, (GCompareFunc)__compare_icon_with_lang_dpi);
if (tmp != NULL) {
icon = (icon_x *)tmp->data;
return (char *)icon->text;
}
- // if first has failed, find icon whose locale has matched
+ /* if first has failed, find icon whose locale has matched */
tmp = g_list_find_custom(icons, lang, (GCompareFunc)__compare_icon_with_lang);
if (tmp != NULL) {
icon = (icon_x *)tmp->data;
return (char *)icon->text;
}
- // if second has failed, find icon whose dpi has matched with system's dpi
+ /* if second has failed, find icon whose dpi has matched with system's dpi */
ret = system_info_get_platform_int("http://tizen.org/feature/screen.dpi", &dpi);
if (ret == SYSTEM_INFO_ERROR_NONE) {
tmp = g_list_find_custom(icons, GINT_TO_POINTER(dpi), (GCompareFunc)__compare_icon_with_dpi);
}
}
- // last, find default icon marked as "No Locale"
+ /* last, find default icon marked as "No Locale" */
tmp = g_list_find_custom(icons, NULL, (GCompareFunc)__compare_icon);
if (tmp != NULL) {
icon = (icon_x *)tmp->data;
sqlite3_free(query);
/*insert ui app locale info to pkg locale to get mainapp data */
- if (strcasecmp(app->mainapp, "true")==0) {
+ if (strcasecmp(app->mainapp, "true") == 0) {
query = sqlite3_mprintf("INSERT OR REPLACE INTO package_localized_info(package, package_locale, "
"package_label, package_icon, package_description, package_license, package_author) VALUES"
"(%Q, %Q, "
_LOGD("Package App Info DB Insert Failed\n");
return -1;
}
- if (strcasecmp(app->mainapp, "True")==0)
+ if (strcasecmp(app->mainapp, "True") == 0)
mfx->mainapp_id = strdup(app->appid);
}
}
free((void *)app->mainapp);
- app->mainapp= strdup("true");
+ app->mainapp = strdup("true");
mfx->mainapp_id = strdup(app->appid);
}
while (tmp_list != NULL) {
category_data = (char *)tmp_list->data;
- if (strcmp(category_data, APP_BG_CATEGORY_MEDIA_STR) == 0) {
+ if (strcmp(category_data, APP_BG_CATEGORY_MEDIA_STR) == 0)
ret = ret | APP_BG_CATEGORY_MEDIA_VAL;
- } else if (strcmp(category_data, APP_BG_CATEGORY_DOWNLOAD_STR) == 0) {
+ else if (strcmp(category_data, APP_BG_CATEGORY_DOWNLOAD_STR) == 0)
ret = ret | APP_BG_CATEGORY_DOWNLOAD_VAL;
- } else if (strcmp(category_data, APP_BG_CATEGORY_BGNETWORK_STR) == 0) {
+ else if (strcmp(category_data, APP_BG_CATEGORY_BGNETWORK_STR) == 0)
ret = ret | APP_BG_CATEGORY_BGNETWORK_VAL;
- } else if (strcmp(category_data, APP_BG_CATEGORY_LOCATION_STR) == 0) {
+ else if (strcmp(category_data, APP_BG_CATEGORY_LOCATION_STR) == 0)
ret = ret | APP_BG_CATEGORY_LOCATION_VAL;
- } else if (strcmp(category_data, APP_BG_CATEGORY_SENSOR_STR) == 0) {
+ else if (strcmp(category_data, APP_BG_CATEGORY_SENSOR_STR) == 0)
ret = ret | APP_BG_CATEGORY_SENSOR_VAL;
- } else if (strcmp(category_data, APP_BG_CATEGORY_IOTCOMM_STR) == 0) {
+ else if (strcmp(category_data, APP_BG_CATEGORY_IOTCOMM_STR) == 0)
ret = ret | APP_BG_CATEGORY_IOTCOMM_VAL;
- } else if (strcmp(category_data, APP_BG_CATEGORY_SYSTEM) == 0) {
+ else if (strcmp(category_data, APP_BG_CATEGORY_SYSTEM) == 0)
ret = ret | APP_BG_CATEGORY_SYSTEM_VAL;
- } else {
+ else
_LOGE("Unidentified category [%s]", category_data);
- }
tmp_list = g_list_next(tmp_list);
}
ss = (splashscreen_x *)tmp->data;
sqlite3_snprintf(MAX_QUERY_LEN, query,
"INSERT INTO package_app_splash_screen" \
- "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \
+ "(app_id, src, type, orientation, indicatordisplay, " \
+ "operation, color_depth) " \
"VALUES(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
app->appid, ss->src, ss->type, ss->orientation,
ss->indicatordisplay, ss->operation,
ss->color_depth);
+
ret = __exec_query(query);
if (ret == -1) {
_LOGD("Package UiApp Splash Screen DB Insert Failed");
const char *image_type;
const char *indicatordisplay;
const char *orientation;
- const char *operation = NULL;
+ const char *operation = "launch-effect";
const char *color_depth = "24"; /* default */
for (app_tmp = mfx->application; app_tmp; app_tmp = app_tmp->next) {
if (operation && operation[1] != '\0')
operation++;
else
- operation = NULL;
+ operation = "launch-effect";
} else if (strcasestr(md->key, "launch_effect")) {
- operation = NULL;
+ operation = "launch-effect";
} else {
continue;
}
API int pkgmgr_parser_initialize_db(uid_t uid)
{
int ret = -1;
+ char *db_path;
/*Manifest DB*/
ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_INFO);
return ret;
}
- if( 0 != __parserdb_change_perm(getUserPkgCertDBPathUID(GLOBAL_USER), GLOBAL_USER)) {
- _LOGD("Failed to change cert db permission\n");
+ db_path = getUserPkgCertDBPathUID(GLOBAL_USER);
+ if (db_path == NULL) {
+ _LOGD("Failed to get user cert db path - GLOBAL_USER");
+ } else {
+ ret = __parserdb_change_perm(db_path, GLOBAL_USER);
+ if (ret != 0)
+ _LOGD("Failed to change cert db permission");
+ free(db_path);
}
- if( 0 != __parserdb_change_perm(getUserPkgParserDBPathUID(uid), uid)) {
- _LOGD("Failed to change parser db permission\n");
+
+ db_path = getUserPkgParserDBPathUID(uid);
+ if (db_path == NULL) {
+ _LOGD("Failed to get user pkg parser db path - %d", uid);
+ } else {
+ ret = __parserdb_change_perm(db_path, uid);
+ if (ret != 0)
+ _LOGD("Failed to change parser db permission\n");
+ free(db_path);
}
return 0;
if (db_file == NULL)
return -1;
- if (getuid() != OWNER_ROOT) //At this time we should be root to apply this
+ if (getuid() != OWNER_ROOT) /* At this time we should be root to apply this */
return 0;
snprintf(journal_file, sizeof(journal_file), "%s%s", db_file, "-journal");
if (uid == OWNER_ROOT)
API int pkgmgr_parser_create_and_initialize_db(uid_t uid)
{
int ret;
+ char *db_path;
if (getuid() != OWNER_ROOT) {
_LOGE("Only root user is allowed");
return -1;
}
- if (access(getUserPkgParserDBPathUID(uid), F_OK) != -1) {
+ db_path = getUserPkgParserDBPathUID(uid);
+ if (db_path == NULL) {
+ _LOGE("Failed to get pkg parser db path - %d", uid);
+ return -1;
+ }
+
+ if (access(db_path, F_OK) != -1) {
_LOGE("Manifest db for user %d is already exists", uid);
+ free(db_path);
+ return -1;
+ }
+ free(db_path);
+
+ db_path = getUserPkgCertDBPathUID(uid);
+ if (db_path == NULL) {
+ _LOGE("Failed to get pkg cert db path - %d", uid);
return -1;
}
- if (access(getUserPkgCertDBPathUID(uid), F_OK) != -1) {
+ if (access(db_path, F_OK) != -1) {
_LOGE("Cert db for user %d is already exists", uid);
+ free(db_path);
return -1;
}
+ free(db_path);
ret = pkgmgr_parser_check_and_create_db(uid);
if (ret < 0)
API int pkgmgr_parser_check_and_create_db(uid_t uid)
{
int ret = -1;
+ char *db_path;
+
+ db_path = getUserPkgParserDBPathUID(uid);
+ if (db_path == NULL) {
+ _LOGD("Failed to get pkg parser db path - %d", uid);
+ return -1;
+ }
+
/*Manifest DB*/
- ret = __pkgmgr_parser_create_db(&pkgmgr_parser_db, getUserPkgParserDBPathUID(uid));
+ ret = __pkgmgr_parser_create_db(&pkgmgr_parser_db, db_path);
if (ret) {
_LOGD("Manifest DB creation Failed\n");
+ free(db_path);
+ return -1;
+ }
+ free(db_path);
+
+ db_path = getUserPkgCertDBPathUID(GLOBAL_USER);
+ if (db_path == NULL) {
+ _LOGE("Failed to get pkg cert db path - GLOBAL_USER");
return -1;
}
/*Cert DB*/
- ret = __pkgmgr_parser_create_db(&pkgmgr_cert_db, getUserPkgCertDBPathUID(GLOBAL_USER));
+ ret = __pkgmgr_parser_create_db(&pkgmgr_cert_db, db_path);
if (ret) {
_LOGD("Cert DB creation Failed\n");
+ free(db_path);
return -1;
}
+
+ free(db_path);
+
return 0;
}
if (ret == -1)
goto err;
/*Preserve guest mode visibility*/
- __preserve_guestmode_visibility_value( mfx);
+ __preserve_guestmode_visibility_value(mfx);
/*Begin transaction*/
ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {