#define _NOT_SUPPORTED_IMAGE_TYPE (-1)
#define IMG_HEADER_LENGTH 8
-static int _image_util_decode_read_header(const char *path, unsigned char **buffer)
+static int __image_util_decode_read_header(const char *path, unsigned char **buffer)
{
FILE *fp = NULL;
unsigned char *read_buffer = NULL;
return IMAGE_UTIL_ERROR_NONE;
}
-static int _image_util_decode_check_image_type(const unsigned char *image_buffer, image_util_type_e *image_type)
+static int __image_util_decode_check_image_type(const unsigned char *image_buffer, image_util_type_e *image_type)
{
static char _JPEG_HEADER[] = { 0xFF, 0xD8 };
static char _PNG_HEADER[] = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a };
image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if(!IMAGE_UTIL_STRING_VALID(path), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
- err = _image_util_decode_read_header(path, &image_header);
- image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "_image_util_decode_read_header failed");
+ err = __image_util_decode_read_header(path, &image_header);
+ image_util_retvm_if((err != IMAGE_UTIL_ERROR_NONE), err, "__image_util_decode_read_header failed");
- err = _image_util_decode_check_image_type(image_header, &_handle->image_type);
+ err = __image_util_decode_check_image_type(image_header, &_handle->image_type);
if (err != IMAGE_UTIL_ERROR_NONE) {
- image_util_error("_image_util_decode_check_image_type failed");
+ image_util_error("__image_util_decode_check_image_type failed");
IMAGE_UTIL_SAFE_FREE(image_header);
return err;
}
image_util_retvm_if(_handle == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if((src_buffer == NULL || src_size < IMG_HEADER_LENGTH), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input buffer");
- err = _image_util_decode_check_image_type(src_buffer, &_handle->image_type);
- image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "_image_util_decode_check_image_type failed");
+ err = __image_util_decode_check_image_type(src_buffer, &_handle->image_type);
+ image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "__image_util_decode_check_image_type failed");
IMAGE_UTIL_SAFE_FREE(_handle->src_buffer);
image_util_fenter();
- ret = _image_util_decode_read_header(file_path, &image_header);
- image_util_retvm_if((ret != IMAGE_UTIL_ERROR_NONE), ret, "_image_util_decode_read_header failed");
+ ret = __image_util_decode_read_header(file_path, &image_header);
+ image_util_retvm_if((ret != IMAGE_UTIL_ERROR_NONE), ret, "__image_util_decode_read_header failed");
- ret = _image_util_decode_check_image_type(image_header, &image_type);
+ ret = __image_util_decode_check_image_type(image_header, &image_type);
IMAGE_UTIL_SAFE_FREE(image_header);
- image_util_retvm_if((ret != IMAGE_UTIL_ERROR_NONE), ret, "_image_util_decode_check_image_type failed");
+ image_util_retvm_if((ret != IMAGE_UTIL_ERROR_NONE), ret, "__image_util_decode_check_image_type failed");
switch (image_type) {
case IMAGE_UTIL_JPEG:
image_util_fenter();
- ret = _image_util_decode_check_image_type(buffer, &image_type);
- image_util_retvm_if(ret != IMAGE_UTIL_ERROR_NONE, ret, "_image_util_decode_check_image_type failed");
+ ret = __image_util_decode_check_image_type(buffer, &image_type);
+ image_util_retvm_if(ret != IMAGE_UTIL_ERROR_NONE, ret, "__image_util_decode_check_image_type failed");
switch (image_type) {
case IMAGE_UTIL_JPEG:
return _image_error_capi(ret);
}
-gpointer _image_util_decode_thread(gpointer data)
+static gpointer __image_util_decode_thread(gpointer data)
{
decode_s *_handle = (decode_s *) data;
int ret = IMAGE_UTIL_ERROR_NONE;
return NULL;
}
-static int _image_util_decode_create_thread(decode_s * handle)
+static int __image_util_decode_create_thread(decode_s * handle)
{
image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if((handle->thread != NULL), IMAGE_UTIL_ERROR_INVALID_OPERATION, "A thread is alread running");
/*create threads */
- handle->thread = g_thread_new("decode_thread", (GThreadFunc) _image_util_decode_thread, (gpointer) handle);
+ handle->thread = g_thread_new("decode_thread", (GThreadFunc) __image_util_decode_thread, (gpointer) handle);
image_util_retvm_if((!handle->thread), IMAGE_UTIL_ERROR_INVALID_OPERATION, "ERROR - create thread");
return IMAGE_UTIL_ERROR_NONE;
_handle->_decode_cb->user_data = user_data;
_handle->_decode_cb->image_decode_completed_cb = completed_cb;
- err = _image_util_decode_create_thread(_handle);
+ err = __image_util_decode_create_thread(_handle);
if (err != IMAGE_UTIL_ERROR_NONE) {
IMAGE_UTIL_SAFE_FREE(_handle->_decode_cb);
_handle->_decode_cb = NULL;
_handle->decode2_cb->user_data = user_data;
_handle->decode2_cb->image_decode_completed_cb = callback;
- ret = _image_util_decode_create_thread(_handle);
+ ret = __image_util_decode_create_thread(_handle);
if (ret != IMAGE_UTIL_ERROR_NONE)
IMAGE_UTIL_SAFE_FREE(_handle->decode2_cb);
return _image_error_capi(ret);
}
-gpointer _image_util_encode_thread(gpointer data)
+static gpointer __image_util_encode_thread(gpointer data)
{
int ret = IMAGE_UTIL_ERROR_NONE;
encode_s *_handle = (encode_s *) data;
return NULL;
}
-static int _image_util_encode_create_thread(encode_s * handle)
+static int __image_util_encode_create_thread(encode_s * handle)
{
image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
image_util_retvm_if((handle->thread != NULL), IMAGE_UTIL_ERROR_INVALID_OPERATION, "The thread is alread running");
/*create threads */
- handle->thread = g_thread_new("encode_thread", (GThreadFunc) _image_util_encode_thread, (gpointer) handle);
+ handle->thread = g_thread_new("encode_thread", (GThreadFunc) __image_util_encode_thread, (gpointer) handle);
image_util_retvm_if((handle->thread == NULL), IMAGE_UTIL_ERROR_INVALID_OPERATION, "ERROR - create thread");
return IMAGE_UTIL_ERROR_NONE;
_handle->_encode_cb->user_data = user_data;
_handle->_encode_cb->image_encode_completed_cb = completed_cb;
- err = _image_util_encode_create_thread(_handle);
+ err = __image_util_encode_create_thread(_handle);
if (err != IMAGE_UTIL_ERROR_NONE) {
IMAGE_UTIL_SAFE_FREE(_handle->_encode_cb);
_handle->_encode_cb = NULL;
_handle->encode_to_file_cb->user_data = user_data;
_handle->encode_to_file_cb->image_encode_to_file_cb = completed_cb;
- ret = _image_util_encode_create_thread(_handle);
+ ret = __image_util_encode_create_thread(_handle);
if (ret != IMAGE_UTIL_ERROR_NONE) {
mm_image_destroy_image(_handle->new_src);
IMAGE_UTIL_SAFE_FREE(_handle->encode_to_file_cb);
_handle->encode_to_buffer_cb->user_data = user_data;
_handle->encode_to_buffer_cb->image_encode_to_buffer_cb = completed_cb;
- ret = _image_util_encode_create_thread(_handle);
+ ret = __image_util_encode_create_thread(_handle);
if (ret != IMAGE_UTIL_ERROR_NONE) {
mm_image_destroy_image(_handle->new_src);
IMAGE_UTIL_SAFE_FREE(_handle->encode_to_buffer_cb);