Remove unused code 85/297285/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Wed, 16 Aug 2023 08:27:05 +0000 (17:27 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Wed, 16 Aug 2023 08:27:05 +0000 (17:27 +0900)
Change-Id: I1b829bcef8c750408cf7a40f6c55343213c84609
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
client/src/pkgmgr_client_internal.c
client/src/pkgmgr_client_internal.h

index 1c303f9aff252ca5b9e637e84e8b4502a38ffbcf..da4d5a7ef3073d6de924bf2378d668656fce8360 100644 (file)
@@ -66,101 +66,6 @@ void _app_str_trim(char *input)
        return;
 }
 
-int _get_mime_from_file(const char *filename, char *mimetype, int len)
-{
-       const char *mime;
-       if (filename == NULL)
-               return -1;
-
-       if (access(filename, F_OK) != 0)
-               return -1;
-
-       mime = xdg_mime_get_mime_type_for_file(filename, 0);
-       if (strcmp(mime, "application/octet-stream") == 0)
-               mime = xdg_mime_get_mime_type_from_file_name(filename);
-
-       snprintf(mimetype, len, "%s", mime);
-       return 0;
-}
-
-int _get_mime_extension(const char *mimetype, char *ext, int len)
-{
-       const char **extlist;
-       int totlen = 0;
-       const char *unaliased_mimetype;
-
-       if (mimetype == NULL || ext == NULL || len <= 0)
-               return -1;
-
-       unaliased_mimetype = xdg_mime_unalias_mime_type(mimetype);
-       if (unaliased_mimetype == NULL)
-               return -1;
-
-       extlist = xdg_mime_get_file_names_from_mime_type(unaliased_mimetype);
-       if (extlist == NULL)
-               return -1;
-
-       if (extlist[0] == NULL)
-               return -1;
-
-       ext[0] = 0;
-       while (*extlist != NULL) {
-               if (*(extlist + 1) == NULL) {
-                       snprintf(&ext[totlen], len - totlen, "%s", *extlist);
-                       break;
-               } else {
-                       snprintf(&ext[totlen], len - totlen, "%s,", *extlist);
-                       if (strlen(*extlist) > len - totlen - 1)
-                               break;
-                       totlen += strlen(*extlist) + 1;
-                       extlist++;
-               }
-       }
-
-       return 0;
-}
-
-package_manager_pkg_info_t *_pkg_malloc_appinfo(int num)
-{
-       package_manager_app_info_t *app_info = NULL;
-       package_manager_app_info_t *first = NULL;
-       package_manager_app_info_t *last = NULL;
-       int i = 0;
-
-       for (i = 0; i < num; i++) {
-               app_info = (package_manager_app_info_t *)
-                   malloc(sizeof(package_manager_app_info_t));
-               if (app_info == NULL) {
-                       package_manager_app_info_t *temp_info;
-                       package_manager_app_info_t *next;
-
-                       for (temp_info = first; temp_info != NULL;
-                            temp_info = next) {
-                               next = temp_info->next;
-                               free(temp_info);
-                               temp_info = NULL;
-                       }
-
-                       return NULL;
-               }
-
-               memset(app_info, 0x00, sizeof(package_manager_app_info_t));
-
-               if (first == NULL)
-                       first = app_info;
-
-               if (last == NULL)
-                       last = app_info;
-               else {
-                       last->next = app_info;
-                       last = app_info;
-               }
-       }
-
-       return first;
-
-}
-
 static pkg_plugin_set *plugin_set_list[24] = { 0, };
 
 pkg_plugin_set *_pkg_plugin_load_library(const char *pkg_type,
@@ -291,129 +196,3 @@ pkg_plugin_set *_package_manager_load_library(const char *pkg_type)
 
        return plugin_set;
 }
