From: SeokHoon Lee Date: Tue, 16 Aug 2016 09:26:16 +0000 (+0900) Subject: Apply the tizen coding rule X-Git-Tag: submit/tizen/20160818.052348~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56ada9c141b66531fd0626c027a31ccc3abec68c;p=platform%2Fcore%2Fapi%2Fscreen-mirroring.git Apply the tizen coding rule Signed-off-by: SeokHoon Lee Change-Id: I4a1007968b8afc37f4b4426823f480bafa7640fc --- diff --git a/miracast_server/miracast_server_impl.c b/miracast_server/miracast_server_impl.c old mode 100755 new mode 100644 index 396e728..bbc2669 --- a/miracast_server/miracast_server_impl.c +++ b/miracast_server/miracast_server_impl.c @@ -99,11 +99,10 @@ handle_method_call(GDBusConnection *connection, if (method_name != NULL) { scmirroring_debug("method_name is %s\n", method_name); - if (g_strcmp0(method_name, "launch_method") == 0) { + if (g_strcmp0(method_name, "launch_method") == 0) g_dbus_method_invocation_return_value(invocation, NULL); - } else if (g_strcmp0(method_name, "get_miracast_wfd_source_status") == 0) { + else if (g_strcmp0(method_name, "get_miracast_wfd_source_status") == 0) g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", g_server_status)); - } } } @@ -229,9 +228,8 @@ void __miracast_server_quit_program(MiracastServer *server) } ret = __miracast_server_emit_status_signal(MIRACAST_WFD_SOURCE_OFF); - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) scmirroring_error("Failed to emit miracast server off signal"); - } pool = (void *)gst_rtsp_server_get_session_pool(server->server); if (pool) { @@ -260,9 +258,8 @@ static void __miracast_server_signal_handler(int signo) case SIGQUIT: case SIGTERM: ret = __miracast_server_emit_status_signal(MIRACAST_WFD_SOURCE_OFF); - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) scmirroring_error("Failed to emit miracast server off signal"); - } break; default: break; @@ -411,9 +408,8 @@ void __miracast_server_msg_cb(gboolean is_error, void *userdata) { /*MiracastServer *server = (MiracastServer *)userdata; */ - if (is_error) { + if (is_error) scmirroring_error("Error occured"); - } } gint miracast_server_gst_init() @@ -464,32 +460,31 @@ gint miracast_server_gst_init() } } - for (i = 0; i < *argc; i++) { + for (i = 0; i < *argc; i++) scmirroring_debug("argv[%d] : %s\n", i, argv[i]); - } /* initializing gstreamer */ if (!gst_init_check(argc, &argv, &err)) { scmirroring_error("Could not initialize GStreamer: %s\n", err ? err->message : "unknown error occurred"); - if (err) { + if (err) g_error_free(err); - } + goto ERROR; } /* release */ - for (i = 0; i < *argc; i++) { + for (i = 0; i < *argc; i++) SCMIRRORING_SAFE_FREE(argv[i]); - } + SCMIRRORING_SAFE_FREE(argv); SCMIRRORING_SAFE_FREE(argc); return SCMIRRORING_ERROR_NONE; ERROR: - for (i = 0; i < *argc; i++) { + for (i = 0; i < *argc; i++) SCMIRRORING_SAFE_FREE(argv[i]); - } + SCMIRRORING_SAFE_FREE(argv); SCMIRRORING_SAFE_FREE(argc); return SCMIRRORING_ERROR_INVALID_OPERATION; @@ -747,9 +742,8 @@ void __miracast_server_interpret(MiracastServer *server, gchar *buf) klass->send_response(server, "OK:LISTENING"); ret = __miracast_server_emit_status_signal(MIRACAST_WFD_SOURCE_ON); - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) scmirroring_error("Failed to emit miracast server on signal"); - } } else { klass->send_response(server, "FAIL:LISTENING"); diff --git a/packaging/capi-media-screen-mirroring.spec b/packaging/capi-media-screen-mirroring.spec old mode 100755 new mode 100644 index 9eaf5f3..c3a5b9f --- a/packaging/capi-media-screen-mirroring.spec +++ b/packaging/capi-media-screen-mirroring.spec @@ -1,6 +1,6 @@ Name: capi-media-screen-mirroring Summary: A screen mirroring library in Tizen C API -Version: 0.1.49 +Version: 0.1.50 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/scmirroring_src.c b/src/scmirroring_src.c old mode 100755 new mode 100644 index bcbf098..3aff34f --- a/src/scmirroring_src.c +++ b/src/scmirroring_src.c @@ -168,34 +168,32 @@ static int __miracast_server_launch(scmirroring_src_s *scmirroring) static int __scmirroring_src_get_error(gchar *str) { - if (g_strrstr(str, "OK")) { + if (g_strrstr(str, "OK")) return SCMIRRORING_ERROR_NONE; - } else if (g_strrstr(str, "FAIL")) { + else if (g_strrstr(str, "FAIL")) return SCMIRRORING_ERROR_INVALID_OPERATION; - } return SCMIRRORING_ERROR_NONE; } static int __scmirroring_src_get_status(gchar *str) { - if (g_strrstr(str, "LISTENING")) { + if (g_strrstr(str, "LISTENING")) return SCMIRRORING_STATE_CONNECTION_WAIT; - } else if (g_strrstr(str, "CONNECTED")) { + else if (g_strrstr(str, "CONNECTED")) return SCMIRRORING_STATE_CONNECTED; - } else if (g_strrstr(str, "PLAYING")) { + else if (g_strrstr(str, "PLAYING")) return SCMIRRORING_STATE_PLAYING; - } else if (g_strrstr(str, "SET")) { + else if (g_strrstr(str, "SET")) return SCMIRRORING_STATE_READY; - } else if (g_strrstr(str, SCMIRRORING_STATE_CMD_PAUSE)) { + else if (g_strrstr(str, SCMIRRORING_STATE_CMD_PAUSE)) return SCMIRRORING_STATE_PAUSED; - } else if (g_strrstr(str, SCMIRRORING_STATE_CMD_RESUME)) { + else if (g_strrstr(str, SCMIRRORING_STATE_CMD_RESUME)) return SCMIRRORING_STATE_PLAYING; - } else if (g_strrstr(str, SCMIRRORING_STATE_CMD_STOP)) { + else if (g_strrstr(str, SCMIRRORING_STATE_CMD_STOP)) return SCMIRRORING_STATE_TEARDOWN; - } else if (g_strrstr(str, SCMIRRORING_STATE_CMD_DESTROY)) { + else if (g_strrstr(str, SCMIRRORING_STATE_CMD_DESTROY)) return SCMIRRORING_STATE_NULL; - } return SCMIRRORING_STATE_NONE; } @@ -420,9 +418,8 @@ int scmirroring_src_set_connection_mode(scmirroring_src_h scmirroring, scmirrori _scmirroring->connect_mode = connect_mode; - if (_scmirroring->connected) { + if (_scmirroring->connected) ret = __scmirroring_src_send_set_cm(_scmirroring); - } scmirroring_debug_fleave(); @@ -503,9 +500,8 @@ int scmirroring_src_set_ip_and_port(scmirroring_src_h scmirroring, const char *i return SCMIRRORING_ERROR_OUT_OF_MEMORY; } - if (_scmirroring->connected) { + if (_scmirroring->connected) ret = __scmirroring_src_send_set_ip(_scmirroring); - } scmirroring_debug_fleave(); @@ -531,9 +527,8 @@ int scmirroring_src_set_resolution(scmirroring_src_h scmirroring, scmirroring_re _scmirroring->resolution = resolution; - if (_scmirroring->connected) { + if (_scmirroring->connected) ret = __scmirroring_src_send_set_reso(_scmirroring); - } scmirroring_debug_fleave(); @@ -574,9 +569,8 @@ int scmirroring_src_set_multisink_ability(scmirroring_src_h scmirroring, scmirro _scmirroring->multisink = multisink; - if (_scmirroring->connected) { + if (_scmirroring->connected) ret = __scmirroring_src_send_set_multisink(_scmirroring); - } scmirroring_debug_fleave(); @@ -687,9 +681,8 @@ try: ret = __scmirroring_src_send_set_reso(_scmirroring); } - if (_scmirroring->multisink == SCMIRRORING_MULTISINK_ENABLE) { + if (_scmirroring->multisink == SCMIRRORING_MULTISINK_ENABLE) ret = __scmirroring_src_send_set_multisink(_scmirroring); - } scmirroring_debug_fleave(); diff --git a/src/scmirroring_src_ini.c b/src/scmirroring_src_ini.c index a54e81c..86a227d 100644 --- a/src/scmirroring_src_ini.c +++ b/src/scmirroring_src_ini.c @@ -197,7 +197,7 @@ scmirroring_src_ini_load(void) } /* free dict as we got our own structure */ - if(dict) + if (dict) iniparser_freedict(dict); loaded = TRUE; diff --git a/test/scmirroring_test.c b/test/scmirroring_test.c old mode 100755 new mode 100644 index 3638a28..770d331 --- a/test/scmirroring_test.c +++ b/test/scmirroring_test.c @@ -107,9 +107,8 @@ static void __interpret(char *cmd) g_print("unknown menu \n"); } - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) g_print("Error Occured [%d]\n", ret); - } g_timeout_add(100, __timeout_menu_display, 0); diff --git a/test/scmirroring_wifi_direct_test.c b/test/scmirroring_wifi_direct_test.c old mode 100755 new mode 100644 index 4f54311..dbc6fbb --- a/test/scmirroring_wifi_direct_test.c +++ b/test/scmirroring_wifi_direct_test.c @@ -152,9 +152,8 @@ static void __interpret(char *cmd) g_print("unknown menu \n"); } - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) g_print("Error Occured [%d]\n", ret); - } g_timeout_add(100, __timeout_menu_display, 0); @@ -182,11 +181,10 @@ static gboolean __disconnect_p2p_connection(void) int ret = WIFI_DIRECT_ERROR_NONE; ret = wifi_direct_disconnect_all(); - if (!ret) { + if (!ret) g_print("wifi_direct_disconnect_all success\n"); - } else { + else g_print("wifi_direct_disconnect_all fail\n"); - } g_print("------p2p connection disconnected------\n"); @@ -268,9 +266,8 @@ void _discover_cb(int error_code, wifi_direct_discovery_state_e discovery_state, case WIFI_DIRECT_DISCOVERY_FOUND: g_print("discovery_state : WIFI_DIRECT_DISCOVERY_FOUND \n"); ret = wifi_direct_foreach_discovered_peers(_discovered_peer_cb, (void *)NULL); - if (ret != WIFI_DIRECT_ERROR_NONE) { + if (ret != WIFI_DIRECT_ERROR_NONE) g_print("Error : wifi_direct_foreach_discovered_peers failed : %d\n", ret); - } break; case WIFI_DIRECT_DISCOVERY_FINISHED: g_print("discovery_state : WIFI_DIRECT_DISCOVERY_FINISHED \n"); @@ -453,11 +450,10 @@ static gboolean __start_p2p_connection(gpointer data) } else { g_print("wifi direct status >= WIFI_DIRECT_STATE_ACTIVATED.. Disconnect all first\n"); ret = wifi_direct_disconnect_all(); - if (!ret) { + if (!ret) g_print("wifi_direct_disconnect_all success\n"); - } else { + else g_print("wifi_direct_disconnect_all fail\n"); - } ret = __start_wifi_display_connection(); if (ret == TRUE) { diff --git a/test_sink/scmirroring_sink_test.c b/test_sink/scmirroring_sink_test.c index 7191f93..eaeea8c 100644 --- a/test_sink/scmirroring_sink_test.c +++ b/test_sink/scmirroring_sink_test.c @@ -154,9 +154,9 @@ static Evas_Object* _create_win(const char *name) static Evas_Object *create_evas_image_object(Evas_Object *eo_parent) { - if (!eo_parent) { + if (!eo_parent) return NULL; - } + Evas *evas = evas_object_evas_get(eo_parent); Evas_Object *eo = NULL; @@ -184,9 +184,8 @@ static int app_create(void *data) evas_object_show(win); result = _scmirroring_start_jobs((void *)NULL); - if (result != TRUE) { + if (result != TRUE) g_print("failed _scmirroring_start_jobs "); - } g_print("app_create leave"); @@ -358,21 +357,19 @@ static void __interpret_stream_info_submenu(char *cmd) int width, height; ret = scmirroring_sink_get_negotiated_video_resolution(g_scmirroring, &width, &height); - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) g_print("Error : scmirroring_sink_get_negotiated_video_resolution fail[%d]\n", ret); - } else { + else g_print("video resoltuion : width[%d], height[%d]\n", width, height); - } } else if (strncmp(cmd, "3", 1) == 0) { int frame_rate; ret = scmirroring_sink_get_negotiated_video_frame_rate(g_scmirroring, &frame_rate); - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) g_print("Error : scmirroring_sink_get_negotiated_video_frame_rate fail[%d]\n", ret); - } else { + else g_print("video frame rate[%d]\n", frame_rate); - } } else if (strncmp(cmd, "4", 1) == 0) { scmirroring_audio_codec_e codec; @@ -399,29 +396,26 @@ static void __interpret_stream_info_submenu(char *cmd) } else if (strncmp(cmd, "5", 1) == 0) { int channel; ret = scmirroring_sink_get_negotiated_audio_channel(g_scmirroring, &channel); - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) g_print("Error : scmirroring_sink_get_negotiated_audio_channel fail[%d]\n", ret); - } else { + else g_print("audio channel[%d]\n", channel); - } } else if (strncmp(cmd, "6", 1) == 0) { int sample_rate; ret = scmirroring_sink_get_negotiated_audio_sample_rate(g_scmirroring, &sample_rate); - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) g_print("Error : scmirroring_sink_get_negotiated_audio_sample_rate fail[%d]\n", ret); - } else { + else g_print("audio sample rate[%d]\n", sample_rate); - } } else if (strncmp(cmd, "7", 1) == 0) { int bitwidth; ret = scmirroring_sink_get_negotiated_audio_bitwidth(g_scmirroring, &bitwidth); - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) g_print("Error : scmirroring_sink_get_negotiated_audio_bitwidth fail[%d]\n", ret); - } else { + else g_print("audio bitwidth[%d]\n", bitwidth); - } } else if (strncmp(cmd, "g", 1) == 0) { g_print("go back to main menu\n"); @@ -512,12 +506,10 @@ static void scmirroring_sink_state_callback(scmirroring_error_e error_code, scmi g_print(" state[%d] SCMIRRORING_SINK_STATE_PAUSED\n", state); else if (state == SCMIRRORING_SINK_STATE_DISCONNECTED) { g_print(" state[%d] SCMIRRORING_SINK_STATE_DISCONNECTED\n", state); - if (scmirroring_sink_unprepare(g_scmirroring) != SCMIRRORING_ERROR_NONE) { + if (scmirroring_sink_unprepare(g_scmirroring) != SCMIRRORING_ERROR_NONE) g_print("scmirroring_sink_unprepare fail\n"); - } - if (scmirroring_sink_destroy(g_scmirroring) != SCMIRRORING_ERROR_NONE) { + if (scmirroring_sink_destroy(g_scmirroring) != SCMIRRORING_ERROR_NONE) g_print("scmirroring_sink_destroy fail\n"); - } __quit_program(); } else g_print(" state[%d] Invalid State", state); @@ -652,9 +644,8 @@ void _discover_cb(int error_code, wifi_direct_discovery_state_e discovery_state, case WIFI_DIRECT_DISCOVERY_FOUND: g_print("discovery_state : WIFI_DIRECT_DISCOVERY_FOUND \n"); ret = wifi_direct_foreach_discovered_peers(_discovered_peer_cb, (void *)NULL); - if (ret != WIFI_DIRECT_ERROR_NONE) { + if (ret != WIFI_DIRECT_ERROR_NONE) g_print("Error : wifi_direct_foreach_discovered_peers failed : %d\n", ret); - } break; case WIFI_DIRECT_DISCOVERY_FINISHED: g_print("discovery_state : WIFI_DIRECT_DISCOVERY_FINISHED \n"); @@ -682,13 +673,11 @@ void _ip_assigned_cb(const char *mac_address, const char *ip_address, const char g_print("Can not get port info\n Use default(2022)\n"); peer_port = DEFAULT_SCREEN_MIRRORING_PORT; } - if (wifi_direct_get_peer_info((char *)mac_address, &peer_info) != WIFI_DIRECT_ERROR_NONE) { + if (wifi_direct_get_peer_info((char *)mac_address, &peer_info) != WIFI_DIRECT_ERROR_NONE) g_print("Can not get peer info and device name\n"); - } - if (peer_info != NULL && peer_info->device_name != NULL) { + if (peer_info != NULL && peer_info->device_name != NULL) g_print("[_ip_assigned_cb] Connected to device_name [%s]\n", peer_info->device_name); - } g_print("[_ip_assigned_cb] Connected to IP [%s]\n", ip_address); g_print("[_ip_assigned_cb] Connected to Port [%d]\n", peer_port); @@ -715,9 +704,8 @@ void _connection_cb(int error_code, wifi_direct_connection_state_e connection_st { g_print("WIFI_DIRECT_CONNECTION_REQ : Connection is requested\n"); ret = wifi_direct_accept_connection((char *)mac_address); - if (ret != WIFI_DIRECT_ERROR_NONE) { - g_print("Error : wifi_direct_accept_connection failed : %d\n", ret); - } + if (ret != WIFI_DIRECT_ERROR_NONE) + g_print("Error : wifi_direct_accept_connection failed : %d\n", ret); break; } case WIFI_DIRECT_CONNECTION_WPS_REQ: @@ -731,9 +719,8 @@ void _connection_cb(int error_code, wifi_direct_connection_state_e connection_st bool is_go = FALSE; g_print("WIFI_DIRECT_CONNECTION_RSP : Connected\n"); ret = wifi_direct_is_group_owner(&is_go); - if (ret != WIFI_DIRECT_ERROR_NONE) { + if (ret != WIFI_DIRECT_ERROR_NONE) g_print("Error : wifi_direct_is_group_owner failed : %d\n", ret); - } if (is_go) { g_print("Connected as Group Owner\n"); @@ -847,9 +834,8 @@ static void __interpret(char *cmd) g_print("unknown menu \n"); } - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) g_print("Error Occured [%d]", ret); - } g_timeout_add(100, __timeout_menu_display, 0); @@ -1028,11 +1014,10 @@ static gboolean __start_p2p_connection(gpointer data) } else { g_print("wifi direct status >= WIFI_DIRECT_STATE_ACTIVATED.. Disconnect all first\n"); ret = wifi_direct_disconnect_all(); - if (!ret) { + if (!ret) g_print("wifi_direct_disconnect_all success\n"); - } else { + else g_print("wifi_direct_disconnect_all fail\n"); - } ret = __start_wifi_display_connection(); if (ret == TRUE) { @@ -1126,9 +1111,8 @@ gboolean __scmirroring_sink_start(gpointer data) if (g_resolution != 0) { ret = scmirroring_sink_set_resolution(g_scmirroring, g_resolution); - if (ret != SCMIRRORING_ERROR_NONE) { + if (ret != SCMIRRORING_ERROR_NONE) g_print("Failed to set resolution, error[%d]\n", ret); - } } if (g_sinktype != -1) {