adapt tizen coding rule 54/71754/1 accepted/tizen/common/20160606.141635 submit/tizen/20160603.013854
authorJunkyeong Kim <jk0430.kim@samsung.com>
Fri, 27 May 2016 04:25:47 +0000 (13:25 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Fri, 27 May 2016 04:25:51 +0000 (13:25 +0900)
Change-Id: Ic09b99f59722c0b04392decec2c6c230b6d285dc
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/tbm_drm_helper_client.c
src/tbm_drm_helper_server.c
src/tbm_surface_internal.c

index aaf096d..ac86115 100644 (file)
@@ -64,7 +64,7 @@ handle_tbm_drm_authentication_info(void *data, struct wl_tbm_drm_auth *wl_tbm_dr
 }
 
 static const struct wl_tbm_drm_auth_listener wl_tbm_drm_auth_client_listener = {
-    handle_tbm_drm_authentication_info
+       handle_tbm_drm_authentication_info
 };
 
 static void
@@ -81,8 +81,8 @@ _wayland_tbm_drm_auth_client_registry_handle_global(void *data, struct wl_regist
 }
 
 static const struct wl_registry_listener registry_listener = {
-    _wayland_tbm_drm_auth_client_registry_handle_global,
-    NULL
+       _wayland_tbm_drm_auth_client_registry_handle_global,
+       NULL
 };
 
 int
@@ -170,4 +170,5 @@ tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities
 
        return 1;
 }
-/* LCOV_EXCL_STOP */
\ No newline at end of file
+/* LCOV_EXCL_STOP */
+
index 1c0395b..568f0e9 100644 (file)
@@ -54,7 +54,7 @@ struct wayland_tbm_drm_auth_server {
        uint32_t flags;
 };
 
-#define MIN(x,y) (((x)<(y))?(x):(y))
+#define MIN(x, y) (((x) < (y)) ? (x) : (y))
 
 struct wayland_tbm_drm_auth_server *tbm_drm_auth_srv;
 
