mm_util_debug("__save_buffer_to_gif");
+ if (GifFile == NULL) {
+ mm_util_error("Invalid parameter: GifFileType");
+ return MM_UTIL_ERROR_INVALID_PARAMETER;
+ }
+
/* Find closest color in first color map for the transparent color. */
color = OutputColorMap->Colors;
for (z = 0; z < OutputColorMap->ColorCount; z++) {
if (EGifPutImageDesc(GifFile, frame->x, frame->y, frame->width, frame->height, false, OutputColorMap) == GIF_ERROR) {
mm_util_error("could not put image description");
- if (GifFile != NULL)
- EGifCloseFile(GifFile, NULL);
+ EGifCloseFile(GifFile, NULL);
return MM_UTIL_ERROR_INVALID_OPERATION;
}
GifByteType *red = NULL, *green = NULL, *blue = NULL, *OutputBuffer = NULL;
ColorMapObject *OutputColorMap = NULL;
+ if (encoded->GifFile == NULL) {
+ mm_util_error("Invalid parameter");
+ return MM_UTIL_ERROR_INVALID_PARAMETER;
+ }
+
if (!encoded->screen_desc_updated) {
if (EGifPutScreenDesc(encoded->GifFile, encoded->frames[0]->width, encoded->frames[0]->height, 8, 0, NULL) == GIF_ERROR) {
mm_util_error("could not put screen description");
- if (encoded->GifFile != NULL)
- EGifCloseFile(encoded->GifFile, NULL);
+ EGifCloseFile(encoded->GifFile, NULL);
return MM_UTIL_ERROR_INVALID_OPERATION;
}
encoded->screen_desc_updated = true;
uint64_t src_size = 0;
uint64_t dst_size = 0;
bool sync_mode = (strcmp(argv[1], "sync") == 0) ? TRUE : FALSE;
- char *command = NULL;
- unsigned int src_width = atoi(argv[4]);
- unsigned int src_height = atoi(argv[5]);
+ char *filename = strdup(argv[2]);
+ char *command = strdup(argv[3]);
+ unsigned int src_width = (unsigned int)atoi(argv[4]);
+ unsigned int src_height = (unsigned int)atoi(argv[5]);
mm_util_img_format src_format = atoi(argv[6]);
- unsigned int dst_width = atoi(argv[7]);
- unsigned int dst_height = atoi(argv[8]);
+ unsigned int dst_width = (unsigned int)atoi(argv[7]);
+ unsigned int dst_height = (unsigned int)atoi(argv[8]);
mm_util_img_format dst_format = atoi(argv[9]);
mm_util_img_rotate_type rotation = atoi(argv[10]);
- mm_util_img_rotate_type start_x = atoi(argv[11]);
- mm_util_img_rotate_type start_y = atoi(argv[12]);
+ unsigned int start_x = (unsigned int)atoi(argv[11]);
+ unsigned int start_y = (unsigned int)atoi(argv[12]);
char output_file[40] = {};
/* async mode */
unsigned int size = 0;
- command = (char *)malloc(MAX_STRING_LEN);
- memset(command, 0x00, MAX_STRING_LEN);
- snprintf(command, MAX_STRING_LEN, "%s", argv[3]);
-
mm_util_debug("command: %s src_width: %d, src_height: %d, src_format: %d, dst_width: %d, dst_height: %d, dst_format:%d, rotation:%d", command, src_width, src_height, src_format, dst_width, dst_height, dst_format, rotation);
/* mem allocation for src dst buffer */
dst = malloc(dst_size);
{ /* read input file */
- FILE *fp = fopen(argv[2], "r");
+ FILE *fp = fopen(filename, "r");
if (fp == NULL) {
mm_util_debug("\tfile open failed %d\n", errno);
goto TEST_FAIL;
IMGP_FREE(src);
IMGP_FREE(dst);
IMGP_FREE(command);
+ IMGP_FREE(filename);
if (!sync_mode) {
media_format_unref(fmt);
mm_util_debug("Destory - src packet");