diff options
author | hyun lee <hyunn.lee@samsung.com> | 2014-08-08 18:17:29 +0900 |
---|---|---|
committer | hyun lee <hyunn.lee@samsung.com> | 2014-08-08 18:17:29 +0900 |
commit | f2338f9d7f65f236d048500de7e5bf2c6027ee77 (patch) | |
tree | 9e957388e6fecd1e1990b987b9f817a614c40246 | |
parent | 3359f5873b30b51f6fcb34099f54f51d8d08a5d6 (diff) | |
download | shortcut-f2338f9d7f65f236d048500de7e5bf2c6027ee77.tar.gz shortcut-f2338f9d7f65f236d048500de7e5bf2c6027ee77.tar.bz2 shortcut-f2338f9d7f65f236d048500de7e5bf2c6027ee77.zip |
Update doxygen and Remove error type
Signed-off-by: hyun lee <hyunn.lee@samsung.com>
-rwxr-xr-x[-rw-r--r--] | TC/testcase/utc_shortcut.c | 60 | ||||
-rwxr-xr-x | lib/include/shortcut.h | 40 | ||||
-rwxr-xr-x[-rw-r--r--] | lib/include/shortcut_product.h | 24 | ||||
-rwxr-xr-x[-rw-r--r--] | lib/src/icon.c | 68 | ||||
-rwxr-xr-x[-rw-r--r--] | lib/src/main.c | 60 |
5 files changed, 123 insertions, 129 deletions
diff --git a/TC/testcase/utc_shortcut.c b/TC/testcase/utc_shortcut.c index 654dc68..b38d9ea 100644..100755 --- a/TC/testcase/utc_shortcut.c +++ b/TC/testcase/utc_shortcut.c @@ -66,18 +66,18 @@ static int shortcut_request_cb(const char *appid, const char *name, int type, co if (!strcmp(appid, "fail")) { return SHORTCUT_ERROR_UNSUPPORTED; } else if (!strcmp(appid, "success")) { - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } } - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } static void utc_shortcut_set_request_cb_p(void) { int ret; ret = shortcut_set_request_cb(shortcut_request_cb, NULL); - dts_check_eq("shortcut_set_request_cb", ret, SHORTCUT_SUCCESS, "success"); + dts_check_eq("shortcut_set_request_cb", ret, SHORTCUT_ERROR_NONE, "success"); } static int response_cb(int ret, int pid, void *data) @@ -85,7 +85,7 @@ static int response_cb(int ret, int pid, void *data) if ((int)data == 1) { dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_ERROR_UNSUPPORTED, "success"); } else if ((int)data == 2) { - dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_SUCCESS, "success"); + dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_ERROR_NONE, "success"); } return 0; @@ -95,8 +95,8 @@ static void utc_add_to_home_shortcut_n(void) { int ret; ret = add_to_home_shortcut("fail", NULL, LAUNCH_BY_PACKAGE, NULL, NULL, 1, response_cb, (void *)1); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_SUCCESS, "success"); + if (ret != SHORTCUT_ERROR_NONE) { + dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_ERROR_NONE, "success"); } } @@ -104,8 +104,8 @@ static void utc_add_to_home_shortcut_p(void) { int ret; ret = add_to_home_shortcut("success", NULL, LAUNCH_BY_PACKAGE, NULL, NULL, 1, response_cb, (void *)2); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_SUCCESS, "success"); + if (ret != SHORTCUT_ERROR_NONE) { + dts_check_eq("add_to_home_shortcut", ret, SHORTCUT_ERROR_NONE, "success"); } } @@ -134,8 +134,8 @@ static void utc_add_to_home_livebox_n(void) { int ret; ret = add_to_home_livebox("fail", NULL, LIVEBOX_TYPE_1x1, NULL, NULL, -1.0f, 1, response_cb, (void *)1); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_livebox", ret, SHORTCUT_SUCCESS, "success"); + if (ret != SHORTCUT_ERROR_NONE) { + dts_check_eq("add_to_home_livebox", ret, SHORTCUT_ERROR_NONE, "success"); } } @@ -143,8 +143,8 @@ static void utc_add_to_home_livebox_p(void) { int ret; ret = add_to_home_livebox("success", NULL, LIVEBOX_TYPE_1x1, NULL, NULL, -1.0f, 1, response_cb, (void *)2); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_livebox", ret, SHORTCUT_SUCCESS, "success"); + if (ret != SHORTCUT_ERROR_NONE) { + dts_check_eq("add_to_home_livebox", ret, SHORTCUT_ERROR_NONE, "success"); } } @@ -152,8 +152,8 @@ static void utc_add_to_home_remove_shortcut_n(void) { int ret; ret = add_to_home_remove_shortcut("fail", NULL, NULL, response_cb, (void *)1); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID, "Invalid"); + if (ret != SHORTCUT_ERROR_NONE) { + dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID_PARAMETER, "Invalid"); } } @@ -161,8 +161,8 @@ static void utc_add_to_home_remove_shortcut_p(void) { int ret; ret = add_to_home_remove_shortcut("success", NULL, NULL, response_cb, (void *)2); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID, "Invalid"); + if (ret != SHORTCUT_ERROR_NONE) { + dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID_PARAMETER, "Invalid"); } } @@ -170,8 +170,8 @@ static void utc_add_to_home_remove_livebox_n(void) { int ret; ret = add_to_home_remove_livebox("fail", NULL, response_cb, (void *)1); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID, "Invalid"); + if (ret != SHORTCUT_ERROR_NONE) { + dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID_PARAMETER, "Invalid"); } } @@ -179,8 +179,8 @@ static void utc_add_to_home_remove_livebox_p(void) { int ret; ret = add_to_home_remove_livebox("success", NULL, response_cb, (void *)2); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID, "Invalid"); + if (ret != SHORTCUT_ERROR_NONE) { + dts_check_eq("add_to_home_remove_shortcut", ret, SHORTCUT_ERROR_INVALID_PARAMETER, "Invalid"); } } @@ -195,7 +195,7 @@ static void utc_shortcut_icon_service_init_n(void) static int icon_service_cb(int status, void *data) { - dts_check_eq("shortcut_icon_service_init", status, SHORTCUT_SUCCESS); + dts_check_eq("shortcut_icon_service_init", status, SHORTCUT_ERROR_NONE); return 0; } @@ -204,8 +204,8 @@ static void utc_shortcut_icon_service_init_p(void) int ret; ret = shortcut_icon_service_init(icon_service_cb, NULL); - if (ret != SHORTCUT_SUCCESS) { - dts_check_eq("shortcut_icon_service_init", ret, SHORTCUT_SUCCESS); + if (ret != SHORTCUT_ERROR_NONE) { + dts_check_eq("shortcut_icon_service_init", ret, SHORTCUT_ERROR_NONE); } } @@ -222,7 +222,7 @@ static void utc_shortcut_icon_service_fini_p(void) { int ret; ret = shortcut_icon_service_fini(); - dts_check_eq("shortcut_icon_service_fini", ret, SHORTCUT_SUCCESS, "success"); + dts_check_eq("shortcut_icon_service_fini", ret, SHORTCUT_ERROR_NONE, "success"); } static void utc_shortcut_icon_request_create_n(void) @@ -240,7 +240,7 @@ static void utc_shortcut_icon_request_set_info_n(void) { int ret; ret = shortcut_icon_request_set_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL); - dts_check_ne("shortcut_icon_request_set_info", ret, SHORTCUT_ERROR_INVALID, "invalid handle"); + dts_check_ne("shortcut_icon_request_set_info", ret, SHORTCUT_ERROR_INVALID_PARAMETER, "invalid handle"); } static void utc_shortcut_icon_request_set_info_p(void) @@ -261,7 +261,7 @@ static void utc_shortcut_icon_request_send_n(void) int ret; ret = shortcut_icon_request_send(NULL, LIVEBOX_TYPE_1x1, NULL, NULL, NULL, NULL, NULL); - dts_check_eq("shortcut_icon_request_send", ret, SHORTCUT_ERROR_INVALID, "success"); + dts_check_eq("shortcut_icon_request_send", ret, SHORTCUT_ERROR_INVALID_PARAMETER, "success"); } static int result_cb(struct shortcut_icon *handle, int ret, void *data) @@ -287,7 +287,7 @@ static void utc_shortcut_icon_request_destroy_n(void) int ret; ret = shortcut_icon_request_destroy(NULL); - dts_check_eq("shortcut_icon_request_destroy", ret, SHORTCUT_ERROR_INVALID, "invalid"); + dts_check_eq("shortcut_icon_request_destroy", ret, SHORTCUT_ERROR_INVALID_PARAMETER, "invalid"); } static void utc_shortcut_icon_request_destroy_p(void) @@ -300,7 +300,7 @@ static void utc_shortcut_icon_request_destroy_p(void) } ret = shortcut_icon_request_destroy(s_info.handle); - dts_check_eq("shortcut_icon_request_destroy", ret, SHORTCUT_SUCCESS, "Destroy"); + dts_check_eq("shortcut_icon_request_destroy", ret, SHORTCUT_ERROR_NONE, "Destroy"); s_info.handle = NULL; } @@ -308,7 +308,7 @@ static void utc_shortcut_icon_request_set_data_n(void) { int ret; ret = shortcut_icon_request_set_data(NULL, NULL); - dts_check_eq("shortcut_icon_request_set_data", ret, SHORTCUT_ERROR_INVALID, "invalid"); + dts_check_eq("shortcut_icon_request_set_data", ret, SHORTCUT_ERROR_INVALID_PARAMETER, "invalid"); } static void utc_shortcut_icon_request_set_data_p(void) @@ -321,7 +321,7 @@ static void utc_shortcut_icon_request_set_data_p(void) } ret = shortcut_icon_request_set_data(s_info.handle, (void *)1); - dts_check_eq("shortcut_icon_request_set_data", ret, SHORTCUT_SUCCESS, "success"); + dts_check_eq("shortcut_icon_request_set_data", ret, SHORTCUT_ERROR_NONE, "success"); } static void utc_shortcut_icon_request_data_n(void) diff --git a/lib/include/shortcut.h b/lib/include/shortcut.h index bd6b3ec..08c43fc 100755 --- a/lib/include/shortcut.h +++ b/lib/include/shortcut.h @@ -122,12 +122,6 @@ enum shortcut_error_e { SHORTCUT_ERROR_PERMISSION_DENIED = SHORTCUT_ERROR | 0x0200, /**< Has no permission to add a shortcut */ SHORTCUT_STATUS_CARED = 0x08000000, /**< Shortcut status is already cared. check this using SHORTCUT_STATUS_IS_CARED macro */ - - SHORTCUT_SUCCESS = 0x00000000, /**< @internal */ - SHORTCUT_ERROR_INVALID = SHORTCUT_ERROR | 0x0020, /**< @internal */ - SHORTCUT_ERROR_MEMORY = SHORTCUT_ERROR | 0x0080, /**< @internal */ - SHORTCUT_ERROR_IO = SHORTCUT_ERROR | 0x0100, /**< @internal */ - SHORTCUT_ERROR_PERMISSION = SHORTCUT_ERROR | 0x0200 /**< @internal */ }; /** @@ -290,11 +284,11 @@ extern int shortcut_set_request_cb(request_cb_t request_cb, void *data); * @return Return Type (int) * @retval 0 Succeed to send the request * @retval #SHORTCUT_ERROR_FAULT Unrecoverable error - * @retval #SHORTCUT_ERROR_INVALID Shortcut request is not valid, invalid parameter or invalid argument value + * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Shortcut request is not valid, invalid parameter or invalid argument value * @retval #SHORTCUT_ERROR_COMM Connection is not estabilished. or there is a problem of communication - * @retval #SHORTCUT_ERROR_MEMORY Memory is not enough to handle new request - * @retval #SHORTCUT_ERROR_IO Unable to access file or DB. Check your resource files - * @retval #SHORTCUT_ERROR_PERMISSION Has no permission to add a shortcut + * @retval #SHORTCUT_ERROR_OUT_OF_MEMORY Memory is not enough to handle new request + * @retval #SHORTCUT_ERROR_IO_ERROR Unable to access file or DB. Check your resource files + * @retval #SHORTCUT_ERROR_PERMISSION_DENIED Has no permission to add a shortcut * * @pre You have to prepare the callback function. * @@ -365,7 +359,7 @@ extern int add_to_home_shortcut(const char *appid, const char *name, int type, c * @return Return Type (int) * @retval @c N Number of items (call count of callback function) * @retval #SHORTCUT_ERROR_FAULT Unrecoverable error - * @retval #SHORTCUT_ERROR_IO Unable to access file or DB. Check your resource files + * @retval #SHORTCUT_ERROR_IO_ERROR Unable to access file or DB. Check your resource files * * @pre You have to prepare the callback function. * @@ -410,11 +404,11 @@ extern int shortcut_get_list(const char *appid, int (*cb)(const char *appid, con * @return Return Type (int) * @retval 0 Succeed to send the request * @retval #SHORTCUT_ERROR_FAULT Unrecoverable error - * @retval #SHORTCUT_ERROR_INVALID Shortcut request is not valid, invalid parameter or invalid argument value + * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Shortcut request is not valid, invalid parameter or invalid argument value * @retval #SHORTCUT_ERROR_COMM Connection is not estabilished or there is a problem of communication - * @retval #SHORTCUT_ERROR_MEMORY Memory is not enough to handle new request - * @retval #SHORTCUT_ERROR_IO Unable to access file or DB Check your resource files - * @retval #SHORTCUT_ERROR_PERMISSION Has no permission to add a shortcut + * @retval #SHORTCUT_ERROR_OUT_OF_MEMORY Memory is not enough to handle new request + * @retval #SHORTCUT_ERROR_IO_ERROR Unable to access file or DB Check your resource files + * @retval #SHORTCUT_ERROR_PERMISSION_DENIED Has no permission to add a shortcut * * @pre You have to prepare the callback function. * @@ -485,11 +479,11 @@ extern int add_to_home_livebox(const char *appid, const char *name, int type, co * @return Return Type (int) * \retval 0 Succeed to send the request * \retval #SHORTCUT_ERROR_FAULT Unrecoverable error - * \retval #SHORTCUT_ERROR_INVALID Shortcut request is not valid, invalid parameter or invalid argument value + * \retval #SHORTCUT_ERROR_INVALID_PARAMETER Shortcut request is not valid, invalid parameter or invalid argument value * \retval #SHORTCUT_ERROR_COMM Connection is not estabilished. or there is a problem of communication - * \retval #SHORTCUT_ERROR_MEMORY Memory is not enough to handle new request - * \retval #SHORTCUT_ERROR_IO Unable to access file or DB. Check your resource files - * \retval #SHORTCUT_ERROR_PERMISSION Has no permission to add a shortcut + * \retval #SHORTCUT_ERROR_OUT_OF_MEMORY Memory is not enough to handle new request + * \retval #SHORTCUT_ERROR_IO_ERROR Unable to access file or DB. Check your resource files + * \retval #SHORTCUT_ERROR_PERMISSION_DENIED Has no permission to add a shortcut * * @pre You have to prepare the callback function * @@ -559,11 +553,11 @@ extern int add_to_home_remove_shortcut(const char *appid, const char *name, cons * @return Return Type (int) * \retval 0 Succeed to send the request * \retval #SHORTCUT_ERROR_FAULT Unrecoverable error - * \retval #SHORTCUT_ERROR_INVALID Shortcut request is not valid, invalid parameter or invalid argument value + * \retval #SHORTCUT_ERROR_INVALID_PARAMETER Shortcut request is not valid, invalid parameter or invalid argument value * \retval #SHORTCUT_ERROR_COMM Connection is not estabilished. or there is a problem of communication - * \retval #SHORTCUT_ERROR_MEMORY Memory is not enough to handle new request - * \retval #SHORTCUT_ERROR_IO Unable to access file or DB. Check your resource files - * \retval #SHORTCUT_ERROR_PERMISSION Has no permission to add a shortcut + * \retval #SHORTCUT_ERROR_OUT_OF_MEMORY Memory is not enough to handle new request + * \retval #SHORTCUT_ERROR_IO_ERROR Unable to access file or DB. Check your resource files + * \retval #SHORTCUT_ERROR_PERMISSION_DENIED Has no permission to add a shortcut * * @pre You have to prepare the callback function * diff --git a/lib/include/shortcut_product.h b/lib/include/shortcut_product.h index 9a9b21a..f54acba 100644..100755 --- a/lib/include/shortcut_product.h +++ b/lib/include/shortcut_product.h @@ -122,7 +122,7 @@ typedef int (*icon_request_cb_t)(struct shortcut_icon *handle, int ret, void *da * @param[in] init_cb Initialized result will be delievered via this callback * @param[in] data Callback data * @return int value - * @retval #SHORTCUT_ERROR_INVALID Already initialized + * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Already initialized * @retval #SHORTCUT_ERROR_SUCCESS Successfully initialized * @see shortcut_icon_service_fini() */ @@ -131,8 +131,8 @@ extern int shortcut_icon_service_init(int (*init_cb)(int status, void *data), vo /** * @brief Finalizes the icon creation service. * @return int value - * @retval #SHORTCUT_SUCCESS Successfully initialized - * @retval #SHORTCUT_ERROR_INVALID icon service is not initialized + * @retval #SHORTCUT_ERROR_NONE Successfully initialized + * @retval #SHORTCUT_ERROR_INVALID_PARAMETER icon service is not initialized * @see shortcut_icon_service_init() */ extern int shortcut_icon_service_fini(void); @@ -157,8 +157,8 @@ extern struct shortcut_icon *shortcut_icon_request_create(void); * @param[in] subid ID for script. this ID will be used as "id" * @return int value * @retval index Index of data set - * @retval #SHORTCUT_ERROR_INVALID Invalid handle - * @retval #SHORTCUT_ERROR_MEMORY Out of memory + * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Invalid handle + * @retval #SHORTCUT_ERROR_OUT_OF_MEMORY Out of memory * @see shortcut_icon_request_create() */ extern int shortcut_icon_request_set_info(struct shortcut_icon *handle, const char *id, const char *type, const char *part, const char *data, const char *option, const char *subid); @@ -173,10 +173,10 @@ extern int shortcut_icon_request_set_info(struct shortcut_icon *handle, const ch * @param[in] result_cb Result callback * @param[in] data Callback data * @return int value - * @retval #SHORTCUT_ERROR_INVALID Invalid parameters - * @retval #SHORTCUT_ERROR_MEMORY Out of memory + * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Invalid parameters + * @retval #SHORTCUT_ERROR_OUT_OF_MEMORY Out of memory * @retval #SHORTCUT_ERROR_FAULT Failed to send a request - * @retval #SHORTCUT_SUCCESS Successfully sent + * @retval #SHORTCUT_ERROR_NONE Successfully sent * @see shortcut_icon_service_fini() */ extern int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, const char *layout, const char *group, const char *outfile, icon_request_cb_t result_cb, void *data); @@ -185,8 +185,8 @@ extern int shortcut_icon_request_send(struct shortcut_icon *handle, int size_typ * @brief Destroys handle of creating shortcut icon request. * @param[in] handle Shortcut request handle * @return int value - * @retval #SHORTCUT_ERROR_INVALID Invalid handle - * @retval #SHORTCUT_SUCCESS Successfully destroyed + * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Invalid handle + * @retval #SHORTCUT_ERROR_NONE Successfully destroyed * @see shortcut_icon_service_fini() */ extern int shortcut_icon_request_destroy(struct shortcut_icon *handle); @@ -197,8 +197,8 @@ extern int shortcut_icon_request_destroy(struct shortcut_icon *handle); * @param[in] handle Handle to be used for carrying a data * @param[in] data Private data * @return int value - * @retval #SHORTCUT_ERROR_INVALID Invalid handle - * @retval #SHORTCUT_SUCCESS Successfully done + * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Invalid handle + * @retval #SHORTCUT_ERROR_NONE Successfully done * @see shortcut_icon_service_fini() */ extern int shortcut_icon_request_set_data(struct shortcut_icon *handle, void *data); diff --git a/lib/src/icon.c b/lib/src/icon.c index ef2c498..4d5eb34 100644..100755 --- a/lib/src/icon.c +++ b/lib/src/icon.c @@ -216,13 +216,13 @@ static inline int shortcut_icon_desc_save(struct shortcut_desc *handle, const ch FILE *fp; if (!handle) { - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } fp = fopen(filename, "w+t"); if (!fp) { ErrPrint("Error: %s\n", strerror(errno)); - return SHORTCUT_ERROR_IO; + return SHORTCUT_ERROR_IO_ERROR; } DbgPrint("Close and flush\n"); @@ -266,7 +266,7 @@ static inline int shortcut_icon_desc_save(struct shortcut_desc *handle, const ch if (fclose(fp) != 0) { ErrPrint("fclose: %s\n", strerror(errno)); } - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -296,7 +296,7 @@ static inline int update_block(struct block *block, const char *data, const char _data = strdup(data); if (!_data) { ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } } @@ -304,7 +304,7 @@ static inline int update_block(struct block *block, const char *data, const char _option = strdup(option); if (!_option) { ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } } @@ -329,7 +329,7 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con struct block *block; if (!handle || !type) { - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if (!part) { @@ -343,7 +343,7 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con if (target_id) { if (strcmp(type, SHORTCUT_ICON_TYPE_SCRIPT)) { ErrPrint("target id only can be used for script type\n"); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } } @@ -352,14 +352,14 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con block = calloc(1, sizeof(*block)); if (!block) { ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } block->type = strdup(type); if (!block->type) { ErrPrint("Heap: %s\n", strerror(errno)); free(block); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } block->part = strdup(part); @@ -367,7 +367,7 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con ErrPrint("Heap: %s\n", strerror(errno)); free(block->type); free(block); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } block->data = strdup(data); @@ -376,7 +376,7 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con free(block->type); free(block->part); free(block); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } if (option) { @@ -387,7 +387,7 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con free(block->type); free(block->part); free(block); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } } @@ -400,7 +400,7 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con free(block->type); free(block->part); free(block); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } } @@ -414,7 +414,7 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con free(block->type); free(block->part); free(block); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } } @@ -423,17 +423,17 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con } else { if (strcmp(block->type, type)) { ErrPrint("type is not valid (%s, %s)\n", block->type, type); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if ((block->target_id && !target_id) || (!block->target_id && target_id)) { ErrPrint("type is not valid (%s, %s)\n", block->type, type); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if (block->target_id && target_id && strcmp(block->target_id, target_id)) { ErrPrint("type is not valid (%s, %s)\n", block->type, type); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } update_block(block, data, option); @@ -493,7 +493,7 @@ static inline int make_connection(void) struct pending_item *pend; if (s_info.init_cb) { - s_info.init_cb(SHORTCUT_SUCCESS, s_info.cbdata); + s_info.init_cb(SHORTCUT_ERROR_NONE, s_info.cbdata); } dlist_foreach_safe(s_info.pending_list, l, n, pend) { @@ -512,7 +512,7 @@ static inline int make_connection(void) free(pend); } - ret = SHORTCUT_SUCCESS; + ret = SHORTCUT_ERROR_NONE; } return ret; @@ -528,7 +528,7 @@ static void master_started_cb(keynode_t *node, void *user_data) ErrPrint("Unable to get \"%s\"\n", VCONFKEY_MASTER_STARTED); } - if (state == 1 && make_connection() == SHORTCUT_SUCCESS) { + if (state == 1 && make_connection() == SHORTCUT_ERROR_NONE) { (void)vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb); } } @@ -540,7 +540,7 @@ EAPI int shortcut_icon_service_init(int (*init_cb)(int status, void *data), void int ret; if (s_info.fd >= 0) { - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if (s_info.initialized) { @@ -559,7 +559,7 @@ EAPI int shortcut_icon_service_init(int (*init_cb)(int status, void *data), void } master_started_cb(NULL, NULL); - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -576,7 +576,7 @@ EAPI int shortcut_icon_service_fini(void) } if (s_info.fd < 0) { - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } com_core_packet_client_fini(s_info.fd); @@ -593,7 +593,7 @@ EAPI int shortcut_icon_service_fini(void) free(pend->item); free(pend); } - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -625,11 +625,11 @@ EAPI int shortcut_icon_request_set_data(struct shortcut_icon *handle, void *data { if (!handle || handle->state != CREATED) { ErrPrint("Handle is not valid\n"); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } handle->data = data; - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -650,7 +650,7 @@ EAPI int shortcut_icon_request_set_info(struct shortcut_icon *handle, const char { if (!handle || handle->state != CREATED) { ErrPrint("Handle is not valid\n"); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } return shortcut_icon_desc_add_block(handle->desc, id, type, part, data, option, subid); @@ -662,11 +662,11 @@ EAPI int shortcut_icon_request_destroy(struct shortcut_icon *handle) { if (!handle || handle->state != CREATED) { ErrPrint("Handle is not valid\n"); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } (void)shortcut_icon_request_unref(handle); - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -681,7 +681,7 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, if (!handle || handle->state != CREATED) { ErrPrint("Handle is not valid\n"); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if (!layout) { @@ -696,7 +696,7 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, filename = malloc(len); if (!filename) { ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } #if defined(_USE_ECORE_TIME_GET) @@ -750,7 +750,7 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, if (unlink(filename) < 0) { ErrPrint("Unlink: %s\n", strerror(errno)); } - ret = SHORTCUT_ERROR_MEMORY; + ret = SHORTCUT_ERROR_OUT_OF_MEMORY; goto out; } @@ -794,7 +794,7 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, ErrPrint("Unlink: %s\n", strerror(errno)); } (void)shortcut_icon_request_unref(handle); - ret = SHORTCUT_ERROR_MEMORY; + ret = SHORTCUT_ERROR_OUT_OF_MEMORY; goto out; } @@ -804,7 +804,7 @@ EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, s_info.pending_list = dlist_append(s_info.pending_list, pend); DbgPrint("Request is pended\n"); - ret = SHORTCUT_SUCCESS; + ret = SHORTCUT_ERROR_NONE; } out: diff --git a/lib/src/main.c b/lib/src/main.c index 890124c..c1dd974 100644..100755 --- a/lib/src/main.c +++ b/lib/src/main.c @@ -204,7 +204,7 @@ static void master_started_cb(keynode_t *node, void *user_data) ErrPrint("Unable to get \"%s\"\n", VCONFKEY_MASTER_STARTED); } - if (state == 1 && make_connection() == SHORTCUT_SUCCESS) { + if (state == 1 && make_connection() == SHORTCUT_ERROR_NONE) { (void)vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb); } } @@ -233,13 +233,13 @@ static gboolean timeout_cb(void *data) static int disconnected_cb(int handle, void *data) { if (s_info.client_fd == handle) { - s_info.client_fd = SHORTCUT_ERROR_INVALID; + s_info.client_fd = SHORTCUT_ERROR_INVALID_PARAMETER; return 0; } if (s_info.server_fd == handle) { if (!s_info.timer_id) { - s_info.server_fd = SHORTCUT_ERROR_INVALID; + s_info.server_fd = SHORTCUT_ERROR_INVALID_PARAMETER; s_info.timer_id = g_timeout_add(1000, timeout_cb, NULL); if (!s_info.timer_id) { ErrPrint("Unable to add timer\n"); @@ -305,7 +305,7 @@ static inline int make_connection(void) s_info.server_fd = -1; ret = SHORTCUT_ERROR_COMM; } else { - ret = SHORTCUT_SUCCESS; + ret = SHORTCUT_ERROR_NONE; } DbgPrint("Server FD: %d\n", s_info.server_fd); @@ -332,7 +332,7 @@ EAPI int shortcut_set_request_cb(request_cb_t request_cb, void *data) master_started_cb(NULL, NULL); } - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -354,13 +354,13 @@ static int shortcut_send_cb(pid_t pid, int handle, const struct packet *packet, ret = SHORTCUT_ERROR_FAULT; } else if (packet_get(packet, "i", &ret) != 1) { ErrPrint("Packet is not valid\n"); - ret = SHORTCUT_ERROR_INVALID; + ret = SHORTCUT_ERROR_INVALID_PARAMETER; } if (item->result_cb) { ret = item->result_cb(ret, pid, item->data); } else { - ret = SHORTCUT_SUCCESS; + ret = SHORTCUT_ERROR_NONE; } free(item); return ret; @@ -376,7 +376,7 @@ EAPI int add_to_home_remove_shortcut(const char *appid, const char *name, const if (!appid || !name) { ErrPrint("Invalid argument\n"); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if (!s_info.initialized) { @@ -402,7 +402,7 @@ EAPI int add_to_home_remove_shortcut(const char *appid, const char *name, const item = malloc(sizeof(*item)); if (!item) { ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } item->result_cb = result_cb; @@ -420,11 +420,11 @@ EAPI int add_to_home_remove_shortcut(const char *appid, const char *name, const packet_destroy(packet); free(item); com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = SHORTCUT_ERROR_INVALID; + s_info.client_fd = SHORTCUT_ERROR_INVALID_PARAMETER; return SHORTCUT_ERROR_COMM; } - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -437,7 +437,7 @@ EAPI int add_to_home_remove_livebox(const char *appid, const char *name, result_ if (!appid || !name) { ErrPrint("Invalid argument\n"); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if (!s_info.initialized) { @@ -464,7 +464,7 @@ EAPI int add_to_home_remove_livebox(const char *appid, const char *name, result_ item = malloc(sizeof(*item)); if (!item) { ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } item->result_cb = result_cb; @@ -482,11 +482,11 @@ EAPI int add_to_home_remove_livebox(const char *appid, const char *name, result_ packet_destroy(packet); free(item); com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = SHORTCUT_ERROR_INVALID; + s_info.client_fd = SHORTCUT_ERROR_INVALID_PARAMETER; return SHORTCUT_ERROR_COMM; } - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -499,7 +499,7 @@ EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, con if (!appid || ADD_TO_HOME_IS_LIVEBOX(type)) { ErrPrint("Invalid type used for adding a shortcut\n"); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if (!s_info.initialized) { @@ -525,7 +525,7 @@ EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, con item = malloc(sizeof(*item)); if (!item) { ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } item->result_cb = result_cb; @@ -555,11 +555,11 @@ EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, con packet_destroy(packet); free(item); com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = SHORTCUT_ERROR_INVALID; + s_info.client_fd = SHORTCUT_ERROR_INVALID_PARAMETER; return SHORTCUT_ERROR_COMM; } - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -572,7 +572,7 @@ EAPI int add_to_home_livebox(const char *appid, const char *name, int type, cons if (!appid || !ADD_TO_HOME_IS_LIVEBOX(type)) { ErrPrint("Invalid type is used for adding a livebox\n"); - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if (!s_info.initialized) { @@ -597,7 +597,7 @@ EAPI int add_to_home_livebox(const char *appid, const char *name, int type, cons item = malloc(sizeof(*item)); if (!item) { ErrPrint("Heap: %s\n", strerror(errno)); - return SHORTCUT_ERROR_MEMORY; + return SHORTCUT_ERROR_OUT_OF_MEMORY; } item->result_cb = result_cb; @@ -615,11 +615,11 @@ EAPI int add_to_home_livebox(const char *appid, const char *name, int type, cons packet_destroy(packet); free(item); com_core_packet_client_fini(s_info.client_fd); - s_info.client_fd = SHORTCUT_ERROR_INVALID; + s_info.client_fd = SHORTCUT_ERROR_INVALID_PARAMETER; return SHORTCUT_ERROR_COMM; } - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -630,10 +630,10 @@ static inline int open_db(void) ret = db_util_open(s_info.dbfile, &s_info.handle, DB_UTIL_REGISTER_HOOK_METHOD); if (ret != SQLITE_OK) { DbgPrint("Failed to open a %s\n", s_info.dbfile); - return SHORTCUT_ERROR_IO; + return SHORTCUT_ERROR_IO_ERROR; } - return SHORTCUT_SUCCESS; + return SHORTCUT_ERROR_NONE; } @@ -768,7 +768,7 @@ EAPI int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const char *language; if (cb == NULL) { - return SHORTCUT_ERROR_INVALID; + return SHORTCUT_ERROR_INVALID_PARAMETER; } if (!s_info.db_opened) { @@ -777,7 +777,7 @@ EAPI int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const if (!s_info.db_opened) { ErrPrint("Failed to open a DB\n"); - return SHORTCUT_ERROR_IO; + return SHORTCUT_ERROR_IO_ERROR; } language = cur_locale(); @@ -792,7 +792,7 @@ EAPI int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const if (ret != SQLITE_OK) { ErrPrint("prepare: %s\n", sqlite3_errmsg(s_info.handle)); free(language); - return SHORTCUT_ERROR_IO; + return SHORTCUT_ERROR_IO_ERROR; } ret = sqlite3_bind_text(stmt, 1, appid, -1, SQLITE_TRANSIENT); @@ -800,7 +800,7 @@ EAPI int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const ErrPrint("bind text: %s\n", sqlite3_errmsg(s_info.handle)); sqlite3_finalize(stmt); free(language); - return SHORTCUT_ERROR_IO; + return SHORTCUT_ERROR_IO_ERROR; } } else { query = "SELECT id, appid, name, extra_key, extra_data, icon FROM shortcut_service"; @@ -808,7 +808,7 @@ EAPI int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const if (ret != SQLITE_OK) { ErrPrint("prepare: %s\n", sqlite3_errmsg(s_info.handle)); free(language); - return SHORTCUT_ERROR_IO; + return SHORTCUT_ERROR_IO_ERROR; } } |