Fix getting author name 75/46275/1
authorSangyoon Jang <s89.jang@samsung.com>
Wed, 19 Aug 2015 02:57:08 +0000 (11:57 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Wed, 19 Aug 2015 02:57:08 +0000 (11:57 +0900)
there is only one author element
author element doesn't need lang attibute

Change-Id: I3c22ade424eae62c124ccc8e2fc344b3abdb13a5
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
parser/pkgmgr_parser.c
src/pkgmgrinfo_pkginfo.c

index e0bb926..d1bf905 100644 (file)
@@ -1647,7 +1647,6 @@ static int __ps_process_author(xmlTextReaderPtr reader, author_x *author)
 {
        __save_xml_attribute(reader, "email", &author->email, NULL);
        __save_xml_attribute(reader, "href", &author->href, NULL);
-       __save_xml_lang(reader, &author->lang);
        __save_xml_value(reader, &author->text);
        return 0;
 }
index fe5033c..25d8e40 100644 (file)
@@ -1125,35 +1125,18 @@ API int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **d
 
 API int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name)
 {
-       char *locale;
-       author_x *ptr;
        pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
        retvm_if(author_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
 
-       locale = info->locale;
-       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
-
-       for (ptr = info->pkg_info->author; ptr != NULL; ptr = ptr->next) {
-               if (ptr->lang == NULL)
-                       continue;
+       if (info->pkg_info == NULL || info->pkg_info->author == NULL ||
+                       info->pkg_info->author->text == NULL)
+               return PMINFO_R_ERROR;
 
-               if (strcmp(ptr->lang, locale) == 0) {
-                       *author_name = (char *)ptr->text;
-                       if (strcasecmp(*author_name, PKGMGR_PARSER_EMPTY_STR) == 0) {
-                               locale = DEFAULT_LOCALE;
-                               continue;
-                       } else {
-                               return PMINFO_R_OK;
-                       }
-               } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
-                       *author_name = (char *)ptr->text;
-                       return PMINFO_R_OK;
-               }
-       }
+       *author_name = (char *)info->pkg_info->author->text;
 
-       return PMINFO_R_ERROR;
+       return PMINFO_R_OK;
 }
 
 API int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email)