Apply tizen coding rule 86/49586/3
authorHaejeong, Kim <backto.kim@samsung.com>
Thu, 15 Oct 2015 08:59:14 +0000 (17:59 +0900)
committerHaejeong, Kim <backto.kim@samsung.com>
Fri, 16 Oct 2015 00:22:54 +0000 (09:22 +0900)
Change-Id: Id3e53ece459151791f678fbbd230bf7f824afa18

14 files changed:
packaging/libmedia-thumbnail.spec
server/thumb-server-dcm.c
server/thumb-server-internal.c
server/thumb-server.c
src/codec/IfegDecodeAGIF.c
src/codec/img-codec-parser.c
src/codec/img-codec.c
src/include/util/media-thumb-debug.h
src/include/util/media-thumb-util.h
src/ipc/media-thumb-ipc.c
src/media-thumb-internal.c
src/media-thumbnail.c
src/util/media-thumb-db.c
test/test-thumb.c

index 913a4c4..e6a25a9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmedia-thumbnail
 Summary:    Media thumbnail service library for multimedia applications
-Version: 0.1.85
+Version: 0.1.86
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 27b274d..8554ed4 100755 (executable)
 
 #ifdef _SUPPORT_DCM
 #define dcm_retvm_if(expr, val, fmt, arg...) do { \
