From: Sung-jae Park Date: Wed, 30 Jan 2013 07:42:29 +0000 (+0000) Subject: Update the livebox_service_provider_name function. X-Git-Tag: accepted/tizen_2.1/20130425.023343~9^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a23ebdd3f54a76f449ed9b3b5b6e389db97ef61;p=platform%2Fframework%2Fweb%2Flivebox-service.git Update the livebox_service_provider_name function. Change-Id: Iaffea302a7a4b1e0f9bddc80487de122846c7cd7 --- diff --git a/packaging/liblivebox-service.spec b/packaging/liblivebox-service.spec index 0b01175..abda310 100644 --- a/packaging/liblivebox-service.spec +++ b/packaging/liblivebox-service.spec @@ -1,6 +1,6 @@ Name: liblivebox-service Summary: Service API for gathering installed livebox information. -Version: 0.3.0 +Version: 0.3.1 Release: 1 Group: framework/livebox License: Flora License diff --git a/src/livebox-service.c b/src/livebox-service.c index 5f638d0..85fc4c0 100644 --- a/src/livebox-service.c +++ b/src/livebox-service.c @@ -1194,11 +1194,43 @@ EAPI char *livebox_service_pkgname(const char *appid) EAPI char *livebox_service_provider_name(const char *lbid) { char *ret; + int stage = 0; + int seq = 0; + int idx = 0; + char *str = "com.samsung."; if (!lbid) return NULL; - ret = strdup(lbid); + while (str[idx] && lbid[idx] && lbid[idx] == str[idx]) { + idx++; + if (seq < 2 && lbid[idx] == '.') { + stage = idx; + seq++; + } + } + + if (!str[idx] && lbid[idx]) { + /* Inhouse */ + return strdup(lbid); + } else if (seq < 2) { + while (seq < 2) { + if (lbid[idx] == '.') { + seq++; + } else if (!lbid[idx]) { + ErrPrint("Invalid lbid: %s\n", lbid); + return NULL; + } + + idx++; + } + + stage = idx; + } else { + stage++; + } + + ret = strdup(lbid + stage); if (!ret) { ErrPrint("Error: %s\n", strerror(errno)); return NULL;