x = NULL; \
} while(0)
#define MMUTIL_SAFE_STRCPY(dst, src, n) g_strlcpy(dst, src, n)
-#define MMUTIL_STRING_VALID(str) (str != NULL && strlen(str) > 0)
+#define MMUTIL_STRING_VALID(str) (str != NULL && strlen(str) > 0)
/* for alignment */
#define MM_UTIL_ROUND_UP_2(num) (((num)+1)&~1)
#define MM_UTIL_ROUND_DOWN_4(num) ((num)&(~3))
#define MM_UTIL_ROUND_DOWN_16(num) ((num)&(~15))
-#define IS_VALID_COLOR(color) mm_util_is_valid_color_format(color)
+#define IS_VALID_COLOR(color) ((color >= MM_UTIL_COLOR_YUV420) && (color < MM_UTIL_COLOR_NUM))
#define IS_VALID_IMAGE(image) mm_image_is_valid_image(image)
typedef int (*ANIM_ENC_CREATE)(void *);
bool lossless;
} mm_util_enc_opt_t;
-bool mm_util_is_valid_color_format(mm_util_color_format_e color);
-
// for using fp like jpeg
int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp);
void mm_util_safe_fclose(FILE *fp);
#define IMAGE_UTIL_INI_PATH SYSCONFDIR"/multimedia/mmfw_image_util.ini"
-bool mm_util_is_valid_color_format(mm_util_color_format_e color)
-{
- if ((color < MM_UTIL_COLOR_YUV420) || (color >= MM_UTIL_COLOR_NUM)) {
- return false;
- }
- return true;
-}
-
int mm_util_safe_fopen(const char *path, const char *mode, FILE **fp)
{
char *_realpath = NULL;
mm_util_fenter();
mm_util_retvm_if(imgsize == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid imgsize");
- mm_util_retvm_if(IS_VALID_COLOR(format) == false, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid format(%u)", format);
+ mm_util_retvm_if(!IS_VALID_COLOR(format), MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid format(%u)", format);
mm_util_retvm_if(__check_valid_picture_size(width, height) != MM_UTIL_ERROR_NONE, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid width(%u) or height(%u)", width, height);
switch (format) {
mm_util_fenter();
mm_util_retvm_if(!MMUTIL_STRING_VALID(file_path), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid file_path");
- mm_util_retvm_if((IS_VALID_COLOR(fmt) == false), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
+ mm_util_retvm_if(!IS_VALID_COLOR(fmt), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
mm_util_retvm_if((!__mm_util_is_supported_color_format(fmt)), MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported fmt [%d]", fmt);
mm_util_retvm_if(!decoded, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid image handle");
mm_util_retvm_if(!memory, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid jpeg image");
mm_util_retvm_if(!src_size, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid src_size");
- mm_util_retvm_if((IS_VALID_COLOR(fmt) == false), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
+ mm_util_retvm_if(!IS_VALID_COLOR(fmt), MM_UTIL_ERROR_INVALID_PARAMETER, "invalid fmt [%d]", fmt);
mm_util_retvm_if((!__mm_util_is_supported_color_format(fmt)), MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported fmt [%d]", fmt);
mm_util_retvm_if(!decoded, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid image handle");