@@ -164,7 +164,7 @@ tbm_drm_helper_wl_auth_server_init(void *wl_display,   int fd, const char *devic
                tbm_drm_auth_srv->fd = fd;
                tbm_drm_auth_srv->flags = flags;
 
-               if(wl_display_add_socket(tbm_drm_auth_srv->display, "tbm-drm-auth")) {
+               if (wl_display_add_socket(tbm_drm_auth_srv->display, "tbm-drm-auth")) {
                        TBM_LOG_E("[TBM_DRM] fail to add socket\n");
 
                        if (tbm_drm_auth_srv->device_name)
@@ -201,67 +201,66 @@ tbm_drm_helper_wl_auth_server_deinit(void)
 int
 tbm_drm_helper_get_master_fd(void)
 {
-    const char *value;
-    int ret, flags, fd = -1;
-    int new_fd = -1;
+       const char *value;
+       int ret, flags, fd = -1;
+       int new_fd = -1;
 
-    value = (const char*)getenv("TDM_DRM_MASTER_FD");
-    if (!value)
-        return -1;
+       value = (const char*)getenv("TDM_DRM_MASTER_FD");
+       if (!value)
+               return -1;
 
-    ret = sscanf(value, "%d", &fd);
-    if (ret <= 0)
-        return -1;
+       ret = sscanf(value, "%d", &fd);
+       if (ret <= 0)
+               return -1;
 
-    TBM_LOG_I("TDM_DRM_MASTER_FD: %d\n", fd);
+       TBM_LOG_I("TDM_DRM_MASTER_FD: %d\n", fd);
 
-    flags = fcntl(fd, F_GETFD);
-    if (flags == -1) {
-        TBM_LOG_E("fcntl failed: %m");
-        return -1;
-    }
+       flags = fcntl(fd, F_GETFD);
+       if (flags == -1) {
+               TBM_LOG_E("fcntl failed: %m");
+               return -1;
+       }
 
-    new_fd = dup(fd);
-    if (new_fd < 0) {
-        TBM_LOG_E("dup failed: %m");
-        return -1;
-    }
+       new_fd = dup(fd);
+       if (new_fd < 0) {
+               TBM_LOG_E("dup failed: %m");
+               return -1;
+       }
 
-    fcntl(new_fd, F_SETFD, flags|FD_CLOEXEC);
+       fcntl(new_fd, F_SETFD, flags|FD_CLOEXEC);
 
-    TBM_LOG_I("Return MASTER_FD: %d\n", new_fd);
+       TBM_LOG_I("Return MASTER_FD: %d\n", new_fd);
 
-    return new_fd;
+       return new_fd;
 }
 
 void
 tbm_drm_helper_set_tbm_master_fd(int fd)
 {
-    char buf[32];
-    int ret;
+       char buf[32];
+       int ret;
 
-    snprintf(buf, sizeof(buf), "%d", fd);
+       snprintf(buf, sizeof(buf), "%d", fd);
 
-    ret = setenv("TBM_DRM_MASTER_FD", (const char*)buf, 1);
-    if (ret)
-    {
-        TBM_LOG_E("failed to set TIZEN_DRM_MASTER_FD to %d", fd);
-        return;
-    }
+       ret = setenv("TBM_DRM_MASTER_FD", (const char*)buf, 1);
+       if (ret) {
+               TBM_LOG_E("failed to set TIZEN_DRM_MASTER_FD to %d", fd);
+               return;
+       }
 
-    TBM_LOG_I("TBM_DRM_MASTER_FD: %d\n", fd);
+       TBM_LOG_I("TBM_DRM_MASTER_FD: %d\n", fd);
 }
 
 void
 tbm_drm_helper_unset_tbm_master_fd(void)
 {
-    int ret;
-
-    ret = unsetenv("TBM_DRM_MASTER_FD");
-    if (ret)
-    {
-        TBM_LOG_E("failed to unset TBM_DRM_MASTER_FD");
-        return;
-    }
+       int ret;
+
+       ret = unsetenv("TBM_DRM_MASTER_FD");
+       if (ret) {
+               TBM_LOG_E("failed to unset TBM_DRM_MASTER_FD");
+               return;
+       }
 }
-/* LCOV_EXCL_STOP */
\ No newline at end of file
+/* LCOV_EXCL_STOP */
+
index 7c678e5..f66648d 100644 (file)
@@ -36,11 +36,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "list.h"
 #include <png.h>
 
-#define C(b,m)              (((b) >> (m)) & 0xFF)
-#define B(c,s)              ((((unsigned int)(c)) & 0xff) << (s))
-#define FOURCC(a,b,c,d)     (B(d,24) | B(c,16) | B(b,8) | B(a,0))
-#define FOURCC_STR(id)      C(id,0), C(id,8), C(id,16), C(id,24)
-#define FOURCC_ID(str)      FOURCC(((char*)str)[0],((char*)str)[1],((char*)str)[2],((char*)str)[3])
+#define C(b, m)              (((b) >> (m)) & 0xFF)
+#define B(c, s)              ((((unsigned int)(c)) & 0xff) << (s))
+#define FOURCC(a, b, c, d)     (B(d, 24) | B(c, 16) | B(b, 8) | B(a, 0))
+#define FOURCC_STR(id)      C(id, 0), C(id, 8), C(id, 16), C(id, 24)
+#define FOURCC_ID(str)      FOURCC(((char*)str)[0], ((char*)str)[1], ((char*)str)[2], ((char*)str)[3])
 
 static tbm_bufmgr g_surface_bufmgr;
 static pthread_mutex_t tbm_surface_lock;
@@ -584,7 +584,7 @@ tbm_surface_internal_create_with_flags(int width, int height,
 
                        pthread_mutex_lock(&surf->bufmgr->lock);
 
-                       bo_priv = mgr->backend->surface_bo_alloc (bo, width, height, format, flags, i);
+                       bo_priv = mgr->backend->surface_bo_alloc(bo, width, height, format, flags, i);
                        if (!bo_priv) {
                                TBM_LOG_E("fail to alloc bo priv\n");
                                free(bo);
@@ -1141,8 +1141,7 @@ tbm_surface_internal_set_debug_pid(tbm_surface_h surface, unsigned int pid)
 typedef struct _tbm_surface_dump_info tbm_surface_dump_info;
 typedef struct _tbm_surface_dump_buf_info tbm_surface_dump_buf_info;
 
-struct _tbm_surface_dump_buf_info
-{
+struct _tbm_surface_dump_buf_info {
        int index;
        tbm_bo bo;
        int size;
@@ -1157,8 +1156,7 @@ struct _tbm_surface_dump_buf_info
        struct list_head link;
 };
 
-struct _tbm_surface_dump_info
-{
+struct _tbm_surface_dump_info {
        char *path;  // copy???
        int dump_max;
        int count;
@@ -1171,7 +1169,7 @@ static const char *dump_postfix[2] = {"png", "yuv"};
 
 static void
 _tbm_surface_internal_dump_file_raw(const char *file, void *data1, int size1, void *data2,
-                     int size2, void *data3, int size3)
+               int size2, void *data3, int size3)
 {
        unsigned int *blocks;
        FILE *fp = fopen(file, "w+");
@@ -1195,14 +1193,14 @@ _tbm_surface_internal_dump_file_raw(const char *file, void *data1, int size1, vo
 
 static void
 _tbm_surface_internal_dump_file_png(const char *file, const void *data, int width,
-                     int height)
+               int height)
 {
        FILE *fp = fopen(file, "wb");
        TBM_RETURN_IF_FAIL(fp != NULL);
        int depth = 8;
 
        png_structp pPngStruct =
-               png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+               png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
        if (!pPngStruct) {
                fclose(fp);
                return;
@@ -1217,13 +1215,13 @@ _tbm_surface_internal_dump_file_png(const char *file, const void *data, int widt
 
        png_init_io(pPngStruct, fp);
        png_set_IHDR(pPngStruct,
-                    pPngInfo,
-                    width,
-                    height,
-                    depth,
-                    PNG_COLOR_TYPE_RGBA,
-                    PNG_INTERLACE_NONE,
-                    PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+                       pPngInfo,
+                       width,
+                       height,
+                       depth,
+                       PNG_COLOR_TYPE_RGBA,
+                       PNG_INTERLACE_NONE,
+                       PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
 
        png_set_bgr(pPngStruct);
        png_write_info(pPngStruct, pPngInfo);
@@ -1238,7 +1236,7 @@ _tbm_surface_internal_dump_file_png(const char *file, const void *data, int widt
 
        for (; y < height; ++y) {
                png_bytep row =
-                       png_malloc(pPngStruct, sizeof(png_byte) * width * pixel_size);
+                       png_malloc(pPngStruct, sizeof(png_byte) * width * pixel_size);
                row_pointers[y] = (png_bytep)row;
                for (x = 0; x < width; ++x) {
                        unsigned int curBlock = blocks[y * width + x];
@@ -1284,7 +1282,7 @@ tbm_surface_internal_dump_start(char *path, int w, int h, int count)
                return;
        }
 
-       g_dump_info = calloc(1, sizeof (struct _tbm_surface_dump_info));
+       g_dump_info = calloc(1, sizeof(struct _tbm_surface_dump_info));
        TBM_RETURN_IF_FAIL(g_dump_info);
 
        LIST_INITHEAD(&g_dump_info->surface_list);