From 3b553d2a4ed167a72ee26c523178ebb50a6eee96 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Sun, 25 Sep 2016 18:51:12 +0900 Subject: [PATCH] obey the coding rule Change-Id: Idbf678141871dc9fabc0389fa1f6a7847599800b --- src/tbm_surface_queue.c | 4 ++-- ut/src/stubs.h | 29 +++++++++++------------------ ut/src/ut_tbm_bufmgr.h | 6 +++--- ut/stubs/pthread_stubs.h | 3 +-- ut/stubs/tbm_bufmgr_stubs.h | 31 +++++++++++-------------------- 5 files changed, 28 insertions(+), 45 deletions(-) diff --git a/src/tbm_surface_queue.c b/src/tbm_surface_queue.c index feddb94..aef924c 100644 --- a/src/tbm_surface_queue.c +++ b/src/tbm_surface_queue.c @@ -823,7 +823,7 @@ tbm_surface_queue_can_dequeue(tbm_surface_queue_h surface_queue, int wait) if (_queue_is_empty(&surface_queue->free_queue)) { if (wait && - _tbm_surface_queue_get_node_count(surface_queue,QUEUE_NODE_TYPE_ACQUIRE)) { + _tbm_surface_queue_get_node_count(surface_queue, QUEUE_NODE_TYPE_ACQUIRE)) { pthread_cond_wait(&surface_queue->free_cond, &surface_queue->lock); pthread_mutex_unlock(&surface_queue->lock); @@ -939,7 +939,7 @@ tbm_surface_queue_can_acquire(tbm_surface_queue_h surface_queue, int wait) if (_queue_is_empty(&surface_queue->dirty_queue)) { if (wait && - _tbm_surface_queue_get_node_count(surface_queue,QUEUE_NODE_TYPE_DEQUEUE)) { + _tbm_surface_queue_get_node_count(surface_queue, QUEUE_NODE_TYPE_DEQUEUE)) { if (!_queue_has_node_type(surface_queue, QUEUE_NODE_TYPE_DEQUEUE)) { TBM_LOG_E("Deosn't have dequeue type node\n"); diff --git a/ut/src/stubs.h b/ut/src/stubs.h index 3b15f7e..15d59c4 100644 --- a/ut/src/stubs.h +++ b/ut/src/stubs.h @@ -52,30 +52,25 @@ int ut_fclose(FILE *stream) FILE *ut_fopen(const char *filename, const char *mode) { - if (!filename || !mode) { + if (!filename || !mode) return NULL; - } - if (!strcmp(filename, "/proc/111/cmdline")) { + if (!strcmp(filename, "/proc/111/cmdline")) return NULL; - } - if (!strcmp(filename, "/proc/222/cmdline")) { + if (!strcmp(filename, "/proc/222/cmdline")) return &g_error_file; - } return &g_file; } char *ut_fgets(char *str, int num, FILE *stream) { - if (!str || num < 1 || !stream) { + if (!str || num < 1 || !stream) return NULL; - } - if (stream == &g_error_file) { + if (stream == &g_error_file) return NULL; - } strncpy(str, "application", 255); @@ -89,25 +84,24 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex) int dup2(int old_handle, int new_handle) { - if (old_handle == new_handle) { + if (old_handle == new_handle) return -1; - } + return 0; } int dup(int handle) { - if (1 == handle) { + if (1 == handle) return -1; - } + return 0; } int ioctl(int fd, unsigned long int request, ...) { - if (IOCTL_FD_ERROR == fd) { + if (IOCTL_FD_ERROR == fd) return 1; - } if (IOCTL_FD_GET == fd) { va_list argList; @@ -123,9 +117,8 @@ int ioctl(int fd, unsigned long int request, ...) void *ut_calloc(size_t nmemb, size_t size) { - if (CALLOC_ERROR) { + if (CALLOC_ERROR) return NULL; - } return calloc(nmemb, size); } diff --git a/ut/src/ut_tbm_bufmgr.h b/ut/src/ut_tbm_bufmgr.h index beafcf2..e410681 100644 --- a/ut/src/ut_tbm_bufmgr.h +++ b/ut/src/ut_tbm_bufmgr.h @@ -42,11 +42,11 @@ public: tbm_bo_handle() {} tbm_bo_handle(const uint64_t v) { - if (v == 0) { + if (v == 0) ptr = NULL; - } else { + else ptr = &u64; - } + s32 = v; u32 = v; s64 = v; diff --git a/ut/stubs/pthread_stubs.h b/ut/stubs/pthread_stubs.h index 2256a4d..3767162 100644 --- a/ut/stubs/pthread_stubs.h +++ b/ut/stubs/pthread_stubs.h @@ -41,9 +41,8 @@ static int ut_pthread_mutex_unlock(pthread_mutex_t * __mutex) {} static int ut_pthread_mutex_init(pthread_mutex_t * __mutex, const pthread_mutexattr_t * __mutexattr) { - if (PTHREAD_MUTEX_INIT_ERROR) { + if (PTHREAD_MUTEX_INIT_ERROR) return PTHREAD_MUTEX_INIT_ERROR; - } return 0; } diff --git a/ut/stubs/tbm_bufmgr_stubs.h b/ut/stubs/tbm_bufmgr_stubs.h index 30d4cc9..4c1012e 100644 --- a/ut/stubs/tbm_bufmgr_stubs.h +++ b/ut/stubs/tbm_bufmgr_stubs.h @@ -53,18 +53,16 @@ static int ut_bo2_size(tbm_bo bo) static void *ut_bo_alloc(tbm_bo bo, int size, int flags) { - if (TBM_BO_ALLOC_ERROR) { + if (TBM_BO_ALLOC_ERROR) return NULL; - } return ret_bo; } static void *ut_bo_import(tbm_bo bo, unsigned int key) { - if (TBM_BO_IMPORT_ERROR) { + if (TBM_BO_IMPORT_ERROR) return NULL; - } return ret_bo; } @@ -76,27 +74,24 @@ static int ut_bo_get_flags(tbm_bo bo) static void *ut_bo_import_fd(tbm_bo bo, tbm_fd fd) { - if (TBM_BO_IMPORT_ERROR) { + if (TBM_BO_IMPORT_ERROR) return NULL; - } return ret_bo; } static unsigned int ut_bo_export(tbm_bo bo) { - if (UT_TBM_ERROR) { + if (UT_TBM_ERROR) return 0; - } return 1; } static tbm_fd ut_bo_export_fd(tbm_bo bo) { - if (UT_TBM_ERROR) { + if (UT_TBM_ERROR) return -1; - } return 1; } @@ -105,11 +100,10 @@ static tbm_bo_handle ut_bo_get_handle(tbm_bo bo, int device) { tbm_bo_handle ret; - if (UT_TBM_ERROR) { + if (UT_TBM_ERROR) ret.ptr = NULL; - } else { + else ret.ptr = (void *)12; - } return ret; } @@ -118,20 +112,18 @@ static tbm_bo_handle ut_bo_map(tbm_bo bo, int device, int opt) { tbm_bo_handle ret; - if (UT_TBM_ERROR) { + if (UT_TBM_ERROR) ret.ptr = NULL; - } else { + else ret.ptr = (void *)12; - } return ret; } static int ut_bo_unmap(tbm_bo bo) { - if (UT_TBM_ERROR) { + if (UT_TBM_ERROR) return 0; - } return 1; } @@ -140,9 +132,8 @@ static void ut_tbm_data_free(void *user_data) {} static int ut_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *NativeDisplay) { - if (UT_TBM_ERROR) { + if (UT_TBM_ERROR) return 0; - } return 1; } -- 2.7.4