DestroyMagick();
}
-static int __mm_util_get_map(mm_util_color_format_e format, char **map)
+static const char * __mm_util_get_map(mm_util_color_format_e format)
{
- mm_util_retvm_if(map == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid map");
switch (format) {
case MM_UTIL_COLOR_RGB24:
- *map = g_strdup("RGB");
- break;
+ return "RGB";
case MM_UTIL_COLOR_ARGB:
- *map = g_strdup("ARGB");
- break;
+ return "ARGB";
case MM_UTIL_COLOR_BGRA:
- *map = g_strdup("BGRA");
- break;
+ return "BGRA";
case MM_UTIL_COLOR_RGBA:
- *map = g_strdup("RGBA");
- break;
+ return "RGBA";
default:
mm_util_error("Not supported format. [%d]", format);
- return MM_UTIL_ERROR_INVALID_PARAMETER;
+ return NULL;
}
-
- return MM_UTIL_ERROR_NONE;
}
static Image * __mm_util_constitute_image(mm_util_image_h handle)
{
- int ret = MM_UTIL_ERROR_NONE;
mm_image_info_s *_handle = (mm_image_info_s*)handle;
- char *map = NULL;
+ const char *map = NULL;
Image *_image = NULL;
ExceptionInfo exception;
mm_util_retvm_if(!handle, NULL, "invalid handle");
- ret = __mm_util_get_map(_handle->color, &map);
- mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, NULL, "fail to get map");
+ map = __mm_util_get_map(_handle->color);
+ mm_util_retvm_if(!map, NULL, "fail to get map");
GetExceptionInfo(&exception);
}
DestroyExceptionInfo(&exception);
- g_free(map);
mm_util_fleave();
void *pixels = NULL;
unsigned int width = 0;
unsigned int height = 0;
- char *map = NULL;
+ const char *map = NULL;
mm_util_fenter();
mm_util_retvm_if(!image, MM_UTIL_ERROR_INVALID_PARAMETER, "invalid image");
- ret = __mm_util_get_map(format, &map);
- mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "fail to get map");
+ map = __mm_util_get_map(format);
+ mm_util_retvm_if(!map, MM_UTIL_ERROR_INVALID_PARAMETER, "fail to get map");
GetExceptionInfo(&exception);
ERROR:
DestroyExceptionInfo(&exception);
- g_free(map);
mm_util_fleave();