Update coding convetion.
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 13 Aug 2013 01:44:28 +0000 (10:44 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 13 Aug 2013 01:44:28 +0000 (10:44 +0900)
Change-Id: Iaac15cbf752bc72aae77b7983d701147c60ebb61

lib/include/shortcut.h
lib/src/dlist.c
lib/src/icon.c
lib/src/main.c
packaging/libshortcut.spec
pkgmgr_shortcut/src/dlist.c
pkgmgr_shortcut/src/service_register.c
test/icon.c

index 431348c..95de869 100644 (file)
@@ -29,7 +29,6 @@ extern "C" {
 
 /**
  * @defgroup SHORTCUT Add to home (shortcut)
- * @author Sung-jae Park <nicesj.park@samsung.com>
  * @version 0.1
  * @brief To enhance the Add to home feature. Two types of API set are supported.
  *        One for the homescreen developers.
@@ -307,17 +306,17 @@ extern int add_to_home_remove_livebox(const char *appid, const char *name, resul
  *     }
  * 
  *     // Send the request to the shortcut service
- *     ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_IMAGE, "/usr/share/.../icon.png", NULL, NULL);
+ *     ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_IMAGE, "icon, "/usr/share/.../icon.png", NULL, NULL);
  *     if (ret < 0) {
  *        ...
  *     }
  *
- *     ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_TEXT, "app icon", NULL, NULL);
+ *     ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_TEXT, "text, "app icon", NULL, NULL);
  *     if (ret < 0) {
  *        ...
  *     }
  *
- *     ret = shortcut_icon_request_send(handle, LB_SIZE_TYPE_1x1, NULL, NULL, "/opt/usr/apps/com.samsung.cluster-home/data/out.png", result_cb, NULL);
+ *     ret = shortcut_icon_request_send(handle, LB_SIZE_TYPE_1x1, NULL, NULL, "/opt/usr/apps/org.tizen.cluster-home/data/out.png", result_cb, NULL);
  *     if (ret < 0) {
  *        ...
  *     }
index fa3082a..3ae571b 100644 (file)
@@ -45,8 +45,9 @@ struct dlist *dlist_append(struct dlist *list, void *data)
        struct dlist *item;
 
        item = malloc(sizeof(*item));
-       if (!item)
+       if (!item) {
                return NULL;
+       }
 
        item->next = NULL;
        item->data = data;
@@ -71,8 +72,9 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
        struct dlist *item;
 
        item = malloc(sizeof(*item));
-       if (!item)
+       if (!item) {
                return NULL;
+       }
 
        item->data = data;
 
@@ -80,8 +82,9 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
                item->prev = item;
                item->next = NULL;
        } else {
-               if (list->prev->next)
+               if (list->prev->next) {
                        list->prev->next = item;
+               }
 
                item->prev = list->prev;
                item->next = list;
@@ -95,16 +98,19 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
 
 struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
 {
-       if (!list || !l)
+       if (!list || !l) {
                return NULL;
+       }
 
-       if (l == list)
+       if (l == list) {
                list = l->next;
-       else
+       } else {
                l->prev->next = l->next;
+       }
 
-       if (l->next)
+       if (l->next) {
                l->next->prev = l->prev;
+       }
        /*!
         * \note
         * If the removed entry 'l' has no next element, it is the last element.
@@ -113,8 +119,9 @@ struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
         *
         * If we didn't care about this, the head element(list) can indicates the invalid element.
         */
-       else if (list)
+       else if (list) {
                list->prev = l->prev;
+       }
 
        free(l);
        return list;
@@ -126,8 +133,9 @@ struct dlist *dlist_find_data(struct dlist *list, void *data)
        void *_data;
 
        dlist_foreach(list, l, _data) {
-               if (data == _data)
+               if (data == _data) {
                        return l;
+               }
        }
 
        return NULL;
@@ -169,8 +177,9 @@ struct dlist *dlist_nth(struct dlist *l, int nth)
 
        i = 0;
        for (n = l; n; n = n->next) {
-               if (i == nth)
+               if (i == nth) {
                        return n;
+               }
                i++;
        }
 
index 99d5ea6..e129c3a 100644 (file)
@@ -170,8 +170,9 @@ static inline struct shortcut_icon *shortcut_icon_request_ref(struct shortcut_ic
 
 static int disconnected_cb(int handle, void *data)
 {
-       if (s_info.fd != handle)
+       if (s_info.fd != handle) {
                return 0;
+       }
 
        ErrPrint("Disconnected\n");
        s_info.fd = -1;
@@ -205,8 +206,9 @@ static inline int shortcut_icon_desc_save(struct shortcut_desc *handle, const ch
        struct block *block;
        FILE *fp;
 
-       if (!handle)
+       if (!handle) {
                return -EINVAL;
+       }
 
        fp = fopen(filename, "w+t");
        if (!fp) {
@@ -252,7 +254,9 @@ static inline int shortcut_icon_desc_save(struct shortcut_desc *handle, const ch
                DbgPrint("}\n");
        }
 
-       fclose(fp);
+       if (fclose(fp) != 0) {
+               ErrPrint("fclose: %s\n", strerror(errno));
+       }
        return 0;
 }
 
@@ -264,8 +268,9 @@ static inline struct block *find_block(struct shortcut_desc *handle, const char
        struct dlist *l;
 
        dlist_foreach(handle->block_list, l, block) {
-               if (!strcmp(block->part, part) && (!id || !strcmp(block->id, id)))
+               if (!strcmp(block->part, part) && (!id || !strcmp(block->id, id))) {
                        return block;
+               }
        }
 
        return NULL;
@@ -314,14 +319,17 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con
 {
        struct block *block;
 
-       if (!handle || !type)
+       if (!handle || !type) {
                return SHORTCUT_ERROR_INVALID;
+       }
 
-       if (!part)
+       if (!part) {
                part = "";
+       }
 
-       if (!data)
+       if (!data) {
                data = "";
+       }
 
        if (target_id) {
                if (strcmp(type, SHORTCUT_ICON_TYPE_SCRIPT)) {
@@ -442,8 +450,9 @@ static int icon_request_cb(pid_t pid, int handle, const struct packet *packet, v
                }
        }
 
-       if (item->result_cb)
+       if (item->result_cb) {
                item->result_cb(item->handle, ret, item->data);
+       }
 
        (void)shortcut_icon_request_unref(item->handle);
        free(item);
@@ -466,15 +475,17 @@ static inline int make_connection(void)
        if (s_info.fd < 0) {
                ret = SHORTCUT_ERROR_COMM;
 
-               if (s_info.init_cb)
+               if (s_info.init_cb) {
                        s_info.init_cb(ret, s_info.cbdata);
+               }
        } else {
                struct dlist *l;
                struct dlist *n;
                struct pending_item *pend;
 
-               if (s_info.init_cb)
+               if (s_info.init_cb) {
                        s_info.init_cb(SHORTCUT_SUCCESS, s_info.cbdata);
+               }
 
                dlist_foreach_safe(s_info.pending_list, l, n, pend) {
                        s_info.pending_list = dlist_remove(s_info.pending_list, l);
@@ -483,8 +494,9 @@ static inline int make_connection(void)
                        packet_destroy(pend->packet);
                        if (ret < 0) {
                                ErrPrint("ret: %d\n", ret);
-                               if (pend->item->result_cb)
+                               if (pend->item->result_cb) {
                                        pend->item->result_cb(pend->item->handle, ret, pend->item->data);
+                               }
                                free(pend->item);
                        }
 
@@ -503,8 +515,9 @@ static void master_started_cb(keynode_t *node, void *user_data)
 {
        int state = 0;
 
-       if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0)
+       if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0) {
                ErrPrint("Unable to get \"%s\"\n", VCONFKEY_MASTER_STARTED);
+       }
 
        if (state == 1 && make_connection() == SHORTCUT_SUCCESS) {
                int ret;
@@ -519,8 +532,9 @@ EAPI int shortcut_icon_service_init(int (*init_cb)(int status, void *data), void
 {
        int ret;
 
-       if (s_info.fd >= 0)
+       if (s_info.fd >= 0) {
                return -EALREADY;
+       }
 
        if (s_info.initialized) {
                s_info.initialized = 1;
@@ -531,10 +545,11 @@ EAPI int shortcut_icon_service_init(int (*init_cb)(int status, void *data), void
        s_info.cbdata = data;
 
        ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL);
-       if (ret < 0)
+       if (ret < 0) {
                ErrPrint("Failed to add vconf for service state [%d]\n", ret);
-       else
+       } else {
                DbgPrint("vconf is registered\n");
+       }
 
        master_started_cb(NULL, NULL);
        return 0;
@@ -553,8 +568,9 @@ EAPI int shortcut_icon_service_fini(void)
                s_info.initialized = 0;
        }
 
-       if (s_info.fd < 0)
+       if (s_info.fd < 0) {
                return -EINVAL;
+       }
 
        com_core_packet_client_fini(s_info.fd);
        s_info.init_cb = NULL;
@@ -564,8 +580,9 @@ EAPI int shortcut_icon_service_fini(void)
        dlist_foreach_safe(s_info.pending_list, l, n, pend) {
                s_info.pending_list = dlist_remove(s_info.pending_list, l);
                packet_unref(pend->packet);
-               if (pend->item->result_cb)
+               if (pend->item->result_cb) {
                        pend->item->result_cb(pend->item->handle, SHORTCUT_ERROR_COMM, pend->item->data);
+               }
                free(pend->item);
                free(pend);
        }
@@ -660,11 +677,13 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type,
                return -EINVAL;
        }
 
-       if (!layout)
+       if (!layout) {
                layout = DEFAULT_ICON_LAYOUT;
+       }
 
-       if (!group)
+       if (!group) {
                group = DEFAULT_ICON_GROUP;
+       }
 
        len = strlen(outfile) + strlen(".desc") + 1;
        filename = malloc(len);
@@ -676,14 +695,16 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type,
        snprintf(filename, len, "%s.desc", outfile);
 
        ret = shortcut_icon_desc_save(handle->desc, filename);
-       if (ret < 0)
+       if (ret < 0) {
                goto out;
+       }
 
        item = malloc(sizeof(*item));
        if (!item) {
                ErrPrint("Heap: %s\n", strerror(errno));
-               if (unlink(filename) < 0)
+               if (unlink(filename) < 0) {
                        ErrPrint("Unlink: %s\n", strerror(errno));
+               }
                ret = -ENOMEM;
                goto out;
        }
@@ -695,8 +716,9 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type,
        packet = packet_create("icon_create", "sssis", layout, group, filename, size_type, outfile);
        if (!packet) {
                ErrPrint("Failed to create a packet\n");
-               if (unlink(filename) < 0)
+               if (unlink(filename) < 0) {
                        ErrPrint("Unlink: %s\n", strerror(errno));
+               }
                free(item);
                (void)shortcut_icon_request_unref(handle);
                ret = -EFAULT;
@@ -708,8 +730,9 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type,
                packet_destroy(packet);
                if (ret < 0) {
                        ErrPrint("ret: %d\n", ret);
-                       if (unlink(filename) < 0)
+                       if (unlink(filename) < 0) {
                                ErrPrint("Unlink: %s\n", strerror(errno));
+                       }
                        free(item);
                        (void)shortcut_icon_request_unref(handle);
                }
@@ -722,8 +745,9 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type,
                        ErrPrint("Heap: %s\n", strerror(errno));
                        packet_destroy(packet);
                        free(item);
-                       if (unlink(filename) < 0)
+                       if (unlink(filename) < 0) {
                                ErrPrint("Unlink: %s\n", strerror(errno));
+                       }
                        (void)shortcut_icon_request_unref(handle);
                        ret = -ENOMEM;
                        goto out;
index 958ccde..60b91b1 100644 (file)
@@ -87,10 +87,11 @@ static struct packet *remove_shortcut_handler(pid_t pid, int handle, const struc
 
        DbgPrint("appid[%s], name[%s], content_info[%s]\n", appid, name, content_info);
 
-       if (s_info.server_cb.request_cb)
+       if (s_info.server_cb.request_cb) {
                ret = s_info.server_cb.request_cb(appid, name, SHORTCUT_REMOVE, content_info, NULL, sender_pid, -1.0f, 0, s_info.server_cb.data);
-       else
+       } else {
                ret = SHORTCUT_ERROR_UNSUPPORTED;
+       }
 
        return packet_create_reply(packet, "i", ret);
 }
@@ -116,10 +117,11 @@ static struct packet *remove_livebox_handler(pid_t pid, int handle, const struct
 
        DbgPrint("appid[%s], name[%s]\n", appid, name);
 
-       if (s_info.server_cb.request_cb)
+       if (s_info.server_cb.request_cb) {
                ret = s_info.server_cb.request_cb(appid, name, LIVEBOX_REMOVE, NULL, NULL, sender_pid, -1.0f, 0, s_info.server_cb.data);
-       else
+       } else {
                ret = SHORTCUT_ERROR_UNSUPPORTED;
+       }
 
        return packet_create_reply(packet, "i", ret);
 }
@@ -137,8 +139,9 @@ static struct packet *add_shortcut_handler(pid_t pid, int handle, const struct p
        int ret;
        int sender_pid;
 
-       if (!packet)
+       if (!packet) {
                return NULL;
+       }
 
        if (packet_get(packet, "ississi", &sender_pid, &appid, &name, &type, &content, &icon, &allow_duplicate) != 7) {
                ErrPrint("Invalid packet\n");
@@ -147,10 +150,11 @@ static struct packet *add_shortcut_handler(pid_t pid, int handle, const struct p
 
        DbgPrint("appid[%s], name[%s], type[0x%x], content[%s], icon[%s] allow_duplicate[%d]\n", appid, name, type, content, icon, allow_duplicate);
 
-       if (s_info.server_cb.request_cb)
+       if (s_info.server_cb.request_cb) {
                ret = s_info.server_cb.request_cb(appid, name, type, content, icon, sender_pid, -1.0f, allow_duplicate, s_info.server_cb.data);
-       else
+       } else {
                ret = SHORTCUT_ERROR_UNSUPPORTED;
+       }
 
        return packet_create_reply(packet, "i", ret);
 }
@@ -169,8 +173,9 @@ static struct packet *add_livebox_handler(pid_t pid, int handle, const struct pa
        int ret;
        int sender_pid;
 
-       if (!packet)
+       if (!packet) {
                return NULL;
+       }
 
        if (packet_get(packet, "ississdi", &sender_pid, &appid, &name, &type, &content, &icon, &period, &allow_duplicate) != 8) {
                ErrPrint("Invalid packet\n");
@@ -179,10 +184,11 @@ static struct packet *add_livebox_handler(pid_t pid, int handle, const struct pa
 
        DbgPrint("appid[%s], name[%s], type[0x%x], content[%s], icon[%s], period[%lf], allow_duplicate[%d]\n", appid, name, type, content, icon, period, allow_duplicate);
 
-       if (s_info.server_cb.request_cb)
+       if (s_info.server_cb.request_cb) {
                ret = s_info.server_cb.request_cb(appid, name, type, content, icon, sender_pid, period, allow_duplicate, s_info.server_cb.data);
-       else
+       } else {
                ret = 0;
+       }
 
        return packet_create_reply(packet, "i", ret);
 }
@@ -193,8 +199,9 @@ static void master_started_cb(keynode_t *node, void *user_data)
 {
        int state = 0;
 
-       if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0)
+       if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0) {
                ErrPrint("Unable to get \"%s\"\n", VCONFKEY_MASTER_STARTED);
+       }
 
        if (state == 1 && make_connection() == SHORTCUT_SUCCESS) {
                int ret;
@@ -210,10 +217,11 @@ static gboolean timeout_cb(void *data)
        int ret;
 
        ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL);
-       if (ret < 0)
+       if (ret < 0) {
                ErrPrint("Failed to add vconf for service state [%d]\n", ret);
-       else
+       } else {
                DbgPrint("vconf is registered\n");
+       }
 
        master_started_cb(NULL, NULL);
 
@@ -234,8 +242,9 @@ static int disconnected_cb(int handle, void *data)
                if (!s_info.timer_id) {
                        s_info.server_fd = SHORTCUT_ERROR_INVALID;
                        s_info.timer_id = g_timeout_add(1000, timeout_cb, NULL);
-                       if (!s_info.timer_id)
+                       if (!s_info.timer_id) {
                                ErrPrint("Unable to add timer\n");
+                       }
                }
                return 0;
        }
@@ -349,10 +358,11 @@ static int shortcut_send_cb(pid_t pid, int handle, const struct packet *packet,
                ret = SHORTCUT_ERROR_INVALID;
        }
 
-       if (item->result_cb)
+       if (item->result_cb) {
                ret = item->result_cb(ret, pid, item->data);
-       else
+       } else {
                ret = SHORTCUT_SUCCESS;
+       }
        free(item);
        return ret;
 }
@@ -488,8 +498,9 @@ EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, con
        struct result_cb_item *item;
        int ret;
 
-       if (ADD_TO_HOME_IS_LIVEBOX(type))
+       if (ADD_TO_HOME_IS_LIVEBOX(type)) {
                ErrPrint("Invalid type used for adding a shortcut\n");
+       }
 
        if (!s_info.initialized) {
                s_info.initialized = 1;
@@ -520,17 +531,21 @@ EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, con
        item->result_cb = result_cb;
        item->data = data;
 
-       if (!appid)
+       if (!appid) {
                appid = "";
+       }
 
-       if (!name)
+       if (!name) {
                name = "";
+       }
 
-       if (!content)
+       if (!content) {
                content = "";
+       }
 
-       if (!icon)
+       if (!icon) {
                icon = "";
+       }
 
        packet = packet_create("add_shortcut", "ississi", getpid(), appid, name, type, content, icon, allow_duplicate);
        if (!packet) {
@@ -559,8 +574,9 @@ EAPI int add_to_home_livebox(const char *appid, const char *name, int type, cons
        struct result_cb_item *item;
        int ret;
 
-       if (!ADD_TO_HOME_IS_LIVEBOX(type))
+       if (!ADD_TO_HOME_IS_LIVEBOX(type)) {
                ErrPrint("Invalid type is used for adding a livebox\n");
+       }
 
        if (!s_info.initialized) {
                s_info.initialized = 1;
@@ -576,8 +592,9 @@ EAPI int add_to_home_livebox(const char *appid, const char *name, int type, cons
                };
 
                s_info.client_fd = com_core_packet_client_init(s_info.socket_file, 0, service_table);
-               if (s_info.client_fd < 0)
+               if (s_info.client_fd < 0) {
                        return SHORTCUT_ERROR_COMM;
+               }
        }
 
        item = malloc(sizeof(*item));
@@ -688,15 +705,17 @@ static inline char *cur_locale(void)
                                break;
                        }
 
-                       if (*ptr == '_')
+                       if (*ptr == '_') {
                                *ptr = '-';
+                       }
 
                        ptr++;
                }
        } else {
                language = strdup("en-us");
-               if (!language)
+               if (!language) {
                        ErrPrint("Heap: %s\n", strerror(errno));
+               }
        }
 
        return language;
@@ -721,8 +740,9 @@ EAPI int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const
        int cnt;
        char *language;
 
-       if (!s_info.db_opened)
+       if (!s_info.db_opened) {
                s_info.db_opened = (open_db() == 0);
+       }
 
        if (!s_info.db_opened) {
                ErrPrint("Failed to open a DB\n");
index f8cb0c1..3dc5a88 100644 (file)
@@ -1,6 +1,6 @@
 Name: libshortcut
 Summary: Shortcut add feature supporting library
-Version: 0.6.5
+Version: 0.6.6
 Release: 0
 Group: HomeTF/Framework
 License: Apache License
@@ -34,6 +34,11 @@ Requires:   %{name} = %{version}-%{release}
 %setup -q
 
 %build
+%if 0%{?tizen_build_binary_release_type_eng}
+export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
+export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
+%endif
 %cmake .
 make %{?jobs:-j%jobs}
 
index 2b40ff4..1764dfd 100644 (file)
@@ -46,8 +46,9 @@ struct dlist *dlist_append(struct dlist *list, void *data)
        struct dlist *item;
 
        item = malloc(sizeof(*item));
-       if (!item)
+       if (!item) {
                return NULL;
+       }
 
        item->next = NULL;
        item->data = data;
@@ -72,8 +73,9 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
        struct dlist *item;
 
        item = malloc(sizeof(*item));
-       if (!item)
+       if (!item) {
                return NULL;
+       }
 
        item->data = data;
 
@@ -81,8 +83,9 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
                item->prev = item;
                item->next = NULL;
        } else {
-               if (list->prev->next)
+               if (list->prev->next) {
                        list->prev->next = item;
+               }
 
                item->prev = list->prev;
                item->next = list;
@@ -99,13 +102,15 @@ struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
        if (!list || !l)
                return NULL;
 
-       if (l == list)
+       if (l == list) {
                list = l->next;
-       else
+       } else {
                l->prev->next = l->next;
+       }
 
-       if (l->next)
+       if (l->next) {
                l->next->prev = l->prev;
+       }
        /*!
         * \note
         * If the removed entry 'l' has no next element, it is the last element.
@@ -114,8 +119,9 @@ struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
         *
         * If we didn't care about this, the head element(list) can indicates the invalid element.
         */
-       else if (list)
+       else if (list) {
                list->prev = l->prev;
+       }
 
        free(l);
        return list;
@@ -127,8 +133,9 @@ struct dlist *dlist_find_data(struct dlist *list, void *data)
        void *_data;
 
        dlist_foreach(list, l, _data) {
-               if (data == _data)
+               if (data == _data) {
                        return l;
+               }
        }
 
        return NULL;
@@ -170,8 +177,9 @@ struct dlist *dlist_nth(struct dlist *l, int nth)
 
        i = 0;
        for (n = l; n; n = n->next) {
-               if (i == nth)
+               if (i == nth) {
                        return n;
+               }
                i++;
        }
 
index ac91cc9..31b83e7 100644 (file)
@@ -161,8 +161,9 @@ static inline void db_create_table(void)
                return;
        }
 
-       if (sqlite3_changes(s_info.handle) == 0)
+       if (sqlite3_changes(s_info.handle) == 0) {
                ErrPrint("No changes to DB\n");
+       }
 
        ddl = "CREATE TABLE shortcut_name (id INTEGER, lang TEXT, name TEXT)";
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
@@ -170,8 +171,9 @@ static inline void db_create_table(void)
                return;
        }
 
-       if (sqlite3_changes(s_info.handle) == 0)
+       if (sqlite3_changes(s_info.handle) == 0) {
                ErrPrint("No changes to DB\n");
+       }
 }
 
 static inline int db_remove_record(const char *appid, const char *key, const char *data)
@@ -213,8 +215,9 @@ static inline int db_remove_record(const char *appid, const char *key, const cha
                ErrPrint("Failed to execute the DML for %s - %s(%s)\n", appid, key, data);
        }
 
-       if (sqlite3_changes(s_info.handle) == 0)
+       if (sqlite3_changes(s_info.handle) == 0) {
                DbgPrint("No changes\n");
+       }
 
 out:
        sqlite3_reset(stmt);
@@ -253,8 +256,9 @@ static inline int db_remove_name(int id)
                goto out;
        }
 
-       if (sqlite3_changes(s_info.handle) == 0)
+       if (sqlite3_changes(s_info.handle) == 0) {
                DbgPrint("No changes\n");
+       }
 
 out:
        sqlite3_reset(stmt);
@@ -457,16 +461,18 @@ static inline int db_init(void)
                return -EINVAL;
        }
 
-       if (!stat.st_size)
+       if (!stat.st_size) {
                db_create_table();
+       }
 
        return 0;
 }
 
 static inline int db_fini(void)
 {
-       if (!s_info.handle)
+       if (!s_info.handle) {
                return 0;
+       }
 
        db_util_close(s_info.handle);
        s_info.handle = NULL;
@@ -490,13 +496,15 @@ int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char *_appid)
        }
 
        if (!s_info.handle) {
-               if (db_init() < 0)
+               if (db_init() < 0) {
                        return -EIO;
+               }
        }
 
        for (root = root->children; root; root = root->next) {
-               if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list"))
+               if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list")) {
                        break;
+               }
        }
 
        if (!root) {
@@ -507,11 +515,13 @@ int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char *_appid)
        DbgPrint("AppID: %s\n", _appid);
        root = root->children;
        for (node = root; node; node = node->next) {
-               if (node->type == XML_ELEMENT_NODE)
+               if (node->type == XML_ELEMENT_NODE) {
                        DbgPrint("Element %s\n", node->name);
+               }
 
-               if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut"))
+               if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut")) {
                        continue;
+               }
 
                if (!xmlHasProp(node, (xmlChar *)"extra_data")
                        || !xmlHasProp(node, (xmlChar *)"extra_key")
@@ -597,13 +607,15 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid)
        }
 
        if (!s_info.handle) {
-               if (db_init() < 0)
+               if (db_init() < 0) {
                        return -EIO;
+               }
        }
 
        for (root = root->children; root; root = root->next) {
-               if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list"))
+               if (!xmlStrcasecmp(root->name, (const xmlChar *)"shortcut-list")) {
                        break;
+               }
        }
 
        if (!root) {
@@ -615,11 +627,13 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid)
 
        root = root->children; /* Jump to children node */
        for (node = root; node; node = node->next) {
-               if (node->type == XML_ELEMENT_NODE)
+               if (node->type == XML_ELEMENT_NODE) {
                        DbgPrint("Element %s\n", node->name);
+               }
 
-               if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut"))
+               if (xmlStrcasecmp(node->name, (const xmlChar *)"shortcut")) {
                        continue;
+               }
 
                if (!xmlHasProp(node, (xmlChar *)"extra_key") || !xmlHasProp(node, (xmlChar *)"extra_data")) {
                        DbgPrint("Invalid element %s\n", node->name);
@@ -708,8 +722,9 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid)
                        } else {
                                dlist_foreach_safe(i18n_list, l, n, i18n) {
                                        i18n_list = dlist_remove(i18n_list, l);
-                                       if (db_insert_name(id, (char *)i18n->lang, (char *)i18n->name) < 0)
+                                       if (db_insert_name(id, (char *)i18n->lang, (char *)i18n->name) < 0) {
                                                ErrPrint("Failed to add i18n name: %s(%s)\n", i18n->name, i18n->lang);
+                                       }
                                        xmlFree(i18n->lang);
                                        xmlFree(i18n->name);
                                        free(i18n);
index 3086729..9267bad 100644 (file)
@@ -41,7 +41,7 @@ static Eina_Bool test_main(void *data)
        }
 
        printf("Test: %d\n", idx);
-       ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_IMAGE, DEFAULT_ICON_PART, "/usr/share/icons/default/small/com.samsung.music-player.png", NULL, NULL);
+       ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_IMAGE, DEFAULT_ICON_PART, "/usr/share/icons/default/small/org.tizen.music-player.png", NULL, NULL);
        printf("NAME set_info: %d\n", ret);
 
        snprintf(filename, sizeof(filename), "App Name %d", idx);