Fix for coding rule 37/87337/1
authorSeungbae Shin <seungbae.shin@samsung.com>
Wed, 7 Sep 2016 10:56:22 +0000 (19:56 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Wed, 7 Sep 2016 10:56:22 +0000 (19:56 +0900)
Change-Id: Ic6badd17cd9bfe0386dee4a5300483ee0aec417e

src/priority.c
src/stream.c
test/proxy/src/proxy.c
test/sound_pool_test.c

index 834f83a..124946d 100644 (file)
@@ -89,7 +89,7 @@ sound_pool_error_e _sound_stream_priority_add_stream(
        SP_INST_CHECK(mgr, SOUND_POOL_ERROR_INVALID_PARAMETER);
        SP_INST_CHECK(stream, SOUND_POOL_ERROR_INVALID_PARAMETER);
 
-       mgr->priority_queue = g_list_append(mgr->priority_queue,(gpointer)stream);
+       mgr->priority_queue = g_list_append(mgr->priority_queue, (gpointer)stream);
        _sound_stream_priority_update_playback(mgr);
 
        SP_DEBUG_FLEAVE();
index 453e847..878573e 100644 (file)
@@ -346,8 +346,7 @@ sound_pool_error_e _sound_stream_resume(sound_stream_t *stream)
                        SOUND_POOL_ERROR_INVALID_OPERATION, "Can't set current context.");
 
        if (pool->state == SOUND_POOL_STATE_INACTIVE &&
-                       stream->state == SOUND_POOL_STREAM_STATE_PAUSED)
-       {
+                       stream->state == SOUND_POOL_STREAM_STATE_PAUSED) {
                stream->state_previous = stream->state;
                stream->state = SOUND_POOL_STREAM_STATE_SUSPENDED;
                ret = _stream_cb_manager_register_event(pool->cbmgr, stream);
index c2837b4..2ea4440 100644 (file)
@@ -36,9 +36,9 @@ static char *scripts[MAX_POOL_CNT] = { NULL };
 
 #define MAX_STREAM_CNT 1000
 /* Messages to be used for callbacks output (for pool state changing) */
-static char *stream_messages[MAX_POOL_CNT][MAX_STREAM_CNT] = {{ NULL }};
+static char *stream_messages[MAX_POOL_CNT][MAX_STREAM_CNT] = { { NULL } };
 /* Messages to be used for callbacks output (for stream state changing) */
-static char *stream_scripts[MAX_POOL_CNT][MAX_STREAM_CNT] = {{ NULL }};
+static char *stream_scripts[MAX_POOL_CNT][MAX_STREAM_CNT] = { { NULL } };
 
 static const char *__stringify_sound_pool_error(sound_pool_error_e error);
 static int __proxy_sound_pool_execute_script(const char *pars);
@@ -832,7 +832,7 @@ static int __proxy_sound_pool_play_stream(const char *pars)
        char tag[MAX_PATH_LEN] = {'\0'};
 
        if ((pars == NULL) || sscanf(pars, " %zu %"MAX_PATH_LEN_STR"[^ ] %i %f %u",
-                                            &idx, tag, &loop, &volume, &rank) < 2) {
+                                                               &idx, tag, &loop, &volume, &rank) < 2) {
                _printf(CMD_COLOR_RED, "You have to specify at least pool identifier and "
                                "source tag to be played in stream! Format: " CMD_PLAY_STREAM
                                " <pool id> <source tag> <loop> <volume> <priority rank>... "
@@ -1282,7 +1282,7 @@ static int __proxy_sound_pool_set_stream_state_change_callback_message(const cha
        char msg[MAX_MSG_LEN] = { '\0' };
 
        if ((pars == NULL) || sscanf(pars, " %zu %zu %"MAX_MSG_LEN_STR"[^ ]",
-                                            &idx, &stream_idx, msg) < 3) {
+                                                               &idx, &stream_idx, msg) < 3) {
                _printf(CMD_COLOR_RED, "You have to specify both identifier of the "
                                "pool and stream, plus message to be shown each time when "
                                "state of the stream is changed! Message should be a single "
@@ -1338,7 +1338,7 @@ static int __proxy_sound_pool_set_stream_state_change_callback_script(const char
        char scr[MAX_MSG_LEN] = { '\0' };
 
        if ((pars == NULL) || sscanf(pars, " %zu %zu %"MAX_MSG_LEN_STR"[^ ]",
-                                                &idx, &stream_idx, scr) < 3) {
+                                                               &idx, &stream_idx, scr) < 3) {
                _printf(CMD_COLOR_RED, "You have to specify both identifier of the "
                                "pool and stream, plus file with script to be executed each "
                                "time when state of the stream is changed! Message should be a "
@@ -1518,7 +1518,7 @@ static int cmd_pars[MAX_COMMAND_LINE_LEN] = { /* CMD_EXIT */ 0,
                /* CMD_SET_STREAM_PRIORITY */ 3, /* CMD_GET_STREAM_PRIORITY */ 2,
                /* CMD_GET_STREAM_STATE */ 2, /* CMD_SET_STREAM_CB_MSG */ 3,
                /* CMD_SET_STREAM_CB_SCRIPT */ 3, /* CMD_UNSET_STREAM_CB */ 2,
-               /* CMD_EXECUTE_SCRIPT */ 1, /* CMD_SLEEP */ 1 };
+               /* CMD_EXECUTE_SCRIPT */ 1, /* CMD_SLEEP */ 1 };
 
 /* Command -> Function mapping */
 static int (*cmd_fcns[MAX_COMMAND_LINE_LEN])() = {
@@ -1552,7 +1552,7 @@ static int (*cmd_fcns[MAX_COMMAND_LINE_LEN])() = {
                /* CMD_SET_STREAM_CB_MSG */ __proxy_sound_pool_set_stream_state_change_callback_message,
                /* CMD_SET_STREAM_CB_SCRIPT */ __proxy_sound_pool_set_stream_state_change_callback_script,
                /* CMD_UNSET_STREAM_CB */ __proxy_sound_pool_unset_stream_state_change_callback,
-               /* CMD_EXECUTE_SCRIPT */ __proxy_sound_pool_execute_script,
+               /* CMD_EXECUTE_SCRIPT */ __proxy_sound_pool_execute_script,
                /* CMD_SLEEP */ __proxy_sleep };
 
 int _exec_cmd(const char *cmd_line)
@@ -1561,7 +1561,7 @@ int _exec_cmd(const char *cmd_line)
        if (strlen(cmd_line) == 0) return OK;
 
        size_t trim_len = 0;
-       while((cmd_line + trim_len)[0] == ' ')
+       while ((cmd_line + trim_len)[0] == ' ')
                trim_len++;
 
        const char *cmd = cmd_line + trim_len;
index c2cce8a..2bbe3e6 100644 (file)
@@ -42,13 +42,14 @@ static _cmd_history_t *_cmd_history_tail = NULL;
 static _cmd_history_t *_cmd_history_curp = NULL;
 static char OUTPUT_LOG_FILE[MAX_PATH_LEN] = "out.log";
 
-void print_usage() {
-       printf( "Usage: sound_pool_test [options]                              \n");
-       printf( "Test Suite for testing Tizen SoundPool module                 \n");
-       printf( "-h, --help             - shows this help;                     \n");
-       printf( "-s, --script=SCRIPT    - executes commands from the text file \n"
+void print_usage()
+{
+       printf("Usage: sound_pool_test [options]                              \n");
+       printf("Test Suite for testing Tizen SoundPool module                 \n");
+       printf("-h, --help             - shows this help;                     \n");
+       printf("-s, --script=SCRIPT    - executes commands from the text file \n"
                        "                         directly after start;                \n");
-       printf( "-t, --target=TARGET(S) - selects the target or targets to     \n"
+       printf("-t, --target=TARGET(S) - selects the target or targets to     \n"
                        "                         output logs. Possible targets are:   \n"
                        "                         stderr, dlog, file. You can also     \n"
                        "                         select multiple targets using coma.  \n"
@@ -56,7 +57,7 @@ void print_usage() {
                        "                         > sound_pool_test -t stderr,file     \n"
                        "                         will output both in standard         \n"
                        "                         error and file;                      \n");
-       printf( "-f, --file=FILEPATH    - selects file for file output logging.\n"
+       printf("-f, --file=FILEPATH    - selects file for file output logging.\n"
                        "                         Works only in -t argument value      \n"
                        "                         includes 'file' target;              \n");
 }
@@ -117,7 +118,7 @@ size_t get_identical_start_len(const char *str1, const char *str2)
        size_t len1 = strnlen(str1, MAX_COMMAND_LINE_LEN);
        size_t len2 = strnlen(str2, MAX_COMMAND_LINE_LEN);
        size_t idx = 0;
-       while(idx < len1 && idx < len2) {
+       while (idx < len1 && idx < len2) {
                if (str1[idx] != str2[idx])
                        break;
                ++idx;
@@ -163,15 +164,15 @@ size_t print_cmd_prompt()
 
 int getch(void)
 {
-    struct termios oldattr, newattr;
-    int ch;
-    tcgetattr(STDIN_FILENO, &oldattr);
-    newattr = oldattr;
-    newattr.c_lflag &= ~(ICANON | ECHO);
-    tcsetattr(STDIN_FILENO, TCSANOW, &newattr);
-    ch = getchar();
-    tcsetattr(STDIN_FILENO, TCSANOW, &oldattr);
-    return ch;
+       struct termios oldattr, newattr;
+       int ch;
+       tcgetattr(STDIN_FILENO, &oldattr);
+       newattr = oldattr;
+       newattr.c_lflag &= ~(ICANON | ECHO);
+       tcsetattr(STDIN_FILENO, TCSANOW, &newattr);
+       ch = getchar();
+       tcsetattr(STDIN_FILENO, TCSANOW, &oldattr);
+       return ch;
 }
 
 size_t ts_getline(char *cmd_line)