Skip to content

Commit 176c415

Browse files
committed
hold HeifPixelImage memory in uint8_t* instead of void*
1 parent beb414a commit 176c415

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

libheif/pixelimage.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ bool HeifPixelImage::ImagePlane::alloc(int width, int height, heif_channel_datat
207207
stride = (stride + alignment - 1U) & ~(alignment - 1U);
208208

209209
try {
210-
uint8_t* allocated_mem_8 = new uint8_t[m_mem_height * stride + alignment - 1];
211-
uint8_t* mem_8 = allocated_mem_8;
210+
allocated_mem = new uint8_t[m_mem_height * stride + alignment - 1];
211+
uint8_t* mem_8 = allocated_mem;
212212

213213
// shift beginning of image data to aligned memory position
214214

@@ -219,7 +219,6 @@ bool HeifPixelImage::ImagePlane::alloc(int width, int height, heif_channel_datat
219219
}
220220

221221
mem = mem_8;
222-
allocated_mem = allocated_mem_8;
223222

224223
return true;
225224
}

libheif/pixelimage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class HeifPixelImage : public std::enable_shared_from_this<HeifPixelImage>,
188188
int m_mem_height = 0;
189189

190190
void* mem = nullptr; // aligned memory start
191-
void* allocated_mem = nullptr; // unaligned memory we allocated
191+
uint8_t* allocated_mem = nullptr; // unaligned memory we allocated
192192
uint32_t stride = 0; // bytes per line
193193

194194
int get_bytes_per_pixel() const;

0 commit comments

Comments
 (0)