switch (status) {
case START:
- if (isspace(ch) || ch == EOF)
+ if (isspace(ch) || ch == EOF) {
continue;
+ }
if (ch == '#') {
status = COMMENT;
buffer[idx++] = ch;
break;
case TYPE_END:
- if (ch == '=')
+ if (ch == '=') {
status = SIZE_START;
+ }
break;
case SIZE_START:
- if (isspace(ch) || ch == EOF)
+ if (isspace(ch) || ch == EOF) {
continue;
+ }
status = SIZE;
idx = 0;
ungetc(ch, fp);
break;
case ERROR:
- if (ch == '\n' || ch == '\r' || ch == '\f')
+ if (ch == '\n' || ch == '\r' || ch == '\f') {
status = START;
+ }
break;
case COMMENT:
- if (ch == '\n' || ch == '\r' || ch == '\f')
+ if (ch == '\n' || ch == '\r' || ch == '\f') {
status = START;
+ }
break;
default:
ErrPrint("Unknown status. couldn't be reach to here\n");
break;
}
} while (!feof(fp));
- fclose(fp);
+
+ if (fclose(fp) != 0) {
+ ErrPrint("fclose: %s\n", strerror(errno));
+ }
return NR_OF_SIZE_LIST - updated;
}
unsigned int depth;
register int i;
- if (s_info.res_resolved)
+ if (s_info.res_resolved) {
return LB_STATUS_SUCCESS;
+ }
disp = XOpenDisplay(NULL);
if (!disp) {
return LB_STATUS_ERROR_FAULT;
}
- if (update_from_file() == 0)
+ if (update_from_file() == 0) {
DbgPrint("Resolution info is all updated by file\n");
+ }
for (i = 0; i < NR_OF_SIZE_LIST; i++) {
SIZE_LIST[i].w = (unsigned int)((double)SIZE_LIST[i].w * (double)width / 720.0f);
if (!s_info.handle) {
int ret;
- ret = db_util_open(s_info.dbfile, &handle, DB_UTIL_REGISTER_HOOK_METHOD);
+ ret = db_util_open_with_options(s_info.dbfile, &handle, SQLITE_OPEN_READONLY, NULL);
if (ret != SQLITE_OK) {
ErrPrint("Failed to open a DB\n");
return NULL;
static inline __attribute__((always_inline)) void close_db(sqlite3 *handle)
{
- if (!s_info.handle)
+ if (!s_info.handle) {
db_util_close(handle);
+ }
}
static inline int convert_size_from_type(enum livebox_size_type type, int *width, int *height)
return LB_STATUS_ERROR_INVALID;
}
- if (update_resolution() < 0)
+ if (update_resolution() < 0) {
ErrPrint("Failed to update resolution\n");
+ }
*width = SIZE_LIST[idx].w;
*height = SIZE_LIST[idx].h;
}
uri = util_id_to_uri(id);
- if (!uri)
+ if (!uri) {
return LB_STATUS_ERROR_MEMORY;
+ }
packet = packet_create("service_change_period", "ssd", pkgname, uri, period);
free(uri);
return ret;
}
-EAPI int livebox_service_trigger_update(const char *pkgname, const char *id, const char *cluster, const char *category, int force)
+EAPI int livebox_service_trigger_update_with_content(const char *pkgname, const char *id, const char *cluster, const char *category, const char *content, int force)
{
struct packet *packet;
struct packet *result;
return LB_STATUS_ERROR_CANCEL;
}
- uri = util_id_to_uri(id);
- if (!uri)
- return LB_STATUS_ERROR_MEMORY;
+ if (id) {
+ uri = util_id_to_uri(id);
+ if (!uri) {
+ return LB_STATUS_ERROR_MEMORY;
+ }
+ } else {
+ uri = NULL;
+ }
- if (!cluster)
+ if (!cluster) {
cluster = "user,created";
+ }
- if (!category)
+ if (!category) {
category = "default";
+ }
- packet = packet_create("service_update", "ssss", pkgname, uri, cluster, category);
+ packet = packet_create("service_update", "sssssi", pkgname, uri, cluster, category, content, force);
+ /*!
+ * \note
+ * "free" function accepts NULL
+ */
free(uri);
if (!packet) {
ErrPrint("Failed to create a packet for service_update\n");
return ret;
}
+EAPI int livebox_service_trigger_update(const char *pkgname, const char *id, const char *cluster, const char *category, int force)
+{
+ return livebox_service_trigger_update_with_content(pkgname, id, cluster, category, NULL, force);
+}
+
/*!
* pkgid == Package Id (not the livebox id)
*/
char *_appid = NULL;
char *_pkgname = NULL;
- if (!handle || handle->type != PKGLIST_TYPE_LB_LIST)
+ if (!handle || handle->type != PKGLIST_TYPE_LB_LIST) {
return LB_STATUS_ERROR_INVALID;
+ }
- if (sqlite3_step(handle->stmt) != SQLITE_ROW)
+ if (sqlite3_step(handle->stmt) != SQLITE_ROW) {
return LB_STATUS_ERROR_NOT_EXIST;
+ }
if (appid) {
tmp = (const char *)sqlite3_column_text(handle->stmt, 0);
}
}
- if (is_prime)
+ if (is_prime) {
*is_prime = sqlite3_column_int(handle->stmt, 2);
+ }
- if (appid)
+ if (appid) {
*appid = _appid;
+ }
- if (pkgname)
+ if (pkgname) {
*pkgname = _pkgname;
+ }
return LB_STATUS_SUCCESS;
}
EAPI int livebox_service_pkglist_destroy(struct pkglist_handle *handle)
{
- if (!handle || handle->type != PKGLIST_TYPE_LB_LIST)
+ if (!handle || handle->type != PKGLIST_TYPE_LB_LIST) {
return LB_STATUS_ERROR_INVALID;
+ }
handle->type = PKGLIST_TYPE_UNKNOWN;
sqlite3_reset(handle->stmt);
int is_prime;
sqlite3 *handle;
- if (!cb)
+ if (!cb) {
return LB_STATUS_ERROR_INVALID;
+ }
handle = open_db();
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_IO;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT appid, pkgid, prime FROM pkgmap", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
int is_prime;
sqlite3 *handle;
- if (!cb)
+ if (!cb) {
return LB_STATUS_ERROR_INVALID;
+ }
handle = open_db();
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_IO;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT pkgid, prime FROM pkgmap WHERE appid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
int ret;
ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
- if (ret < 0)
+ if (ret < 0) {
ErrPrint("Unable to get appid\n");
- else
+ } else {
cbdata->cb(cbdata->lbid, appid, cbdata->cbdata);
+ }
return 0;
}
cbdata.cbdata = data;
ret = pkgmgrinfo_appinfo_get_list(handle, PM_UI_APP, pkgmgr_cb, &cbdata);
- if (ret < 0)
+ if (ret < 0) {
ErrPrint("Failed to get applist\n");
+ }
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
return ret;
sqlite3 *handle;
int ret;
- if (!lbid || !cb)
+ if (!lbid || !cb) {
return LB_STATUS_ERROR_INVALID;
+ }
handle = open_db();
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_IO;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT appid FROM pkgmap WHERE (pkgid = ?) or (appid = ?)", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
ret = pkgmgr_get_applist(pkgid, lbid, cb, data);
free(pkgid);
+ switch (ret) {
+ case PMINFO_R_EINVAL:
+ ret = LB_STATUS_ERROR_INVALID;
+ break;
+ case PMINFO_R_OK:
+ ret = LB_STATUS_SUCCESS;
+ break;
+ case PMINFO_R_ERROR:
+ default:
+ ret = LB_STATUS_ERROR_FAULT;
+ break;
+ }
+
out:
close_db(handle);
return ret;
sqlite3 *handle;
char *ret = NULL;
- if (!lbid)
+ if (!lbid) {
return NULL;
+ }
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
if (sqlite3_prepare_v2(handle, "SELECT appid, uiapp FROM pkgmap WHERE (pkgid = ?) or (appid = ? and prime = 1)", -1, &stmt, NULL) != SQLITE_OK) {
ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
ret = pkgmgr_get_mainapp(tmp);
} else {
ret = strdup(pkgid);
- if (!ret)
+ if (!ret) {
ErrPrint("Error: %s\n", strerror(errno));
+ }
}
sqlite3_reset(stmt);
int size;
int ret;
- if (!types || !cnt || !pkgid)
+ if (!types || !cnt || !pkgid) {
return LB_STATUS_ERROR_INVALID;
+ }
handle = open_db();
- if (!handle)
+ if (!handle) {
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) {
goto out;
}
- if (*cnt > NR_OF_SIZE_LIST)
+ if (*cnt > NR_OF_SIZE_LIST) {
*cnt = NR_OF_SIZE_LIST;
+ }
ret = 0;
while (sqlite3_step(stmt) == SQLITE_ROW && ret < *cnt) {
*cnt = ret;
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
- ret = 0;
+ ret = LB_STATUS_SUCCESS;
out:
close_db(handle);
return ret;
break;
}
- if (*ptr == '_')
+ if (*ptr == '_') {
*ptr = '-';
+ }
ptr++;
}
} else {
language = strdup("en-us");
- if (!language)
+ if (!language) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
return language;
int ret;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT name FROM client WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
tmp = (const char *)sqlite3_column_text(stmt, 0);
if (tmp && strlen(tmp)) {
name = strdup(tmp);
- if (!name)
+ if (!name) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
}
int ret;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT icon FROM client WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
tmp = (const char *)sqlite3_column_text(stmt, 0);
if (tmp && strlen(tmp)) {
icon = strdup(tmp);
- if (!icon)
+ if (!icon) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
}
int ret;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT content FROM client WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
tmp = (const char *)sqlite3_column_text(stmt, 0);
if (tmp && strlen(tmp)) {
content = strdup(tmp);
- if (!content)
+ if (!content) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
}
char *appid;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT setup FROM client WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
const char *tmp;
tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp))
+ if (!tmp || !strlen(tmp)) {
goto out;
+ }
appid = strdup(tmp);
- if (!appid)
+ if (!appid) {
ErrPrint("Error: %s\n", strerror(errno));
+ }
}
out:
int ret;
handle = open_db();
- if (!handle)
+ if (!handle) {
return 0;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT nodisplay FROM client WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW)
+ if (ret == SQLITE_ROW) {
ret = !!sqlite3_column_int(stmt, 0);
- else
+ } else {
ret = 0;
+ }
out:
sqlite3_reset(stmt);
sqlite3 *handle;
int ret;
- if (!appid)
+ if (!appid) {
return NULL;
+ }
pkgid = NULL;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT pkgid FROM pkgmap WHERE (appid = ? AND prime = 1) OR pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
tmp = (char *)sqlite3_column_text(stmt, 0);
if (tmp && strlen(tmp)) {
pkgid = strdup(tmp);
- if (!pkgid)
+ if (!pkgid) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
out:
int ret;
handle = open_db();
- if (!handle)
+ if (!handle) {
return 0;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT mouse_event FROM client WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
int printed;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT preview FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
}
} else {
language = cur_locale();
- if (!language)
+ if (!language) {
return NULL;
+ }
}
handle = open_db();
icon = get_default_icon(pkgid);
} else {
icon = strdup(tmp);
- if (!icon)
+ if (!icon) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
} else {
icon = get_default_icon(pkgid);
}
} else {
language = cur_locale();
- if (!language)
+ if (!language) {
return NULL;
+ }
}
handle = open_db();
name = get_default_name(pkgid);
} else {
name = strdup(tmp);
- if (!name)
+ if (!name) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
} else {
name = get_default_name(pkgid);
int size;
int ret;
- if (!w || !h || !cnt || !pkgid)
+ if (!w || !h || !cnt || !pkgid) {
return LB_STATUS_ERROR_INVALID;
+ }
handle = open_db();
- if (!handle)
+ if (!handle) {
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) {
goto out;
}
- if (*cnt > NR_OF_SIZE_LIST)
+ if (*cnt > NR_OF_SIZE_LIST) {
*cnt = NR_OF_SIZE_LIST;
+ }
ret = 0;
while (sqlite3_step(stmt) == SQLITE_ROW && ret < *cnt) {
char *appid;
char *path;
- if (!pkgid)
+ if (!pkgid) {
return NULL;
+ }
libexec = NULL;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT pkgmap.appid, provider.libexec FROM pkgmap, provider WHERE pkgmap.pkgid = ? AND provider.pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
int ret;
char *new_appid;
- if (!appid)
+ if (!appid) {
return NULL;
+ }
lb_pkgname = get_lb_pkgname_by_appid(appid);
- if (lb_pkgname)
+ if (lb_pkgname) {
return lb_pkgname;
+ }
/*!
* \note
lb_pkgname = get_lb_pkgname_by_appid(new_appid);
pkgmgr_appinfo_destroy_appinfo(handle);
- if (!lb_pkgname && util_validate_livebox_package(appid) == 0)
+ if (!lb_pkgname && util_validate_livebox_package(appid) == 0) {
return strdup(appid);
+ }
return lb_pkgname;
}
int idx = 0;
char *str = SAMSUNG_PREFIX;
- if (!lbid)
+ if (!lbid) {
return NULL;
+ }
while (str[idx] && lbid[idx] && lbid[idx] == str[idx]) {
idx++;
sqlite3 *handle;
int ret = 0;
- if (!lbid)
+ if (!lbid) {
return 0;
+ }
handle = open_db();
- if (!handle)
+ if (!handle) {
return 0;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT prime FROM pkgmap WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
return ret;
}
-/*!
- * appid == Package ID
- * pkgid == Livebox ID
- */
EAPI char *livebox_service_appid(const char *pkgname)
{
sqlite3_stmt *stmt;
int is_prime __attribute__((__unused__));
int ret;
- if (!pkgname)
+ if (!pkgname) {
return NULL;
+ }
appid = NULL;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT appid, prime FROM pkgmap WHERE pkgid = ? OR appid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
}
appid = strdup(new_appid);
- if (!appid)
+ if (!appid) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
pkgmgr_appinfo_destroy_appinfo(pkg_handle);
goto out;
char *appid;
char *lb_src;
- if (!pkgid)
+ if (!pkgid) {
return NULL;
+ }
path = NULL;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT pkgmap.appid, provider.box_src FROM provider, pkgmap WHERE pkgmap.pkgid = ? AND provider.pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
goto out;
}
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_finalize(stmt);
goto out;
}
ret = sqlite3_bind_text(stmt, 2, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_finalize(stmt);
goto out;
}
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
appid = (char *)sqlite3_column_text(stmt, 0);
if (!appid || !strlen(appid)) {
- ErrPrint("Invalid appid : %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Invalid appid : %s, pkgid(%s)\n", sqlite3_errmsg(handle), pkgid);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
lb_src = (char *)sqlite3_column_text(stmt, 1);
if (!lb_src || !strlen(lb_src)) {
- ErrPrint("No records for lb src : %s\n", sqlite3_errmsg(handle));
+ ErrPrint("No records for lb src : %s, pkgid(%s), appid(%s)\n", sqlite3_errmsg(handle), pkgid, appid);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
char *group;
char *tmp;
- if (!pkgid)
+ if (!pkgid) {
return NULL;
+ }
group = NULL;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT box_group FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
tmp = (char *)sqlite3_column_text(stmt, 0);
if (tmp && strlen(tmp)) {
group = strdup(tmp);
- if (!group)
+ if (!group) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
sqlite3_reset(stmt);
char *pd_src;
const char *appid;
- if (!pkgid)
+ if (!pkgid) {
return NULL;
+ }
path = NULL;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT pkgmap.appid, provider.pd_src FROM provider, pkgmap WHERE provider.pkgid = ? AND pkgmap.pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
goto out;
}
ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_finalize(stmt);
goto out;
}
ret = sqlite3_bind_text(stmt, 2, pkgid, -1, SQLITE_TRANSIENT);
if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_finalize(stmt);
goto out;
}
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
appid = (char *)sqlite3_column_text(stmt, 0);
if (!appid || !strlen(appid)) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s pkgid(%s)\n", sqlite3_errmsg(handle), pkgid);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
pd_src = (char *)sqlite3_column_text(stmt, 1);
if (!pd_src || !strlen(pd_src)) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
+ ErrPrint("Error: %s pkgid(%s) appid(%s)\n", sqlite3_errmsg(handle), pkgid, appid);
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
goto out;
char *group;
char *tmp;
- if (!pkgid)
+ if (!pkgid) {
return NULL;
+ }
group = NULL;
handle = open_db();
- if (!handle)
+ if (!handle) {
return NULL;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT pd_group FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
tmp = (char *)sqlite3_column_text(stmt, 0);
if (tmp && strlen(tmp)) {
group = strdup(tmp);
- if (!group)
+ if (!group) {
ErrPrint("Heap: %s\n", strerror(errno));
+ }
}
sqlite3_reset(stmt);
sqlite3_finalize(stmt);
int cnt;
int ret;
- if (!cb)
+ if (!cb) {
return LB_STATUS_ERROR_INVALID;
+ }
handle = open_db();
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_IO;
+ }
cnt = 0;
ret = sqlite3_prepare_v2(handle, "SELECT DISTINCT cluster FROM groupinfo", -1, &stmt, NULL);
while (sqlite3_step(stmt) == SQLITE_ROW) {
cluster = (const char *)sqlite3_column_text(stmt, 0);
- if (!cluster || !strlen(cluster))
+ if (!cluster || !strlen(cluster)) {
continue;
+ }
- if (cb(cluster, data) < 0)
+ if (cb(cluster, data) < 0) {
break;
+ }
cnt++;
}
int cnt;
int ret;
- if (!cluster || !cb)
+ if (!cluster || !cb) {
return LB_STATUS_ERROR_INVALID;
+ }
handle = open_db();
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_IO;
+ }
ret = sqlite3_prepare_v2(handle, "SELECT DISTINCT category FROM groupinfo WHERE cluster = ?", -1, &stmt, NULL);
if (ret != SQLITE_OK) {
cnt = 0;
while (sqlite3_step(stmt) == SQLITE_ROW) {
category = (const char *)sqlite3_column_text(stmt, 0);
- if (!category || !strlen(category))
+ if (!category || !strlen(category)) {
continue;
+ }
- if (cb(cluster, category, data) < 0)
+ if (cb(cluster, category, data) < 0) {
break;
+ }
cnt++;
}
int _width;
int _height;
- if (!width)
+ if (!width) {
width = &_width;
+ }
- if (!height)
+ if (!height) {
height = &_height;
+ }
return convert_size_from_type(type, width, height);
}
{
int idx;
- if (update_resolution() < 0)
+ if (update_resolution() < 0) {
ErrPrint("Failed to update the size list\n");
+ }
for (idx = 0; idx < NR_OF_SIZE_LIST; idx++) {
- if (SIZE_LIST[idx].w == width && SIZE_LIST[idx].h == height)
+ if (SIZE_LIST[idx].w == width && SIZE_LIST[idx].h == height) {
break;
+ }
}
switch (idx) {