API int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
{
- char *locale;
+ const char *locale;
icon_x *ptr;
icon_x *start;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
start = info->app_info->icon;
for (ptr = start; ptr != NULL; ptr = ptr->next) {
- if (ptr->lang == NULL)
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
continue;
+ *icon = (char *)ptr->text;
+ return PMINFO_R_OK;
+ }
- if (strcmp(ptr->lang, locale) == 0) {
- *icon = (char *)ptr->text;
- if (strcasecmp(*icon, "(null)") == 0) {
- locale = DEFAULT_LOCALE;
- continue;
- } else {
- return PMINFO_R_OK;
- }
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *icon = (char *)ptr->text;
- return PMINFO_R_OK;
- }
+ locale = DEFAULT_LOCALE;
+ for (ptr = start; ptr != NULL; ptr = ptr->next) {
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
+ continue;
+ *icon = (char *)ptr->text;
+ return PMINFO_R_OK;
}
return PMINFO_R_ERROR;
API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
{
- char *locale;
+ const char *locale;
label_x *ptr;
label_x *start;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
start = info->app_info->label;
for (ptr = start; ptr != NULL; ptr = ptr->next) {
- if (ptr->lang == NULL)
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
continue;
+ *label = (char *)ptr->text;
+ return PMINFO_R_OK;
+ }
- if (strcmp(ptr->lang, locale) == 0) {
- *label = (char *)ptr->text;
- if (strcasecmp(*label, "(null)") == 0) {
- locale = DEFAULT_LOCALE;
- continue;
- } else {
- return PMINFO_R_OK;
- }
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *label = (char *)ptr->text;
- return PMINFO_R_OK;
- }
+ locale = DEFAULT_LOCALE;
+ for (ptr = start; ptr != NULL; ptr = ptr->next) {
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
+ continue;
+ *label = (char *)ptr->text;
+ return PMINFO_R_OK;
}
return PMINFO_R_ERROR;
API int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon)
{
- char *locale;
+ const char *locale;
icon_x *ptr;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
for (ptr = info->pkg_info->icon; ptr != NULL; ptr = ptr->next) {
- if (ptr->lang == NULL)
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
continue;
+ *icon = (char *)ptr->text;
+ return PMINFO_R_OK;
+ }
- if (strcmp(ptr->lang, locale) == 0) {
- *icon = (char *)ptr->text;
- if (strcasecmp(*icon, "(null)") == 0) {
- locale = DEFAULT_LOCALE;
- continue;
- } else {
- return PMINFO_R_OK;
- }
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *icon = (char *)ptr->text;
- return PMINFO_R_OK;
- }
+ locale = DEFAULT_LOCALE;
+ for (ptr = info->pkg_info->icon; ptr != NULL; ptr = ptr->next) {
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
+ continue;
+ *icon = (char *)ptr->text;
+ return PMINFO_R_OK;
}
return PMINFO_R_ERROR;
API int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
{
- char *locale;
+ const char *locale;
label_x *ptr;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
for (ptr = info->pkg_info->label; ptr != NULL; ptr = ptr->next) {
- if (ptr->lang == NULL)
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
continue;
+ *label = (char *)ptr->text;
+ return PMINFO_R_OK;
+ }
- if (strcmp(ptr->lang, locale) == 0) {
- *label = (char *)ptr->text;
- if (strcasecmp(*label, "(null)") == 0) {
- locale = DEFAULT_LOCALE;
- continue;
- } else {
- return PMINFO_R_OK;
- }
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *label = (char *)ptr->text;
- return PMINFO_R_OK;
- }
+ locale = DEFAULT_LOCALE;
+ for (ptr = info->pkg_info->label; ptr != NULL; ptr = ptr->next) {
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
+ continue;
+ *label = (char *)ptr->text;
+ return PMINFO_R_OK;
}
return PMINFO_R_ERROR;
API int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description)
{
- char *locale;
+ const char *locale;
description_x *ptr;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
for (ptr = info->pkg_info->description; ptr != NULL; ptr = ptr->next) {
- if (ptr->lang == NULL)
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
continue;
+ *description = (char *)ptr->text;
+ return PMINFO_R_OK;
+ }
- if (strcmp(ptr->lang, locale) == 0) {
- *description = (char *)ptr->text;
- if (strcasecmp(*description, PKGMGR_PARSER_EMPTY_STR) == 0) {
- locale = DEFAULT_LOCALE;
- continue;
- } else {
- return PMINFO_R_OK;
- }
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *description = (char *)ptr->text;
- return PMINFO_R_OK;
- }
+ locale = DEFAULT_LOCALE;
+ for (ptr = info->pkg_info->description; ptr != NULL; ptr = ptr->next) {
+ if (ptr->text == NULL || ptr->lang == NULL || strcmp(ptr->lang, locale))
+ continue;
+ *description = (char *)ptr->text;
+ return PMINFO_R_OK;
}
return PMINFO_R_ERROR;