* @see mm_util_bmp_data
* @since R1, 1.0
*/
-int mm_util_decode_from_bmp_memory(mm_util_bmp_data * decoded, void **memory, unsigned long long src_size);
-
-#if 0
-/**
- * This function gets the width of the decoded image.
- * This should be called after the actual decoding.
- *
- * @param data [in] pointer of mm_util_bmp_data.
- * @return Width of the decoded image.
- * @remark
- * @see mm_util_bmp_data
- * @since R1, 1.0
- */
-unsigned long mm_util_bmp_decode_get_width(mm_util_bmp_data * data);
-
-/**
- * This function gets the height of the decoded image.
- * This should be called after the actual decoding.
- *
- * @param data [in] pointer of mm_util_bmp_data.
- * @return Height of the decoded image.
- * @remark
- * @see mm_util_bmp_data
- * @since R1, 1.0
- */
-unsigned long mm_util_bmp_decode_get_height(mm_util_bmp_data * data);
-
-/**
- * This function gets the size of the decoded image.
- * This should be called after the actual decoding.
- *
- * @param data [in] pointer of mm_util_bmp_data.
- * @return Size of the decoded image.
- * @remark
- * @see mm_util_bmp_data
- * @since R1, 1.0
- */
-unsigned long long mm_util_bmp_decode_get_size(mm_util_bmp_data * data);
-#endif
+int mm_util_decode_from_bmp_memory(mm_util_bmp_data * decoded, void *memory, unsigned long long src_size);
/**
* This function encodes raw data to bmp file
return ret;
}
-int mm_util_decode_from_bmp_memory(mm_util_bmp_data *decoded, void **memory, unsigned long long src_size)
+int mm_util_decode_from_bmp_memory(mm_util_bmp_data *decoded, void *memory, unsigned long long src_size)
{
int ret;
mm_util_debug("mm_util_decode_from_gif_file");
- ret = __read_bmp(decoded, NULL, *memory, src_size);
+ ret = __read_bmp(decoded, NULL, memory, src_size);
return ret;
}
-#if 0
-unsigned long mm_util_decode_get_width(mm_util_bmp_data *data)
-{
- return data->width;
-}
-
-unsigned long mm_util_decode_get_height(mm_util_bmp_data *data)
-{
- return data->height;
-}
-
-unsigned long long mm_util_decode_get_size(mm_util_bmp_data *data)
-{
- return data->size;
-}
-#endif
-
int mm_util_encode_bmp_to_file(mm_util_bmp_data *encoded, const char *filename)
{
bmpfile_t *bmp;
*
* @param decoded [out] pointer of mm_util_gif_data.
* After using it, please free the allocated memory.
- * @param filename [in] input file memory, encoded stream file
+ * @param memory [in] input file memory, encoded stream file
* @return This function returns zero on success, or negative value with error code.
* @remark
* @see mm_util_gif_data
* @since R1, 1.0
*/
-int mm_util_decode_from_gif_memory(mm_util_gif_data * decoded, void **memory);
+int mm_util_decode_from_gif_memory(mm_util_gif_data * decoded, void *memory);
/**
* This function creates gif file for output file
return ret;
}
-int mm_util_decode_from_gif_memory(mm_util_gif_data *decoded, void **memory)
+int mm_util_decode_from_gif_memory(mm_util_gif_data *decoded, void *memory)
{
int ret;
mm_util_debug("mm_util_decode_from_gif_memory");
- ret = __read_gif(decoded, NULL, *memory);
+ ret = __read_gif(decoded, NULL, memory);
return ret;
}
void *data; /**< data */
} mm_util_png_data;
-#if 0
-/**
- * This function checks if the given file is a png file.
- *
- * @param filename [in] file name
- * @return This function returns 1 if file is png, or 0 if not a png.
- * @remark
- * @see
- * @since R1, 1.0
- */
-bool mm_util_check_if_png(const char *fpath);
-#endif
/**
* This function extracts raw data from png file
*
* @see mm_util_png_data, mm_util_init_decode_png
* @since R1, 1.0
*/
-int mm_util_decode_from_png_memory(mm_util_png_data * decoded, void **memory, unsigned long long src_size);
+int mm_util_decode_from_png_memory(mm_util_png_data * decoded, void *memory, unsigned long long src_size);
/**
* This function initializes the values of mm_util_png.
*/
void mm_util_init_decode_png(mm_util_png_data * data);
-#if 0
-/**
- * This function sets if the decoding should be done progressively.
- * This function should be called after mm_util_init_decode_png.
- *
- * @param data [in] pointer of mm_util_png_data.
- * @param progressive [in] If decoding should be done progressively.
- * @return None.
- * @remark
- * @see mm_util_png, mm_util_png_data, mm_util_init_decode_png
- * @since R1, 1.0
- */
-void mm_util_png_decode_set_progressive(mm_util_png_data * data, int progressive);
-
-/**
- * This function sets the amount of bytes to process at a time for progressive decoding.
- * This function should be called only if mm_util_decode_set_progressive is set.
- *
- * @param data [in] pointer of mm_util_png_data.
- * @param progressive_bytes [in] Number of bytes to process at a time.
- * @return None.
- * @remark
- * @see mm_util_png, mm_util_png_data, mm_util_decode_set_progressive
- * @since R1, 1.0
- */
-void mm_util_png_decode_set_progressive_bytes(mm_util_png_data * data, int progressive_bytes);
-
-/**
- * This function sets the transform mask for decoding using high level interface.
- * This should be set for non progressive decoding.
- *
- * @param data [in] pointer of mm_util_png_data.
- * @param transform [in] Transform mask for decoding.
- * @return None.
- * @remark
- * @see mm_util_png, mm_util_png_data, mm_util_png_transform_type
- * @since R1, 1.0
- */
-void mm_util_png_decode_set_transform(mm_util_png_data * data, int transform);
-
-/**
- * This function gets the width of the decoded image.
- * This should be called after the actual decoding.
- *
- * @param data [in] pointer of mm_util_png_data.
- * @return Width of the decoded image.
- * @remark
- * @see mm_util_png_data
- * @since R1, 1.0
- */
-png_uint_32 mm_util_png_decode_get_width(mm_util_png_data * data);
-
-/**
- * This function gets the height of the decoded image.
- * This should be called after the actual decoding.
- *
- * @param data [in] pointer of mm_util_png_data.
- * @return Height of the decoded image.
- * @remark
- * @see mm_util_png_data
- * @since R1, 1.0
- */
-png_uint_32 mm_util_png_decode_get_height(mm_util_png_data * data);
-
-/**
- * This function gets the bit depth of the decoded image.
- * This should be called after the actual decoding.
- *
- * @param data [in] pointer of mm_util_png_data.
- * @return Bit depth of the decoded image.
- * @remark
- * @see mm_util_png, mm_util_png_data
- * @since R1, 1.0
- */
-int mm_util_png_decode_get_bit_depth(mm_util_png_data * data);
-
-/**
- * This function gets the size of the decoded image.
- * This should be called after the actual decoding.
- *
- * @param data [in] pointer of mm_util_png_data.
- * @return Size of the decoded image.
- * @remark
- * @see mm_util_png, mm_util_png_data
- * @since R1, 1.0
- */
-png_uint_32 mm_util_png_decode_get_size(mm_util_png_data * data);
-#endif
-
/**
* This function extracts raw data to png file
*
png_size_t size;
} read_data;
-#if 0
-bool mm_util_check_if_png(const char *fpath)
-{
- char buf[MM_UTIL_PNG_BYTES_TO_CHECK];
- FILE *fp;
-
- mm_util_debug("mm_util_check_if_png");
- if ((fp = fopen(fpath, "rb")) == NULL)
- return MM_UTIL_ERROR_NO_SUCH_FILE;
-
- if (fread(buf, 1, MM_UTIL_PNG_BYTES_TO_CHECK, fp) != MM_UTIL_PNG_BYTES_TO_CHECK) {
- fclose(fp);
- return 0;
- }
-
- fclose(fp);
- fp = NULL;
- return png_check_sig((void *)buf, MM_UTIL_PNG_BYTES_TO_CHECK);
-}
-#endif
-
static void __user_error_fn(png_structp png_ptr, png_const_charp error_msg)
{
mm_util_error("%s", error_msg);
mm_util_debug("and we are done reading this image");
}
-static int __read_png_progressive(mm_util_png_data *decoded, FILE * fp, void **memory, unsigned long long src_size)
+static int __read_png_progressive(mm_util_png_data *decoded, FILE * fp, void *memory, unsigned long long src_size)
{
png_structp png_ptr;
png_infop info_ptr;
if (fp) {
if (!(bytes_read = fread(buf, 1, decoded->png.progressive_bytes, fp)))
break;
- } else if (*memory) {
+ } else if (memory) {
unsigned long long length = src_size - old_length;
if (length == 0)
else
bytes_read = length;
- memcpy(buf, *memory + old_length, bytes_read);
+ memcpy(buf, memory + old_length, bytes_read);
old_length += bytes_read;
} else
return ret;
}
-int mm_util_decode_from_png_memory(mm_util_png_data *decoded, void **memory, unsigned long long src_size)
+int mm_util_decode_from_png_memory(mm_util_png_data *decoded, void *memory, unsigned long long src_size)
{
int ret = MM_UTIL_ERROR_NONE;
if (decoded->png.progressive)
ret = __read_png_progressive(decoded, NULL, memory, src_size);
else
- ret = __read_png(decoded, NULL, *memory);
+ ret = __read_png(decoded, NULL, memory);
return ret;
}
data->png.transform = MM_UTIL_PNG_TRANSFORM_IDENTITY;
}
-#if 0
-void mm_util_png_decode_set_progressive(mm_util_png_data *data, int progressive)
-{
- data->png.progressive = progressive;
-}
-
-void mm_util_png_decode_set_progressive_bytes(mm_util_png_data *data, int progressive_bytes)
-{
- data->png.progressive_bytes = progressive_bytes;
-}
-
-void mm_util_png_decode_set_transform(mm_util_png_data *data, int transform)
-{
- data->png.transform = transform;
-}
-
-png_uint_32 mm_util_png_decode_get_width(mm_util_png_data *data)
-{
- return data->width;
-}
-
-png_uint_32 mm_util_png_decode_get_height(mm_util_png_data *data)
-{
- return data->height;
-}
-
-int mm_util_png_decode_get_bit_depth(mm_util_png_data *data)
-{
- return data->png.bit_depth;
-}
-
-png_uint_32 mm_util_png_decode_get_size(mm_util_png_data *data)
-{
- return data->size;
-}
-#endif
static void user_flush_data(png_structp png_ptr G_GNUC_UNUSED)
{
+ /* do nothing */
}
static void user_write_data(png_structp png_ptr, png_bytep data, png_uint_32 length)