From 4e08539814b1ed9d3094825b2b68c83dc38082a5 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Mon, 25 Mar 2013 04:08:15 +0000 Subject: [PATCH] Update License 2012 -> 2013 Change-Id: I03536bbb798e59fd31673e0f093ed2003c661d91 --- CMakeLists.txt | 1 + LICENSE | 2 +- include/debug.h | 2 +- include/dlist.h | 2 +- include/livebox-service.h | 2 +- include/livebox-service_PG.h | 2 +- include/util.h | 2 +- packaging/liblivebox-service.spec | 5 ++- src/dlist.c | 2 +- src/livebox-service.c | 77 ++++++++++++++++++++------------------- src/util.c | 11 +++--- 11 files changed, 56 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dfdcdd..ad1d298 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,5 +55,6 @@ SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME} INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/livebox-service.h DESTINATION include/${PROJECT_NAME}) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/livebox-errno.h DESTINATION include/${PROJECT_NAME}) INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/livebox-service_PG.h DESTINATION /usr/share/doc/${PROJECT_NAME}) INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}") diff --git a/LICENSE b/LICENSE index 27daa90..009765e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Flora License -Version 1.0, May, 2012 +Version 1.0, May, 2013 http://www.tizenopensource.org/license diff --git a/include/debug.h b/include/debug.h index 2d2748e..98d671c 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,5 +1,5 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd + * Copyright 2013 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/dlist.h b/include/dlist.h index b4a5719..7085384 100644 --- a/include/dlist.h +++ b/include/dlist.h @@ -1,5 +1,5 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd + * Copyright 2013 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/livebox-service.h b/include/livebox-service.h index 1de8c31..5d5ebe8 100644 --- a/include/livebox-service.h +++ b/include/livebox-service.h @@ -1,5 +1,5 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd + * Copyright 2013 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/livebox-service_PG.h b/include/livebox-service_PG.h index 62077ae..d262be8 100644 --- a/include/livebox-service_PG.h +++ b/include/livebox-service_PG.h @@ -1,5 +1,5 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd + * Copyright 2013 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/util.h b/include/util.h index 0bf4596..070b4a8 100644 --- a/include/util.h +++ b/include/util.h @@ -1,5 +1,5 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd + * Copyright 2013 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packaging/liblivebox-service.spec b/packaging/liblivebox-service.spec index 34ff7da..96725b5 100644 --- a/packaging/liblivebox-service.spec +++ b/packaging/liblivebox-service.spec @@ -1,8 +1,8 @@ Name: liblivebox-service Summary: Service API for gathering installed livebox information. -Version: 0.3.10 +Version: 0.3.12 Release: 1 -Group: framework/livebox +Group: HomeTF/Livebox License: Flora License Source0: %{name}-%{version}.tar.gz BuildRequires: cmake, gettext-tools, coreutils @@ -51,6 +51,7 @@ mkdir -p %{buildroot}/%{_datarootdir}/license %files devel %defattr(-,root,root,-) %{_includedir}/livebox-service/livebox-service.h +%{_includedir}/livebox-service/livebox-errno.h %{_datarootdir}/doc/livebox-service/livebox-service_PG.h %{_libdir}/pkgconfig/*.pc diff --git a/src/dlist.c b/src/dlist.c index 56ff060..78c76ba 100644 --- a/src/dlist.c +++ b/src/dlist.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd + * Copyright 2013 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/livebox-service.c b/src/livebox-service.c index 9bb81e3..6cea99d 100644 --- a/src/livebox-service.c +++ b/src/livebox-service.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd + * Copyright 2013 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ #include "util.h" #include "debug.h" #include "livebox-service.h" +#include "livebox-errno.h" #define SAMSUNG_PREFIX "com.samsung." #define EAPI __attribute__((visibility("default"))) @@ -144,7 +145,7 @@ static inline int update_from_file(void) fp = fopen(s_info.conf_file, "r"); if (!fp) { ErrPrint("Open failed: %s\n", strerror(errno)); - return -EIO; + return LB_STATUS_ERROR_IO; } updated = 0; @@ -258,18 +259,18 @@ static int update_resolution(void) register int i; if (s_info.res_resolved) - return 0; + return LB_STATUS_SUCCESS; disp = XOpenDisplay(NULL); if (!disp) { ErrPrint("Failed to open a display\n"); - return -EFAULT; + return LB_STATUS_ERROR_FAULT; } root = XDefaultRootWindow(disp); if (!XGetGeometry(disp, root, &dummy, &x, &y, &width, &height, &border, &depth)) { XCloseDisplay(disp); - return -EFAULT; + return LB_STATUS_ERROR_FAULT; } if (update_from_file() == 0) @@ -284,7 +285,7 @@ static int update_resolution(void) XCloseDisplay(disp); s_info.res_resolved = 1; - return 0; + return LB_STATUS_SUCCESS; } static inline sqlite3 *open_db(void) @@ -348,7 +349,7 @@ static inline int convert_size_from_type(enum livebox_size_type type, int *width idx = 9; break; default: - return -EINVAL; + return LB_STATUS_ERROR_INVALID; } if (update_resolution() < 0) @@ -356,7 +357,7 @@ static inline int convert_size_from_type(enum livebox_size_type type, int *width *width = SIZE_LIST[idx].w; *height = SIZE_LIST[idx].h; - return 0; + return LB_STATUS_SUCCESS; } EAPI int livebox_service_change_period(const char *pkgname, const char *id, double period) @@ -368,18 +369,18 @@ EAPI int livebox_service_change_period(const char *pkgname, const char *id, doub if (!pkgname || !id || period < 0.0f) { ErrPrint("Invalid argument\n"); - return -EINVAL; + return LB_STATUS_ERROR_INVALID; } uri = util_id_to_uri(id); if (!uri) - return -ENOMEM; + return LB_STATUS_ERROR_MEMORY; packet = packet_create("service_change_period", "ssd", pkgname, uri, period); free(uri); if (!packet) { ErrPrint("Failed to create a packet for period changing\n"); - return -EFAULT; + return LB_STATUS_ERROR_FAULT; } result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT); @@ -388,12 +389,12 @@ EAPI int livebox_service_change_period(const char *pkgname, const char *id, doub if (result) { if (packet_get(result, "i", &ret) != 1) { ErrPrint("Failed to parse a result packet\n"); - ret = -EINVAL; + ret = LB_STATUS_ERROR_INVALID; } packet_unref(result); } else { ErrPrint("Failed to get result packet\n"); - ret = -EFAULT; + ret = LB_STATUS_ERROR_FAULT; } return ret; @@ -408,17 +409,17 @@ EAPI int livebox_service_trigger_update(const char *pkgname, const char *id, con if (!pkgname) { ErrPrint("Invalid argument\n"); - return -EINVAL; + return LB_STATUS_ERROR_INVALID; } if (!force && access("/tmp/.live.paused", R_OK) == 0) { DbgPrint("Provider is paused\n"); - return -ECANCELED; + return LB_STATUS_ERROR_CANCEL; } uri = util_id_to_uri(id); if (!uri) - return -ENOMEM; + return LB_STATUS_ERROR_MEMORY; if (!cluster) cluster = "user,created"; @@ -430,7 +431,7 @@ EAPI int livebox_service_trigger_update(const char *pkgname, const char *id, con free(uri); if (!packet) { ErrPrint("Failed to create a packet for service_update\n"); - return -EFAULT; + return LB_STATUS_ERROR_FAULT; } result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT); @@ -439,13 +440,13 @@ EAPI int livebox_service_trigger_update(const char *pkgname, const char *id, con if (result) { if (packet_get(result, "i", &ret) != 1) { ErrPrint("Failed to parse a result packet\n"); - ret = -EINVAL; + ret = LB_STATUS_ERROR_INVALID; } packet_unref(result); } else { ErrPrint("Failed to get result packet\n"); - ret = -EFAULT; + ret = LB_STATUS_ERROR_FAULT; } return ret; @@ -461,16 +462,16 @@ EAPI int livebox_service_get_pkglist(int (*cb)(const char *appid, const char *pk sqlite3 *handle; if (!cb) - return -EINVAL; + return LB_STATUS_ERROR_INVALID; handle = open_db(); if (!handle) - return -EIO; + return LB_STATUS_ERROR_IO; ret = sqlite3_prepare_v2(handle, "SELECT appid, pkgid, prime FROM pkgmap", -1, &stmt, NULL); if (ret != SQLITE_OK) { ErrPrint("Error: %s\n", sqlite3_errmsg(handle)); - ret = -EIO; + ret = LB_STATUS_ERROR_IO; goto out; } @@ -514,16 +515,16 @@ EAPI int livebox_service_get_supported_size_types(const char *pkgid, int *cnt, i int ret; if (!types || !cnt || !pkgid) - return -EINVAL; + return LB_STATUS_ERROR_INVALID; handle = open_db(); if (!handle) - return -EIO; + return LB_STATUS_ERROR_IO; ret = sqlite3_prepare_v2(handle, "SELECT size_type FROM box_size WHERE pkgid = ? ORDER BY size_type ASC", -1, &stmt, NULL); if (ret != SQLITE_OK) { ErrPrint("Error: %s\n", sqlite3_errmsg(handle)); - ret = -EIO; + ret = LB_STATUS_ERROR_IO; goto out; } @@ -532,7 +533,7 @@ EAPI int livebox_service_get_supported_size_types(const char *pkgid, int *cnt, i ErrPrint("Error: %s\n", sqlite3_errmsg(handle)); sqlite3_reset(stmt); sqlite3_finalize(stmt); - ret = -EIO; + ret = LB_STATUS_ERROR_IO; goto out; } @@ -1146,16 +1147,16 @@ EAPI int livebox_service_get_supported_sizes(const char *pkgid, int *cnt, int *w int ret; if (!w || !h || !cnt || !pkgid) - return -EINVAL; + return LB_STATUS_ERROR_INVALID; handle = open_db(); if (!handle) - return -EIO; + return LB_STATUS_ERROR_IO; ret = sqlite3_prepare_v2(handle, "SELECT size_type FROM box_size WHERE pkgid = ? ORDER BY size_type ASC", -1, &stmt, NULL); if (ret != SQLITE_OK) { ErrPrint("Error: %s\n", sqlite3_errmsg(handle)); - ret = -EIO; + ret = LB_STATUS_ERROR_IO; goto out; } @@ -1164,7 +1165,7 @@ EAPI int livebox_service_get_supported_sizes(const char *pkgid, int *cnt, int *w ErrPrint("Error: %s\n", sqlite3_errmsg(handle)); sqlite3_reset(stmt); sqlite3_finalize(stmt); - ret = -EIO; + ret = LB_STATUS_ERROR_IO; goto out; } @@ -1786,17 +1787,17 @@ EAPI int livebox_service_enumerate_cluster_list(int (*cb)(const char *cluster, v int ret; if (!cb) - return -EINVAL; + return LB_STATUS_ERROR_INVALID; handle = open_db(); if (!handle) - return -EIO; + return LB_STATUS_ERROR_IO; cnt = 0; ret = sqlite3_prepare_v2(handle, "SELECT DISTINCT cluster FROM groupinfo", -1, &stmt, NULL); if (ret != SQLITE_OK) { ErrPrint("Error: %s\n", sqlite3_errmsg(handle)); - cnt = -EIO; + cnt = LB_STATUS_ERROR_IO; goto out; } @@ -1827,16 +1828,16 @@ EAPI int livebox_service_enumerate_category_list(const char *cluster, int (*cb)( int ret; if (!cluster || !cb) - return -EINVAL; + return LB_STATUS_ERROR_INVALID; handle = open_db(); if (!handle) - return -EIO; + return LB_STATUS_ERROR_IO; ret = sqlite3_prepare_v2(handle, "SELECT DISTINCT category FROM groupinfo WHERE cluster = ?", -1, &stmt, NULL); if (ret != SQLITE_OK) { ErrPrint("Error: %s\n", sqlite3_errmsg(handle)); - cnt = -EIO; + cnt = LB_STATUS_ERROR_IO; goto out; } @@ -1873,14 +1874,14 @@ EAPI int livebox_service_init(void) return 0; } - return -EIO; + return LB_STATUS_ERROR_IO; } EAPI int livebox_service_fini(void) { if (!s_info.handle || s_info.init_count <= 0) { ErrPrint("Service is not initialized\n"); - return -EIO; + return LB_STATUS_ERROR_IO; } s_info.init_count--; diff --git a/src/util.c b/src/util.c index 678f50a..c88ab66 100644 --- a/src/util.c +++ b/src/util.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd + * Copyright 2013 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ #include "util.h" #include "debug.h" +#include "livebox-errno.h" int errno; @@ -45,7 +46,7 @@ static inline char *check_native_livebox(const char *pkgname) snprintf(path, len, "/opt/usr/live/%s/libexec/liblive-%s.so", pkgname, pkgname); if (access(path, F_OK | R_OK) != 0) { - ErrPrint("%s is not a valid package\n", pkgname); + ErrPrint("%s is not a valid package (%s)\n", pkgname, strerror(errno)); free(path); return NULL; } @@ -69,7 +70,7 @@ static inline char *check_web_livebox(const char *pkgname) snprintf(path, len, "/opt/usr/apps/%s/res/wgt/livebox/index.html", pkgname); if (access(path, F_OK | R_OK) != 0) { - ErrPrint("%s is not a valid package\n", pkgname); + ErrPrint("%s is not a valid package (%s)\n", pkgname, strerror(errno)); free(path); return NULL; } @@ -83,7 +84,7 @@ int util_validate_livebox_package(const char *pkgname) if (!pkgname) { ErrPrint("Invalid argument\n"); - return -EINVAL; + return LB_STATUS_ERROR_INVALID; } path = check_native_livebox(pkgname); @@ -98,7 +99,7 @@ int util_validate_livebox_package(const char *pkgname) return 0; } - return -EINVAL; + return LB_STATUS_ERROR_INVALID; } double util_timestamp(void) -- 2.7.4