From 00515ba46f26743a99b7cf5b0d3b0666b62d7ca6 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sun, 14 Jul 2019 17:26:28 +0200 Subject: [PATCH] Use pointer instead. --- coders/tim2.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/coders/tim2.c b/coders/tim2.c index 8499a1816..eb0fe75d1 100644 --- a/coders/tim2.c +++ b/coders/tim2.c @@ -151,31 +151,26 @@ typedef enum % o exception: return any errors or warnings in this structure. % */ -static inline TIM2ImageHeader ReadTIM2ImageHeader(Image *image) +static inline void ReadTIM2ImageHeader(Image *image,TIM2ImageHeader *header) { - TIM2ImageHeader - image_header; - - image_header.total_size=ReadBlobLSBLong(image); - image_header.clut_size=ReadBlobLSBLong(image); - image_header.image_size=ReadBlobLSBLong(image); - image_header.header_size=ReadBlobLSBShort(image); - - image_header.clut_color_count=ReadBlobLSBShort(image); - image_header.img_format=(unsigned char) ReadBlobByte(image); - image_header.mipmap_count=(unsigned char) ReadBlobByte(image); - image_header.clut_type=(unsigned char) ReadBlobByte(image); - image_header.bpp_type=(unsigned char) ReadBlobByte(image); - - image_header.width=ReadBlobLSBShort(image); - image_header.height=ReadBlobLSBShort(image); - - image_header.GsTex0=ReadBlobMSBLongLong(image); - image_header.GsTex1=ReadBlobMSBLongLong(image); - image_header.GsRegs=ReadBlobMSBLong(image); - image_header.GsTexClut=ReadBlobMSBLong(image); - - return image_header; + header->total_size=ReadBlobLSBLong(image); + header->clut_size=ReadBlobLSBLong(image); + header->image_size=ReadBlobLSBLong(image); + header->header_size=ReadBlobLSBShort(image); + + header->clut_color_count=ReadBlobLSBShort(image); + header->img_format=(unsigned char) ReadBlobByte(image); + header->mipmap_count=(unsigned char) ReadBlobByte(image); + header->clut_type=(unsigned char) ReadBlobByte(image); + header->bpp_type=(unsigned char) ReadBlobByte(image); + + header->width=ReadBlobLSBShort(image); + header->height=ReadBlobLSBShort(image); + + header->GsTex0=ReadBlobMSBLongLong(image); + header->GsTex1=ReadBlobMSBLongLong(image); + header->GsRegs=ReadBlobMSBLong(image); + header->GsTexClut=ReadBlobMSBLong(image); } static inline Quantum GetChannelValue(unsigned int word,unsigned char channel, @@ -711,7 +706,7 @@ static Image *ReadTIM2Image(const ImageInfo *image_info,ExceptionInfo *exception TIM2ImageHeader image_header; - image_header=ReadTIM2ImageHeader(image); + ReadTIM2ImageHeader(image,&image_header); if (image_header.mipmap_count != 1) ThrowReaderException(CoderError,"NumberOfImagesIsNotSupported"); if (image_header.header_size < 48) -- 2.40.0