From: hj kim Date: Thu, 23 Aug 2018 02:12:53 +0000 (+0900) Subject: Just add some debug msg to track error X-Git-Tag: submit/tizen/20180823.021953^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F00%2F187400%2F1;p=platform%2Fcore%2Fapi%2Fimage-util.git Just add some debug msg to track error Change-Id: I3a4b84d7376cebdfd5bcb7d55c250dea44ebf0fb --- diff --git a/include/image_util_private.h b/include/image_util_private.h index 26f0569..036769c 100755 --- a/include/image_util_private.h +++ b/include/image_util_private.h @@ -53,7 +53,7 @@ extern "C" LOGD(FONT_COLOR_YELLOW""FONT_COLOR_RESET); \ } while (0) -#define image_util__fleave() do { \ +#define image_util_fleave() do { \ LOGD(FONT_COLOR_YELLOW""FONT_COLOR_RESET); \ } while (0) diff --git a/src/image_util_decode.c b/src/image_util_decode.c index 043b00a..eab8d36 100755 --- a/src/image_util_decode.c +++ b/src/image_util_decode.c @@ -206,24 +206,15 @@ int image_util_decode_set_input_buffer(image_util_decode_h handle, const unsigne IMAGE_UTIL_SAFE_FREE(_handle->path); err = _image_util_decode_check_image_type(src_buffer, &_handle->image_type); - if (err != IMAGE_UTIL_ERROR_NONE) { - image_util_error("_image_util_decode_check_image_type failed"); - return err; - } + image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "_image_util_decode_check_image_type failed"); err = _image_util_decode_create_image_handle(_handle); - if (err != IMAGE_UTIL_ERROR_NONE) { - image_util_error("_image_util_decode_create_image_handle failed"); - return err; - } + image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "_image_util_decode_create_image_handle failed"); IMAGE_UTIL_SAFE_FREE(_handle->src_buffer); _handle->src_buffer = (void *)calloc(1, sizeof(void *)); - if (_handle->src_buffer == NULL) { - image_util_error("The memory of input buffer was not allocated"); - return IMAGE_UTIL_ERROR_OUT_OF_MEMORY; - } + image_util_retvm_if(_handle->src_buffer == NULL, IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "The memory of input buffer was not allocated"); _handle->src_buffer[0] = (void *)src_buffer; _handle->src_size = src_size; @@ -235,6 +226,8 @@ int image_util_decode_set_output_buffer(image_util_decode_h handle, unsigned cha { decode_encode_s *_handle = (decode_encode_s *) handle; + image_util_fenter(); + IMAGE_UTIL_DECODE_HANDLE_CHECK(handle); image_util_retvm_if(dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter"); @@ -276,7 +269,11 @@ static int _image_util_decode_internal(decode_encode_s * _handle) { int err = MM_UTIL_ERROR_NONE; + image_util_fenter(); + image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "invalid parameter"); + image_util_retvm_if(_handle->dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output"); + switch (_handle->image_type) { case IMAGE_UTIL_JPEG: { @@ -293,6 +290,8 @@ static int _image_util_decode_internal(decode_encode_s * _handle) _handle->dst_size = (unsigned long long)jpeg_data.size; _handle->width = jpeg_data.width; _handle->height = jpeg_data.height; + } else { + image_util_error("fail to decode jpeg [%d]", err); } } break; @@ -311,6 +310,8 @@ static int _image_util_decode_internal(decode_encode_s * _handle) _handle->dst_size = (unsigned long long)png_data.size; _handle->width = png_data.width; _handle->height = png_data.height; + } else { + image_util_error("fail to decode png [%d]", err); } } break; @@ -329,6 +330,8 @@ static int _image_util_decode_internal(decode_encode_s * _handle) _handle->dst_size = gif_data.size; _handle->width = gif_data.width; _handle->height = gif_data.height; + } else { + image_util_error("fail to decode gif [%d]", err); } } break; @@ -347,14 +350,19 @@ static int _image_util_decode_internal(decode_encode_s * _handle) _handle->dst_size = (unsigned long long)bmp_data.size; _handle->width = bmp_data.width; _handle->height = bmp_data.height; + } else { + image_util_error("fail to decode bmp [%d]", err); } } break; default: + image_util_error("Not supported format [%d]", _handle->image_type); return IMAGE_UTIL_ERROR_INVALID_PARAMETER; break; } + image_util_debug("dst_buffer(%p) width (%lu) height (%lu) dst_size (%zu)", *(_handle->dst_buffer), _handle->width, _handle->height, _handle->dst_size); + return _image_error_capi(ERR_TYPE_DECODE, err); } @@ -368,11 +376,7 @@ int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsi image_util_retvm_if(_handle->dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output"); err = _image_util_decode_internal(_handle); - - if (err != IMAGE_UTIL_ERROR_NONE) { - image_util_error("Error - decode run"); - return err; - } + image_util_retvm_if(err != IMAGE_UTIL_ERROR_NONE, err, "fail to _image_util_decode_internal"); if (width) *width = _handle->width; @@ -389,6 +393,8 @@ gpointer _image_util_decode_thread(gpointer data) decode_encode_s *_handle = (decode_encode_s *) data; int err = IMAGE_UTIL_ERROR_NONE; + image_util_fenter(); + if (!_handle) { image_util_error("[ERROR] - handle"); return NULL; @@ -401,11 +407,13 @@ gpointer _image_util_decode_thread(gpointer data) image_util_error("Error - decode_internal"); if (_handle->_decode_cb) { - image_util_debug("completed_cb"); + image_util_debug("call completed_cb"); _handle->_decode_cb->image_decode_completed_cb(err, _handle->_decode_cb->user_data, _handle->width, _handle->height, _handle->dst_size); + } else { + image_util_error("No callback"); } - image_util_debug("exit thread"); + image_util_fleave(); return NULL; } @@ -430,6 +438,8 @@ int image_util_decode_run_async(image_util_decode_h handle, image_util_decode_co int err = IMAGE_UTIL_ERROR_NONE; decode_encode_s *_handle = (decode_encode_s *) handle; + image_util_fenter(); + IMAGE_UTIL_DECODE_HANDLE_CHECK(handle); image_util_retvm_if((_handle->path == NULL && _handle->src_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input"); image_util_retvm_if(_handle->dst_buffer == NULL, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid output"); @@ -453,6 +463,8 @@ int image_util_decode_run_async(image_util_decode_h handle, image_util_decode_co _handle->_decode_cb = NULL; } + image_util_fleave(); + return err; } @@ -460,7 +472,7 @@ int image_util_decode_destroy(image_util_decode_h handle) { decode_encode_s *_handle = (decode_encode_s *) handle; - image_util_debug("image_util_decode_destroy"); + image_util_fenter(); IMAGE_UTIL_DECODE_HANDLE_CHECK(handle); @@ -473,5 +485,7 @@ int image_util_decode_destroy(image_util_decode_h handle) IMAGE_UTIL_SAFE_FREE(_handle->src_buffer); IMAGE_UTIL_SAFE_FREE(_handle); + image_util_fleave(); + return IMAGE_UTIL_ERROR_NONE; }