From ce94722f41898a88b37fb36a55a24c3b110e2ee2 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sat, 5 Jun 2021 22:23:37 -0700 Subject: [PATCH] Fix building C source as C++ apg_bmp used implicit void*->type* cast which compiles in C but not in C++. --- encoder/apg_bmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/encoder/apg_bmp.c b/encoder/apg_bmp.c index ef3d015..d342b20 100644 --- a/encoder/apg_bmp.c +++ b/encoder/apg_bmp.c @@ -247,7 +247,7 @@ unsigned char* apg_bmp_read( const char* filename, int* w, int* h, unsigned int* } // allocate memory for the output pixels block. cast to size_t in case width and height are both the max of 65536 and n_dst_chans > 1 - unsigned char* dst_img_ptr = malloc( (size_t)width * (size_t)height * (size_t)n_dst_chans ); + unsigned char* dst_img_ptr = (unsigned char*)malloc( (size_t)width * (size_t)height * (size_t)n_dst_chans ); if ( !dst_img_ptr ) { free( record.data ); return NULL; @@ -480,7 +480,7 @@ unsigned int apg_bmp_write( const char* filename, unsigned char* pixels_ptr, int dib_hdr.bitmask_b = 0x0000FF00; } - uint8_t* dst_pixels_ptr = malloc( dst_pixels_padded_sz ); + uint8_t* dst_pixels_ptr = (uint8_t*)malloc( dst_pixels_padded_sz ); if ( !dst_pixels_ptr ) { return 0; } { size_t dst_byte_idx = 0;