From e1c85791e3871256b6426727f883be6c4fcb06e6 Mon Sep 17 00:00:00 2001 From: "giwoong.kim" Date: Mon, 10 Dec 2012 21:49:16 +0900 Subject: [PATCH] skin: indent the code indent the some lines & delete goto statement Signed-off-by: GiWoong Kim --- tizen/src/skin/maruskin_keymap.c | 13 ++-- tizen/src/skin/maruskin_operation.c | 35 ++++++---- tizen/src/skin/maruskin_server.c | 135 +++++++++++++++++++++++------------- 3 files changed, 113 insertions(+), 70 deletions(-) mode change 100644 => 100755 tizen/src/skin/maruskin_server.c diff --git a/tizen/src/skin/maruskin_keymap.c b/tizen/src/skin/maruskin_keymap.c index a01022f..ba9f1f3 100644 --- a/tizen/src/skin/maruskin_keymap.c +++ b/tizen/src/skin/maruskin_keymap.c @@ -88,20 +88,23 @@ int javakeycode_to_scancode( kbd_put_keycode(58); kbd_put_keycode(58 | 0x80); set_emul_caps_lock_state(get_emul_caps_lock_state() ^ 1); - INFO("qemu CapsLock state was synchronized with host key value (%d)\n", get_emul_caps_lock_state()); + INFO("qemu CapsLock state was synchronized with host key value (%d)\n", + get_emul_caps_lock_state()); } if (num_lock != -1 && get_emul_num_lock_state() != num_lock) { kbd_put_keycode(69); kbd_put_keycode(69 | 0x80); set_emul_num_lock_state(get_emul_num_lock_state() ^ 1); - INFO("qemu NumLock state was synchronized with host key value (%d)\n", get_emul_num_lock_state()); + INFO("qemu NumLock state was synchronized with host key value (%d)\n", + get_emul_num_lock_state()); } } - -/*#ifdef _WIN32 +#if 0 +#ifdef _WIN32 return MapVirtualKey(vk, MAPVK_VK_TO_VSC); -#endif*/ +#endif +#endif if (vk == 0) { //meta keys TRACE("meta key\n"); diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c index 27fc0da..04c50d7 100644 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -248,9 +248,10 @@ void do_key_event(int event_type, int keycode, int state_mask, int key_location) } } -void do_hardkey_event( int event_type, int keycode ) +void do_hardkey_event(int event_type, int keycode) { - INFO( "do_hardkey_event event_type:%d, keycode:%d\n", event_type, keycode ); + INFO("do_hardkey_event event_type:%d, keycode:%d\n", + event_type, keycode); if ( is_suspended_state() ) { if ( KEY_PRESSED == event_type ) { @@ -272,19 +273,21 @@ void do_hardkey_event( int event_type, int keycode ) mloop_evcmd_hwkey(event_type, keycode); } -void do_scale_event( double scale_factor ) +void do_scale_event(double scale_factor) { INFO("do_scale_event scale_factor:%lf\n", scale_factor); set_emul_win_scale(scale_factor); +#if 0 //TODO: thread safe //qemu refresh - //vga_hw_invalidate(); - //vga_hw_update(); + vga_hw_invalidate(); + vga_hw_update(); +#endif } -void do_rotation_event( int rotation_type) +void do_rotation_event(int rotation_type) { INFO( "do_rotation_event rotation_type:%d\n", rotation_type); @@ -315,8 +318,8 @@ void do_rotation_event( int rotation_type) } -QemuSurfaceInfo* get_screenshot_info( void ) { - +QemuSurfaceInfo* get_screenshot_info(void) +{ DisplaySurface* qemu_display_surface = get_qemu_display_surface(); if ( !qemu_display_surface ) { @@ -353,17 +356,19 @@ QemuSurfaceInfo* get_screenshot_info( void ) { } -void free_screenshot_info( QemuSurfaceInfo* info ) { - if( info ) { - if( info->pixel_data ) { - g_free( info->pixel_data ); +void free_screenshot_info(QemuSurfaceInfo* info) +{ + if (info) { + if(info->pixel_data) { + g_free(info->pixel_data); } - g_free( info ); + + g_free(info); } } -DetailInfo* get_detail_info( int qemu_argc, char** qemu_argv ) { - +DetailInfo* get_detail_info(int qemu_argc, char** qemu_argv) +{ DetailInfo* detail_info = g_malloc0( sizeof(DetailInfo) ); if ( !detail_info ) { ERR( "Fail to malloc for DetailInfo.\n" ); diff --git a/tizen/src/skin/maruskin_server.c b/tizen/src/skin/maruskin_server.c old mode 100644 new mode 100755 index f47cc6f..f5f1f42 --- a/tizen/src/skin/maruskin_server.c +++ b/tizen/src/skin/maruskin_server.c @@ -371,52 +371,63 @@ static void parse_skinconfig_prop(void) } -static void parse_skin_args( void ) { - +static void parse_skin_args(void) +{ int i; - for ( i = 0; i < skin_argc; i++ ) { + + for (i = 0; i < skin_argc; i++) { char* arg = NULL; - arg = strdup( skin_argv[i] ); + arg = strdup(skin_argv[i]); - if ( arg ) { + if (arg) { - char* key = strtok( arg, "=" ); - char* value = strtok( NULL, "=" ); + char* key = strtok(arg, "="); + char* value = strtok(NULL, "="); - INFO( "skin params key:%s, value:%s\n", key, value ); + INFO("skin params key:%s, value:%s\n", key, value); - if( 0 == strcmp( TEST_HB_IGNORE, key ) ) { - if( 0 == strcmp( "true", value ) ) { + if (0 == strcmp(TEST_HB_IGNORE, key)) { + if (0 == strcmp("true", value)) { ignore_heartbeat = 1; - }else if( 0 == strcmp( "false", value ) ) { + } else if (0 == strcmp("false", value)) { ignore_heartbeat = 0; } } - free( arg ); + free(arg); } else { - ERR( "fail to strdup." ); + ERR("fail to strdup."); } } } -static void* run_skin_server( void* args ) { +static void print_fail_log(void) +{ + ERR("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + ERR("! Fail to initialize for skin server operation. Shutdown QEMU !\n"); + ERR("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); +} +static void* run_skin_server(void* args) +{ struct sockaddr server_addr, client_addr; socklen_t server_len, client_len; - int shutdown_qmu = 0; + int shutdown_qemu = 0; INFO("run skin server\n"); - if ( 0 > ( server_sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ) ) { - ERR( "create listen socket error\n" ); - perror( "create listen socket error : " ); - shutdown_qmu = 1; - goto cleanup; + if (0 > (server_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP))) { + ERR("create listen socket error\n"); + perror("create listen socket error : "); + + print_fail_log(); + shutdown_qemu_gracefully(); + + return NULL; } memset( &server_addr, '\0', sizeof( server_addr ) ); @@ -426,36 +437,60 @@ static void* run_skin_server( void* args ) { server_len = sizeof( server_addr ); - if ( 0 != bind( server_sock, &server_addr, server_len ) ) { - ERR( "skin server bind error\n" ); - perror( "skin server bind error : " ); - shutdown_qmu = 1; - goto cleanup; + if (0 != bind(server_sock, &server_addr, server_len)) { + ERR("skin server bind error\n"); + perror("skin server bind error : "); + + if (server_sock) { +#ifdef CONFIG_WIN32 + closesocket(server_sock); +#else + close(server_sock); +#endif + server_sock = 0; + } + + print_fail_log(); + shutdown_qemu_gracefully(); + + return NULL; } memset( &server_addr, '\0', sizeof( server_addr ) ); getsockname( server_sock, (struct sockaddr *) &server_addr, &server_len ); svr_port = ntohs( ( (struct sockaddr_in *) &server_addr )->sin_port ); - INFO( "success to bind port[127.0.0.1:%d/tcp] for skin_server in host \n", svr_port ); + INFO("success to bind port[127.0.0.1:%d/tcp] for skin_server in host \n", svr_port); - if ( 0 > listen( server_sock, 4 ) ) { - ERR( "skin_server listen error\n" ); - perror( "skin_server listen error : " ); - shutdown_qmu = 1; - goto cleanup; + if (0 > listen( server_sock, 4)) { + ERR("skin_server listen error\n"); + perror("skin_server listen error : "); + + if (server_sock) { +#ifdef CONFIG_WIN32 + closesocket(server_sock); +#else + close(server_sock); +#endif + server_sock = 0; + } + + print_fail_log(); + shutdown_qemu_gracefully(); + + return NULL; } - client_len = sizeof( client_addr ); + client_len = sizeof(client_addr); char recvbuf[RECV_BUF_SIZE]; - INFO( "skin server start...port:%d\n", svr_port ); + INFO("skin server start...port:%d\n", svr_port); - while ( 1 ) { + while (1) { - if ( stop_server ) { - INFO( "close server socket normally.\n" ); + if (stop_server) { + INFO("close server socket normally.\n"); break; } @@ -464,7 +499,7 @@ static void* run_skin_server( void* args ) { if( !is_started_heartbeat ) { if ( !start_heart_beat() ) { ERR( "Fail to start heartbeat thread.\n" ); - shutdown_qmu = 1; + shutdown_qemu = 1; break; } } @@ -796,13 +831,15 @@ static void* run_skin_server( void* args ) { break; } case RECV_RESPONSE_HEART_BEAT: { - log_cnt += sprintf( log_buf + log_cnt, "RECV_RESPONSE_HEART_BEAT ==\n" ); -// TRACE( log_buf ); - TRACE( "recv HB req_id:%d\n", req_id ); + log_cnt += sprintf(log_buf + log_cnt, "RECV_RESPONSE_HEART_BEAT ==\n"); +#if 0 + TRACE(log_buf); +#endif + TRACE("recv HB req_id:%d\n", req_id); - pthread_mutex_lock( &mutex_recv_heartbeat_count ); + pthread_mutex_lock(&mutex_recv_heartbeat_count); recv_heartbeat_count = 0; - pthread_mutex_unlock( &mutex_recv_heartbeat_count ); + pthread_mutex_unlock(&mutex_recv_heartbeat_count); break; } @@ -860,20 +897,18 @@ static void* run_skin_server( void* args ) { stop_heart_beat(); -cleanup: - if ( server_sock ) { + /* clean up */ + if (server_sock) { #ifdef CONFIG_WIN32 - closesocket( server_sock ); + closesocket(server_sock); #else - close( server_sock ); + close(server_sock); #endif server_sock = 0; } - if( shutdown_qmu ) { - ERR( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" ); - ERR( "!!! Fail to initialize for skin server operation. Shutdown QEMU !!!\n" ); - ERR( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" ); + if (shutdown_qemu) { + print_fail_log(); shutdown_qemu_gracefully(); } -- 2.7.4