-
-typedef struct _detail_info_map_t {
-       char *name;
-       void *field;
-       char *type;
-} detail_info_map_t;
-
-/*
-       typedef struct _package_manager_pkg_detail_info_t {
-               char pkg_type[PKG_TYPE_STRING_LEN_MAX];
-               char pkgid[PKG_NAME_STRING_LEN_MAX];
-               char version[PKG_VERSION_STRING_LEN_MAX];
-               char pkg_description[PKG_VALUE_STRING_LEN_MAX];
-               char min_platform_version[PKG_VERSION_STRING_LEN_MAX];
-               time_t installed_time;
-               int installed_size;
-               int app_size;
-               int data_size;
-               char optional_id[PKG_NAME_STRING_LEN_MAX];
-               void *pkg_optional_info;
-       } package_manager_pkg_detail_info_t;
-*/
-
-static package_manager_pkg_detail_info_t tmp_pkg_detail_info;
-
-static detail_info_map_t info_map[] = {
-       {"pkg_type", tmp_pkg_detail_info.pkg_type, "string"},
-       {"pkgid", tmp_pkg_detail_info.pkgid, "string"},
-       {"version", tmp_pkg_detail_info.version, "string"},
-       {"pkg_description", tmp_pkg_detail_info.pkg_description, "string"},
-       {"min_platform_version", tmp_pkg_detail_info.min_platform_version,
-        "string"},
-       {"installed_time", &tmp_pkg_detail_info.installed_time, "time_t"},
-       {"installed_size", &tmp_pkg_detail_info.installed_size, "int"},
-       {"app_size", &tmp_pkg_detail_info.app_size, "int"},
-       {"data_size", &tmp_pkg_detail_info.data_size, "int"},
-       {"optional_id", tmp_pkg_detail_info.optional_id, "string"}
-};
-
-char *_get_info_string(const char *key,
-                      const package_manager_pkg_detail_info_t *
-                      pkg_detail_info)
-{
-       detail_info_map_t *tmp;
-       int i = 0;
-
-       if (pkg_detail_info == NULL)
-               return NULL;
-
-       memcpy(&tmp_pkg_detail_info, pkg_detail_info,
-              sizeof(package_manager_pkg_detail_info_t));
-
-       for (i = 0; i < sizeof(info_map) / sizeof(detail_info_map_t); i++) {
-               tmp = &info_map[i];
-               if (strcmp(key, tmp->name) == 0) {
-                       if (strcmp(tmp->type, "string") == 0) {
-                               return strdup((char *)(tmp->field));
-                       } else if (strcmp(tmp->type, "bool") == 0) {
-                               char temp[PKG_VALUE_STRING_LEN_MAX];
-                               snprintf(temp, PKG_VALUE_STRING_LEN_MAX - 1,
-                                       "%d", (int)*(bool *) (tmp->field));
-                               return strdup(temp);
-                       } else if (strcmp(tmp->type, "int") == 0) {
-                               char temp[PKG_VALUE_STRING_LEN_MAX];
-                               snprintf(temp, PKG_VALUE_STRING_LEN_MAX - 1,
-                                       "%d", (int)*(int *)(tmp->field));
-                               return strdup(temp);
-                       } else if (strcmp(tmp->type, "time_t") == 0) {
-                               char temp[PKG_VALUE_STRING_LEN_MAX];
-                               snprintf(temp, PKG_VALUE_STRING_LEN_MAX - 1,
-                                       "%d", (int)*(time_t *) (tmp->field));
-                               return strdup(temp);
-                       } else
-                               return NULL;
-               }
-       }
-       return NULL;
-}
-
-int _get_info_int(const char *key,
-                 const package_manager_pkg_detail_info_t *pkg_detail_info)
-{
-       detail_info_map_t *tmp;
-       int i = 0;
-
-       if (pkg_detail_info == NULL)
-               return -1;
-
-       memcpy(&tmp_pkg_detail_info, pkg_detail_info,
-              sizeof(package_manager_pkg_detail_info_t));
-       for (i = 0; i < sizeof(info_map) / sizeof(detail_info_map_t); i++) {
-               tmp = &info_map[i];
-               if (strcmp(key, tmp->name) == 0) {
-                       if (strcmp(tmp->type, "int") == 0)
-                               return (int)*(int *)(tmp->field);
-                       else
-                               return -1;
-               }
-       }
-       return -1;
-}
-
-time_t _get_info_time(const char *key,
-                     const package_manager_pkg_detail_info_t *pkg_detail_info)
-{
-       detail_info_map_t *tmp;
-       int i = 0;
-
-       if (pkg_detail_info == NULL)
-               return -1;
-
-       memcpy(&tmp_pkg_detail_info, pkg_detail_info,
-              sizeof(package_manager_pkg_detail_info_t));
-       for (i = 0; i < sizeof(info_map) / sizeof(detail_info_map_t); i++) {
-               tmp = &info_map[i];
-               if (strcmp(key, tmp->name) == 0) {
-                       if (strcmp(tmp->type, "time_t") == 0)
-                               return (time_t) *(time_t *) (tmp->field);
-                       else
-                               return (time_t) -1;
-               }
-       }
-       return (time_t) -1;
-}
-
-
index 02c42054cc07d9bcf3c9c01575d36a8d567dc215..cb6b147a1cdc9a4c46560b7898357d902f08e529 100644 (file)
@@ -75,12 +75,6 @@ void pkgmgr_client_connection_unset_callback(struct pkgmgr_client_t *pc,
 int pkgmgr_client_connection_send_request(struct pkgmgr_client_t *pc,
                const char *method, GVariant *params, GVariant **result);
 
-
-typedef package_manager_pkg_info_t package_manager_app_info_t;
-
-
-package_manager_pkg_info_t *_pkg_malloc_appinfo(int num);
-
 pkg_plugin_set *_pkg_plugin_load_library(const char *pkg_type,
                                         const char *library_path);
 
@@ -88,33 +82,9 @@ int _pkg_plugin_get_library_path(const char *pkg_type, char *library_path);
 
 pkg_plugin_set *_package_manager_load_library(const char *pkg_type);
 
-char *_get_info_string(const char *key,
-                      const package_manager_pkg_detail_info_t *
-                      pkg_detail_info);
-
-int _get_info_int(const char *key,
-                 const package_manager_pkg_detail_info_t *pkg_detail_info);
-
-time_t _get_info_time(const char *key,
-                     const package_manager_pkg_detail_info_t *
-                     pkg_detail_info);
-
-
-#define PKG_FRONTEND   "frontend:"
-#define PKG_BACKEND            "backend:"
 #define PKG_BACKENDLIB "backendlib:"
-#define PKG_PARSERLIB  "parserlib:"
 #define PKG_CONF_PATH  "/etc/package-manager/pkg_path.conf"
 
-#define PKG_STATUS             "STATUS"
-
-#define PKG_STRING_LEN_MAX 1024
-#define PKG_EXT_LEN_MAX                 20
-#define PKG_ARGC_MAX            16
-
 void _app_str_trim(char *input);
 
-int _get_mime_from_file(const char *filename, char *mimetype, int len);
-int _get_mime_extension(const char *mimetype, char *ext, int len);
-
 #endif                         /* __PKGMGR_CLIENT_INTERNAL_H__ */