#endif
#define TryReturn(condition, expr, returnValue, ...) \
- if (!(condition)) { \
+ if (!(condition)) { \
expr; \
- LOGE(__VA_ARGS__); \
- return returnValue; \
- } \
- else {;}
+ LOGE(__VA_ARGS__); \
+ return returnValue; \
+ }
#ifndef PI_API
#define PI_API __attribute__((visibility("default")))
#endif
-typedef enum
-{
- PRVINFO_ERROR_NO_MATCHING_PRIVILEGE = TIZEN_ERROR_PRIVILEGE_INFORMATION | 0x01
-}privilege_info_internal_error_e;
+typedef enum {
+ PRVINFO_ERROR_NO_MATCHING_PRIVILEGE = TIZEN_ERROR_PRIVILEGE_INFORMATION | 0x01
+} privilege_info_internal_error_e;
int privilege_info_get_display_name_string_id(const char* api_version, const char *privilege, char **display_name_string_id)
{
- TryReturn(api_version != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
- TryReturn(privilege != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
-
- char* temp = NULL;
-
- // Check NATIVE
- int ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
-
- if(ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- {
- if(temp == NULL)
- {
- *display_name_string_id = NULL;
- }
- else if(strcmp(temp,"") == 0)
- {
- *display_name_string_id = NULL;
- }
- else
- {
- goto err_none;
- }
- }
- else if(ret != PRIVILEGE_DB_NO_EXIST_RESULT)
- {
- goto err_internal_error;
- }
-
- if(temp != NULL)
- {
- free(temp);
- temp = NULL;
- }
-
- // Check WEB
- ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp);
-
- if(ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- {
- if(temp == NULL)
- {
- goto err_no_matching_privilege;
- }
- else if(strcmp(temp,"") == 0)
- {
- goto err_no_matching_privilege;
- }
- else
- {
- goto err_none;
- }
- }
- else if(ret == PRIVILEGE_DB_NO_EXIST_RESULT)
- {
- goto err_no_matching_privilege;
- }
- else
- {
- goto err_internal_error;
- }
+ TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
+ TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+
+ char* temp = NULL;
+
+ /* Check NATIVE */
+ int ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
+
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) {
+ if (temp == NULL)
+ *display_name_string_id = NULL;
+ else if (strcmp(temp, "") == 0)
+ *display_name_string_id = NULL;
+ else
+ goto err_none;
+ } else if (ret != PRIVILEGE_DB_NO_EXIST_RESULT) {
+ goto err_internal_error;
+ }
+
+ if (temp != NULL) {
+ free(temp);
+ temp = NULL;
+ }
+
+ /* Check WEB */
+ ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp);
+
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) {
+ if (temp == NULL)
+ goto err_no_matching_privilege;
+ else if (strcmp(temp, "") == 0)
+ goto err_no_matching_privilege;
+ else
+ goto err_none;
+ } else if (ret == PRIVILEGE_DB_NO_EXIST_RESULT) {
+ goto err_no_matching_privilege;
+ } else {
+ goto err_internal_error;
+ }
err_none:
- *display_name_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*display_name_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
- memcpy(*display_name_string_id, temp, strlen(temp));
- LOGD("display_name_string_id = %s", *display_name_string_id);
- free(temp);
- return PRVINFO_ERROR_NONE;
+ *display_name_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*display_name_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
+ memcpy(*display_name_string_id, temp, strlen(temp));
+ LOGD("display_name_string_id = %s", *display_name_string_id);
+ free(temp);
+ return PRVINFO_ERROR_NONE;
err_no_matching_privilege:
- *display_name_string_id = NULL;
- free(temp);
- return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
+ *display_name_string_id = NULL;
+ free(temp);
+ return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
err_internal_error:
- free(temp);
- return PRVINFO_ERROR_INTERNAL_ERROR;
+ free(temp);
+ return PRVINFO_ERROR_INTERNAL_ERROR;
}
int privilege_info_get_display_name_by_string_id(const char *string_id, char **display_name)
{
- char *temp = NULL;
- TryReturn(string_id != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] string_id is NULL");
+ char *temp = NULL;
+ TryReturn(string_id != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] string_id is NULL");
- temp = dgettext("privilege", string_id);
+ temp = dgettext("privilege", string_id);
- *display_name = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*display_name != NULL,, PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+ *display_name = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*display_name != NULL, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- memcpy(*display_name, temp, strlen(temp));
+ memcpy(*display_name, temp, strlen(temp));
- return PRVINFO_ERROR_NONE;
+ return PRVINFO_ERROR_NONE;
}
PI_API
int privilege_info_get_display_name(const char* api_version, const char* privilege, char** display_name)
{
- int ret = 0;
- char* display_name_string_id = NULL;
+ int ret = 0;
+ char* display_name_string_id = NULL;
- TryReturn(api_version != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
- TryReturn(privilege != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+ TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
+ TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
- ret = privilege_info_get_display_name_string_id(api_version, privilege, &display_name_string_id);
+ ret = privilege_info_get_display_name_string_id(api_version, privilege, &display_name_string_id);
- if(ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE)
- {
- char* tempPrivilege = NULL;
- char* token = NULL;
- char* temp = NULL;
+ if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
+ char* tempPrivilege = NULL;
+ char* token = NULL;
+ char* temp = NULL;
char* save = NULL;
tempPrivilege = strdup(privilege);
TryReturn(tempPrivilege != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] tempPrivilege's strdup is failed.");
- token = strtok_r(tempPrivilege, "/", &save);
- while(token)
- {
- temp = token;
- token = strtok_r(NULL, "/", &save);
- }
- *display_name = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- memcpy(*display_name, temp, strlen(temp));
+ token = strtok_r(tempPrivilege, "/", &save);
+ while (token) {
+ temp = token;
+ token = strtok_r(NULL, "/", &save);
+ }
+ *display_name = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+ memcpy(*display_name, temp, strlen(temp));
free(tempPrivilege);
- }
- else if(ret == PRVINFO_ERROR_NONE)
- {
- ret = privilege_info_get_display_name_by_string_id(display_name_string_id, display_name);
- free(display_name_string_id);
- TryReturn(ret == PRVINFO_ERROR_NONE,, PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- }
- else
- {
- return PRVINFO_ERROR_INTERNAL_ERROR;
- }
- return PRVINFO_ERROR_NONE;
+ } else if (ret == PRVINFO_ERROR_NONE) {
+ ret = privilege_info_get_display_name_by_string_id(display_name_string_id, display_name);
+ free(display_name_string_id);
+ TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+ } else {
+ return PRVINFO_ERROR_INTERNAL_ERROR;
+ }
+ return PRVINFO_ERROR_NONE;
}
int privilege_info_get_description_string_id(const char* api_version, const char *privilege, char **description_string_id)
{
- TryReturn(api_version != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
- TryReturn(privilege != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
-
- char* temp = NULL;
-
- // Check NATIVE
- int ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
-
- if(ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- {
- if(temp == NULL)
- {
- *description_string_id = NULL;
- }
- else if(strcmp(temp, "") == 0)
- {
- *description_string_id = NULL;
- }
- else
- {
- goto err_none;
- }
- }
- else if(ret != PRIVILEGE_DB_NO_EXIST_RESULT)
- {
- goto err_internal_error;
- }
-
- if(temp != NULL)
- {
- free(temp);
- temp = NULL;
- }
- // Check WEB
- ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp);
-
- if(ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- {
- if(temp == NULL)
- {
- goto err_no_matching_privilege;
- }
- else if(strcmp(temp,"") == 0)
- {
- goto err_no_matching_privilege;
- }
- else
- {
- goto err_none;
- }
- }
- else if(ret == PRIVILEGE_DB_NO_EXIST_RESULT)
- {
- goto err_no_matching_privilege;
- }
- else
- {
- goto err_internal_error;
- }
+ TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
+ TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+
+ char* temp = NULL;
+
+ /* Check NATIVE */
+ int ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
+
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) {
+ if (temp == NULL)
+ *description_string_id = NULL;
+ else if (strcmp(temp, "") == 0)
+ *description_string_id = NULL;
+ else
+ goto err_none;
+ } else if (ret != PRIVILEGE_DB_NO_EXIST_RESULT) {
+ goto err_internal_error;
+ }
+
+ if (temp != NULL) {
+ free(temp);
+ temp = NULL;
+ }
+ /* Check WEB */
+ ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp);
+
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) {
+ if (temp == NULL)
+ goto err_no_matching_privilege;
+ else if (strcmp(temp, "") == 0)
+ goto err_no_matching_privilege;
+ else
+ goto err_none;
+ } else if (ret == PRIVILEGE_DB_NO_EXIST_RESULT) {
+ goto err_no_matching_privilege;
+ } else {
+ goto err_internal_error;
+ }
err_none:
- *description_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*description_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
- memcpy(*description_string_id, temp, strlen(temp));
- LOGD("description_string_id = %s", *description_string_id);
- free(temp);
- return PRVINFO_ERROR_NONE;
+ *description_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*description_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
+ memcpy(*description_string_id, temp, strlen(temp));
+ LOGD("description_string_id = %s", *description_string_id);
+ free(temp);
+ return PRVINFO_ERROR_NONE;
err_no_matching_privilege:
- *description_string_id = NULL;
- free(temp);
- return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
+ *description_string_id = NULL;
+ free(temp);
+ return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
err_internal_error:
- free(temp);
- return PRVINFO_ERROR_INTERNAL_ERROR;
+ free(temp);
+ return PRVINFO_ERROR_INTERNAL_ERROR;
}
int privilege_info_get_description_by_string_id(const char *string_id, char **description)
{
- char *temp = NULL;
- TryReturn(string_id != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] string_id is NULL");
+ char *temp = NULL;
+ TryReturn(string_id != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] string_id is NULL");
- temp = dgettext("privilege", string_id);
+ temp = dgettext("privilege", string_id);
- *description = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*description != NULL,, PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+ *description = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*description != NULL, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- memcpy(*description, temp, strlen(temp));
+ memcpy(*description, temp, strlen(temp));
- return PRVINFO_ERROR_NONE;
+ return PRVINFO_ERROR_NONE;
}
PI_API
int privilege_info_get_description(const char* api_version, const char* privilege, char** description)
{
- int ret = 0;
- char* description_string_id = NULL;
-
- TryReturn(api_version != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
- TryReturn(privilege != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
-
- ret = privilege_info_get_description_string_id(api_version, privilege, &description_string_id);
-
- if(ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE)
- {
- char* temp = NULL;
- temp = dgettext("privilege", "IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED");
- *description = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*description != NULL,, PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
-
- memcpy(*description, temp, strlen(temp));
- }
- else if(ret == PRVINFO_ERROR_NONE)
- {
- ret = privilege_info_get_description_by_string_id(description_string_id, description);
- free(description_string_id);
- TryReturn(ret == PRVINFO_ERROR_NONE,, PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- }
- else
- {
- return PRVINFO_ERROR_INTERNAL_ERROR;
- }
- return PRVINFO_ERROR_NONE;
+ int ret = 0;
+ char* description_string_id = NULL;
+
+ TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
+ TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+
+ ret = privilege_info_get_description_string_id(api_version, privilege, &description_string_id);
+
+ if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
+ char* temp = NULL;
+ temp = dgettext("privilege", "IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED");
+ *description = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*description != NULL, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+
+ memcpy(*description, temp, strlen(temp));
+ } else if (ret == PRVINFO_ERROR_NONE) {
+ ret = privilege_info_get_description_by_string_id(description_string_id, description);
+ free(description_string_id);
+ TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+ } else {
+ return PRVINFO_ERROR_INTERNAL_ERROR;
+ }
+ return PRVINFO_ERROR_NONE;
}
int privilege_info_get_display_name_string_id_by_pkgtype(const char* package_type, const char* api_version, const char *privilege, char **display_name_string_id)
{
- TryReturn(package_type != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
- TryReturn(api_version != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
- TryReturn(privilege != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
-
- char* temp = NULL;
-
- // Check package_type
- int ret = 0;
- if(strcmp(package_type,"PRVINFO_PACKAGE_TYPE_NATIVE") == 0)
- {
- LOGD("package_type = %s", package_type);
- }
- else if(strcmp(package_type,"PRVINFO_PACKAGE_TYPE_WEB") == 0)
- {
- LOGD("package_type = %s", package_type);
- ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp);
- if(ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- {
- if(temp == NULL)
- {
- *display_name_string_id = NULL;
- }
- else if(strcmp(temp,"") == 0)
- {
- *display_name_string_id = NULL;
- }
- else
- {
- goto err_none;
- }
- }
- else if(ret != PRIVILEGE_DB_NO_EXIST_RESULT)
- {
- goto err_internal_error;
- }
-
- if(temp != NULL)
- {
- free(temp);
- temp = NULL;
- }
- }
- else
- {
- LOGD("package_type = %s", package_type);
- free(temp);
- return PRVINFO_ERROR_INVALID_PARAMETER;
- }
-
- ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
-
- if(ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- {
- if(temp == NULL)
- {
- goto err_no_matching_privilege;
- }
- else if(strcmp(temp, "") == 0)
- {
- goto err_no_matching_privilege;
- }
- else
- {
- goto err_none;
- }
- }
- else if(ret == PRIVILEGE_DB_NO_EXIST_RESULT)
- {
- goto err_no_matching_privilege;
- }
- else
- {
- goto err_internal_error;
- }
+ TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
+ TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
+ TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+
+ char* temp = NULL;
+
+ /* Check package_type */
+ int ret = 0;
+ if (strcmp(package_type, "PRVINFO_PACKAGE_TYPE_NATIVE") == 0) {
+ LOGD("package_type = %s", package_type);
+ } else if (strcmp(package_type, "PRVINFO_PACKAGE_TYPE_WEB") == 0) {
+ LOGD("package_type = %s", package_type);
+ ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp);
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) {
+ if (temp == NULL)
+ *display_name_string_id = NULL;
+ else if (strcmp(temp, "") == 0)
+ *display_name_string_id = NULL;
+ else
+ goto err_none;
+ } else if (ret != PRIVILEGE_DB_NO_EXIST_RESULT) {
+ goto err_internal_error;
+ }
+
+ if (temp != NULL) {
+ free(temp);
+ temp = NULL;
+ }
+ } else {
+ LOGD("package_type = %s", package_type);
+ free(temp);
+ return PRVINFO_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = privilege_db_manager_get_privilege_display(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
+
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) {
+ if (temp == NULL)
+ goto err_no_matching_privilege;
+ else if (strcmp(temp, "") == 0)
+ goto err_no_matching_privilege;
+ else
+ goto err_none;
+ } else if (ret == PRIVILEGE_DB_NO_EXIST_RESULT) {
+ goto err_no_matching_privilege;
+ } else {
+ goto err_internal_error;
+ }
err_none:
- *display_name_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*display_name_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
- memcpy(*display_name_string_id, temp, strlen(temp));
- LOGD("display_name_string_id = %s", *display_name_string_id);
- free(temp);
- return PRVINFO_ERROR_NONE;
+ *display_name_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*display_name_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
+ memcpy(*display_name_string_id, temp, strlen(temp));
+ LOGD("display_name_string_id = %s", *display_name_string_id);
+ free(temp);
+ return PRVINFO_ERROR_NONE;
err_no_matching_privilege:
- *display_name_string_id = NULL;
- free(temp);
- return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
+ *display_name_string_id = NULL;
+ free(temp);
+ return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
err_internal_error:
- free(temp);
- return PRVINFO_ERROR_INTERNAL_ERROR;
+ free(temp);
+ return PRVINFO_ERROR_INTERNAL_ERROR;
}
PI_API
int privilege_info_get_display_name_by_pkgtype(const const char* package_type, const char* api_version, const char* privilege, char** display_name)
{
- int ret = 0;
- char* display_name_string_id = NULL;
+ int ret = 0;
+ char* display_name_string_id = NULL;
- TryReturn(package_type != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
- TryReturn(api_version != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
- TryReturn(privilege != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+ TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
+ TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
+ TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
- ret = privilege_info_get_display_name_string_id_by_pkgtype(package_type, api_version, privilege, &display_name_string_id);
+ ret = privilege_info_get_display_name_string_id_by_pkgtype(package_type, api_version, privilege, &display_name_string_id);
- if(ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE)
- {
- char* tempPrivilege = NULL;
- char* token = NULL;
- char* temp = NULL;
+ if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
+ char* tempPrivilege = NULL;
+ char* token = NULL;
+ char* temp = NULL;
char* save = NULL;
- tempPrivilege = strdup(privilege);
+ tempPrivilege = strdup(privilege);
TryReturn(tempPrivilege != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] tempPrivilege's strdup is failed.");
- token = strtok_r(tempPrivilege, "/", &save);
- while(token)
- {
- temp = token;
- token = strtok_r(NULL, "/", &save);
- }
- *display_name = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- memcpy(*display_name, temp, strlen(temp));
+ token = strtok_r(tempPrivilege, "/", &save);
+ while (token) {
+ temp = token;
+ token = strtok_r(NULL, "/", &save);
+ }
+ *display_name = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*display_name != NULL, free(tempPrivilege), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+ memcpy(*display_name, temp, strlen(temp));
free(tempPrivilege);
- }
- else if(ret == PRVINFO_ERROR_NONE)
- {
- ret = privilege_info_get_display_name_by_string_id(display_name_string_id, display_name);
- free(display_name_string_id);
- TryReturn(ret == PRVINFO_ERROR_NONE,, PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- }
- else
- {
- return PRVINFO_ERROR_INTERNAL_ERROR;
- }
- return PRVINFO_ERROR_NONE;
+ } else if (ret == PRVINFO_ERROR_NONE) {
+ ret = privilege_info_get_display_name_by_string_id(display_name_string_id, display_name);
+ free(display_name_string_id);
+ TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+ } else {
+ return PRVINFO_ERROR_INTERNAL_ERROR;
+ }
+ return PRVINFO_ERROR_NONE;
}
int privilege_info_get_description_string_id_by_pkgtype(const char* package_type, const char* api_version, const char *privilege, char **description_string_id)
{
- TryReturn(package_type != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
- TryReturn(api_version != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
- TryReturn(privilege != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
-
- char* temp = NULL;
-
- // Check package_type
- int ret = 0;
-
- if(strcmp(package_type,"PRVINFO_PACKAGE_TYPE_WEB") == 0)
- {
- LOGD("package_type = %s", package_type);
- ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp);
- if(ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- {
- if(temp == NULL)
- {
- *description_string_id = NULL;
- }
- else if(strcmp(temp,"") == 0)
- {
- *description_string_id = NULL;
- }
- else
- {
- goto err_none;
- }
- }
- else if(ret != PRIVILEGE_DB_NO_EXIST_RESULT)
- {
- goto err_internal_error;
- }
-
- if(temp != NULL)
- {
- free(temp);
- temp = NULL;
- }
- }
- else if(strcmp(package_type,"PRVINFO_PACKAGE_TYPE_NATIVE") == 0)
- {
- LOGD("package_type = %s", package_type);
- }
- else
- {
- LOGD("package_type = %s", package_type);
- free(temp);
- return PRVINFO_ERROR_INVALID_PARAMETER;
- }
-
- ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
-
- if(ret == PRIVILEGE_DB_MANAGER_ERR_NONE)
- {
- if(temp == NULL)
- {
- goto err_no_matching_privilege;
- }
- else if(strcmp(temp,"") == 0)
- {
- goto err_no_matching_privilege;
- }
- else
- {
- goto err_none;
- }
- }
- else if(ret == PRIVILEGE_DB_NO_EXIST_RESULT)
- {
- goto err_no_matching_privilege;
- }
- else
- {
- goto err_internal_error;
- }
+ TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
+ TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
+ TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+
+ char* temp = NULL;
+
+ /* Check package_type */
+ int ret = 0;
+
+ if (strcmp(package_type, "PRVINFO_PACKAGE_TYPE_WEB") == 0) {
+ LOGD("package_type = %s", package_type);
+ ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_WRT, privilege, api_version, &temp);
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) {
+ if (temp == NULL)
+ *description_string_id = NULL;
+ else if (strcmp(temp, "") == 0)
+ *description_string_id = NULL;
+ else
+ goto err_none;
+ } else if (ret != PRIVILEGE_DB_NO_EXIST_RESULT) {
+ goto err_internal_error;
+ }
+
+ if (temp != NULL) {
+ free(temp);
+ temp = NULL;
+ }
+ } else if (strcmp(package_type, "PRVINFO_PACKAGE_TYPE_NATIVE") == 0) {
+ LOGD("package_type = %s", package_type);
+ } else {
+ LOGD("package_type = %s", package_type);
+ free(temp);
+ return PRVINFO_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = privilege_db_manager_get_privilege_description(PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege, api_version, &temp);
+
+ if (ret == PRIVILEGE_DB_MANAGER_ERR_NONE) {
+ if (temp == NULL)
+ goto err_no_matching_privilege;
+ else if (strcmp(temp, "") == 0)
+ goto err_no_matching_privilege;
+ else
+ goto err_none;
+ } else if (ret == PRIVILEGE_DB_NO_EXIST_RESULT) {
+ goto err_no_matching_privilege;
+ } else {
+ goto err_internal_error;
+ }
err_none:
- *description_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*description_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
- memcpy(*description_string_id, temp, strlen(temp));
- LOGD("description_string_id = %s", *description_string_id);
- free(temp);
- return PRVINFO_ERROR_NONE;
+ *description_string_id = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*description_string_id != NULL, free(temp), PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation is failed.");
+ memcpy(*description_string_id, temp, strlen(temp));
+ LOGD("description_string_id = %s", *description_string_id);
+ free(temp);
+ return PRVINFO_ERROR_NONE;
err_no_matching_privilege:
- *description_string_id = NULL;
- free(temp);
- return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
+ *description_string_id = NULL;
+ free(temp);
+ return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
err_internal_error:
- free(temp);
- return PRVINFO_ERROR_INTERNAL_ERROR;
+ free(temp);
+ return PRVINFO_ERROR_INTERNAL_ERROR;
}
PI_API
int privilege_info_get_description_by_pkgtype(const char* package_type, const char* api_version, const char* privilege, char** description)
{
- int ret = 0;
- char* description_string_id = NULL;
-
- TryReturn(package_type != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
- TryReturn(api_version != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
- TryReturn(privilege != NULL,, PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
-
- ret = privilege_info_get_description_string_id_by_pkgtype(package_type, api_version, privilege, &description_string_id);
-
- if(ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE)
- {
- char* temp = NULL;
- temp = dgettext("privilege", "IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED");
- *description = (char*)calloc(strlen(temp) + 1, sizeof(char));
- TryReturn(*description != NULL,, PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- memcpy(*description, temp, strlen(temp));
- //return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE;
- }
- else if(ret == PRVINFO_ERROR_NONE)
- {
- ret = privilege_info_get_description_by_string_id(description_string_id, description);
- free(description_string_id);
- TryReturn(ret == PRVINFO_ERROR_NONE,, PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
- }
- else
- {
- return PRVINFO_ERROR_INTERNAL_ERROR;
- }
- return PRVINFO_ERROR_NONE;
+ int ret = 0;
+ char* description_string_id = NULL;
+
+ TryReturn(package_type != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] package_type is NULL");
+ TryReturn(api_version != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] api_version is NULL");
+ TryReturn(privilege != NULL, , PRVINFO_ERROR_INVALID_PARAMETER, "[PRVINFO_ERROR_INVALID_PARAMETER] privilege is NULL");
+
+ ret = privilege_info_get_description_string_id_by_pkgtype(package_type, api_version, privilege, &description_string_id);
+
+ if (ret == PRVINFO_ERROR_NO_MATCHING_PRIVILEGE) {
+ char* temp = NULL;
+ temp = dgettext("privilege", "IDS_TPLATFORM_BODY_THIS_PRIVILEGE_IS_NOT_DEFINED");
+ *description = (char*)calloc(strlen(temp) + 1, sizeof(char));
+ TryReturn(*description != NULL, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+ memcpy(*description, temp, strlen(temp));
+ /* return PRVINFO_ERROR_NO_MATCHING_PRIVILEGE; */
+ } else if (ret == PRVINFO_ERROR_NONE) {
+ ret = privilege_info_get_description_by_string_id(description_string_id, description);
+ free(description_string_id);
+ TryReturn(ret == PRVINFO_ERROR_NONE, , PRVINFO_ERROR_OUT_OF_MEMORY, "[PRVINFO_ERROR_OUT_OF_MEMORY] Memory allocation failed.");
+ } else {
+ return PRVINFO_ERROR_INTERNAL_ERROR;
+ }
+ return PRVINFO_ERROR_NONE;
}
#define YELLOW 33
#define BG_BLACK 40
-static int fail_cnt=0;
-static int success_cnt=0;
+static int fail_cnt = 0;
+static int success_cnt = 0;
-static void __change_color_to_red(){
- printf("%c[%d;%dm", 0x1B, BRIGHTNESS, RED);
+static void __change_color_to_red()
+{
+ printf("%c[%d;%dm", 0x1B, BRIGHTNESS, RED);
}
-static void __change_color_to_green(){
- printf("%c[%d;%dm", 0x1B, BRIGHTNESS, GREEN);
+static void __change_color_to_green()
+{
+ printf("%c[%d;%dm", 0x1B, BRIGHTNESS, GREEN);
}
-static void __change_color_to_yellow(){
- printf("%c[%d;%dm", 0x1B, BRIGHTNESS, YELLOW);
+static void __change_color_to_yellow()
+{
+ printf("%c[%d;%dm", 0x1B, BRIGHTNESS, YELLOW);
}
-static void __change_color_to_origin(){
- printf("%c[%dm", 0x1B, 0);
+static void __change_color_to_origin()
+{
+ printf("%c[%dm", 0x1B, 0);
}
-static const char* __get_result_string(privilege_info_error_e ret){
- if(ret == PRVINFO_ERROR_NONE){
- return "PRVINFO_ERROR_NONE";
- }
- else if(ret == PRVINFO_ERROR_INVALID_PARAMETER){
- return "PRVINFO_ERROR_INVALID_PARAMETER";
- }
- else if(ret == PRVINFO_ERROR_OUT_OF_MEMORY)
- {
- return "PRVINFO_ERROR_OUT_OF_MEMORY";
- }
- else if(ret == PRVINFO_ERROR_INTERNAL_ERROR){
- return "PRVINFO_ERROR_INTERNAL_ERROR";
- }
+static const char* __get_result_string(privilege_info_error_e ret)
+{
+ if (ret == PRVINFO_ERROR_NONE)
+ return "PRVINFO_ERROR_NONE";
+ else if (ret == PRVINFO_ERROR_INVALID_PARAMETER)
+ return "PRVINFO_ERROR_INVALID_PARAMETER";
+ else if (ret == PRVINFO_ERROR_OUT_OF_MEMORY)
+ return "PRVINFO_ERROR_OUT_OF_MEMORY";
+ else if (ret == PRVINFO_ERROR_INTERNAL_ERROR)
+ return "PRVINFO_ERROR_INTERNAL_ERROR";
}
static void __check_get_privilege_display_name_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* display_name)
{
- printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
-
- if(expected_result != result)
- {
- printf("not matched\n");
- __change_color_to_red();
- printf("test fail\n");
- fail_cnt++;
- }else{
- printf("matched\n");
- if(result == PRVINFO_ERROR_NONE)
- {
- if(display_name == NULL)
- {
- printf("display_name must not be NULL\n");
- __change_color_to_red();
- printf("test fail\n");
- fail_cnt++;
- __change_color_to_origin();
- return;
- }else{
- printf("display_name = %s\n", display_name);
- }
- }else{
- if(display_name != NULL)
- {
- printf("display_name = %s\n", display_name);
- printf("display_name must be NULL\n");
- __change_color_to_red();
- printf("test fail\n");
- fail_cnt++;
- __change_color_to_origin();
- return;
- }
- }
- __change_color_to_green();
- printf("test success\n");
- success_cnt++;
- }
- __change_color_to_origin();
+ printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+
+ if (expected_result != result) {
+ printf("not matched\n");
+ __change_color_to_red();
+ printf("test fail\n");
+ fail_cnt++;
+ } else {
+ printf("matched\n");
+ if (result == PRVINFO_ERROR_NONE) {
+ if (display_name == NULL) {
+ printf("display_name must not be NULL\n");
+ __change_color_to_red();
+ printf("test fail\n");
+ fail_cnt++;
+ __change_color_to_origin();
+ return;
+ } else {
+ printf("display_name = %s\n", display_name);
+ }
+ } else {
+ if (display_name != NULL) {
+ printf("display_name = %s\n", display_name);
+ printf("display_name must be NULL\n");
+ __change_color_to_red();
+ printf("test fail\n");
+ fail_cnt++;
+ __change_color_to_origin();
+ return;
+ }
+ }
+ __change_color_to_green();
+ printf("test success\n");
+ success_cnt++;
+ }
+ __change_color_to_origin();
}
static void __check_get_privilege_description_result(privilege_info_error_e expected_result, privilege_info_error_e result, const char* description)
{
- printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
-
- if(expected_result != result)
- {
- printf("not matched\n");
- __change_color_to_red();
- printf("test fail\n");
- fail_cnt++;
- }else{
- printf("matched\n");
- if(result == PRVINFO_ERROR_NONE)
- {
- if(description == NULL)
- {
- printf("description must not be NULL\n");
- __change_color_to_red();
- printf("test fail\n");
- fail_cnt++;
- __change_color_to_origin();
- return;
- }else{
- printf("description = %s\n", description);
- }
- }else{
- if(description != NULL)
- {
- printf("description = %s\n", description);
- printf("description must be NULL\n");
- __change_color_to_red();
- printf("test fail\n");
- fail_cnt++;
- __change_color_to_origin();
- return;
- }
- }
-
- __change_color_to_green();
- printf("test success\n");
- success_cnt++;
- }
- __change_color_to_origin();
+ printf("expected result = %s, result = %s\n", __get_result_string(expected_result), __get_result_string(result));
+
+ if (expected_result != result) {
+ printf("not matched\n");
+ __change_color_to_red();
+ printf("test fail\n");
+ fail_cnt++;
+ } else {
+ printf("matched\n");
+ if (result == PRVINFO_ERROR_NONE) {
+ if (description == NULL) {
+ printf("description must not be NULL\n");
+ __change_color_to_red();
+ printf("test fail\n");
+ fail_cnt++;
+ __change_color_to_origin();
+ return;
+ } else {
+ printf("description = %s\n", description);
+ }
+ } else {
+ if (description != NULL) {
+ printf("description = %s\n", description);
+ printf("description must be NULL\n");
+ __change_color_to_red();
+ printf("test fail\n");
+ fail_cnt++;
+ __change_color_to_origin();
+ return;
+ }
+ }
+
+ __change_color_to_green();
+ printf("test success\n");
+ success_cnt++;
+ }
+ __change_color_to_origin();
}
static void __test_privilege_info_get_display_name()
{
- int ret;
- char* display_name = NULL;
-
- printf("-----------------------------------------------------------\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
-
- printf("-----------------------------------------------------------\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(display_name != NULL)
- {
- free(display_name);
- display_name = NULL;
- }
- ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/mediacapture", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
-
- printf("-----------------------------------------------------------\n");
- printf("Not existing privilege\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(display_name != NULL)
- {
- free(display_name);
- display_name = NULL;
- }
- ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
-
- printf("-----------------------------------------------------------\n");
- printf("Invalid parameter\n");
- printf("api_version : NULL\n");
- printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(display_name != NULL)
- {
- free(display_name);
- display_name = NULL;
- }
- ret = privilege_info_get_display_name(NULL, "http://tizen.org/privilege/window,priority.set", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, display_name);
-
- free(display_name);
+ int ret;
+ char* display_name = NULL;
+
+ printf("-----------------------------------------------------------\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+
+ printf("-----------------------------------------------------------\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/mediacapture\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (display_name != NULL) {
+ free(display_name);
+ display_name = NULL;
+ }
+ ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/mediacapture", &display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+
+ printf("-----------------------------------------------------------\n");
+ printf("Not existing privilege\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (display_name != NULL) {
+ free(display_name);
+ display_name = NULL;
+ }
+ ret = privilege_info_get_display_name("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+
+ printf("-----------------------------------------------------------\n");
+ printf("Invalid parameter\n");
+ printf("api_version : NULL\n");
+ printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (display_name != NULL) {
+ free(display_name);
+ display_name = NULL;
+ }
+ ret = privilege_info_get_display_name(NULL, "http://tizen.org/privilege/window, priority.set", &display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, display_name);
+
+ free(display_name);
}
static void __test_privilege_info_get_display_name_by_pkgtype()
{
- int ret;
- char* display_name = NULL;
-
- printf("-----------------------------------------------------------\n");
- printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
-
- printf("-----------------------------------------------------------\n");
- printf("pkgtype : PRVINFO_PACKAGE_TYPE_WEB\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(display_name != NULL)
- {
- free(display_name);
- display_name = NULL;
- }
- ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
-
- printf("-----------------------------------------------------------\n");
- printf("Mismatched package type: write WEB as NATIVE\n");
- printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(display_name != NULL)
- {
- free(display_name);
- display_name = NULL;
- }
- ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
-
-
- printf("-----------------------------------------------------------\n");
- printf("Not existing privilege\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(display_name != NULL)
- {
- free(display_name);
- display_name = NULL;
- }
- ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
-
- printf("-----------------------------------------------------------\n");
- printf("Invalid parameter\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(display_name != NULL)
- {
- free(display_name);
- display_name = NULL;
- }
- ret = privilege_info_get_display_name_by_pkgtype(NULL, "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
- __check_get_privilege_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, display_name);
-
- free(display_name);
+ int ret;
+ char* display_name = NULL;
+
+ printf("-----------------------------------------------------------\n");
+ printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+
+ printf("-----------------------------------------------------------\n");
+ printf("pkgtype : PRVINFO_PACKAGE_TYPE_WEB\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/mediacapture\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (display_name != NULL) {
+ free(display_name);
+ display_name = NULL;
+ }
+ ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+
+ printf("-----------------------------------------------------------\n");
+ printf("Mismatched package type: write WEB as NATIVE\n");
+ printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/mediacapture\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (display_name != NULL) {
+ free(display_name);
+ display_name = NULL;
+ }
+ ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+
+
+ printf("-----------------------------------------------------------\n");
+ printf("Not existing privilege\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (display_name != NULL) {
+ free(display_name);
+ display_name = NULL;
+ }
+ ret = privilege_info_get_display_name_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_NONE, ret, display_name);
+
+ printf("-----------------------------------------------------------\n");
+ printf("Invalid parameter\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/mediacapture\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (display_name != NULL) {
+ free(display_name);
+ display_name = NULL;
+ }
+ ret = privilege_info_get_display_name_by_pkgtype(NULL, "2.3", "http://tizen.org/privilege/mediacapture", &display_name);
+ __check_get_privilege_display_name_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, display_name);
+
+ free(display_name);
}
static void __test_privilege_info_get_description()
{
- int ret;
- char* description = NULL;
-
- printf("-----------------------------------------------------------\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/window.priority.set", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
-
- printf("-----------------------------------------------------------\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(description != NULL)
- {
- free(description);
- description = NULL;
- }
- ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/mediacapture", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
-
- printf("-----------------------------------------------------------\n");
- printf("Not existing privilege\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(description != NULL)
- {
- free(description);
- description = NULL;
- }
- ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
-
- printf("-----------------------------------------------------------\n");
- printf("Invalid parameter\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(description != NULL)
- {
- free(description);
- description = NULL;
- }
- ret = privilege_info_get_description(NULL, "http://tizen.org/privilege/mediacapture", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, description);
-
- free(description);
+ int ret;
+ char* description = NULL;
+
+ printf("-----------------------------------------------------------\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/window.priority.set", &description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+
+ printf("-----------------------------------------------------------\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/mediacapture\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (description != NULL) {
+ free(description);
+ description = NULL;
+ }
+ ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/mediacapture", &description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+
+ printf("-----------------------------------------------------------\n");
+ printf("Not existing privilege\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (description != NULL) {
+ free(description);
+ description = NULL;
+ }
+ ret = privilege_info_get_description("2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+
+ printf("-----------------------------------------------------------\n");
+ printf("Invalid parameter\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/mediacapture\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (description != NULL) {
+ free(description);
+ description = NULL;
+ }
+ ret = privilege_info_get_description(NULL, "http://tizen.org/privilege/mediacapture", &description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, description);
+
+ free(description);
}
static void __test_privilege_info_get_description_by_pkgtype()
{
- int ret;
- char* description = NULL;
-
- printf("-----------------------------------------------------------\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/window.priority.set\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
-
- printf("-----------------------------------------------------------\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(description != NULL)
- {
- free(description);
- description = NULL;
- }
- ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/mediacapture", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
-
- printf("-----------------------------------------------------------\n");
- printf("Mismatched package type: write WEB as NATIVE\n");
- printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/mediacapture\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(description != NULL)
- {
- free(description);
- description = NULL;
- }
- ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
-
- printf("-----------------------------------------------------------\n");
- printf("Not existing privilege\n");
- printf("api_version : 2.3\n");
- printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
- printf("expected result : PRVINFO_ERROR_NONE\n");
- if(description != NULL)
- {
- free(description);
- description = NULL;
- }
- ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
-
- printf("-----------------------------------------------------------\n");
- printf("Invalid parameter\n");
- printf("api_version : 2.3\n");
- printf("privilege : NULL\n");
- printf("expected result : PRVINFO_ERROR_INVALID_PARAMETER\n");
- if(description != NULL)
- {
- free(description);
- description = NULL;
- }
- ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE","2.3", NULL, &description);
- __check_get_privilege_description_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, description);
-
- free(description);
+ int ret;
+ char* description = NULL;
+
+ printf("-----------------------------------------------------------\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/window.priority.set\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/window.priority.set", &description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+
+ printf("-----------------------------------------------------------\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/mediacapture\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (description != NULL) {
+ free(description);
+ description = NULL;
+ }
+ ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_WEB", "2.3", "http://tizen.org/privilege/mediacapture", &description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+
+ printf("-----------------------------------------------------------\n");
+ printf("Mismatched package type: write WEB as NATIVE\n");
+ printf("pkgtype : PRVINFO_PACKAGE_TYPE_NATIVE\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/mediacapture\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (description != NULL) {
+ free(description);
+ description = NULL;
+ }
+ ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/mediacapture", &description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+
+ printf("-----------------------------------------------------------\n");
+ printf("Not existing privilege\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : http://tizen.org/privilege/RRRRRRRRRR\n");
+ printf("expected result : PRVINFO_ERROR_NONE\n");
+ if (description != NULL) {
+ free(description);
+ description = NULL;
+ }
+ ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", "http://tizen.org/privilege/RRRRRRRRRR", &description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_NONE, ret, description);
+
+ printf("-----------------------------------------------------------\n");
+ printf("Invalid parameter\n");
+ printf("api_version : 2.3\n");
+ printf("privilege : NULL\n");
+ printf("expected result : PRVINFO_ERROR_INVALID_PARAMETER\n");
+ if (description != NULL) {
+ free(description);
+ description = NULL;
+ }
+ ret = privilege_info_get_description_by_pkgtype("PRVINFO_PACKAGE_TYPE_NATIVE", "2.3", NULL, &description);
+ __check_get_privilege_description_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, description);
+
+ free(description);
}
int main()
{
- __change_color_to_yellow();
- printf("Test function : privilege_info_get_display_name\n");
- __change_color_to_origin();
- __test_privilege_info_get_display_name();
-
- __change_color_to_yellow();
- printf("Test function : privilege_info_get_display_name_by_pkgtype\n");
- __change_color_to_origin();
- __test_privilege_info_get_display_name_by_pkgtype();
-
- __change_color_to_yellow();
- printf("Test function : privilege_info_get_description\n");
- __change_color_to_origin();
- __test_privilege_info_get_description();
-
- __change_color_to_yellow();
- printf("Test function : privilege_info_get_description_by_pkgtype\n");
- __change_color_to_origin();
- __test_privilege_info_get_description_by_pkgtype();
-
- __change_color_to_green();
- printf("Test Complete\n");
- printf("success : %d, ", success_cnt);
- __change_color_to_red();
- printf("fail : %d\n", fail_cnt);
- __change_color_to_origin();
+ __change_color_to_yellow();
+ printf("Test function : privilege_info_get_display_name\n");
+ __change_color_to_origin();
+ __test_privilege_info_get_display_name();
+
+ __change_color_to_yellow();
+ printf("Test function : privilege_info_get_display_name_by_pkgtype\n");
+ __change_color_to_origin();
+ __test_privilege_info_get_display_name_by_pkgtype();
+
+ __change_color_to_yellow();
+ printf("Test function : privilege_info_get_description\n");
+ __change_color_to_origin();
+ __test_privilege_info_get_description();
+
+ __change_color_to_yellow();
+ printf("Test function : privilege_info_get_description_by_pkgtype\n");
+ __change_color_to_origin();
+ __test_privilege_info_get_description_by_pkgtype();
+
+ __change_color_to_green();
+ printf("Test Complete\n");
+ printf("success : %d, ", success_cnt);
+ __change_color_to_red();
+ printf("fail : %d\n", fail_cnt);
+ __change_color_to_origin();
}