GraphicsMagick: coders/tga.c Cleanup GCC compile warnings.
GraphicsMagick Commits <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.6007.1666184711.1459.graphicsmagick-commit@lists.sourceforge.net> |
changeset e21971c2d352 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=e21971c2d352 summary: coders/tga.c Cleanup GCC compile warnings. diffstat: ChangeLog | 5 +++++ coders/tga.c | 34 +++++++++++++--------------------- 2 files changed, 18 insertions(+), 21 deletions(-) diffs (85 lines): diff -r 30b8d06f0fbf -r e21971c2d352 ChangeLog --- a/ChangeLog Tue Oct 18 19:58:03 2022 +0200 +++ b/ChangeLog Wed Oct 19 15:04:44 2022 +0200 @@ -1,3 +1,8 @@ +2022-10-19 Fojtik Jaroslav <[email protected]> + + * coders/tga.c Cleanup GCC compile warnings. + + 2022-10-17 Fojtik Jaroslav <[email protected]> * coders/tga.c Do not consider whole image to be invalid when a second diff -r 30b8d06f0fbf -r e21971c2d352 coders/tga.c --- a/coders/tga.c Tue Oct 18 19:58:03 2022 +0200 +++ b/coders/tga.c Wed Oct 19 15:04:44 2022 +0200 @@ -396,7 +396,7 @@ is_grayscale=MagickFalse; unsigned char readbuffer[15]; - char commentbuffer[256]; + char CommentAndBuffer[256]; size_t readbufferpos = 0; @@ -508,7 +508,7 @@ /* Read TGA header information. */ - if(LoadHeaderTGA(&tga_info, image, commentbuffer) < 0) + if(LoadHeaderTGA(&tga_info, image, (unsigned char*)CommentAndBuffer) < 0) ThrowReaderException(CorruptImageError,UnexpectedEndOfFile,image); if(ValidateHeaderTGA(&tga_info) < 0) @@ -622,10 +622,10 @@ /* TGA image comment. */ - if (ReadBlob(image,tga_info.id_length,commentbuffer) != tga_info.id_length) + if (ReadBlob(image,tga_info.id_length,CommentAndBuffer) != tga_info.id_length) ThrowReaderException(CorruptImageError,UnexpectedEndOfFile,image); - commentbuffer[tga_info.id_length]='\0'; - (void) SetImageAttribute(image,"comment",commentbuffer); + CommentAndBuffer[tga_info.id_length]='\0'; + (void) SetImageAttribute(image,"comment",CommentAndBuffer); } (void) memset(&pixel,0,sizeof(PixelPacket)); pixel.opacity=TransparentOpacity; @@ -655,21 +655,13 @@ /* 5 bits each of red green and blue. */ - unsigned int - packet; - - if (ReadBlob(image, 2, readbuffer) != 2) - ThrowReaderException(CorruptImageError,UnexpectedEndOfFile,image); - readbufferpos = 0; - packet = ReadBlobByteFromBuffer(readbuffer, &readbufferpos); - packet |= (((unsigned int) ReadBlobByteFromBuffer(readbuffer, &readbufferpos)) << 8); - - pixel.red=(packet >> 10) & 0x1f; - pixel.red=ScaleCharToQuantum(ScaleColor5to8(pixel.red)); - pixel.green=(packet >> 5) & 0x1f; - pixel.green=ScaleCharToQuantum(ScaleColor5to8(pixel.green)); - pixel.blue=packet & 0x1f; - pixel.blue=ScaleCharToQuantum(ScaleColor5to8(pixel.blue)); + const magick_uint16_t packet = ReadBlobLSBShort(image); + pixel.red = (packet >> 10) & 0x1f; + pixel.red = ScaleCharToQuantum(ScaleColor5to8(pixel.red)); + pixel.green = (packet >> 5) & 0x1f; + pixel.green = ScaleCharToQuantum(ScaleColor5to8(pixel.green)); + pixel.blue = packet & 0x1f; + pixel.blue = ScaleCharToQuantum(ScaleColor5to8(pixel.blue)); break; } case 24: @@ -906,7 +898,7 @@ if (image->scene >= (image_info->subimage+image_info->subrange-1)) break; - if(LoadHeaderTGA(&tga_info, image, commentbuffer) < 0) + if(LoadHeaderTGA(&tga_info, image, (unsigned char*)CommentAndBuffer) < 0) status = MagickFalse; else {