Use size_t for Width and Height to conform eglodepng_decode prototype.

This commit is contained in:
Jief L 2020-03-29 13:35:09 +03:00
parent 22b9a6013b
commit b605d0d3bb
4 changed files with 7 additions and 9 deletions

View File

@ -46,8 +46,8 @@ typedef struct {
class XImage class XImage
{ {
protected: protected:
UINTN Width; size_t Width;
UINTN Height; size_t Height;
XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL> PixelData; XArray<EFI_GRAPHICS_OUTPUT_BLT_PIXEL> PixelData;
public: public:

View File

@ -856,7 +856,8 @@ EG_IMAGE * egEnsureImageSize(IN EG_IMAGE *Image, IN INTN Width, IN INTN Height,
EG_IMAGE * egDecodePNG(IN UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN WantAlpha) { EG_IMAGE * egDecodePNG(IN UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN WantAlpha) {
EG_IMAGE *NewImage = NULL; EG_IMAGE *NewImage = NULL;
UINTN Error, i, ImageSize, Width, Height; UINTN Error, i, ImageSize;
size_t Width, Height;
EG_PIXEL *PixelData; EG_PIXEL *PixelData;
EG_PIXEL *Pixel, *PixelD; EG_PIXEL *Pixel, *PixelD;
@ -873,7 +874,7 @@ EG_IMAGE * egDecodePNG(IN UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN W
return NULL; return NULL;
} }
if (!PixelData || Width > 4096U || Height > 4096U) { if (!PixelData || Width > 4096U || Height > 4096U) {
DBG("egDecodePNG(%p, %llu, %c): eglodepng_decode returned suspect values, PixelData %p, Width %llu, Height %llu\n", DBG("egDecodePNG(%p, %llu, %c): eglodepng_decode returned suspect values, PixelData %p, Width %zu, Height %zu\n",
FileData, FileDataLength, WantAlpha?'Y':'N', PixelData, Width, Height); FileData, FileDataLength, WantAlpha?'Y':'N', PixelData, Width, Height);
} }

View File

@ -37,7 +37,9 @@
#ifndef __LIBEG_LIBEG_H__ #ifndef __LIBEG_LIBEG_H__
#define __LIBEG_LIBEG_H__ #define __LIBEG_LIBEG_H__
#ifndef USE_XTHEME
#define USE_XTHEME 1 #define USE_XTHEME 1
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -39,11 +39,6 @@ freely, subject to the following restrictions:
//#define LODEPNG_NO_COMPILE_ANCILLARY_CHUNKS //#define LODEPNG_NO_COMPILE_ANCILLARY_CHUNKS
//#define LODEPNG_NO_COMPILE_CPP //#define LODEPNG_NO_COMPILE_CPP
// Microsoft compiler has built-in size_t
//#if !defined(_MSC_VER)
#define size_t UINTN
//#endif
extern const char* LODEPNG_VERSION_STRING; extern const char* LODEPNG_VERSION_STRING;