diff options
author | Jiyong Min <jiyong.min@samsung.com> | 2017-04-26 12:53:31 +0900 |
---|---|---|
committer | Jiyong Min <jiyong.min@samsung.com> | 2017-04-26 13:19:09 +0900 |
commit | c0d0de15cb4785b41147e9768b87f15789b5fff8 (patch) | |
tree | 7c5d082996768f52fe79ffe09905d52cfb214686 | |
parent | 07bf2f5ed03a79aeab5a094788fe3a8564810bc1 (diff) | |
download | media-controller-c0d0de15cb4785b41147e9768b87f15789b5fff8.tar.gz media-controller-c0d0de15cb4785b41147e9768b87f15789b5fff8.tar.bz2 media-controller-c0d0de15cb4785b41147e9768b87f15789b5fff8.zip |
Change application name validity checkertizen_4.0.m1_releasesubmit/tizen/20170427.042538accepted/tizen/unified/20170428.032542
[Problem] Can not seperate two similar application name. (ex. music-player & musicxplayer)
[Solution] The 'APPID_SEP' specific seperator has been added.
Change-Id: I0a906fce8d2d4e8b61e12a264b75dadc842279bb
Signed-off-by: jiyong min <jiyong.min@samsung.com>
-rwxr-xr-x | packaging/capi-media-controller.spec | 2 | ||||
-rwxr-xr-x | src/media_controller_util.c | 31 |
2 files changed, 19 insertions, 14 deletions
diff --git a/packaging/capi-media-controller.spec b/packaging/capi-media-controller.spec index c549e4e..aa6312d 100755 --- a/packaging/capi-media-controller.spec +++ b/packaging/capi-media-controller.spec @@ -1,6 +1,6 @@ Name: capi-media-controller Summary: A media controller library in Tizen Native API -Version: 0.1.37 +Version: 0.1.38 Release: 1 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_controller_util.c b/src/media_controller_util.c index f9811a4..4b94eed 100755 --- a/src/media_controller_util.c +++ b/src/media_controller_util.c @@ -19,38 +19,43 @@ #define MAX_NAME_LENGTH 255 -static void _mc_util_check_valid_name(const char *name, char **new_name) +static void _mc_util_check_valid_name(const char *name, char **valid_name) { char old_word[MAX_NAME_LENGTH] = {0, }; char new_word[MAX_NAME_LENGTH] = {0, }; - unsigned int i = 0; + unsigned int i = 0, j = 0; mc_retm_if(name == NULL, "Invalid parameter."); memset(old_word, 0, MAX_NAME_LENGTH); memset(new_word, 0, MAX_NAME_LENGTH); - /* It should have terminated C string, old-word should be limited to MAX_NAME_LENGTH - 1 */ - if (strlen(name) > MAX_NAME_LENGTH - 1) - memcpy(old_word, name, MAX_NAME_LENGTH - 1); - else - memcpy(old_word, name, strlen(name)); + g_strlcpy(old_word, name, sizeof(old_word)); /* only 0~9, a~z, A~Z, '.', '_' will be used */ - for (i = 0; i < strlen(old_word); i++) { + for (i = 0; (i < strlen(old_word)) && (j < sizeof(new_word)); i++) { if ((old_word[i] >= '0' && old_word[i] <= '9') || (old_word[i] >= 'a' && old_word[i] <= 'z') || (old_word[i] >= 'A' && old_word[i] <= 'Z') || - (old_word[i] == '.' && i != 0)) { - new_word[i] = old_word[i]; + (old_word[i] == '.' && i != 0) || + (old_word[i] == '_' && i != 0)) { + new_word[j++] = old_word[i]; } else { - new_word[i] = 'x'; + new_word[j++] = 'A'; + new_word[j++] = 'P'; + new_word[j++] = 'P'; + new_word[j++] = 'I'; + new_word[j++] = 'D'; + new_word[j++] = '_'; + new_word[j++] = 'S'; + new_word[j++] = 'E'; + new_word[j++] = 'P'; } } - (*new_name) = strdup(new_word); + *valid_name = g_strdup(new_word); - mc_retm_if((*new_name) == NULL, "Error allocation memory."); + mc_retm_if((*valid_name) == NULL, "Error allocation memory."); } int mc_util_get_own_name(char **name) |