replace g_memdup() to g_memdup2() 92/267892/2 accepted/tizen/unified/20211222.230459 submit/tizen/20211212.233427
authorJiyong Min <jiyong.min@samsung.com>
Mon, 13 Dec 2021 04:17:50 +0000 (13:17 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Mon, 13 Dec 2021 04:24:53 +0000 (13:24 +0900)
  - g_memdup() was removed in glib2

Change-Id: I6b2554e5e48d582c978d70dc097a60078fa52b6d

common/mm_util_image.c
gif/mm_util_gif.c
packaging/libmm-utility.spec
webp/mm_util_webp.c

index a09c4d5..cfd9f40 100755 (executable)
@@ -66,7 +66,7 @@ int mm_image_create_image(unsigned int width, unsigned int height,
        if (size == TEMP_DATA_SIZE)
                _image->data = (unsigned char *)data;
        else
-               _image->data = g_memdup(data, size);
+               _image->data = g_memdup2(data, size);
 
        _image->size = size;
        _image->width = width;
@@ -98,7 +98,7 @@ int mm_image_clone_image(mm_util_image_h src, mm_util_image_h *dst)
        if (_src->size == TEMP_DATA_SIZE)
                _dst->data = _src->data;
        else
-               _dst->data = g_memdup(_src->data, _dst->size);
+               _dst->data = g_memdup2(_src->data, _dst->size);
 
        *dst = (mm_util_image_h)_dst;
 
@@ -149,7 +149,7 @@ int mm_image_get_image(mm_util_image_h image, unsigned int *width,
                *color = _image->color;
 
        if (data && size) {
-               *data = g_memdup(_image->data, _image->size);
+               *data = g_memdup2(_image->data, _image->size);
                *size = _image->size;
        }
 
index 5311c1b..f0e652e 100644 (file)
@@ -111,7 +111,7 @@ static int __gif_generate_frame_buffer(GifFileType *gif_image, GifRowType **scre
 
        for (idx = 1; idx < (int)(gif_image->SHeight); idx++) {
                /* Allocate the other rows, and set their color to background too: */
-               _screen_buf[idx] = g_memdup(_screen_buf[0], row_size);
+               _screen_buf[idx] = g_memdup2(_screen_buf[0], row_size);
        }
 
        *screen_buf = _screen_buf;
@@ -478,7 +478,7 @@ static int __write_gif_to_buffer(gif_file_s *handle, void **buffer, size_t *buff
        mm_util_retvm_if(!handle->io_buf.buf || handle->io_buf.buf_size == 0, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid io_buf");
        mm_util_retvm_if(!buffer || !buffer_size, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid buffer");
 
-       *buffer = g_memdup(handle->io_buf.buf, handle->io_buf.buf_size);;
+       *buffer = g_memdup2(handle->io_buf.buf, handle->io_buf.buf_size);
        *buffer_size = handle->io_buf.buf_size;
 
        return MM_UTIL_ERROR_NONE;
index 1094f73..bc167b2 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.3.1
+Version:    0.3.2
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index fc27595..8822a2d 100644 (file)
@@ -317,7 +317,7 @@ int mm_util_webp_anim_enc_save_to_buffer(mm_util_webp_anim_enc_h anim_enc_h, voi
 
        ret = __mm_util_webp_anim_enc_save(anim_enc, &webp_data);
        if (ret == MM_UTIL_ERROR_NONE) {
-               *buf = g_memdup(webp_data.bytes, webp_data.size);
+               *buf = g_memdup2(webp_data.bytes, webp_data.size);
                *buf_size = webp_data.size;
        } else {
                mm_util_error("Error! __mm_util_webp_anim_enc_save(%d)", ret);