-       if(expr) { \
+       if (expr) { \
                thumb_err(fmt, ##arg); \
                thumb_err("(%s) -> %s() return", #expr, __FUNCTION__); \
                return (val); \
        } \
 } while (0)
 
-#define DCM_CHECK_VAL(expr, val)               dcm_retvm_if(!(expr), val, "Invalid parameter, return ERROR code!")
+#define DCM_CHECK_VAL(expr, val)               dcm_retvm_if(!(expr), val, "Invalid parameter, return ERROR code!")
 
 #define DCM_SVC_NAME "dcm-svc"
 #define DCM_SVC_EXEC_NAME "/usr/bin/dcm-svc"
@@ -57,10 +57,10 @@ static bool b_dcm_svc_launched;
 static int g_dcm_timer_id = 0;
 static int g_dcm_server_pid = 0;
 
-static char DCM_IPC_PATH[3][100] =
-                       {"/var/run/media-server/media_ipc_thumbdcm_dcmrecv",
-                        "/var/run/media-server/media_ipc_thumbdcm_thumbrecv",
-                        "/var/run/media-server/dcm_ipc_thumbserver_comm_recv"};
+static char DCM_IPC_PATH[3][100] = {
+                       "/var/run/media-server/media_ipc_thumbdcm_dcmrecv",
+                       "/var/run/media-server/media_ipc_thumbdcm_thumbrecv",
+                       "/var/run/media-server/dcm_ipc_thumbserver_comm_recv"};
 
 static gboolean g_folk_dcm_server = FALSE;
 static gboolean g_dcm_server_extracting = FALSE;
@@ -106,8 +106,8 @@ void __thumb_server_dcm_create_timer(int id)
                g_source_destroy(g_main_context_find_source_by_id(g_main_context_get_thread_default(), id));
 
        GSource *timer_src = g_timeout_source_new_seconds(MS_TIMEOUT_SEC_20);
-       g_source_set_callback (timer_src, __thumb_server_dcm_agent_timer, NULL, NULL);
-       g_dcm_timer_id = g_source_attach (timer_src, g_main_context_get_thread_default());
+       g_source_set_callback(timer_src, __thumb_server_dcm_agent_timer, NULL, NULL);
+       g_dcm_timer_id = g_source_attach(timer_src, g_main_context_get_thread_default());
 
 }
 
@@ -155,8 +155,7 @@ bool __thumb_server_dcm_check_process()
                if (result == NULL)
                        break;
 
-               if (pinfo.d_type != 4 || pinfo.d_name[0] == '.'
-                   || pinfo.d_name[0] > 57)
+               if (pinfo.d_type != 4 || pinfo.d_name[0] == '.' || pinfo.d_name[0] > 57)
                        continue;
 
                FILE *fp;
@@ -210,7 +209,7 @@ bool __thumb_server_dcm_check_process()
 
        if (!(recv_msg.msg_type >= 0 && recv_msg.msg_type < THUMB_SERVER_DCM_MSG_MAX)) {
                thumb_err("IPC message is wrong!");
-               return  MEDIA_THUMB_ERROR_NETWORK;
+               return MEDIA_THUMB_ERROR_NETWORK;
        }
 
        if (recv_msg.msg_type == THUMB_SERVER_DCM_MSG_SERVER_READY) {
@@ -267,7 +266,7 @@ static int __thumb_server_dcm_process_recv_msg(thumb_server_dcm_ipc_msg_s *recv_
        }
 
        if (g_folk_dcm_server == FALSE && g_dcm_server_extracting == FALSE) {
-               if(__thumb_server_dcm_check_process() == FALSE) {  // dcm-svc is running?
+               if (__thumb_server_dcm_check_process() == FALSE) { // dcm-svc is running?
                        thumb_warn("Dcm-svc server is not running.. so start it");
                        memcpy(&last_msg, recv_msg, sizeof(thumb_server_dcm_ipc_msg_s));
                        if (!__thumb_server_dcm_agent_execute_server()) {
@@ -340,7 +339,7 @@ static int __thumb_server_dcm_receive_tcp_msg(int client_sock, thumb_server_dcm_
 
        if (!(recv_msg->msg_type >= 0 && recv_msg->msg_type < THUMB_SERVER_DCM_MSG_MAX)) {
                thumb_err("IPC message is wrong!");
-               return  MS_MEDIA_ERR_SOCKET_RECEIVE;
+               return MS_MEDIA_ERR_SOCKET_RECEIVE;
        }
 
        return MS_MEDIA_ERR_NONE;
@@ -355,11 +354,11 @@ static int __thumb_server_dcm_accept_tcp_socket(int serv_sock, int* client_sock)
 
        if ((sockfd = accept(serv_sock, (struct sockaddr*)&client_addr, &client_addr_len)) < 0) {
                thumb_err("accept failed : %s", strerror(errno));
-               *client_sock  = -1;
+               *client_sock = -1;
                return MS_MEDIA_ERR_SOCKET_ACCEPT;
        }
 
-       *client_sock  = sockfd;
+       *client_sock = sockfd;
 
        return MS_MEDIA_ERR_NONE;
 }
@@ -429,12 +428,12 @@ static int __thumb_server_dcm_create_socket(int *socket_fd, thumb_server_dcm_por
        strcpy(serv_addr.sun_path, DCM_IPC_PATH[port]);
 
        /* Bind socket to local address */
-       for (i = 0; i < 20; i ++) {
+       for (i = 0; i < 20; i++) {
                if (bind(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) == 0) {
                        bind_success = true;
                        break;
                }
-               thumb_dbg("#%d bind",i);
+               thumb_dbg("#%d bind", i);
                usleep(250000);
        }
 
@@ -472,7 +471,7 @@ gboolean _thumb_server_dcm_thread(void *data)
        GMainContext *context = NULL;
        int err = 0;
 
-       thumb_err( "_thumb_server_dcm_thread!S");
+       thumb_err("_thumb_server_dcm_thread!S");
 
 
        /* Create TCP Socket to receive message from thumb server main thread */
@@ -504,7 +503,7 @@ gboolean _thumb_server_dcm_thread(void *data)
        b_dcm_svc_launched = false;
 
        thumb_dbg("********************************************");
-       thumb_dbg("*** Thumb Server DCM thread is running   ***");
+       thumb_dbg("*** Thumb Server DCM thread is running ***");
        thumb_dbg("********************************************");
 
        /* Start to run main event loop for dcm thread */
@@ -513,7 +512,7 @@ gboolean _thumb_server_dcm_thread(void *data)
        thumb_dbg("*** Thumb Server DCM thread will be closed ***");
 
        /* Destroy IO channel */
-       g_io_channel_shutdown(channel,  FALSE, NULL);
+       g_io_channel_shutdown(channel, FALSE, NULL);
        g_io_channel_unref(channel);
 
        /* Close the TCP socket */
@@ -532,7 +531,7 @@ int _thumb_server_dcm_send_msg(thumb_server_dcm_ipc_msg_type_e msg_type, uid_t u
                return MS_MEDIA_ERR_SOCKET_SEND;
        }
 
-       thumb_err( "_thumb_server_dcm_send_msg to %d ", port);
+       thumb_err("_thumb_server_dcm_send_msg to %d", port);
 
        int socket_fd = -1;
        struct sockaddr_un serv_addr;
index 88b6190..eaf1745 100755 (executable)
@@ -247,7 +247,7 @@ static int __thumb_daemon_all_extract(uid_t uid)
                return MS_MEDIA_ERR_INTERNAL;
        }
 
-       while(1) {
+       while (1) {
                err = sqlite3_step(sqlite_stmt);
                if (err != SQLITE_ROW) {
                        thumb_dbg("end of row [%s]", sqlite3_errmsg(sqlite_db_handle));
@@ -296,7 +296,7 @@ int _thumb_daemon_process_queue_jobs(gpointer data)
                strncpy(recv_msg.org_path, path, sizeof(recv_msg.org_path));
                recv_msg.org_path[sizeof(recv_msg.org_path) - 1] = '\0';
 
-               err = _thumb_daemon_process_job(&recv_msg, &res_msg,uid );
+               err = _thumb_daemon_process_job(&recv_msg, &res_msg, uid);
                if (err == MS_MEDIA_ERR_FILE_NOT_EXIST) {
                        thumb_err("Thumbnail processing is failed : %d", err);
                } else {
@@ -370,7 +370,7 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
        }
 
        if (ms_cynara_receive_untrusted_message_thumb(client_sock, &recv_msg, &credentials) != MS_MEDIA_ERR_NONE) {
-               thumb_err("ms_cynara_receive_untrusted_message_thumb failed");  
+               thumb_err("ms_cynara_receive_untrusted_message_thumb failed");
                close(client_sock);
                return FALSE;
        }
@@ -380,9 +380,9 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
                _thumb_server_send_deny_message(client_sock);
                close(client_sock);
                return TRUE;
-       }
+       }
 
-       if(recv_msg.msg_type != THUMB_REQUEST_KILL_SERVER) {
+       if (recv_msg.msg_type != THUMB_REQUEST_KILL_SERVER) {
                if (ms_cynara_check(&credentials, MEDIA_STORAGE_PRIVILEGE) != MS_MEDIA_ERR_NONE) {
                        thumb_err("Cynara denied access to process request");
                        _thumb_server_send_deny_message(client_sock);
@@ -400,17 +400,17 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
                thumb_dbg("All thumbnails are being extracted now");
                __thumb_daemon_all_extract(recv_msg.uid);
                g_idle_add(_thumb_daemon_process_queue_jobs, NULL);
-               
+
 #ifdef _SUPPORT_DCM
                /* Send msg to dcm thread to scan all images */
                _thumb_server_dcm_send_msg(THUMB_SERVER_DCM_MSG_SCAN_ALL, recv_msg.uid, NULL, THUMB_SERVER_DCM_PORT_DCM_RECV);
 #endif /* _SUPPORT_DCM */
-       } else if(recv_msg.msg_type == THUMB_REQUEST_RAW_DATA) {
+       } else if (recv_msg.msg_type == THUMB_REQUEST_RAW_DATA) {
                __thumb_daemon_process_job_raw(&recv_msg, &res_msg);
-       } else if(recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
+       } else if (recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
                thumb_warn("received KILL msg from thumbnail agent.");
        } else {
-               _thumb_daemon_process_job(&recv_msg, &res_msg,recv_msg.uid);
+               _thumb_daemon_process_job(&recv_msg, &res_msg, recv_msg.uid);
 
 #ifdef _SUPPORT_DCM
                /* Send msg to dcm thread to scan a single image */
@@ -418,12 +418,12 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
 #endif /* _SUPPORT_DCM */
        }
 
-       if(res_msg.msg_type == 0)
+       if (res_msg.msg_type == 0)
                res_msg.msg_type = recv_msg.msg_type;
        res_msg.request_id = recv_msg.request_id;
        strncpy(res_msg.org_path, recv_msg.org_path, recv_msg.origin_path_size);
        res_msg.origin_path_size = recv_msg.origin_path_size;
-       if(res_msg.msg_type != THUMB_RESPONSE_RAW_DATA) {
+       if (res_msg.msg_type != THUMB_RESPONSE_RAW_DATA) {
                res_msg.dest_path_size = strlen(res_msg.dst_path)+1;
                res_msg.thumb_size = 0;
        } else {
@@ -437,8 +437,8 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
        unsigned char *buf = NULL;
        _media_thumb_set_buffer(&res_msg, &buf, &buf_size);
 
-       while(buf_size > 0) {
-               if(buf_size < THUMB_BLOCK_SIZE) {
+       while (buf_size > 0) {
+               if (buf_size < THUMB_BLOCK_SIZE) {
                        block_size = buf_size;
                }
                if (send(client_sock, buf+sending_block, block_size, 0) != block_size) {
@@ -446,16 +446,16 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
                }
                sending_block += block_size;
                buf_size -= block_size;
-               if(block_size < THUMB_BLOCK_SIZE) {
+               if (block_size < THUMB_BLOCK_SIZE) {
                        block_size = THUMB_BLOCK_SIZE;
                }
        }
-       if(buf_size == 0) {
+       if (buf_size == 0) {
                thumb_dbg_slog("Sent data(%d) from %s", res_msg.thumb_size, res_msg.org_path);
        }
        SAFE_FREE(buf);
 
-       if(recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
+       if (recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
                thumb_warn("Shutting down...");
 #ifdef _SUPPORT_DCM
                /* Quit dcm thread main loop */
@@ -508,7 +508,7 @@ static gboolean __thumb_server_send_msg_to_agent(int msg_type)
 
        ms_ipc_delete_client_socket(&sock_info);
 
-       return TRUE;
+       return TRUE;
 }
 
 static gboolean _thumb_server_send_deny_message(int sockfd)
@@ -558,26 +558,23 @@ static char* _media_thumb_get_default_path(uid_t uid)
 {
        char *result_psswd = NULL;
        struct group *grpinfo = NULL;
-       if(uid == getuid())
-       {
+       if (uid == getuid()) {
                result_psswd = strdup(THUMB_DEFAULT_PATH);
                grpinfo = getgrnam("users");
-               if(grpinfo == NULL) {
+               if (grpinfo == NULL) {
                        thumb_err("getgrnam(users) returns NULL !");
-                       if(result_psswd)
+                       if (result_psswd)
                                free(result_psswd);
                        return NULL;
                }
-       }
-       else
-       {
+       } else {
                struct passwd *userinfo = getpwuid(uid);
-               if(userinfo == NULL) {
+               if (userinfo == NULL) {
                        thumb_err("getpwuid(%d) returns NULL !", uid);
                        return NULL;
                }
                grpinfo = getgrnam("users");
-               if(grpinfo == NULL) {
+               if (grpinfo == NULL) {
                        thumb_err("getgrnam(users) returns NULL !");
                        return NULL;
                }
@@ -632,7 +629,7 @@ int _thumbnail_get_data(const char *origin_path,
        file_type = _media_thumb_get_file_type(origin_path);
        thumb_width = *width;
        thumb_height = *height;
-       if(thumb_width == 0) {
+       if (thumb_width == 0) {
                thumb_width = THUMB_DEFAULT_WIDTH;
                thumb_height = THUMB_DEFAULT_HEIGHT;
        }
@@ -661,7 +658,7 @@ int _thumbnail_get_data(const char *origin_path,
        if (origin_width) *origin_width = thumb_info.origin_width;
        if (origin_height) *origin_height = thumb_info.origin_height;
        if (alpha) *alpha = thumb_info.alpha;
-       if (is_saved) *is_saved= thumb_info.is_saved;
+       if (is_saved) *is_saved = thumb_info.is_saved;
 
        thumb_dbg("Thumb data is generated successfully (Size:%d, W:%d, H:%d) 0x%x",
                                *size, *width, *height, *data);
@@ -782,10 +779,10 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
                        return MS_MEDIA_ERR_NONE;
                } else {
                        if (strlen(thumb_path) == 0) {
-                               err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length,uid);
+                               err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length, uid);
                                if (err != MS_MEDIA_ERR_NONE) {
                                        char *default_path = _media_thumb_get_default_path(uid);
-                                       if(default_path) {
+                                       if (default_path) {
                                                thumb_err("_media_thumb_get_hash_name failed - %d", err);
                                                strncpy(thumb_path, default_path, max_length);
                                                free(default_path);
@@ -803,10 +800,10 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
                strncpy(thumb_path, req_msg->dst_path, max_length);
 
        } else if (msg_type == THUMB_REQUEST_ALL_MEDIA) {
-               err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length,uid);
+               err = _media_thumb_get_hash_name(origin_path, thumb_path, max_length, uid);
                if (err != MS_MEDIA_ERR_NONE) {
                        char *default_path = _media_thumb_get_default_path(uid);
-                       if(default_path) {
+                       if (default_path) {
                                thumb_err("_media_thumb_get_hash_name failed - %d", err);
                                strncpy(thumb_path, default_path, max_length);
                                free(default_path);
@@ -832,7 +829,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
                thumb_err("_thumbnail_get_data failed - %d", err);
                SAFE_FREE(data);
 
-               if(default_path) {
+               if (default_path) {
                        strncpy(thumb_path, default_path, max_length);
                        free(default_path);
                        default_path = NULL;
@@ -874,7 +871,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
                        SAFE_FREE(data);
 
                        if (msg_type == THUMB_REQUEST_DB_INSERT || msg_type == THUMB_REQUEST_ALL_MEDIA) {
-                               if(default_path) {
+                               if (default_path) {
                                        strncpy(thumb_path, default_path, max_length);
                                        free(default_path);
                                        default_path = NULL;
index 44bd2eb..a927a7b 100755 (executable)
@@ -87,7 +87,7 @@ static void _thumb_server_add_signal_handler(void)
                thumb_err("sigaction failed [%s]", strerror(errno));
        }
 
-       signal(SIGPIPE,SIG_IGN);
+       signal(SIGPIPE, SIG_IGN);
 }
 #endif
 
@@ -137,12 +137,12 @@ int main(void)
        g_source_attach(source, context);
 
        GSource *source_evas_init = NULL;
-       source_evas_init = g_idle_source_new ();
-       g_source_set_callback (source_evas_init, _thumb_daemon_start_jobs, NULL, NULL);
-       g_source_attach (source_evas_init, context);
+       source_evas_init = g_idle_source_new();
+       g_source_set_callback(source_evas_init, _thumb_daemon_start_jobs, NULL, NULL);
+       g_source_attach(source_evas_init, context);
 
 #ifdef _SUPPORT_DCM
-       thumb_dbg( "[GD] _thumb_server_dcm_thread created");
+       thumb_dbg("[GD] _thumb_server_dcm_thread created");
        /* Create dcm thread */
        GThread *dcm_thread = NULL;
        dcm_thread = g_thread_new("dcm_thread", (GThreadFunc)_thumb_server_dcm_thread, NULL);
index 6fc2f1a..8b53226 100755 (executable)
 
 
 
-#define MAX_CODES   4096
+#define MAX_CODES      4096
 
-int __FastImgGetNextFrameAGIF_NoBuffer (AGifFrameInfo *pFrameData, BOOL bCenterAlign);
-int __FastImgGetNextFrameAGIF_UseBuffer (AGifFrameInfo *pFrameData, BOOL bCenterAlign);
+int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAlign);
+int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAlign);
 
 int image_left_pos_N = 0;      /* left position of image in Logical screeen */
 int image_top_pos_N = 0;
@@ -85,14 +85,14 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh
 
        pFrameData->nRepeatCount = 0;
 
-       thumb_dbg("10st data :  0x%x , global color table num : %d", pEncodedData[10], header_temp);
+       thumb_dbg("10st data : 0x%x , global color table num : %d", pEncodedData[10], header_temp);
        thumb_dbg("13: 0x%x ,14: 0x%x, 15: 0x%x, nRepeatCount : %d, nLoopCount : %d", pEncodedData[13+header_temp], pEncodedData[14+header_temp], pEncodedData[15+header_temp], pFrameData->nRepeatCount, pFrameData->nLoopCount);
 
        backcolor_index = pEncodedData[11];
 
        if (pEncodedData[14+header_temp] == 0xF9) {
                transparent = pEncodedData[16+header_temp] & 0x01;
-               transIndex =    pEncodedData[19+header_temp];
+               transIndex = pEncodedData[19+header_temp];
 
                backcolor_parsing = (unsigned short)((pEncodedData[inputPos+backcolor_index*3] >> 3)<<11) | ((pEncodedData[inputPos+backcolor_index*3+1] >> 2)<<5) | (pEncodedData[inputPos+backcolor_index*3+2] >> 3);
        } else if (pEncodedData[14+19+header_temp] == 0xF9) {
@@ -110,14 +110,14 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh
        if (pEncodedData[14+header_temp] == 0xF9 || pEncodedData[14+19+header_temp] == 0xF9) {
 
                if (transparent == 1 && backcolor_index == transIndex) {
-                       image_backcolor =  ui_backcolor;
+                       image_backcolor = ui_backcolor;
                } else if (transparent == 1 && backcolor_index != transIndex) {
                        image_backcolor = backcolor_parsing;
                } else {
-                       image_backcolor =  backcolor_parsing;           
+                       image_backcolor = backcolor_parsing;            
                }
        } else {
-               image_backcolor =  backcolor_parsing;   
+               image_backcolor = backcolor_parsing;    
        }
 
 #if MODE == 0
@@ -145,7 +145,7 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh
 
 #if MODE == 2
        if (((pFrameData->logi_wdt <= width) && (pFrameData->logi_hgt <= height))) {
-               if (0 ==  (pFrameData->pPrevImg = IfegMemAlloc(sizeof(unsigned char)*width*height*2))) {
+               if (0 == (pFrameData->pPrevImg = IfegMemAlloc(sizeof(unsigned char)*width*height*2))) {
                        if (pFrameData) {
                                IfegMemFree(pFrameData);
                                pFrameData = 0;
@@ -154,7 +154,7 @@ AGifFrameInfo *FastImgCreateAGIFFrameData(unsigned int width, unsigned int heigh
                }
                pFrameData->useBuffer = 0;
        } else {
-               if (0 ==  (pFrameData->pPrevImg = IfegMemAlloc(sizeof(unsigned int)*pFrameData->logi_wdt*pFrameData->logi_hgt))) {
+               if (0 == (pFrameData->pPrevImg = IfegMemAlloc(sizeof(unsigned int)*pFrameData->logi_wdt*pFrameData->logi_hgt))) {
                        if (pFrameData) {
                                IfegMemFree(pFrameData);
                                pFrameData = 0;
@@ -566,8 +566,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
        inputPos = pFrameData->offset;
 
        done_prefix = IfegMemAlloc(sizeof(unsigned char)*(MAX_CODES+1));
-       if (done_prefix == 0)
-       {
+       if (done_prefix == 0) {
                thumb_err("Failed to allocate memory for check buffer.");
                return -1;
        }
@@ -969,7 +968,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
                        out_x = 0, out_y = -dechgt;
 
                        /* Color Resolution */
-                       if ((buffer[8] & 0x80) == 0) { /* Logical color table  */
+                       if ((buffer[8] & 0x80) == 0) { /* Logical color table */
                                /* use global table */
                        } else { /* Logical color table */
                                IfegMemset(dacbox, 0, 1024);
@@ -1104,7 +1103,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
                                }
                                /* Now that we've pushed the decoded string (in reverse order)
                                * onto the stack, lets pop it off and put it into our decode
-                               * buffer...  And when the decode buffer is full, write another
+                               * buffer... And when the decode buffer is full, write another
                                * line...
                                */
                                while (sp > dstack) {
@@ -1126,7 +1125,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
                                                        if (!flag) {
                                                                out_x = 0, out_y += dechgt;
                                                        }
-                                               } else {  /* interlaced image */
+                                               } else { /* interlaced image */
                                                        if (inter_step == 1) {
                                                                startloc += 8;
                                                        } else if (inter_step == 2) {
@@ -1219,7 +1218,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
                                                                                                        a_x += orgwdt, c_x += orgwdt;
                                                                                                }
                                                                                        }
-                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                if (val1 == transIndex) {
                                                                                                        *(pImage32 + (b_x/orgwdt)) += 0x1000000;
                                                                                                        *(pImage32_2 + (d_x/orgwdt)) += 0x1000000;
@@ -1285,7 +1284,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
                                                                                                        c_x += orgwdt;
                                                                                                }
                                                                                        }
-                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                if (val1 == transIndex) {
                                                                                                        *(pImage32_2 + (d_x/orgwdt)) += 0x1000000;
                                                                                                        d_x += orgwdt;
@@ -1326,7 +1325,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
                                                                                                *(pImage32_2 + (c_x/orgwdt)) += pDacbox[val1];
                                                                                                a_x += orgwdt, c_x += orgwdt;
                                                                                        }
-                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                *(pImage32 + (b_x/orgwdt)) += pDacbox[val1];
                                                                                                *(pImage32_2 + (d_x/orgwdt)) += pDacbox[val1];
                                                                                                b_x += orgwdt, d_x += orgwdt;
@@ -1350,7 +1349,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
                                                                                                *(pImage32 + (a_x/orgwdt)) += pDacbox[val1];
                                                                                                a_x += orgwdt;
                                                                                        }
-                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                *(pImage32 + (b_x/orgwdt)) += pDacbox[val1];
                                                                                                b_x += orgwdt;
                                                                                        }
@@ -1460,8 +1459,7 @@ int __FastImgGetNextFrameAGIF_NoBuffer(AGifFrameInfo *pFrameData, BOOL bCenterAl
                                                IfegMemset(done_prefix, 0, sizeof(unsigned char)*(MAX_CODES+1));
                                                while (code >= newcodes) {
                                                        *sp++ = suffix[code];
-                                                       if ((code == prefix[code]) || (done_prefix[code] == 1))
-                                                       {
+                                                       if ((code == prefix[code]) || (done_prefix[code] == 1)) {
                                                                thumb_err("Circular entry in table.");
                                                                if (decoderline != 0) {
                                                                        IfegMemFree(decoderline);
@@ -1815,7 +1813,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                /* Color Resolution */
                IfegMemset(global_dacbox, 0, 1024);
                numcolors = (buffer[10] & 0x7) + 1;
-               if ((buffer[10] & 0x80) == 0) {  /* Global color table */
+               if ((buffer[10] & 0x80) == 0) { /* Global color table */
                        global_dacbox[0] = 0x000000;
                        global_dacbox[1] = 0x3f3f3f;
                        numcolors = 2;
@@ -2110,7 +2108,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                out_x = 0, out_y = -dechgt;
 
                                /* Color Resolution */
-                               if ((buffer[8] & 0x80) == 0) { /* Logical color table  */
+                               if ((buffer[8] & 0x80) == 0) { /* Logical color table */
                                        ;/* use global table */
                                } else { /* Logical color table */
                                        IfegMemset(dacbox, 0, 1024);
@@ -2164,14 +2162,14 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                if (logi_hgt < (image_top_pos + orghgt)) {
                                                        for (i = 0; i < logi_hgt - image_top_pos; i++) {
                                                                for (j = 0; j < orgwdt; j++) {
-                                                                       pImage32[j] = 0x1000000;  /* set ui color */
+                                                                       pImage32[j] = 0x1000000; /* set ui color */
                                                                }
                                                                pImage32 += logi_wdt;
                                                        }
                                                } else {
                                                        for (i = 0; i < orghgt; i++) {
                                                                for (j = 0; j < orgwdt; j++) {
-                                                                       pImage32[j] = 0x1000000;  /* set ui color */
+                                                                       pImage32[j] = 0x1000000; /* set ui color */
                                                                }
                                                                pImage32 += logi_wdt;
                                                        }
@@ -2203,7 +2201,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                        }
-                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -2223,7 +2221,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                a_x += logi_wdt;
                                                                        }
-                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                b_x += logi_wdt;
                                                                        }
@@ -2240,7 +2238,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                c_x += logi_wdt;
                                                                        }
-                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                d_x += logi_wdt;
                                                                        }
@@ -2362,7 +2360,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                }
                                                /* Now that we've pushed the decoded string (in reverse order)
                                                * onto the stack, lets pop it off and put it into our decode
-                                               * buffer...  And when the decode buffer is full, write another
+                                               * buffer... And when the decode buffer is full, write another
                                                * line...
                                                */
                                                while (sp > dstack) {
@@ -2478,7 +2476,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -2502,7 +2500,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                        a_x += logi_wdt, c_x += logi_wdt;
                                                                                                                }
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                if (val1 == transIndex) {
                                                                                                                        *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos];
                                                                                                                        *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos];
@@ -2524,7 +2522,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -2547,7 +2545,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -2567,7 +2565,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                        a_x += logi_wdt;
                                                                                                                }
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                if (val1 == transIndex) {
                                                                                                                        *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos];
                                                                                                                        b_x += logi_wdt;
@@ -2585,7 +2583,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -2604,7 +2602,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -2624,7 +2622,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                        c_x += logi_wdt;
                                                                                                                }
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                if (val1 == transIndex) {
                                                                                                                        *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos];
                                                                                                                        d_x += logi_wdt;
@@ -2642,7 +2640,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -2682,7 +2680,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -2699,7 +2697,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += pDacbox[val1];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -2714,7 +2712,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -2737,7 +2735,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -2753,7 +2751,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += pDacbox[val1];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -2766,7 +2764,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -2786,7 +2784,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -2801,7 +2799,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += pDacbox[val1];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -2814,7 +2812,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -3040,7 +3038,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3064,7 +3062,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                        a_x += logi_wdt, c_x += logi_wdt;
                                                                                                                }
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                if (val1 == transIndex) {
                                                                                                                        *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos];
                                                                                                                        *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos];
@@ -3087,7 +3085,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3110,7 +3108,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -3130,7 +3128,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                        a_x += logi_wdt;
                                                                                                                }
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                if (val1 == transIndex) {
                                                                                                                        *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos];
                                                                                                                        b_x += logi_wdt;
@@ -3149,7 +3147,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                        *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                        a_x += logi_wdt;
                                                                                                }
-                                                                                               if (0 <= d2  && d2 < decwdt) {
+                                                                                               if (0 <= d2 && d2 < decwdt) {
                                                                                                        *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                        b_x += logi_wdt;
                                                                                                }
@@ -3169,7 +3167,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -3189,7 +3187,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                        c_x += logi_wdt;
                                                                                                                }
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                if (val1 == transIndex) {
                                                                                                                        *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos];
                                                                                                                        d_x += logi_wdt;
@@ -3208,7 +3206,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -3249,7 +3247,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3267,7 +3265,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = backcolor888;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3283,7 +3281,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3306,7 +3304,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -3323,7 +3321,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                a_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = backcolor888;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1];
                                                                                                                b_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = backcolor888;
@@ -3337,7 +3335,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -3357,7 +3355,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -3373,7 +3371,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                c_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = backcolor888;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1];
                                                                                                                d_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = backcolor888;
@@ -3387,7 +3385,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -3511,7 +3509,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                }
                                                /* Now that we've pushed the decoded string (in reverse order)
                                                * onto the stack, lets pop it off and put it into our decode
-                                               * buffer...  And when the decode buffer is full, write another
+                                               * buffer... And when the decode buffer is full, write another
                                                * line...
                                                */
                                                while (sp > dstack) {
@@ -3528,7 +3526,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                        len = orgwdt;
                                                                }
 
-                                                               if (interLaced == 0) { /* interlaced image  */
+                                                               if (interLaced == 0) { /* interlaced image */
                                                                        if (!flag) {
                                                                                out_x = 0, out_y += dechgt;
                                                                        }
@@ -3628,7 +3626,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3653,7 +3651,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                        backGround[i+image_left_pos] = pDacbox[val1];
                                                                                                                }
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                if (val1 == transIndex) {
                                                                                                                        *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos];
                                                                                                                        *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos];
@@ -3676,7 +3674,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3699,7 +3697,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -3720,7 +3718,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                        backGround[i+image_left_pos] = pDacbox[val1];
                                                                                                                }
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                if (val1 == transIndex) {
                                                                                                                        *(pImage32 + (b_x/logi_wdt)) += backGround[i+image_left_pos];
                                                                                                                        b_x += logi_wdt;
@@ -3739,7 +3737,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                        *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                        a_x += logi_wdt;
                                                                                                }
-                                                                                               if (0 <= d2  && d2 < decwdt) {
+                                                                                               if (0 <= d2 && d2 < decwdt) {
                                                                                                        *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                        b_x += logi_wdt;
                                                                                                }
@@ -3759,7 +3757,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -3780,7 +3778,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                        backGround[i+image_left_pos] = pDacbox[val1];
                                                                                                                }
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                if (val1 == transIndex) {
                                                                                                                        *(pImage32_2 + (d_x/logi_wdt)) += backGround[i+image_left_pos];
                                                                                                                        d_x += logi_wdt;
@@ -3799,7 +3797,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -3840,7 +3838,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3859,7 +3857,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = pDacbox[val1];
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3875,7 +3873,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -3898,7 +3896,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -3915,7 +3913,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                a_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = pDacbox[val1];
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += pDacbox[val1];
                                                                                                                b_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = pDacbox[val1];
@@ -3929,7 +3927,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                                                a_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                                                b_x += logi_wdt;
                                                                                                        }
@@ -3948,7 +3946,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -3964,7 +3962,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                c_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = pDacbox[val1];
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += pDacbox[val1];
                                                                                                                d_x += logi_wdt;
                                                                                                                backGround[i+image_left_pos] = pDacbox[val1];
@@ -3978,7 +3976,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                                                c_x += logi_wdt;
                                                                                                        }
-                                                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                                                d_x += logi_wdt;
                                                                                                        }
@@ -4146,7 +4144,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                a_x += logi_wdt, c_x += logi_wdt;
                                                                        }
-                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                b_x += logi_wdt, d_x += logi_wdt;
@@ -4166,7 +4164,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                *(pImage32 + (a_x/logi_wdt)) += backGround[i];
                                                                                a_x += logi_wdt;
                                                                        }
-                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                *(pImage32 + (b_x/logi_wdt)) += backGround[i];
                                                                                b_x += logi_wdt;
                                                                        }
@@ -4183,7 +4181,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                                                *(pImage32_2 + (c_x/logi_wdt)) += backGround[i];
                                                                                c_x += logi_wdt;
                                                                        }
-                                                                       if (0 <= d2  && d2 < decwdt) {
+                                                                       if (0 <= d2 && d2 < decwdt) {
                                                                                *(pImage32_2 + (d_x/logi_wdt)) += backGround[i];
                                                                                d_x += logi_wdt;
                                                                        }
@@ -4207,7 +4205,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                }
 
 
-                               /* 565 Conversion  */
+                               /* 565 Conversion */
                                pImage32 = (unsigned int *)(pDecBuf);
        
                                for (i = 0, k = margin_hgt1_2; i < dechgt; i++) {
@@ -4216,7 +4214,7 @@ int __FastImgGetNextFrameAGIF_UseBuffer(AGifFrameInfo *pFrameData, BOOL bCenterA
                                                if ((*pImage32>>24) == 0) {
                                                        *(pImage16++) = ((*pImage32 & 0xf80000) >> 8) | ((*pImage32 & 0xfc00) >> 5) | ((*pImage32 & 0xf8) >> 3);
                                                } else if ((*pImage32 >> 24) == 1) {
-                                                       *(pImage16++) = (((*pImage32 & 0xf80000) >> 6) / 3)  | (((*pImage32 & 0xfc00) >> 3)/3) | (((*pImage32 & 0xf8) >> 1)/3);
+                                                       *(pImage16++) = (((*pImage32 & 0xf80000) >> 6) / 3) | (((*pImage32 & 0xfc00) >> 3)/3) | (((*pImage32 & 0xf8) >> 1)/3);
                                                } else if ((*pImage32 >> 24) == 2) {
                                                        *(pImage16++) = ((*pImage32 & 0xf80000) >> 7) | ((*pImage32 & 0xfc00) >> 4) | ((*pImage32 & 0xf8) >> 2);
                                                } else {
index 8cc94d5..0bd76ea 100755 (executable)
@@ -44,9 +44,9 @@
 #define                TIFF_IMAGE_WIDTH        0x100
 #define                TIFF_IMAGE_HEIGHT       0x101
 
-#define        JPG_HEADER_TYPE_LENGTH 2
-#define        JPG_BLOCK_SIZE_LENGTH 2
-#define        JPG_IMAGE_SIZE_LENGTH 8
+#define                JPG_HEADER_TYPE_LENGTH 2
+#define                JPG_BLOCK_SIZE_LENGTH 2
+#define                JPG_IMAGE_SIZE_LENGTH 8
 
 #define                FILE_READ_SIZE          4096
 typedef struct _stream {
@@ -75,9 +75,7 @@ static int _CheckBuffer(IFEGSTREAMCTRL *pIfegstreamctrl, unsigned int size)
                }
 
                if (pIfegstreamctrl->buffpos == 0) {
-                       if (DrmReadFile
-                           (pIfegstreamctrl->fd, pIfegstreamctrl->buffer,
-                            FILE_READ_SIZE, &fileread) == FALSE) {
+                       if (DrmReadFile(pIfegstreamctrl->fd, pIfegstreamctrl->buffer, FILE_READ_SIZE, &fileread) == FALSE) {
                                return 0;
                        }
                        if (fileread == 0) {
@@ -88,29 +86,20 @@ static int _CheckBuffer(IFEGSTREAMCTRL *pIfegstreamctrl, unsigned int size)
                        pIfegstreamctrl->buffpos = 0;
                } else {
 
-                       if (size >= 2048
-                           || pIfegstreamctrl->buffend -
-                           pIfegstreamctrl->buffpos > FILE_READ_SIZE) {
+                       if (size >= 2048 || pIfegstreamctrl->buffend - pIfegstreamctrl->buffpos > FILE_READ_SIZE) {
                                return 0;
                        }
                        AcMemcpy(pIfegstreamctrl->buffer,
-                                &pIfegstreamctrl->buffer[pIfegstreamctrl->
-                                                         buffpos],
+                                &pIfegstreamctrl->buffer[pIfegstreamctrl->buffpos],
                                 pIfegstreamctrl->buffend -
                                 pIfegstreamctrl->buffpos);
-                       if (DrmReadFile
-                           (pIfegstreamctrl->fd,
-                            &pIfegstreamctrl->buffer[pIfegstreamctrl->buffend -
-                                                     pIfegstreamctrl->buffpos],
-                            pIfegstreamctrl->buffpos, &fileread) == FALSE) {
+                       if (DrmReadFile(pIfegstreamctrl->fd, &pIfegstreamctrl->buffer[pIfegstreamctrl->buffend - pIfegstreamctrl->buffpos], pIfegstreamctrl->buffpos, &fileread) == FALSE) {
                                return 0;
                        }
                        if (fileread == 0) {
                                return 0;
                        }
-                       pIfegstreamctrl->buffend =
-                           pIfegstreamctrl->buffend -
-                           pIfegstreamctrl->buffpos + fileread;
+                       pIfegstreamctrl->buffend = pIfegstreamctrl->buffend - pIfegstreamctrl->buffpos + fileread;
                        pIfegstreamctrl->buffpos = 0;
                        pIfegstreamctrl->filepos += fileread;
                }
@@ -135,7 +124,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt,
        unsigned int *pHeight = NULL;
        int ret = MS_MEDIA_ERR_NONE;
 
-       if (type == NULL || width == NULL ||height == NULL ) {
+       if (type == NULL || width == NULL || height == NULL) {
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        } else {
                pWidth = width;
@@ -225,7 +214,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt,
                thumb_dbg("IMG_CODEC_JPEG");
                *type = IMG_CODEC_JPEG;
        }
-       /***********************  PNG  *************************/
+       /*********************** PNG *************************/
        else if (AcMemcmp(EncodedDataBuffer, gIfegPNGHeader, PNG_HEADER_LENGTH) == 0) {
                unsigned char tmp;
 
@@ -257,7 +246,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt,
                thumb_dbg("IMG_CODEC_PNG");
                *type = IMG_CODEC_PNG;
        }
-       /***********************  BMP  *************************/
+       /*********************** BMP *************************/
        else if (AcMemcmp(EncodedDataBuffer, gIfegBMPHeader, BMP_HEADER_LENGTH) == 0) {
                /* Parse BMP File and get image width and image height */
                if (DrmReadFile(hFile, &EncodedDataBuffer[8], 18, &fileread) == FALSE) {
@@ -277,13 +266,13 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt,
                if (pHeight) {
                        // add the reference function abs(). may have negative height values in bmp header.
                        *pHeight = abs(EncodedDataBuffer[22] | (EncodedDataBuffer[23] << 8) | 
-                                                 (EncodedDataBuffer[24] << 16) | (EncodedDataBuffer[25] << 24));
+                                               (EncodedDataBuffer[24] << 16) | (EncodedDataBuffer[25] << 24));
                }
 
                thumb_dbg("IMG_CODEC_BMP");
                *type = IMG_CODEC_BMP;
        }
-       /***********************  GIF  *************************/
+       /*********************** GIF *************************/
        else if (AcMemcmp(EncodedDataBuffer, gIfegGIFHeader, GIF_HEADER_LENGTH) == 0) {
                unsigned int tablelength = 0;
                unsigned int imagecount = 0;
@@ -438,7 +427,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt,
 
                                        img_block_w = EncodedDataBuffer[ifegstreamctrl.buffpos + 4] |(EncodedDataBuffer[ifegstreamctrl.buffpos + 5] << 8);
                                        img_block_h = EncodedDataBuffer[ifegstreamctrl.buffpos + 6] |(EncodedDataBuffer[ifegstreamctrl.buffpos + 7] << 8);
-                                       thumb_dbg ("Image block width : %d, Height : %d, left:%d, top:%d", img_block_w, img_block_h);
+                                       thumb_dbg("Image block width : %d, Height : %d, left : %d, top : %d", img_block_w, img_block_h);
 
                                        *pWidth = img_block_w;
                                        *pHeight = img_block_h;
@@ -475,7 +464,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt,
                                                return ret;
                                        }
 
-                                       length =EncodedDataBuffer[ifegstreamctrl.buffpos++];
+                                       length = EncodedDataBuffer[ifegstreamctrl.buffpos++];
                                        if ((length + ifegstreamctrl.buffpos) > ifegstreamctrl.buffend) {
                                                length =
                                                        length +
@@ -493,7 +482,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt,
                                                ifegstreamctrl.buffpos = 0;
                                                ifegstreamctrl.buffend = 0;
                                        } else {
-                                               ifegstreamctrl.buffpos +=length;
+                                               ifegstreamctrl.buffpos += length;
                                        }
 
                                        /* File End Check */
@@ -516,7 +505,7 @@ static int _ImgGetImageInfo(HFile hFile, unsigned long fileSize, char *fileExt,
                thumb_dbg("IMG_CODEC_GIF");
                *type = IMG_CODEC_GIF;
        }
-       /***********************  WBMP  *************************/
+       /*********************** WBMP *************************/
        else if ((AcMemcmp(EncodedDataBuffer, gIfegWBMPHeader, WBMP_HEADER_LENGTH) == 0)
                && (strcasecmp(fileExt, "wbmp") == 0)) {
                /* Parse BMP File and get image width and image height */
index a27495c..1887e47 100755 (executable)
@@ -32,32 +32,25 @@ unsigned int *ImgGetFirstFrameAGIFAtSize(const char *szFileName,
        unsigned char *raw_data = NULL;
 
        if (szFileName == NULL) {
-               thumb_err
-                   ("ImgGetFirstFrameAGIFAtSize: Input File Name is NULL");
+               thumb_err("ImgGetFirstFrameAGIFAtSize: Input File Name is NULL");
                return NULL;
        }
 
        if (width == 0 || height == 0) {
-               thumb_err
-                   ("ImgGetFirstFrameAGIFAtSize: Input width or height is zero");
+               thumb_err("ImgGetFirstFrameAGIFAtSize: Input width or height is zero");
                return NULL;
        }
 
-       pFrameInfo =
-           ImgCreateAGIFFrame(szFileName, width,
-                              height, 0, FALSE);
+       pFrameInfo = ImgCreateAGIFFrame(szFileName, width, height, 0, FALSE);
 
        if (pFrameInfo && pFrameInfo->pOutBits) {
                ImgGetNextAGIFFrame(pFrameInfo, TRUE);
 
-               if (ImgConvertRGB565ToRGB888
-                   (pFrameInfo->pOutBits, &pDecodedRGB888Buf,
-                    pFrameInfo->width, pFrameInfo->height)) {
+               if (ImgConvertRGB565ToRGB888(pFrameInfo->pOutBits, &pDecodedRGB888Buf, pFrameInfo->width, pFrameInfo->height)) {
                        if (pDecodedRGB888Buf) {
                                free(pFrameInfo->pOutBits);
                                pFrameInfo->pOutBits = pDecodedRGB888Buf;
-                               unsigned char *src =
-                                   ((unsigned char *)(pFrameInfo->pOutBits));
+                               unsigned char *src = ((unsigned char *)(pFrameInfo->pOutBits));
 
                                unsigned int i = 0;
 
@@ -76,8 +69,7 @@ unsigned int *ImgGetFirstFrameAGIFAtSize(const char *szFileName,
                                unsigned char *dest = raw_data;
                                while (i--) {
                                        if (dest != NULL) {
-                                               *dest =
-                                                   *((unsigned char *)(src));
+                                               *dest = *((unsigned char *)(src));
                                                dest++;
                                                src++;
                                        }
@@ -95,8 +87,7 @@ unsigned int *ImgGetFirstFrameAGIFAtSize(const char *szFileName,
        return (unsigned int *)raw_data;
 }
 
-int ImgConvertRGB565ToRGB888(void *pBuf_rgb565, void **pBuf_rgb888, int width,
-                            int height)
+int ImgConvertRGB565ToRGB888(void *pBuf_rgb565, void **pBuf_rgb888, int width, int height)
 {
        unsigned short *rgb565buf = 0;
        unsigned char *rgb888Buf = 0;
@@ -138,21 +129,7 @@ int ImgConvertRGB565ToRGB888(void *pBuf_rgb565, void **pBuf_rgb888, int width,
        return TRUE;
 }
 
-/**
- * This function is wrapper function for "ImgFastCreateAGIFFrameData".
- *
- * @param      szFileName[in] Specifies the read image data.
- * @param              width[in] Specifies a width of the image to be created.
- * @param      height[in] Specifies a height of the image to be created.
- * @param      bgColor[in] Specifies background color of output buffer.
- * @param      bLoop[in] Specifies looping condition whether infinte or once play.
- * @return     This fucntion returns AGifFrameInfo Structure's pointer.
- * @see                ImgFastCreateAGIFFrameData.
- */
-
-AGifFrameInfo *ImgCreateAGIFFrame(const char *szFileName, unsigned int width,
-                                 unsigned int height, unsigned int bgColor,
-                                 BOOL bLoop)
+AGifFrameInfo *ImgCreateAGIFFrame(const char *szFileName, unsigned int width, unsigned int height, unsigned int bgColor, BOOL bLoop)
 {
        HFile hFile;
        FmFileAttribute fileAttrib;
@@ -189,7 +166,7 @@ AGifFrameInfo *ImgCreateAGIFFrame(const char *szFileName, unsigned int width,
                DrmCloseFile(hFile);
                return NULL;
        }
-       memset(pEncodedData,0,mem_alloc_size);
+       memset(pEncodedData, 0, mem_alloc_size);
        /* coverity[ -tainted_data_argument : pEncodedData ] */
        if (DrmReadFile(hFile, pEncodedData, mem_alloc_size, &size) == FALSE) {
                thumb_err("DrmReadFile was failed");
@@ -207,24 +184,9 @@ AGifFrameInfo *ImgCreateAGIFFrame(const char *szFileName, unsigned int width,
 
        DrmCloseFile(hFile);
 
-       return FastImgCreateAGIFFrameData(width, height, pEncodedData,
-                                         cFileSize, bgColor, bLoop);
+       return FastImgCreateAGIFFrameData(width, height, pEncodedData, cFileSize, bgColor, bLoop);
 }
 
-/**
- * This function is wrapper function for "ImgFastDestroyAGIFFrameData".
- *
- * @param      pFrameData[in]
- * @return     void
- * @see                ImgFastDestroyAGIFFrameData.
- * @see                ImgFastDestroyAGIFFrameData.
- *
- * @note               ImgFastDestroyAGIFFrameData function set free all memory in AGifFrameInfo structure
- *                     even pEncodedData
- *
- * @author     rubric(sinjae4b.lee@samsung.com)
- */
-
 void ImgDestroyAGIFFrame(AGifFrameInfo *pFrameData)
 {
        SysAssert(pFrameData);
@@ -232,22 +194,7 @@ void ImgDestroyAGIFFrame(AGifFrameInfo *pFrameData)
        FastImgDestroyAGIFFrameData(pFrameData);
 }
 
-/**
- * This function is wrapper function for "ImgFastGetNextFrameAGIF".
- *
- * @param      pFrameData[in]
- * @param              bCenterAlign Specifies true if you want center align in output buffer, else left top align
- * @return     This fucntion returns True or False as decoding result.
- * @see                ImgFastGetNextFrameAGIF.
- *
- * @note               This function returns one frame data it decoded.
- *                     next time, returns next decoded frame data... and so on.
- *
- * @author     rubric(sinjae4b.lee@samsung.com)
- */
-
-ImgFastCodecInfo ImgGetNextAGIFFrame(AGifFrameInfo *gFrameData,
-                                    BOOL bCenterAlign)
+ImgFastCodecInfo ImgGetNextAGIFFrame(AGifFrameInfo *gFrameData, BOOL bCenterAlign)
 {
        int iResult;
 
index cafd9d2..66ae59e 100755 (executable)
 
 #define thumb_dbg(fmt, arg...) do{ \
                LOGD(FONT_COLOR_RESET fmt "\n", ##arg); \
-               } while(0)
+               } while (0)
 
 #define thumb_warn(fmt, arg...)        do{ \
                LOGW(FONT_COLOR_GREEN fmt "\n", ##arg); \
-               } while(0)
+               } while (0)
 
 #define thumb_err(fmt, arg...) do{ \
                 LOGE(FONT_COLOR_RED fmt "\n", ##arg); \
-               } while(0)
+               } while (0)
 
 #define thumb_dbg_slog(fmt, arg...)    do{ \
                SECURE_LOGD(FONT_COLOR_RESET fmt "\n", ##arg); \
-               } while(0)
+               } while (0)
 
 #define thumb_warn_slog(fmt, arg...)   do{ \
                SECURE_LOGW(FONT_COLOR_GREEN fmt "\n", ##arg); \
-               } while(0)
+               } while (0)
 
 
 #define ERR_BUF_LENGHT 256
index 6db86bc..9c2e4d3 100755 (executable)
@@ -25,9 +25,9 @@
 #ifndef _MEDIA_THUMB_UTIL_H_
 #define _MEDIA_THUMB_UTIL_H_
 
-#define SAFE_FREE(src)      { if(src) {free(src); src = NULL;}}
+#define SAFE_FREE(src)      { if (src) {free(src); src = NULL;}}
 #define THUMB_MALLOC(src, size)        { if (size <= 0) {src = NULL;} \
-                                                       else { src = malloc(size); if(src) memset(src, 0x0, size);} }
+                                                       else { src = malloc(size); if (src) memset(src, 0x0, size);} }
 
 typedef enum {
        MEDIA_THUMB_BGRA,                       /* BGRA, especially provided for evas users */
index 76e7d0a..7bce1b4 100755 (executable)
@@ -168,7 +168,7 @@ int __media_thumb_pop_manage_queue(const char *path)
                                break;
                        }
                }
-               if(!flag) {
+               if (!flag) {
                        return __media_thumb_check_req_queue_for_cancel(path);
                }
        }
@@ -266,7 +266,7 @@ int __media_thumb_pop_raw_data_manage_queue(int request_id)
                                break;
                        }
                }
-               if(!flag) {
+               if (!flag) {
                        return __media_thumb_check_raw_data_req_queue_for_cancel(request_id);
                }
        }
@@ -312,7 +312,7 @@ bool __media_thumb_check_cancel(void)
        if (req == NULL) {
                return false;
        } else {
-               if(req->isCanceled)
+               if (req->isCanceled)
                        return false;
                else
                        return true;
@@ -327,7 +327,7 @@ bool __media_thumb_check_cancel_for_raw(void)
        if (req == NULL) {
                return false;
        } else {
-               if(req->isCanceled)
+               if (req->isCanceled)
                        return false;
                else
                        return true;
@@ -364,7 +364,7 @@ _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg)
        //thumb_dbg("origin_path_size : %d, dest_path_size : %d, thumb_size : %d", msg->origin_path_size, msg->dest_path_size, msg->thumb_size);
 
        SAFE_FREE(buf);
-       if(msg->origin_path_size < 0  ||msg->dest_path_size < 0 || msg->thumb_size < 0) {
+       if (msg->origin_path_size < 0 || msg->dest_path_size < 0 || msg->thumb_size < 0) {
                thumb_err("recv data is wrong");
                SAFE_FREE(block_buf);
                return MS_MEDIA_ERR_SOCKET_RECEIVE;
@@ -372,13 +372,13 @@ _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg)
 
        remain_size = msg->origin_path_size + msg->dest_path_size + msg->thumb_size;
        THUMB_MALLOC(buf, remain_size);
-       if(buf == NULL) {
+       if (buf == NULL) {
                SAFE_FREE(block_buf);
                return MS_MEDIA_ERR_OUT_OF_MEMORY;
        }
 
-       while(remain_size > 0) {
-               if(remain_size < THUMB_SOCK_BLOCK_SIZE) {
+       while (remain_size > 0) {
+               if (remain_size < THUMB_SOCK_BLOCK_SIZE) {
                        block_size = remain_size;
                }
                if ((recv_msg_len = recv(sock, block_buf, block_size, 0)) < 0) {
@@ -396,9 +396,9 @@ _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg)
        strncpy(msg->dst_path, (char *)buf + msg->origin_path_size, msg->dest_path_size);
 
        SAFE_FREE(msg->thumb_data);
-       if(msg->thumb_size > 0) {
+       if (msg->thumb_size > 0) {
                THUMB_MALLOC(msg->thumb_data, msg->thumb_size);
-               if(msg->thumb_data != NULL) {
+               if (msg->thumb_data != NULL) {
                        memcpy(msg->thumb_data, buf + msg->origin_path_size + msg->dest_path_size, msg->thumb_size);
                } else {
                        SAFE_FREE(buf);
@@ -435,17 +435,17 @@ _media_thumb_recv_udp_msg(int sock, int header_size, thumbMsg *msg, struct socka
 
        memcpy(msg, buf, header_size);
 
-       if (msg->origin_path_size <= 0  || msg->origin_path_size > MAX_PATH_SIZE) {
+       if (msg->origin_path_size <= 0 || msg->origin_path_size > MAX_PATH_SIZE) {
                SAFE_FREE(buf);
-               thumb_err("msg->origin_path_size is invalid %d", msg->origin_path_size );
+               thumb_err("msg->origin_path_size is invalid %d", msg->origin_path_size);
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
        strncpy(msg->org_path, (char*)buf + header_size, msg->origin_path_size);
 
-       if (msg->dest_path_size <= 0  || msg->dest_path_size > MAX_PATH_SIZE) {
+       if (msg->dest_path_size <= 0 || msg->dest_path_size > MAX_PATH_SIZE) {
                SAFE_FREE(buf);
-               thumb_err("msg->origin_path_size is invalid %d", msg->dest_path_size );
+               thumb_err("msg->origin_path_size is invalid %d", msg->dest_path_size);
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
@@ -486,7 +486,7 @@ _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size)
        memcpy(*buf, req_msg, header_size);
        memcpy((*buf)+header_size, req_msg->org_path, org_path_len);
        memcpy((*buf)+header_size + org_path_len, req_msg->dst_path, dst_path_len);
-       if(thumb_data_len > 0)
+       if (thumb_data_len > 0)
                memcpy((*buf)+header_size + org_path_len + dst_path_len, req_msg->thumb_data, thumb_data_len);
 
        *buf_size = size;
@@ -642,7 +642,7 @@ gboolean _media_thumb_write_socket(GIOChannel *src, GIOCondition condition, gpoi
                err = MS_MEDIA_ERR_INTERNAL;
        }
 
-       if(__media_thumb_check_cancel()) {
+       if (__media_thumb_check_cancel()) {
                if (data) {
                        thumbUserData* cb = (thumbUserData*)data;
                        if (cb->func != NULL)
@@ -657,10 +657,10 @@ gboolean _media_thumb_write_socket(GIOChannel *src, GIOCondition condition, gpoi
        SAFE_FREE(recv_msg.thumb_data);
 
        /* Check manage queue */
-       if(g_manage_queue) {
+       if (g_manage_queue) {
                len = g_queue_get_length(g_manage_queue);
 
-               if(len > 0) {
+               if (len > 0) {
                        _media_thumb_send_request();
                } else {
                        g_queue_free(g_manage_queue);
@@ -705,7 +705,7 @@ gboolean _media_thumb_raw_data_write_socket(GIOChannel *src, GIOCondition condit
                err = MS_MEDIA_ERR_INTERNAL;
        }
 
-       if(__media_thumb_check_cancel_for_raw()) {
+       if (__media_thumb_check_cancel_for_raw()) {
                if (data) {
                        thumbRawUserData* cb = (thumbRawUserData*)data;
                        if (cb->func != NULL)
@@ -720,10 +720,10 @@ gboolean _media_thumb_raw_data_write_socket(GIOChannel *src, GIOCondition condit
        SAFE_FREE(recv_msg.thumb_data);
 
        /* Check manage queue */
-       if(g_manage_raw_queue) {
+       if (g_manage_raw_queue) {
                len = g_queue_get_length(g_manage_raw_queue);
 
-               if(len > 0) {
+               if (len > 0) {
                        _media_thumb_raw_data_send_request();
                } else {
                        g_queue_free(g_manage_raw_queue);
@@ -734,7 +734,8 @@ gboolean _media_thumb_raw_data_write_socket(GIOChannel *src, GIOCondition condit
        return FALSE;
 }
 
-int _media_thumb_send_request() {
+int _media_thumb_send_request()
+{
        int err = MS_MEDIA_ERR_NONE;
        int sock = -1;
        struct sockaddr_un serv_addr;
@@ -744,8 +745,7 @@ int _media_thumb_send_request() {
        sock_info.port = MS_THUMB_CREATOR_PORT;
 
        err = ms_ipc_create_client_socket(MS_PROTOCOL_TCP, MS_TIMEOUT_SEC_10, &sock_info);
-       if(err != MS_MEDIA_ERR_NONE)
-       {
+       if (err != MS_MEDIA_ERR_NONE) {
                thumb_err("ms_ipc_create_client_socket failed");
                return err;
        }
@@ -837,7 +837,8 @@ int _media_thumb_send_request() {
        return err;
 }
 
-int _media_thumb_raw_data_send_request() {
+int _media_thumb_raw_data_send_request()
+{
        int err = MS_MEDIA_ERR_NONE;
        int sock = -1;
        struct sockaddr_un serv_addr;
@@ -847,8 +848,7 @@ int _media_thumb_raw_data_send_request() {
        sock_info.port = MS_THUMB_CREATOR_PORT;
 
        err = ms_ipc_create_client_socket(MS_PROTOCOL_TCP, MS_TIMEOUT_SEC_10, &sock_info);
-       if(err != MS_MEDIA_ERR_NONE)
-       {
+       if (err != MS_MEDIA_ERR_NONE) {
                thumb_err("ms_ipc_create_client_socket failed");
                return err;
        }
@@ -941,8 +941,8 @@ int _media_thumb_request_async(int msg_type, const char *origin_path, thumbUserD
 {
        int err = MS_MEDIA_ERR_NONE;
 
-       if(g_manage_queue == NULL) {
-               if(msg_type == THUMB_REQUEST_CANCEL_MEDIA)
+       if (g_manage_queue == NULL) {
+               if (msg_type == THUMB_REQUEST_CANCEL_MEDIA)
                        return MS_MEDIA_ERR_INTERNAL;
 
                g_manage_queue = g_queue_new();
@@ -966,7 +966,7 @@ int _media_thumb_request_async(int msg_type, const char *origin_path, thumbUserD
                err = _media_thumb_send_request();
 
        } else {
-               if(msg_type != THUMB_REQUEST_CANCEL_MEDIA) {
+               if (msg_type != THUMB_REQUEST_CANCEL_MEDIA) {
                        /* Enqueue */
                        if ((msg_type == THUMB_REQUEST_DB_INSERT) && (__media_thumb_check_req_queue(origin_path) < 0)) {
                                thumb_err("duplicated request");
@@ -1000,8 +1000,8 @@ int _media_thumb_request_raw_data_async(int msg_type, int request_id, const char
 {
        int err = MS_MEDIA_ERR_NONE;
 
-       if(g_manage_raw_queue == NULL) {
-               if(msg_type == THUMB_REQUEST_CANCEL_RAW_DATA)
+       if (g_manage_raw_queue == NULL) {
+               if (msg_type == THUMB_REQUEST_CANCEL_RAW_DATA)
                        return MS_MEDIA_ERR_INTERNAL;
 
                g_manage_raw_queue = g_queue_new();
@@ -1017,7 +1017,7 @@ int _media_thumb_request_raw_data_async(int msg_type, int request_id, const char
                thumb_req->request_id = request_id;
                thumb_req->path = strdup(origin_path);
                thumb_req->width = width;
-               thumb_req->height= height;
+               thumb_req->height = height;
                thumb_req->userData = userData;
                thumb_req->isCanceled = false;
                thumb_req->uid = uid;
@@ -1028,7 +1028,7 @@ int _media_thumb_request_raw_data_async(int msg_type, int request_id, const char
                err = _media_thumb_raw_data_send_request();
 
        } else {
-               if(msg_type != THUMB_REQUEST_CANCEL_RAW_DATA) {
+               if (msg_type != THUMB_REQUEST_CANCEL_RAW_DATA) {
                        /* Enqueue */
                        thumbRawReq *thumb_req = NULL;
                        THUMB_MALLOC(thumb_req, sizeof(thumbRawReq));
@@ -1041,7 +1041,7 @@ int _media_thumb_request_raw_data_async(int msg_type, int request_id, const char
                        thumb_req->request_id = request_id;
                        thumb_req->path = strdup(origin_path);
                        thumb_req->width = width;
-                       thumb_req->height= height;
+                       thumb_req->height = height;
                        thumb_req->userData = userData;
                        thumb_req->isCanceled = false;
                        thumb_req->uid = uid;
@@ -1057,19 +1057,20 @@ int _media_thumb_request_raw_data_async(int msg_type, int request_id, const char
        return err;
 }
 
-int _media_thumb_request_cancel_all(bool isRaw) {
+int _media_thumb_request_cancel_all(bool isRaw)
+{
        int i;
        int req_len = -1;
        int len = 0;
 
-       if(isRaw) {
+       if (isRaw) {
                thumbRawReq *tmp_raw_req = NULL;
-               if(g_manage_raw_queue == NULL) {
+               if (g_manage_raw_queue == NULL) {
                        thumb_err("manage_queue is NULL");
-                       if(g_request_raw_queue != NULL) {
+                       if (g_request_raw_queue != NULL) {
                                /* Check request queue */
                                len = g_queue_get_length(g_request_raw_queue);
-                               if(len > 0) {
+                               if (len > 0) {
                                        tmp_raw_req = g_queue_peek_head(g_request_raw_queue);
                                        if (tmp_raw_req != NULL)
                                                tmp_raw_req->isCanceled = true;
@@ -1080,21 +1081,21 @@ int _media_thumb_request_cancel_all(bool isRaw) {
                        return MS_MEDIA_ERR_INTERNAL;
                }
                req_len = g_queue_get_length(g_manage_raw_queue);
-               for(i=0;i<req_len;i++) {
+               for (i = 0; i < req_len; i++) {
                        tmp_raw_req = g_queue_pop_tail(g_manage_raw_queue);
-                       if(tmp_raw_req) {
+                       if (tmp_raw_req) {
                                SAFE_FREE(tmp_raw_req->path);
                                SAFE_FREE(tmp_raw_req->userData);
                                SAFE_FREE(tmp_raw_req);
                                tmp_raw_req = NULL;
                        }
                }
-               g_queue_free (g_manage_raw_queue);
+               g_queue_free(g_manage_raw_queue);
                g_manage_raw_queue = NULL;
-               if(g_request_raw_queue != NULL) {
+               if (g_request_raw_queue != NULL) {
                        /* Check request queue */
                        len = g_queue_get_length(g_request_raw_queue);
-                       if(len > 0) {
+                       if (len > 0) {
                                tmp_raw_req = g_queue_peek_head(g_request_raw_queue);
                                if (tmp_raw_req != NULL)
                                        tmp_raw_req->isCanceled = true;
@@ -1102,12 +1103,12 @@ int _media_thumb_request_cancel_all(bool isRaw) {
                }
        } else {
                thumbReq *tmp_req = NULL;
-               if(g_manage_queue == NULL) {
+               if (g_manage_queue == NULL) {
                        thumb_err("manage_queue is NULL");
-                       if(g_request_queue != NULL) {
+                       if (g_request_queue != NULL) {
                                /* Check request queue */
                                len = g_queue_get_length(g_request_queue);
-                               if(len > 0) {
+                               if (len > 0) {
                                        tmp_req = g_queue_peek_head(g_request_queue);
                                        if (tmp_req != NULL)
                                                tmp_req->isCanceled = true;
@@ -1118,21 +1119,21 @@ int _media_thumb_request_cancel_all(bool isRaw) {
                        return MS_MEDIA_ERR_INTERNAL;
                }
                req_len = g_queue_get_length(g_manage_queue);
-               for(i=0;i<req_len;i++) {
+               for (i = 0; i < req_len; i++) {
                        tmp_req = g_queue_pop_tail(g_manage_queue);
-                       if(tmp_req) {
+                       if (tmp_req) {
                                SAFE_FREE(tmp_req->path);
                                SAFE_FREE(tmp_req->userData);
                                SAFE_FREE(tmp_req);
                                tmp_req = NULL;
                        }
                }
-               g_queue_free (g_manage_queue);
+               g_queue_free(g_manage_queue);
                g_manage_queue = NULL;
-               if(g_request_queue != NULL) {
+               if (g_request_queue != NULL) {
                        /* Check request queue */
                        len = g_queue_get_length(g_request_queue);
-                       if(len > 0) {
+                       if (len > 0) {
                                tmp_req = g_queue_peek_head(g_request_queue);
                                if (tmp_req != NULL)
                                        tmp_req->isCanceled = true;
index 1e379b6..af8f593 100755 (executable)
@@ -89,8 +89,7 @@ int _media_thumb_get_proper_thumb_size(int orig_w, int orig_h,
        return MS_MEDIA_ERR_NONE;
 }
 
-int _media_thumb_get_exif_info(ExifData *ed, char *buf, int max_size, int *value,
-                    int ifdtype, long tagtype)
+int _media_thumb_get_exif_info(ExifData *ed, char *buf, int max_size, int *value, int ifdtype, long tagtype)
 {
        ExifEntry *entry;
        ExifIfd ifd;
@@ -190,7 +189,7 @@ static int _media_thumb_get_data_from_exif(ExifData *ed,
        if (entry) {
                /* Get the contents of the tag in human-readable form */
                char width[10] = {0,};
-               exif_entry_get_value(entry,width,10);
+               exif_entry_get_value(entry, width, 10);
 
                *thumb_width = atoi(width);
        } else {
@@ -202,8 +201,8 @@ static int _media_thumb_get_data_from_exif(ExifData *ed,
        entry = exif_content_get_entry(ed->ifd[ifd], tag);
        if (entry) {
                /* Get the contents of the tag in human-readable form */
-               char height[10] = {0,};
-               exif_entry_get_value(entry,height,10);
+               char height[10] = {0, };
+               exif_entry_get_value(entry, height, 10);
 
                *thumb_height = atoi(height);
        } else {
@@ -220,7 +219,7 @@ static int _media_thumb_get_data_from_exif(ExifData *ed,
 
        if (entry) {
                char width[10] = {0,};
-               exif_entry_get_value(entry,width,10);
+               exif_entry_get_value(entry, width, 10);
 
                *origin_width = atoi(width);
        } else {
@@ -232,8 +231,8 @@ static int _media_thumb_get_data_from_exif(ExifData *ed,
        entry = exif_content_get_entry(ed->ifd[ifd], tag);
 
        if (entry) {
-               char height[10] = {0,};
-               exif_entry_get_value(entry,height,10);
+               char height[10] = {0, };
+               exif_entry_get_value(entry, height, 10);
 
                *origin_height = atoi(height);
        } else {
@@ -266,7 +265,7 @@ int _media_thumb_get_thumb_from_exif(ExifData *ed,
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
-       err =  _media_thumb_get_data_from_exif(ed,
+       err = _media_thumb_get_data_from_exif(ed,
                                                                                &thumb,
                                                                                &size,
                                                                                &thumb_width,
@@ -364,7 +363,7 @@ int _media_thumb_get_thumb_from_exif(ExifData *ed,
                        SAFE_FREE(decoded.data);
                        return MS_MEDIA_ERR_INVALID_PARAMETER;
                }
-       }else {
+       } else {
                /*in this case, just write raw data in file */
                thumb_dbg_slog("Thumb is :%s", thumb_path);
 
@@ -442,7 +441,7 @@ int _media_thumb_resize_data(unsigned char *src_data,
        thumb_info->width = thumb_width;
        thumb_info->height = thumb_height;
        thumb_info->data = malloc(buf_size);
-       if(thumb_info->data != NULL) {
+       if (thumb_info->data != NULL) {
                memcpy(thumb_info->data, dst, buf_size);
        } else {
                thumb_err("malloc fails");
@@ -457,7 +456,7 @@ int _media_thumb_resize_data(unsigned char *src_data,
 int _media_thumb_get_wh_with_evas(const char *origin_path, int *width, int *height)
 {
        /* using evas to get w/h */
-       Ecore_Evas *ee =        ecore_evas_buffer_new(0, 0);
+       Ecore_Evas *ee = ecore_evas_buffer_new(0, 0);
        if (!ee) {
                thumb_err("ecore_evas_buffer_new fails");
                return MS_MEDIA_ERR_INTERNAL;
@@ -606,7 +605,7 @@ int _media_thumb_decode_with_evas(const char *origin_path,
        thumb_info->height = thumb_height;
        thumb_info->data = malloc(buf_size);
        if (thumb_info->data == NULL) {
-               thumb_err("Failed to allocate memory" );
+               thumb_err("Failed to allocate memory");
                ecore_evas_free(resize_img_ee);
                ecore_evas_free(target_ee);
 
@@ -628,7 +627,7 @@ int _media_thumb_decode_with_evas(const char *origin_path,
 
 mm_util_img_format _media_thumb_get_format(media_thumb_format src_format)
 {
-       switch(src_format) {
+       switch (src_format) {
                case MEDIA_THUMB_BGRA:
                        return MM_UTIL_IMG_FMT_BGRA8888;
                case MEDIA_THUMB_RGB888:
@@ -1008,7 +1007,7 @@ int _media_thumb_image(const char *origin_path,
 
        err = ImgGetImageInfoForThumb(origin_path, &image_type, &origin_w, &origin_h);
 
-       if (err != MS_MEDIA_ERR_NONE){
+       if (err != MS_MEDIA_ERR_NONE) {
                thumb_warn("Getting image info is failed err: %d", err);
        }
 
@@ -1026,7 +1025,7 @@ int _media_thumb_image(const char *origin_path,
        if (image_type == IMG_CODEC_AGIF) {
                err = _media_thumb_agif(origin_path, origin_w, origin_h, thumb_width, thumb_height, format, thumb_info);
        } else if (image_type == IMG_CODEC_JPEG) {
-               if(is_req_raw == TRUE) {
+               if (is_req_raw == TRUE) {
                        err = _media_thumb_jpeg_for_raw(origin_path, thumb_path, thumb_width, thumb_height, format, thumb_info);
                } else {
                        err = _media_thumb_jpeg(origin_path, thumb_path, thumb_width, thumb_height, format, thumb_info);
@@ -1095,7 +1094,7 @@ int _media_thumb_video(const char *origin_path,
 
        is_drm = drm_type;
 
-       /* Get Content Tag attribute for orientatin  */
+       /* Get Content Tag attribute for orientatin */
        MMHandleType tag = (MMHandleType) NULL;
        char *p = NULL;
        int cdis_value = 0;
@@ -1110,9 +1109,9 @@ int _media_thumb_video(const char *origin_path,
                        } else {
                                if (strncmp(p, "90", size) == 0) {
                                        rot_type = MM_UTIL_ROTATE_90;
-                               } else if(strncmp(p, "180", size) == 0) {
+                               } else if (strncmp(p, "180", size) == 0) {
                                        rot_type = MM_UTIL_ROTATE_180;
-                               } else if(strncmp(p, "270", size) == 0) {
+                               } else if (strncmp(p, "270", size) == 0) {
                                        rot_type = MM_UTIL_ROTATE_270;
                                } else {
                                        rot_type = MM_UTIL_ROTATE_0;
@@ -1216,7 +1215,7 @@ int _media_thumb_video(const char *origin_path,
                        thumb_info->height = height;
                        thumb_info->data = malloc(size);
                        if (thumb_info->data == NULL) {
-                               thumb_err("memory allcation failed" );
+                               thumb_err("memory allcation failed");
                                mm_file_destroy_content_attrs(content);
                                return MS_MEDIA_ERR_OUT_OF_MEMORY;
                        }
@@ -1287,26 +1286,23 @@ static char* _media_thumb_mmc_get_path(uid_t uid)
 {
        char *result_psswd = NULL;
        struct group *grpinfo = NULL;
-       if(uid == getuid())
-       {
+       if (uid == getuid()) {
                result_psswd = strdup(THUMB_MMC_PATH);
                grpinfo = getgrnam("users");
-               if(grpinfo == NULL) {
+               if (grpinfo == NULL) {
                        thumb_err("getgrnam(users) returns NULL !");
-                       if(result_psswd)
+                       if (result_psswd)
                                free(result_psswd);
                        return NULL;
                }
-       }
-       else
-       {
+       } else {
                struct passwd *userinfo = getpwuid(uid);
-               if(userinfo == NULL) {
+               if (userinfo == NULL) {
                        thumb_err("getpwuid(%d) returns NULL !", uid);
                        return NULL;
                }
                grpinfo = getgrnam("users");
-               if(grpinfo == NULL) {
+               if (grpinfo == NULL) {
                        thumb_err("getgrnam(users) returns NULL !");
                        return NULL;
                }
@@ -1325,26 +1321,23 @@ static char* _media_thumb_phone_get_path(uid_t uid)
 {
        char *result_psswd = NULL;
        struct group *grpinfo = NULL;
-       if(uid == getuid())
-       {
+       if (uid == getuid()) {
                result_psswd = strdup(THUMB_PHONE_PATH);
                grpinfo = getgrnam("users");
-               if(grpinfo == NULL) {
+               if (grpinfo == NULL) {
                        thumb_err("getgrnam(users) returns NULL !");
-                       if(result_psswd)
+                       if (result_psswd)
                                free(result_psswd);
                        return NULL;
                }
-       }
-       else
-       {
+       } else {
                struct passwd *userinfo = getpwuid(uid);
-               if(userinfo == NULL) {
+               if (userinfo == NULL) {
                        thumb_err("getpwuid(%d) returns NULL !", uid);
                        return NULL;
                }
                grpinfo = getgrnam("users");
-               if(grpinfo == NULL) {
+               if (grpinfo == NULL) {
                        thumb_err("getgrnam(users) returns NULL !");
                        return NULL;
                }
@@ -1368,10 +1361,8 @@ int _media_thumb_get_hash_name(const char *file_full_path,
        int ret_len = 0;
        media_thumb_store_type store_type = -1;
 
-       if (file_full_path == NULL || thumb_hash_path == NULL
-           || max_thumb_path <= 0) {
-               thumb_err
-                   ("file_full_path==NULL || thumb_hash_path == NULL || max_thumb_path <= 0");
+       if (file_full_path == NULL || thumb_hash_path == NULL || max_thumb_path <= 0) {
+               thumb_err("file_full_path==NULL || thumb_hash_path == NULL || max_thumb_path <= 0");
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
@@ -1387,8 +1378,7 @@ int _media_thumb_get_hash_name(const char *file_full_path,
        }*/
 
        hash_name = _media_thumb_generate_hash_name(file_full_path);
-       if(hash_name == NULL)
-       {
+       if (hash_name == NULL) {
                thumb_err("_media_thumb_generate_hash_name fail");
                return MS_MEDIA_ERR_INTERNAL;
        }
@@ -1417,7 +1407,7 @@ int _media_thumb_save_to_file_with_evas(unsigned char *data,
                                                                                        int alpha,
                                                                                        char *thumb_path)
 {
-       Ecore_Evas *ee =        ecore_evas_buffer_new(w, h);
+       Ecore_Evas *ee = ecore_evas_buffer_new(w, h);
        if (ee == NULL) {
                thumb_err("ecore_evas_buffer_new failed");
                return MS_MEDIA_ERR_INTERNAL;
index 0920eec..f378f14 100755 (executable)
@@ -43,8 +43,7 @@ int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_pat
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
-       if (!g_file_test
-           (origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+       if (!g_file_test(origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
                        thumb_err("Original path(%s) doesn't exist.", origin_path);
                        return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
@@ -104,8 +103,7 @@ int thumbnail_request_from_db_async(const char *origin_path, ThumbFunc func, voi
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
-       if (!g_file_test
-           (origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+       if (!g_file_test(origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
                        thumb_err("Original path(%s) doesn't exist.", origin_path);
                        return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
@@ -148,15 +146,14 @@ int thumbnail_request_extract_raw_data_async(int request_id, const char *origin_
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
-       if (!g_file_test
-           (origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+       if (!g_file_test(origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
                        thumb_err("Original path(%s) doesn't exist.", origin_path);
                        return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
        thumb_dbg_slog("Path : %s", origin_path);
 
        thumbRawUserData *userData = (thumbRawUserData*)malloc(sizeof(thumbRawUserData));
-       if(userData == NULL) {
+       if (userData == NULL) {
                thumb_err("userData malloc failed : %d", err);
                return MS_MEDIA_ERR_OUT_OF_MEMORY;
        }
@@ -182,7 +179,7 @@ int thumbnail_request_cancel_media(const char *origin_path)
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
-       err = _media_thumb_request_async(THUMB_REQUEST_CANCEL_MEDIA,  origin_path, NULL, 0);
+       err = _media_thumb_request_async(THUMB_REQUEST_CANCEL_MEDIA, origin_path, NULL, 0);
        if (err != MS_MEDIA_ERR_NONE) {
                thumb_err("_media_thumb_request failed : %d", err);
                return err;
@@ -213,7 +210,7 @@ int thumbnail_request_cancel_all(bool is_raw_data)
 {
        int err = MS_MEDIA_ERR_NONE;
 
-       if(is_raw_data) {
+       if (is_raw_data) {
                err = _media_thumb_request_cancel_all(true);
        } else {
                err = _media_thumb_request_cancel_all(false);
index 06f028a..a079cf2 100755 (executable)
@@ -274,7 +274,7 @@ int _media_thumb_db_connect(uid_t uid)
 {
        int err = MS_MEDIA_ERR_NONE;
 
-       err = media_db_connect(&db_handle,uid, FALSE);
+       err = media_db_connect(&db_handle, uid, FALSE);
        if (err != MS_MEDIA_ERR_NONE) {
                thumb_err("media_db_connect failed: %d", err);
                db_handle = NULL;
@@ -411,7 +411,7 @@ int _media_thumb_update_db(const char *origin_path,
        }
 #else
        if (media_type == THUMB_IMAGE_TYPE && width > 0 && height > 0) {
-               err = _media_thumb_update_thumb_path_wh_to_db(db_handle, origin_path, thumb_path, width, height,uid);
+               err = _media_thumb_update_thumb_path_wh_to_db(db_handle, origin_path, thumb_path, width, height, uid);
                if (err < 0) {
                        thumb_err("_media_thumb_update_wh_to_db (%s) failed: %d", origin_path, err);
                        return err;
index d1c49f1..d2ba657 100755 (executable)
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
                int origin_h = 0;
                int alpha = FALSE;
                bool is_saved = FALSE;
-        char *thumb_path = "thumbnail_path.jpg";
+               char *thumb_path = "thumbnail_path.jpg";
 
                media_thumb_format thumb_format = MEDIA_THUMB_BGRA;
                //media_thumb_format thumb_format = MEDIA_THUMB_RGB888;