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)
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;
GList **privileges)
{
static const char query_raw[] =
- "SELECT privilege FROM package_privilege_info WHERE package=%Q";
+ "SELECT DISTINCT privilege FROM package_privilege_info "
+ "WHERE package=%Q";
int ret;
char *query;
sqlite3_stmt *stmt;
- char *privilege;
+ privilege_x *privilege;
query = sqlite3_mprintf(query_raw, pkgid);
if (query == NULL) {
}
while (sqlite3_step(stmt) == SQLITE_ROW) {
- privilege = NULL;
- _save_column_str(stmt, 0, &privilege);
- if (privilege)
- *privileges = g_list_append(*privileges,
- (gpointer)privilege);
+ privilege = calloc(1, sizeof(privilege_x));
+ _save_column_str(stmt, 0, &privilege->value);
+ _save_column_str(stmt, 1, &privilege->type);
+ *privileges = g_list_append(*privileges,
+ (gpointer)privilege);
}
sqlite3_finalize(stmt);
"pi.storeclient_id, pi.mainapp_id, pi.package_url, "
"pi.root_path, pi.csc_path, pi.package_nodisplay, "
"pi.package_api_version, pi.package_support_disable, "
- "pi.package_tep_name, pi.package_zip_mount_file";
+ "pi.package_tep_name, pi.package_zip_mount_file, pi.external_path, "
+ "pi.package_support_mode";
static const char query_author[] =
", pi.author_name, pi.author_email, pi.author_href";
static const char query_label[] =
_save_column_str(stmt, idx++, &info->support_disable);
_save_column_str(stmt, idx++, &info->tep_name);
_save_column_str(stmt, idx++, &info->zip_mount_file);
+ _save_column_str(stmt, idx++, &info->external_path);
+ _save_column_str(stmt, idx++, &info->support_mode);
info->for_all_users =
strdup((uid != GLOBAL_USER) ? "false" : "true");
}
}
+ if (__pkginfo_check_installed_storage(info) != PMINFO_R_OK) {
+ ret = PMINFO_R_ERROR;
+ pkgmgrinfo_basic_free_package(info);
+ info = NULL;
+ continue;
+ }
+
g_hash_table_insert(packages, (gpointer)info->package,
(gpointer)info);
}
if (info->pkg_info == NULL)
return PMINFO_R_ERROR;
- if (info->pkg_info->type == NULL)
- info->pkg_info->type = strdup("");
- *type = (char *)info->pkg_info->type;
+ if (info->pkg_info->type == NULL)
+ *type = "";
+ else
+ *type = (char *)info->pkg_info->type;
return PMINFO_R_OK;
}
if (info->pkg_info == NULL)
return PMINFO_R_ERROR;
- if (info->pkg_info->version == NULL)
- info->pkg_info->version = strdup("");
- *version = (char *)info->pkg_info->version;
+ if (info->pkg_info->version == NULL)
+ *version = "";
+ else
+ *version = (char *)info->pkg_info->version;
return PMINFO_R_OK;
}
if (info->pkg_info == NULL)
return PMINFO_R_ERROR;
- if (info->pkg_info->api_version == NULL)
- info->pkg_info->api_version = strdup("");
- *api_version = (char *)info->pkg_info->api_version;
+ if (info->pkg_info->api_version == NULL)
+ *api_version = "";
+ else
+ *api_version = (char *)info->pkg_info->api_version;
return PMINFO_R_OK;
}
if (info->pkg_info == NULL)
return PMINFO_R_ERROR;
- if (info->pkg_info->zip_mount_file == NULL)
- info->pkg_info->zip_mount_file = strdup("");
- *zip_mount_file = (char *)info->pkg_info->zip_mount_file;
+ if (info->pkg_info->zip_mount_file == NULL)
+ *zip_mount_file = "";
+ else
+ *zip_mount_file = (char *)info->pkg_info->zip_mount_file;
return PMINFO_R_OK;
}
return PMINFO_R_ERROR;
ptr = (description_x *)info->pkg_info->description->data;
- if (ptr == NULL || ptr->text == NULL)
- *description = "";
+ if (ptr == NULL)
+ return PMINFO_R_ERROR;
- *description = (char *)ptr->text;
+ if (ptr->text == NULL)
+ *description = "";
+ else
+ *description = (char *)ptr->text;
return PMINFO_R_OK;
}
author = (author_x *)info->pkg_info->author->data;
if (author == NULL)
return PMINFO_R_ERROR;
- if (author->text == NULL)
- author->text = strdup("");
- *author_name = (char *)author->text;
+ if (author->text == NULL)
+ *author_name = "";
+ else
+ *author_name = (char *)author->text;
return PMINFO_R_OK;
}
author = (author_x *)info->pkg_info->author->data;
if (author == NULL)
return PMINFO_R_ERROR;
- if (author->email == NULL)
- author->email = strdup("");
- *author_email = (char *)author->email;
+ if (author->email == NULL)
+ *author_email = "";
+ else
+ *author_email = (char *)author->email;
return PMINFO_R_OK;
}
author = (author_x *)info->pkg_info->author->data;
if (author == NULL)
return PMINFO_R_ERROR;
- if (author->href == NULL)
- author->href = strdup("");
- *author_href = (char *)author->href;
+ if (author->href == NULL)
+ *author_href = "";
+ else
+ *author_href = (char *)author->href;
return PMINFO_R_OK;
}
if (info->pkg_info == NULL)
return PMINFO_R_ERROR;
- if (info->pkg_info->storeclient_id == NULL)
- info->pkg_info->storeclient_id = strdup("");
- *storeclientid = (char *)info->pkg_info->storeclient_id;
+ if (info->pkg_info->storeclient_id == NULL)
+ *storeclientid = "";
+ else
+ *storeclientid = (char *)info->pkg_info->storeclient_id;
return PMINFO_R_OK;
}
if (info->pkg_info == NULL)
return PMINFO_R_ERROR;
- if (info->pkg_info->package_url == NULL)
- info->pkg_info->package_url = strdup("");
- *url = (char *)info->pkg_info->package_url;
+ if (info->pkg_info->package_url == NULL)
+ *url = "";
+ else
+ *url = (char *)info->pkg_info->package_url;
return PMINFO_R_OK;
}
if (info->pkg_info == NULL)
return PMINFO_R_ERROR;
- if (info->pkg_info->csc_path == NULL)
- info->pkg_info->csc_path = strdup("");
- *path = (char *)info->pkg_info->csc_path;
+ if (info->pkg_info->csc_path == NULL)
+ *path = "";
+ else
+ *path = (char *)info->pkg_info->csc_path;
return PMINFO_R_OK;
}
+API int pkgmgrinfo_pkginfo_get_support_mode(pkgmgrinfo_pkginfo_h handle, int *support_mode)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(support_mode == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ if (info->pkg_info->support_mode)
+ *support_mode = atoi(info->pkg_info->support_mode);
+ else
+ *support_mode = 0;
+
+ return PMINFO_R_OK;
+}
API int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
retvm_if(privilege_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
int ret;
- const char *privilege;
+ privilege_x *privilege;
GList *tmp;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
return PMINFO_R_ERROR;
for (tmp = info->pkg_info->privileges; tmp; tmp = tmp->next) {
- privilege = (const char *)tmp->data;
+ privilege = (privilege_x *)tmp->data;
if (privilege == NULL)
continue;
- ret = privilege_func(privilege, user_data);
+ ret = privilege_func(privilege->value, user_data);
if (ret < 0)
break;
}