diff options
Diffstat (limited to 'libs/freeimage/src/FreeImage')
37 files changed, 592 insertions, 592 deletions
diff --git a/libs/freeimage/src/FreeImage/BitmapAccess.cpp b/libs/freeimage/src/FreeImage/BitmapAccess.cpp index e77344e1e1..4f5fea576a 100644 --- a/libs/freeimage/src/FreeImage/BitmapAccess.cpp +++ b/libs/freeimage/src/FreeImage/BitmapAccess.cpp @@ -85,7 +85,7 @@ FI_STRUCT (FREEIMAGEHEADER) { overall, but it requires quite some changes and it will render FreeImage_GetTransparencyTable obsolete in its current form; */ - BYTE transparent_table[256]; + uint8_t transparent_table[256]; /** number of transparent colors */ int transparency_count; /** TRUE if the image is transparent */ @@ -107,12 +107,12 @@ FI_STRUCT (FREEIMAGEHEADER) { /**@name external pixel buffer management */ //@{ /** pointer to user provided pixels, NULL otherwise */ - BYTE *external_bits; + uint8_t *external_bits; /** user provided pitch, 0 otherwise */ unsigned external_pitch; //@} - //BYTE filler[1]; // fill to 32-bit alignment + //uint8_t filler[1]; // fill to 32-bit alignment }; // ---------------------------------------------------------- @@ -201,7 +201,7 @@ This function includes a protection against malicious images, based on a KISS in @param height Image height @param bpp Number of bits-per-pixel @param need_masks We only store the masks (and allocate memory for them) for 16-bit images of type FIT_BITMAP -@return Returns a size in BYTE units +@return Returns a size in uint8_t units @see FreeImage_AllocateBitmap */ static size_t @@ -259,7 +259,7 @@ or NULL, if no masks are present (e.g. for 24 bit images). */ static FREEIMAGERGBMASKS * FreeImage_GetRGBMasks(FIBITMAP *dib) { - return FreeImage_HasRGBMasks(dib) ? (FREEIMAGERGBMASKS *)(((BYTE *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; + return FreeImage_HasRGBMasks(dib) ? (FREEIMAGERGBMASKS *)(((uint8_t *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; } /** @@ -288,7 +288,7 @@ like the ones used in low-level APIs like OpenCL or intrinsics. @return Returns the allocated FIBITMAP if successful, returns NULL otherwise */ static FIBITMAP * -FreeImage_AllocateBitmap(BOOL header_only, BYTE *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { +FreeImage_AllocateBitmap(BOOL header_only, uint8_t *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { // check input variables width = abs(width); @@ -381,7 +381,7 @@ FreeImage_AllocateBitmap(BOOL header_only, BYTE *ext_bits, unsigned ext_pitch, F return NULL; } - bitmap->data = (BYTE *)FreeImage_Aligned_Malloc(dib_size * sizeof(BYTE), FIBITMAP_ALIGNMENT); + bitmap->data = (uint8_t *)FreeImage_Aligned_Malloc(dib_size * sizeof(uint8_t), FIBITMAP_ALIGNMENT); if (bitmap->data != NULL) { memset(bitmap->data, 0, dib_size); @@ -438,9 +438,9 @@ FreeImage_AllocateBitmap(BOOL header_only, BYTE *ext_bits, unsigned ext_pitch, F // build a default greyscale palette (very useful for image processing) RGBQUAD *pal = FreeImage_GetPalette(bitmap); for(int i = 0; i < 256; i++) { - pal[i].rgbRed = (BYTE)i; - pal[i].rgbGreen = (BYTE)i; - pal[i].rgbBlue = (BYTE)i; + pal[i].rgbRed = (uint8_t)i; + pal[i].rgbGreen = (uint8_t)i; + pal[i].rgbBlue = (uint8_t)i; } } @@ -462,7 +462,7 @@ FreeImage_AllocateBitmap(BOOL header_only, BYTE *ext_bits, unsigned ext_pitch, F } FIBITMAP * DLL_CALLCONV -FreeImage_AllocateHeaderForBits(BYTE *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { +FreeImage_AllocateHeaderForBits(uint8_t *ext_bits, unsigned ext_pitch, FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { return FreeImage_AllocateBitmap(FALSE, ext_bits, ext_pitch, type, width, height, bpp, red_mask, green_mask, blue_mask); } @@ -538,7 +538,7 @@ FreeImage_Clone(FIBITMAP *dib) { unsigned bpp = FreeImage_GetBPP(dib); // if the FIBITMAP is a wrapper to a user provided pixel buffer, get a pointer to this buffer - const BYTE *ext_bits = ((FREEIMAGEHEADER *)dib->data)->external_bits; + const uint8_t *ext_bits = ((FREEIMAGEHEADER *)dib->data)->external_bits; // check for pixel availability ... BOOL header_only = FreeImage_HasPixels(dib) ? FALSE : TRUE; @@ -634,7 +634,7 @@ FreeImage_Clone(FIBITMAP *dib) { // ---------------------------------------------------------- -BYTE * DLL_CALLCONV +uint8_t * DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib) { if(!FreeImage_HasPixels(dib)) { return NULL; @@ -649,7 +649,7 @@ FreeImage_GetBits(FIBITMAP *dib) { lp += sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * FreeImage_GetColorsUsed(dib); lp += FreeImage_HasRGBMasks(dib) ? sizeof(DWORD) * 3 : 0; lp += (lp % FIBITMAP_ALIGNMENT ? FIBITMAP_ALIGNMENT - lp % FIBITMAP_ALIGNMENT : 0); - return (BYTE *)lp; + return (uint8_t *)lp; } // ---------------------------------------------------------- @@ -897,7 +897,7 @@ FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor) { if(bkgnd_color->rgbRed == pal[i].rgbRed) { if(bkgnd_color->rgbGreen == pal[i].rgbGreen) { if(bkgnd_color->rgbBlue == pal[i].rgbBlue) { - bkcolor->rgbReserved = (BYTE)i; + bkcolor->rgbReserved = (uint8_t)i; return TRUE; } } @@ -959,7 +959,7 @@ FreeImage_IsTransparent(FIBITMAP *dib) { return FALSE; } -BYTE * DLL_CALLCONV +uint8_t * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib) { return dib ? ((FREEIMAGEHEADER *)dib->data)->transparent_table : NULL; } @@ -981,7 +981,7 @@ FreeImage_GetTransparencyCount(FIBITMAP *dib) { } void DLL_CALLCONV -FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count) { +FreeImage_SetTransparencyTable(FIBITMAP *dib, uint8_t *table, int count) { if (dib) { count = MAX(0, MIN(count, 256)); if (FreeImage_GetBPP(dib) <= 8) { @@ -1022,7 +1022,7 @@ FreeImage_SetTransparentIndex(FIBITMAP *dib, int index) { if (dib) { int count = FreeImage_GetColorsUsed(dib); if (count) { - BYTE *new_tt = (BYTE *)malloc(count * sizeof(BYTE)); + uint8_t *new_tt = (uint8_t *)malloc(count * sizeof(uint8_t)); memset(new_tt, 0xFF, count); if ((index >= 0) && (index < count)) { new_tt[index] = 0x00; @@ -1049,7 +1049,7 @@ FreeImage_SetTransparentIndex(FIBITMAP *dib, int index) { int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib) { int count = FreeImage_GetTransparencyCount(dib); - BYTE *tt = FreeImage_GetTransparencyTable(dib); + uint8_t *tt = FreeImage_GetTransparencyTable(dib); for (int i = 0; i < count; i++) { if (tt[i] == 0) { return i; @@ -1140,7 +1140,7 @@ FreeImage_GetDIBSize(FIBITMAP *dib) { RGBQUAD * DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib) { - return (dib && FreeImage_GetBPP(dib) < 16) ? (RGBQUAD *)(((BYTE *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; + return (dib && FreeImage_GetBPP(dib) < 16) ? (RGBQUAD *)(((uint8_t *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL; } unsigned DLL_CALLCONV @@ -1206,7 +1206,7 @@ FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag // calculate the size of a METADATAHEADER const size_t header_size = sizeof(METADATAHEADER); - handle->data = (BYTE *)malloc(header_size); + handle->data = (uint8_t *)malloc(header_size); if(handle->data) { memset(handle->data, 0, header_size); diff --git a/libs/freeimage/src/FreeImage/CacheFile.cpp b/libs/freeimage/src/FreeImage/CacheFile.cpp index e98906d39e..51065f36bd 100644 --- a/libs/freeimage/src/FreeImage/CacheFile.cpp +++ b/libs/freeimage/src/FreeImage/CacheFile.cpp @@ -113,7 +113,7 @@ CacheFile::cleanupMemCache() { int CacheFile::allocateBlock() { Block *block = new Block; - block->data = new BYTE[BLOCK_SIZE]; + block->data = new uint8_t[BLOCK_SIZE]; block->next = 0; if (!m_free_pages.empty()) { @@ -144,7 +144,7 @@ CacheFile::lockBlock(int nr) { // again as soon as the memory buffer fills up if (m_current_block->data == NULL) { - m_current_block->data = new BYTE[BLOCK_SIZE]; + m_current_block->data = new uint8_t[BLOCK_SIZE]; fseek(m_file, m_current_block->nr * BLOCK_SIZE, SEEK_SET); fread(m_current_block->data, BLOCK_SIZE, 1, m_file); @@ -197,7 +197,7 @@ CacheFile::deleteBlock(int nr) { } BOOL -CacheFile::readFile(BYTE *data, int nr, int size) { +CacheFile::readFile(uint8_t *data, int nr, int size) { if ((data) && (size > 0)) { int s = 0; int block_nr = nr; @@ -223,7 +223,7 @@ CacheFile::readFile(BYTE *data, int nr, int size) { } int -CacheFile::writeFile(BYTE *data, int size) { +CacheFile::writeFile(uint8_t *data, int size) { if ((data) && (size > 0)) { int nr_blocks_required = 1 + (size / BLOCK_SIZE); int count = 0; diff --git a/libs/freeimage/src/FreeImage/ColorLookup.cpp b/libs/freeimage/src/FreeImage/ColorLookup.cpp index a96bead208..fd77895bad 100644 --- a/libs/freeimage/src/FreeImage/ColorLookup.cpp +++ b/libs/freeimage/src/FreeImage/ColorLookup.cpp @@ -26,9 +26,9 @@ typedef struct tagNamedColor { const char *name; //! color name - BYTE r; //! red value - BYTE g; //! green value - BYTE b; //! blue value + uint8_t r; //! red value + uint8_t g; //! green value + uint8_t b; //! blue value } NamedColor; // -------------------------------------------------------------------------- @@ -554,7 +554,7 @@ static NamedColor X11ColorMap[] = { BOOL DLL_CALLCONV -FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue) { +FreeImage_LookupX11Color(const char *szColor, uint8_t *nRed, uint8_t *nGreen, uint8_t *nBlue) { int i; // lookup color @@ -574,7 +574,7 @@ FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nB // grey<num>, or gray<num>, num 1...100 i = strtol(szColor+4, NULL, 10); - *nRed = (BYTE)(255.0/100.0 * i); + *nRed = (uint8_t)(255.0/100.0 * i); *nGreen = *nRed; *nBlue = *nRed; @@ -748,7 +748,7 @@ static NamedColor SVGColorMap[] = { BOOL DLL_CALLCONV -FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue) { +FreeImage_LookupSVGColor(const char *szColor, uint8_t *nRed, uint8_t *nGreen, uint8_t *nBlue) { int i; // lookup color @@ -768,7 +768,7 @@ FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nB // grey<num>, or gray<num>, num 1...100 i = strtol(szColor+4, NULL, 10); - *nRed = (BYTE)(255.0/100.0 * i); + *nRed = (uint8_t)(255.0/100.0 * i); *nGreen = *nRed; *nBlue = *nRed; return TRUE; diff --git a/libs/freeimage/src/FreeImage/Conversion.cpp b/libs/freeimage/src/FreeImage/Conversion.cpp index f8d8ce4512..7a700b2e48 100644 --- a/libs/freeimage/src/FreeImage/Conversion.cpp +++ b/libs/freeimage/src/FreeImage/Conversion.cpp @@ -74,9 +74,9 @@ BOOL SwapRedBlue32(FIBITMAP* dib) { const unsigned pitch = FreeImage_GetPitch(dib); const unsigned lineSize = FreeImage_GetLine(dib); - BYTE* line = FreeImage_GetBits(dib); + uint8_t* line = FreeImage_GetBits(dib); for(unsigned y = 0; y < height; ++y, line += pitch) { - for(BYTE* pixel = line; pixel < line + lineSize ; pixel += bytesperpixel) { + for(uint8_t* pixel = line; pixel < line + lineSize ; pixel += bytesperpixel) { INPLACESWAP(pixel[0], pixel[2]); } } @@ -94,7 +94,7 @@ assignRGB(WORD r, WORD g, WORD b, WORD* out) { } static inline void -assignRGB(BYTE r, BYTE g, BYTE b, BYTE* out) { +assignRGB(uint8_t r, uint8_t g, uint8_t b, uint8_t* out) { out[FI_RGBA_RED] = r; out[FI_RGBA_GREEN] = g; out[FI_RGBA_BLUE] = b; @@ -129,7 +129,7 @@ CMYKToRGB(T C, T M, T Y, T K, T* out) { template <class T> static void -_convertCMYKtoRGBA(unsigned width, unsigned height, BYTE* line_start, unsigned pitch, unsigned samplesperpixel) { +_convertCMYKtoRGBA(unsigned width, unsigned height, uint8_t* line_start, unsigned pitch, unsigned samplesperpixel) { const BOOL hasBlack = (samplesperpixel > 3) ? TRUE : FALSE; const T MAX_VAL = std::numeric_limits<T>::max(); @@ -169,7 +169,7 @@ ConvertCMYKtoRGBA(FIBITMAP* dib) { const unsigned width = FreeImage_GetWidth(dib); const unsigned height = FreeImage_GetHeight(dib); - BYTE *line_start = FreeImage_GetScanLine(dib, 0); + uint8_t *line_start = FreeImage_GetScanLine(dib, 0); const unsigned pitch = FreeImage_GetPitch(dib); unsigned samplesperpixel = FreeImage_GetLine(dib) / width / channelSize; @@ -177,7 +177,7 @@ ConvertCMYKtoRGBA(FIBITMAP* dib) { if(channelSize == sizeof(WORD)) { _convertCMYKtoRGBA<WORD>(width, height, line_start, pitch, samplesperpixel); } else { - _convertCMYKtoRGBA<BYTE>(width, height, line_start, pitch, samplesperpixel); + _convertCMYKtoRGBA<uint8_t>(width, height, line_start, pitch, samplesperpixel); } return TRUE; @@ -282,7 +282,7 @@ CIELabToRGB(float L, float a, float b, T *rgb) { template<class T> static void -_convertLABtoRGB(unsigned width, unsigned height, BYTE* line_start, unsigned pitch, unsigned samplesperpixel) { +_convertLABtoRGB(unsigned width, unsigned height, uint8_t* line_start, unsigned pitch, unsigned samplesperpixel) { const unsigned max_val = std::numeric_limits<T>::max(); const float sL = 100.F / max_val; const float sa = 256.F / max_val; @@ -318,13 +318,13 @@ ConvertLABtoRGB(FIBITMAP* dib) { const unsigned width = FreeImage_GetWidth(dib); const unsigned height = FreeImage_GetHeight(dib); - BYTE *line_start = FreeImage_GetScanLine(dib, 0); + uint8_t *line_start = FreeImage_GetScanLine(dib, 0); const unsigned pitch = FreeImage_GetPitch(dib); unsigned samplesperpixel = FreeImage_GetLine(dib) / width / channelSize; if(channelSize == 1) { - _convertLABtoRGB<BYTE>(width, height, line_start, pitch, samplesperpixel); + _convertLABtoRGB<uint8_t>(width, height, line_start, pitch, samplesperpixel); } else { _convertLABtoRGB<WORD>(width, height, line_start, pitch, samplesperpixel); @@ -436,7 +436,7 @@ FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize, int Palet // ========================================================== FIBITMAP * DLL_CALLCONV -FreeImage_ConvertFromRawBitsEx(BOOL copySource, BYTE *bits, FREE_IMAGE_TYPE type, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { +FreeImage_ConvertFromRawBitsEx(BOOL copySource, uint8_t *bits, FREE_IMAGE_TYPE type, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { FIBITMAP *dib = NULL; if(copySource) { @@ -473,15 +473,15 @@ FreeImage_ConvertFromRawBitsEx(BOOL copySource, BYTE *bits, FREE_IMAGE_TYPE type } FIBITMAP * DLL_CALLCONV -FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { +FreeImage_ConvertFromRawBits(uint8_t *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { return FreeImage_ConvertFromRawBitsEx(TRUE /* copySource */, bits, FIT_BITMAP, width, height, pitch, bpp, red_mask, green_mask, blue_mask, topdown); } void DLL_CALLCONV -FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { +FreeImage_ConvertToRawBits(uint8_t *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) { if (FreeImage_HasPixels(dib) && (bits != NULL)) { for (unsigned i = 0; i < FreeImage_GetHeight(dib); ++i) { - BYTE *scanline = FreeImage_GetScanLine(dib, topdown ? (FreeImage_GetHeight(dib) - i - 1) : i); + uint8_t *scanline = FreeImage_GetScanLine(dib, topdown ? (FreeImage_GetHeight(dib) - i - 1) : i); if ((bpp == 16) && (FreeImage_GetBPP(dib) == 16)) { // convert 555 to 565 or vice versa diff --git a/libs/freeimage/src/FreeImage/Conversion16_555.cpp b/libs/freeimage/src/FreeImage/Conversion16_555.cpp index a51d9ee6a5..ae0a4b6d1a 100644 --- a/libs/freeimage/src/FreeImage/Conversion16_555.cpp +++ b/libs/freeimage/src/FreeImage/Conversion16_555.cpp @@ -32,7 +32,7 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine1To16_555(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -43,7 +43,7 @@ FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine4To16_555(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; BOOL lonibble = FALSE; int x = 0; @@ -64,7 +64,7 @@ FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To16_555(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -75,7 +75,7 @@ FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16_565_To16_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *src_bits = (WORD *)source; WORD *new_bits = (WORD *)target; @@ -87,7 +87,7 @@ FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pi } void DLL_CALLCONV -FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To16_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -98,7 +98,7 @@ FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To16_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { diff --git a/libs/freeimage/src/FreeImage/Conversion16_565.cpp b/libs/freeimage/src/FreeImage/Conversion16_565.cpp index 54de0c54c3..e48d53b7ad 100644 --- a/libs/freeimage/src/FreeImage/Conversion16_565.cpp +++ b/libs/freeimage/src/FreeImage/Conversion16_565.cpp @@ -28,7 +28,7 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine1To16_565(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -39,7 +39,7 @@ FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine4To16_565(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; BOOL lonibble = FALSE; int x = 0; @@ -60,7 +60,7 @@ FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To16_565(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -71,7 +71,7 @@ FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, } void DLL_CALLCONV -FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16_555_To16_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *src_bits = (WORD *)source; WORD *new_bits = (WORD *)target; @@ -83,7 +83,7 @@ FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pi } void DLL_CALLCONV -FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To16_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -94,7 +94,7 @@ FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To16_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *new_bits = (WORD *)target; for (int cols = 0; cols < width_in_pixels; cols++) { diff --git a/libs/freeimage/src/FreeImage/Conversion24.cpp b/libs/freeimage/src/FreeImage/Conversion24.cpp index c0afe98a7c..9586d853dd 100644 --- a/libs/freeimage/src/FreeImage/Conversion24.cpp +++ b/libs/freeimage/src/FreeImage/Conversion24.cpp @@ -29,9 +29,9 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine1To24(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { for (int cols = 0; cols < width_in_pixels; cols++) { - BYTE index = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0; + uint8_t index = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0; target[FI_RGBA_BLUE] = palette[index].rgbBlue; target[FI_RGBA_GREEN] = palette[index].rgbGreen; @@ -42,7 +42,7 @@ FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine4To24(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { BOOL low_nibble = FALSE; int x = 0; @@ -66,7 +66,7 @@ FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To24(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_BLUE] = palette[source[cols]].rgbBlue; target[FI_RGBA_GREEN] = palette[source[cols]].rgbGreen; @@ -77,33 +77,33 @@ FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To24_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; for (int cols = 0; cols < width_in_pixels; cols++) { - target[FI_RGBA_RED] = (BYTE)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_BLUE] = (BYTE)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_RED] = (uint8_t)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_GREEN] = (uint8_t)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_BLUE] = (uint8_t)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); target += 3; } } void DLL_CALLCONV -FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To24_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; for (int cols = 0; cols < width_in_pixels; cols++) { - target[FI_RGBA_RED] = (BYTE)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); - target[FI_RGBA_BLUE] = (BYTE)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_RED] = (uint8_t)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_GREEN] = (uint8_t)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); + target[FI_RGBA_BLUE] = (uint8_t)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); target += 3; } } void DLL_CALLCONV -FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To24(uint8_t *target, uint8_t *source, int width_in_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_BLUE] = source[FI_RGBA_BLUE]; target[FI_RGBA_GREEN] = source[FI_RGBA_GREEN]; @@ -203,15 +203,15 @@ FreeImage_ConvertTo24Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (int rows = 0; rows < height; rows++) { const FIRGB16 *src_pixel = (FIRGB16*)src_bits; RGBTRIPLE *dst_pixel = (RGBTRIPLE*)dst_bits; for(int cols = 0; cols < width; cols++) { - dst_pixel[cols].rgbtRed = (BYTE)(src_pixel[cols].red >> 8); - dst_pixel[cols].rgbtGreen = (BYTE)(src_pixel[cols].green >> 8); - dst_pixel[cols].rgbtBlue = (BYTE)(src_pixel[cols].blue >> 8); + dst_pixel[cols].rgbtRed = (uint8_t)(src_pixel[cols].red >> 8); + dst_pixel[cols].rgbtGreen = (uint8_t)(src_pixel[cols].green >> 8); + dst_pixel[cols].rgbtBlue = (uint8_t)(src_pixel[cols].blue >> 8); } src_bits += src_pitch; dst_bits += dst_pitch; @@ -230,15 +230,15 @@ FreeImage_ConvertTo24Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (int rows = 0; rows < height; rows++) { const FIRGBA16 *src_pixel = (FIRGBA16*)src_bits; RGBTRIPLE *dst_pixel = (RGBTRIPLE*)dst_bits; for(int cols = 0; cols < width; cols++) { - dst_pixel[cols].rgbtRed = (BYTE)(src_pixel[cols].red >> 8); - dst_pixel[cols].rgbtGreen = (BYTE)(src_pixel[cols].green >> 8); - dst_pixel[cols].rgbtBlue = (BYTE)(src_pixel[cols].blue >> 8); + dst_pixel[cols].rgbtRed = (uint8_t)(src_pixel[cols].red >> 8); + dst_pixel[cols].rgbtGreen = (uint8_t)(src_pixel[cols].green >> 8); + dst_pixel[cols].rgbtBlue = (uint8_t)(src_pixel[cols].blue >> 8); } src_bits += src_pitch; dst_bits += dst_pitch; diff --git a/libs/freeimage/src/FreeImage/Conversion32.cpp b/libs/freeimage/src/FreeImage/Conversion32.cpp index 17dbe7e7b8..43845e19aa 100644 --- a/libs/freeimage/src/FreeImage/Conversion32.cpp +++ b/libs/freeimage/src/FreeImage/Conversion32.cpp @@ -29,7 +29,7 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine1To32(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { for (int cols = 0; cols < width_in_pixels; cols++) { int index = (source[cols>>3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0; @@ -42,7 +42,7 @@ FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine4To32(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { BOOL low_nibble = FALSE; int x = 0; @@ -67,7 +67,7 @@ FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To32(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_BLUE] = palette[source[cols]].rgbBlue; target[FI_RGBA_GREEN] = palette[source[cols]].rgbGreen; @@ -78,33 +78,33 @@ FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQ } void DLL_CALLCONV -FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To32_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; for (int cols = 0; cols < width_in_pixels; cols++) { - target[FI_RGBA_RED] = (BYTE)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_BLUE] = (BYTE)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_RED] = (uint8_t)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_GREEN] = (uint8_t)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_BLUE] = (uint8_t)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); target[FI_RGBA_ALPHA] = 0xFF; target += 4; } } void DLL_CALLCONV -FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To32_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; for (int cols = 0; cols < width_in_pixels; cols++) { - target[FI_RGBA_RED] = (BYTE)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); - target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); - target[FI_RGBA_BLUE] = (BYTE)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_RED] = (uint8_t)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); + target[FI_RGBA_GREEN] = (uint8_t)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); + target[FI_RGBA_BLUE] = (uint8_t)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); target[FI_RGBA_ALPHA] = 0xFF; target += 4; } } /* void DLL_CALLCONV -FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To32(uint8_t *target, uint8_t *source, int width_in_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { *(DWORD *)target = (*(DWORD *) source & FI_RGBA_RGB_MASK) | FI_RGBA_ALPHA_MASK; target += 4; @@ -118,7 +118,7 @@ The bug occurs in release mode only, when the image height is equal to 537 (try e.g. a size of 432x537 to reproduce the bug with the optimized function). */ void DLL_CALLCONV -FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To32(uint8_t *target, uint8_t *source, int width_in_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_RED] = source[FI_RGBA_RED]; target[FI_RGBA_GREEN] = source[FI_RGBA_GREEN]; @@ -132,7 +132,7 @@ FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels) { // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels) { +FreeImage_ConvertLine1To32MapTransparency(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette, uint8_t *table, int transparent_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { int index = (source[cols>>3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0; @@ -145,7 +145,7 @@ FreeImage_ConvertLine1To32MapTransparency(BYTE *target, BYTE *source, int width_ } void DLL_CALLCONV -FreeImage_ConvertLine4To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels) { +FreeImage_ConvertLine4To32MapTransparency(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette, uint8_t *table, int transparent_pixels) { BOOL low_nibble = FALSE; int x = 0; @@ -171,7 +171,7 @@ FreeImage_ConvertLine4To32MapTransparency(BYTE *target, BYTE *source, int width_ } void DLL_CALLCONV -FreeImage_ConvertLine8To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels) { +FreeImage_ConvertLine8To32MapTransparency(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette, uint8_t *table, int transparent_pixels) { for (int cols = 0; cols < width_in_pixels; cols++) { target[FI_RGBA_BLUE] = palette[source[cols]].rgbBlue; target[FI_RGBA_GREEN] = palette[source[cols]].rgbGreen; @@ -294,16 +294,16 @@ FreeImage_ConvertTo32Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (int rows = 0; rows < height; rows++) { const FIRGB16 *src_pixel = (FIRGB16*)src_bits; RGBQUAD *dst_pixel = (RGBQUAD*)dst_bits; for(int cols = 0; cols < width; cols++) { - dst_pixel[cols].rgbRed = (BYTE)(src_pixel[cols].red >> 8); - dst_pixel[cols].rgbGreen = (BYTE)(src_pixel[cols].green >> 8); - dst_pixel[cols].rgbBlue = (BYTE)(src_pixel[cols].blue >> 8); - dst_pixel[cols].rgbReserved = (BYTE)0xFF; + dst_pixel[cols].rgbRed = (uint8_t)(src_pixel[cols].red >> 8); + dst_pixel[cols].rgbGreen = (uint8_t)(src_pixel[cols].green >> 8); + dst_pixel[cols].rgbBlue = (uint8_t)(src_pixel[cols].blue >> 8); + dst_pixel[cols].rgbReserved = (uint8_t)0xFF; } src_bits += src_pitch; dst_bits += dst_pitch; @@ -322,16 +322,16 @@ FreeImage_ConvertTo32Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (int rows = 0; rows < height; rows++) { const FIRGBA16 *src_pixel = (FIRGBA16*)src_bits; RGBQUAD *dst_pixel = (RGBQUAD*)dst_bits; for(int cols = 0; cols < width; cols++) { - dst_pixel[cols].rgbRed = (BYTE)(src_pixel[cols].red >> 8); - dst_pixel[cols].rgbGreen = (BYTE)(src_pixel[cols].green >> 8); - dst_pixel[cols].rgbBlue = (BYTE)(src_pixel[cols].blue >> 8); - dst_pixel[cols].rgbReserved = (BYTE)(src_pixel[cols].alpha >> 8); + dst_pixel[cols].rgbRed = (uint8_t)(src_pixel[cols].red >> 8); + dst_pixel[cols].rgbGreen = (uint8_t)(src_pixel[cols].green >> 8); + dst_pixel[cols].rgbBlue = (uint8_t)(src_pixel[cols].blue >> 8); + dst_pixel[cols].rgbReserved = (uint8_t)(src_pixel[cols].alpha >> 8); } src_bits += src_pitch; dst_bits += dst_pitch; diff --git a/libs/freeimage/src/FreeImage/Conversion4.cpp b/libs/freeimage/src/FreeImage/Conversion4.cpp index 165bdc2a00..c1527810d6 100644 --- a/libs/freeimage/src/FreeImage/Conversion4.cpp +++ b/libs/freeimage/src/FreeImage/Conversion4.cpp @@ -26,7 +26,7 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine1To4(uint8_t *target, uint8_t *source, int width_in_pixels) { BOOL hinibble = TRUE; for (int cols = 0; cols < width_in_pixels; cols++){ if (hinibble == TRUE){ @@ -41,9 +41,9 @@ FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels) { } void DLL_CALLCONV -FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) { +FreeImage_ConvertLine8To4(uint8_t *target, uint8_t *source, int width_in_pixels, RGBQUAD *palette) { BOOL hinibble = TRUE; - BYTE index; + uint8_t index; for (int cols = 0; cols < width_in_pixels; cols++){ index = GREY(palette[source[cols]].rgbRed, palette[source[cols]].rgbGreen, palette[source[cols]].rgbBlue); @@ -58,7 +58,7 @@ FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQU } void DLL_CALLCONV -FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To4_555(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; BOOL hinibble = TRUE; @@ -80,7 +80,7 @@ FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To4_565(uint8_t *target, uint8_t *source, int width_in_pixels) { WORD *bits = (WORD *)source; BOOL hinibble = TRUE; @@ -102,7 +102,7 @@ FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To4(uint8_t *target, uint8_t *source, int width_in_pixels) { BOOL hinibble = TRUE; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -118,7 +118,7 @@ FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels) { } void DLL_CALLCONV -FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To4(uint8_t *target, uint8_t *source, int width_in_pixels) { BOOL hinibble = TRUE; for (int cols = 0; cols < width_in_pixels; cols++) { @@ -160,9 +160,9 @@ FreeImage_ConvertTo4Bits(FIBITMAP *dib) { RGBQUAD *new_pal = FreeImage_GetPalette(new_dib); for(int i = 0; i < 16; i++) { - new_pal[i].rgbRed = (BYTE)((i << 4) + i); - new_pal[i].rgbGreen = (BYTE)((i << 4) + i); - new_pal[i].rgbBlue = (BYTE)((i << 4) + i); + new_pal[i].rgbRed = (uint8_t)((i << 4) + i); + new_pal[i].rgbGreen = (uint8_t)((i << 4) + i); + new_pal[i].rgbBlue = (uint8_t)((i << 4) + i); } switch(bpp) { @@ -182,7 +182,7 @@ FreeImage_ConvertTo4Bits(FIBITMAP *dib) { // Reverse the grayscale palette for(int i = 0; i < 16; i++) { - new_pal[i].rgbRed = new_pal[i].rgbGreen = new_pal[i].rgbBlue = (BYTE)(255 - ((i << 4) + i)); + new_pal[i].rgbRed = new_pal[i].rgbGreen = new_pal[i].rgbBlue = (uint8_t)(255 - ((i << 4) + i)); } } diff --git a/libs/freeimage/src/FreeImage/Conversion8.cpp b/libs/freeimage/src/FreeImage/Conversion8.cpp index 1602c7705c..73820a4d66 100644 --- a/libs/freeimage/src/FreeImage/Conversion8.cpp +++ b/libs/freeimage/src/FreeImage/Conversion8.cpp @@ -30,13 +30,13 @@ // ---------------------------------------------------------- void DLL_CALLCONV -FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine1To8(uint8_t *target, uint8_t *source, int width_in_pixels) { for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) target[cols] = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 255 : 0; } void DLL_CALLCONV -FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine4To8(uint8_t *target, uint8_t *source, int width_in_pixels) { unsigned count_new = 0; unsigned count_org = 0; BOOL hinibble = TRUE; @@ -54,7 +54,7 @@ FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels) { } void DLL_CALLCONV -FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To8_555(uint8_t *target, uint8_t *source, int width_in_pixels) { const WORD *const bits = (WORD *)source; for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) { target[cols] = GREY((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F, @@ -64,7 +64,7 @@ FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine16To8_565(uint8_t *target, uint8_t *source, int width_in_pixels) { const WORD *const bits = (WORD *)source; for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) { target[cols] = GREY((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F, @@ -74,7 +74,7 @@ FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels) } void DLL_CALLCONV -FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine24To8(uint8_t *target, uint8_t *source, int width_in_pixels) { for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) { target[cols] = GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]); source += 3; @@ -82,7 +82,7 @@ FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels) { } void DLL_CALLCONV -FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels) { +FreeImage_ConvertLine32To8(uint8_t *target, uint8_t *source, int width_in_pixels) { for (unsigned cols = 0; cols < (unsigned)width_in_pixels; cols++) { target[cols] = GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]); source += 4; @@ -200,14 +200,14 @@ FreeImage_ConvertTo8Bits(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); for (unsigned rows = 0; rows < height; rows++) { const WORD *const src_pixel = (WORD*)src_bits; - BYTE *dst_pixel = (BYTE*)dst_bits; + uint8_t *dst_pixel = (uint8_t*)dst_bits; for(unsigned cols = 0; cols < width; cols++) { - dst_pixel[cols] = (BYTE)(src_pixel[cols] >> 8); + dst_pixel[cols] = (uint8_t)(src_pixel[cols] >> 8); } src_bits += src_pitch; dst_bits += dst_pitch; @@ -243,7 +243,7 @@ FreeImage_ConvertToGreyscale(FIBITMAP *dib) { FreeImage_CloneMetadata(new_dib, dib); // Create a greyscale palette - BYTE grey_pal[256]; + uint8_t grey_pal[256]; const RGBQUAD *pal = FreeImage_GetPalette(dib); const unsigned size = CalculateUsedPaletteEntries(bpp); for (unsigned i = 0; i < size; i++) { @@ -251,8 +251,8 @@ FreeImage_ConvertToGreyscale(FIBITMAP *dib) { pal++; } - const BYTE *src_bits = FreeImage_GetBits(dib); - BYTE *dst_bits = FreeImage_GetBits(new_dib); + const uint8_t *src_bits = FreeImage_GetBits(dib); + uint8_t *dst_bits = FreeImage_GetBits(new_dib); const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(new_dib); diff --git a/libs/freeimage/src/FreeImage/ConversionFloat.cpp b/libs/freeimage/src/FreeImage/ConversionFloat.cpp index 83114fd381..ca551ab4ad 100644 --- a/libs/freeimage/src/FreeImage/ConversionFloat.cpp +++ b/libs/freeimage/src/FreeImage/ConversionFloat.cpp @@ -82,14 +82,14 @@ FreeImage_ConvertToFloat(FIBITMAP *dib) { const unsigned src_pitch = FreeImage_GetPitch(src); const unsigned dst_pitch = FreeImage_GetPitch(dst); - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); switch(src_type) { case FIT_BITMAP: { for(unsigned y = 0; y < height; y++) { - const BYTE *src_pixel = (BYTE*)src_bits; + const uint8_t *src_pixel = (uint8_t*)src_bits; float *dst_pixel = (float*)dst_bits; for(unsigned x = 0; x < width; x++) { // convert and scale to the range [0..1] diff --git a/libs/freeimage/src/FreeImage/ConversionRGB16.cpp b/libs/freeimage/src/FreeImage/ConversionRGB16.cpp index 9e6fbc0bec..4852a58866 100644 --- a/libs/freeimage/src/FreeImage/ConversionRGB16.cpp +++ b/libs/freeimage/src/FreeImage/ConversionRGB16.cpp @@ -88,7 +88,7 @@ FreeImage_ConvertToRGB16(FIBITMAP *dib) { const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = (BYTE*)FreeImage_GetScanLine(src, y); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetScanLine(src, y); FIRGB16 *dst_bits = (FIRGB16*)FreeImage_GetScanLine(dst, y); for(unsigned x = 0; x < width; x++) { dst_bits[x].red = src_bits[FI_RGBA_RED] << 8; diff --git a/libs/freeimage/src/FreeImage/ConversionRGBA16.cpp b/libs/freeimage/src/FreeImage/ConversionRGBA16.cpp index 7e1259668b..c5ecfdf438 100644 --- a/libs/freeimage/src/FreeImage/ConversionRGBA16.cpp +++ b/libs/freeimage/src/FreeImage/ConversionRGBA16.cpp @@ -88,7 +88,7 @@ FreeImage_ConvertToRGBA16(FIBITMAP *dib) { const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = (BYTE*)FreeImage_GetScanLine(src, y); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetScanLine(src, y); FIRGBA16 *dst_bits = (FIRGBA16*)FreeImage_GetScanLine(dst, y); for(unsigned x = 0; x < width; x++) { dst_bits[x].red = src_bits[FI_RGBA_RED] << 8; diff --git a/libs/freeimage/src/FreeImage/ConversionRGBAF.cpp b/libs/freeimage/src/FreeImage/ConversionRGBAF.cpp index f2bcaa7072..99ece4604d 100644 --- a/libs/freeimage/src/FreeImage/ConversionRGBAF.cpp +++ b/libs/freeimage/src/FreeImage/ConversionRGBAF.cpp @@ -104,11 +104,11 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { // calculate the number of bytes per pixel (4 for 32-bit) const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { - const BYTE *src_pixel = (BYTE*)src_bits; + const uint8_t *src_pixel = (uint8_t*)src_bits; FIRGBAF *dst_pixel = (FIRGBAF*)dst_bits; for(unsigned x = 0; x < width; x++) { // convert and scale to the range [0..1] @@ -128,8 +128,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_UINT16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const WORD *src_pixel = (WORD*)src_bits; @@ -151,8 +151,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_RGB16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGB16 *src_pixel = (FIRGB16*)src_bits; @@ -173,8 +173,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_RGBA16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBA16 *src_pixel = (FIRGBA16*)src_bits; @@ -195,8 +195,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_FLOAT: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const float *src_pixel = (float*)src_bits; @@ -219,8 +219,8 @@ FreeImage_ConvertToRGBAF(FIBITMAP *dib) { case FIT_RGBF: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBF *src_pixel = (FIRGBF*)src_bits; diff --git a/libs/freeimage/src/FreeImage/ConversionRGBF.cpp b/libs/freeimage/src/FreeImage/ConversionRGBF.cpp index cd0e875ddc..d1f7611caa 100644 --- a/libs/freeimage/src/FreeImage/ConversionRGBF.cpp +++ b/libs/freeimage/src/FreeImage/ConversionRGBF.cpp @@ -103,11 +103,11 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { // calculate the number of bytes per pixel (3 for 24-bit or 4 for 32-bit) const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src); - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { - const BYTE *src_pixel = (BYTE*)src_bits; + const uint8_t *src_pixel = (uint8_t*)src_bits; FIRGBF *dst_pixel = (FIRGBF*)dst_bits; for(unsigned x = 0; x < width; x++) { // convert and scale to the range [0..1] @@ -126,8 +126,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_UINT16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const WORD *src_pixel = (WORD*)src_bits; @@ -148,8 +148,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_RGB16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGB16 *src_pixel = (FIRGB16*) src_bits; @@ -169,8 +169,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_RGBA16: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBA16 *src_pixel = (FIRGBA16*) src_bits; @@ -190,8 +190,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_FLOAT: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const float *src_pixel = (float*) src_bits; @@ -213,8 +213,8 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) { case FIT_RGBAF: { - const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBAF *src_pixel = (FIRGBAF*) src_bits; diff --git a/libs/freeimage/src/FreeImage/ConversionType.cpp b/libs/freeimage/src/FreeImage/ConversionType.cpp index b3eedd25a8..be2000ce33 100644 --- a/libs/freeimage/src/FreeImage/ConversionType.cpp +++ b/libs/freeimage/src/FreeImage/ConversionType.cpp @@ -66,7 +66,7 @@ CONVERT_TYPE<Tdst, Tsrc>::convert(FIBITMAP *src, FREE_IMAGE_TYPE dst_type) { /** Convert a greyscale image of type Tsrc to a 8-bit grayscale dib. Conversion is done using either a linear scaling from [min, max] to [0, 255] - or a rounding from src_pixel to (BYTE) MIN(255, MAX(0, q)) where int q = int(src_pixel + 0.5); + or a rounding from src_pixel to (uint8_t) MIN(255, MAX(0, q)) where int q = int(src_pixel + 0.5); */ template<class Tsrc> class CONVERT_TO_BYTE @@ -91,9 +91,9 @@ CONVERT_TO_BYTE<Tsrc>::convert(FIBITMAP *src, BOOL scale_linear) { // build a greyscale palette RGBQUAD *pal = FreeImage_GetPalette(dst); for(int i = 0; i < 256; i++) { - pal[i].rgbRed = (BYTE)i; - pal[i].rgbGreen = (BYTE)i; - pal[i].rgbBlue = (BYTE)i; + pal[i].rgbRed = (uint8_t)i; + pal[i].rgbGreen = (uint8_t)i; + pal[i].rgbBlue = (uint8_t)i; } // convert the src image to dst @@ -121,19 +121,19 @@ CONVERT_TO_BYTE<Tsrc>::convert(FIBITMAP *src, BOOL scale_linear) { // scale to 8-bit for(y = 0; y < height; y++) { Tsrc *src_bits = reinterpret_cast<Tsrc*>(FreeImage_GetScanLine(src, y)); - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for(x = 0; x < width; x++) { - dst_bits[x] = (BYTE)( scale * (src_bits[x] - min) + 0.5); + dst_bits[x] = (uint8_t)( scale * (src_bits[x] - min) + 0.5); } } } else { for(y = 0; y < height; y++) { Tsrc *src_bits = reinterpret_cast<Tsrc*>(FreeImage_GetScanLine(src, y)); - BYTE *dst_bits = FreeImage_GetScanLine(dst, y); + uint8_t *dst_bits = FreeImage_GetScanLine(dst, y); for(x = 0; x < width; x++) { // rounding int q = int(src_bits[x] + 0.5); - dst_bits[x] = (BYTE) MIN(255, MAX(0, q)); + dst_bits[x] = (uint8_t) MIN(255, MAX(0, q)); } } } @@ -179,15 +179,15 @@ CONVERT_TO_COMPLEX<Tsrc>::convert(FIBITMAP *src) { // ---------------------------------------------------------- -// Convert from type BYTE to type X -CONVERT_TYPE<unsigned short, BYTE> convertByteToUShort; -CONVERT_TYPE<short, BYTE> convertByteToShort; -CONVERT_TYPE<DWORD, BYTE> convertByteToULong; -CONVERT_TYPE<LONG, BYTE> convertByteToLong; -CONVERT_TYPE<float, BYTE> convertByteToFloat; -CONVERT_TYPE<double, BYTE> convertByteToDouble; +// Convert from type uint8_t to type X +CONVERT_TYPE<unsigned short, uint8_t> convertByteToUShort; +CONVERT_TYPE<short, uint8_t> convertByteToShort; +CONVERT_TYPE<DWORD, uint8_t> convertByteToULong; +CONVERT_TYPE<LONG, uint8_t> convertByteToLong; +CONVERT_TYPE<float, uint8_t> convertByteToFloat; +CONVERT_TYPE<double, uint8_t> convertByteToDouble; -// Convert from type X to type BYTE +// Convert from type X to type uint8_t CONVERT_TO_BYTE<unsigned short> convertUShortToByte; CONVERT_TO_BYTE<short> convertShortToByte; CONVERT_TO_BYTE<DWORD> convertULongToByte; @@ -209,7 +209,7 @@ CONVERT_TYPE<double, LONG> convertLongToDouble; CONVERT_TYPE<double, float> convertFloatToDouble; // Convert from type X to type FICOMPLEX -CONVERT_TO_COMPLEX<BYTE> convertByteToComplex; +CONVERT_TO_COMPLEX<uint8_t> convertByteToComplex; CONVERT_TO_COMPLEX<unsigned short> convertUShortToComplex; CONVERT_TO_COMPLEX<short> convertShortToComplex; CONVERT_TO_COMPLEX<DWORD> convertULongToComplex; diff --git a/libs/freeimage/src/FreeImage/ConversionUINT16.cpp b/libs/freeimage/src/FreeImage/ConversionUINT16.cpp index 37f0450f31..35f1e2fdd0 100644 --- a/libs/freeimage/src/FreeImage/ConversionUINT16.cpp +++ b/libs/freeimage/src/FreeImage/ConversionUINT16.cpp @@ -85,7 +85,7 @@ FreeImage_ConvertToUINT16(FIBITMAP *dib) { case FIT_BITMAP: { for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = (BYTE*)FreeImage_GetScanLine(src, y); + const uint8_t *src_bits = (uint8_t*)FreeImage_GetScanLine(src, y); WORD *dst_bits = (WORD*)FreeImage_GetScanLine(dst, y); for(unsigned x = 0; x < width; x++) { dst_bits[x] = src_bits[x] << 8; diff --git a/libs/freeimage/src/FreeImage/FreeImage.cpp b/libs/freeimage/src/FreeImage/FreeImage.cpp index 0ecf730cd0..e2709853ec 100644 --- a/libs/freeimage/src/FreeImage/FreeImage.cpp +++ b/libs/freeimage/src/FreeImage/FreeImage.cpp @@ -90,7 +90,7 @@ BOOL DLL_CALLCONV FreeImage_IsLittleEndian() { union { DWORD i; - BYTE c[4]; + uint8_t c[4]; } u; u.i = 1; return (u.c[0] != 0); diff --git a/libs/freeimage/src/FreeImage/Halftoning.cpp b/libs/freeimage/src/FreeImage/Halftoning.cpp index 19195ad27a..dd261e12f0 100644 --- a/libs/freeimage/src/FreeImage/Halftoning.cpp +++ b/libs/freeimage/src/FreeImage/Halftoning.cpp @@ -40,7 +40,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { int seed = 0; int x, y, p, pixel, threshold, error; int width, height, pitch; - BYTE *bits, *new_bits; + uint8_t *bits, *new_bits; FIBITMAP *new_dib = NULL; // allocate a 8-bit DIB @@ -66,7 +66,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { pixel = bits[0] + error; p = (pixel > threshold) ? WHITE : BLACK; error = pixel - p; - new_bits[0] = (BYTE)p; + new_bits[0] = (uint8_t)p; } // right border error = 0; @@ -78,7 +78,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { pixel = bits[width-1] + error; p = (pixel > threshold) ? WHITE : BLACK; error = pixel - p; - new_bits[width-1] = (BYTE)p; + new_bits[width-1] = (uint8_t)p; } // top border bits = FreeImage_GetBits(dib); @@ -89,7 +89,7 @@ static FIBITMAP* FloydSteinberg(FIBITMAP *dib) { pixel = bits[x] + error; p = (pixel > threshold) ? WHITE : BLACK; error = pixel - p; - new_bits[x] = (BYTE)p; + new_bits[x] = (uint8_t)p; lerr[x] = INITERR(bits[x], p); } @@ -161,7 +161,7 @@ static int dithervalue(int x, int y, int size) { static FIBITMAP* OrderedDispersedDot(FIBITMAP *dib, int order) { int x, y; int width, height; - BYTE *bits, *new_bits; + uint8_t *bits, *new_bits; FIBITMAP *new_dib = NULL; // allocate a 8-bit DIB @@ -172,10 +172,10 @@ static FIBITMAP* OrderedDispersedDot(FIBITMAP *dib, int order) { // build the dithering matrix int l = (1 << order); // square of dither matrix order; the dimensions of the matrix - BYTE *matrix = (BYTE*)malloc(l*l * sizeof(BYTE)); + uint8_t *matrix = (uint8_t*)malloc(l*l * sizeof(uint8_t)); for(int i = 0; i < l*l; i++) { // according to "Purdue University: Digital Image Processing Laboratory: Image Halftoning, April 30th, 2006 - matrix[i] = (BYTE)( 255 * (((double)dithervalue(i / l, i % l, order) + 0.5) / (l*l)) ); + matrix[i] = (uint8_t)( 255 * (((double)dithervalue(i / l, i % l, order) + 0.5) / (l*l)) ); } // perform the dithering @@ -251,7 +251,7 @@ static FIBITMAP* OrderedClusteredDot(FIBITMAP *dib, int order) { int x, y, pixel; int width, height; - BYTE *bits, *new_bits; + uint8_t *bits, *new_bits; FIBITMAP *new_dib = NULL; // allocate a 8-bit DIB @@ -378,9 +378,9 @@ FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm) { // Build a greyscale palette (needed by threshold) RGBQUAD *grey_pal = FreeImage_GetPalette(dib8); for(int i = 0; i < 256; i++) { - grey_pal[i].rgbRed = (BYTE)i; - grey_pal[i].rgbGreen = (BYTE)i; - grey_pal[i].rgbBlue = (BYTE)i; + grey_pal[i].rgbRed = (uint8_t)i; + grey_pal[i].rgbGreen = (uint8_t)i; + grey_pal[i].rgbBlue = (uint8_t)i; } // Convert to 1-bit @@ -397,7 +397,7 @@ FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm) { // Thresholding function // FIBITMAP * DLL_CALLCONV -FreeImage_Threshold(FIBITMAP *dib, BYTE T) { +FreeImage_Threshold(FIBITMAP *dib, uint8_t T) { FIBITMAP *dib8 = NULL; if(!FreeImage_HasPixels(dib)) return NULL; @@ -449,8 +449,8 @@ FreeImage_Threshold(FIBITMAP *dib, BYTE T) { // Perform the thresholding // for(int y = 0; y < height; y++) { - BYTE *bits8 = FreeImage_GetScanLine(dib8, y); - BYTE *bits1 = FreeImage_GetScanLine(new_dib, y); + uint8_t *bits8 = FreeImage_GetScanLine(dib8, y); + uint8_t *bits1 = FreeImage_GetScanLine(new_dib, y); for(int x = 0; x < width; x++) { if(bits8[x] < T) { // Set bit(x, y) to 0 diff --git a/libs/freeimage/src/FreeImage/LFPQuantizer.cpp b/libs/freeimage/src/FreeImage/LFPQuantizer.cpp index 88d9944a9d..342615afc3 100644 --- a/libs/freeimage/src/FreeImage/LFPQuantizer.cpp +++ b/libs/freeimage/src/FreeImage/LFPQuantizer.cpp @@ -48,8 +48,8 @@ FIBITMAP* LFPQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserv const unsigned src_pitch = FreeImage_GetPitch(dib); const unsigned dst_pitch = FreeImage_GetPitch(dib8); - const BYTE * const src_bits = FreeImage_GetBits(dib); - BYTE * const dst_bits = FreeImage_GetBits(dib8); + const uint8_t * const src_bits = FreeImage_GetBits(dib); + uint8_t * const dst_bits = FreeImage_GetBits(dib8); unsigned last_color = -1; int last_index = 0; @@ -64,8 +64,8 @@ FIBITMAP* LFPQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserv // Process all but the last scanline. for (unsigned y = 0; y < height - 1; ++y) { - BYTE *dst_line = dst_bits + y * dst_pitch; - const BYTE *src_line = src_bits + y * src_pitch; + uint8_t *dst_line = dst_bits + y * dst_pitch; + const uint8_t *src_line = src_bits + y * src_pitch; for (unsigned x = 0; x < width; ++x) { const unsigned color = *((unsigned *) src_line) & 0x00FFFFFF; if (color != last_color) { @@ -82,8 +82,8 @@ FIBITMAP* LFPQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserv } // Process all but the last pixel of the last scanline. - BYTE *dst_line = dst_bits + (height - 1) * dst_pitch; - const BYTE *src_line = src_bits + (height - 1) * src_pitch; + uint8_t *dst_line = dst_bits + (height - 1) * dst_pitch; + const uint8_t *src_line = src_bits + (height - 1) * src_pitch; for (unsigned x = 0; x < width - 1; ++x) { const unsigned color = *((unsigned *) src_line) & 0x00FFFFFF; if (color != last_color) { @@ -114,8 +114,8 @@ FIBITMAP* LFPQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserv } else { for (unsigned y = 0; y < height; ++y) { - BYTE *dst_line = dst_bits + y * dst_pitch; - const BYTE *src_line = src_bits + y * src_pitch; + uint8_t *dst_line = dst_bits + y * dst_pitch; + const uint8_t *src_line = src_bits + y * src_pitch; for (unsigned x = 0; x < width; ++x) { const unsigned color = *((unsigned *) src_line) & 0x00FFFFFF; if (color != last_color) { diff --git a/libs/freeimage/src/FreeImage/MNGHelper.cpp b/libs/freeimage/src/FreeImage/MNGHelper.cpp index 1a7e924751..d89ec23c6b 100644 --- a/libs/freeimage/src/FreeImage/MNGHelper.cpp +++ b/libs/freeimage/src/FreeImage/MNGHelper.cpp @@ -56,9 +56,9 @@ http://libpng.org/pub/mng/spec/ const DWORD JPEG_CHUNK_SIZE = 8192; /** PNG signature */ -static const BYTE g_png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; +static const uint8_t g_png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; /** JNG signature */ -static const BYTE g_jng_signature[8] = { 139, 74, 78, 71, 13, 10, 26, 10 }; +static const uint8_t g_jng_signature[8] = { 139, 74, 78, 71, 13, 10, 26, 10 }; // -------------------------------------------------------------------------- @@ -128,57 +128,57 @@ typedef std::map<std::string, std::string> tEXtMAP; portable, we use ASCII numbers like this, not characters. */ -static BYTE mng_MHDR[5]={ 77, 72, 68, 82, (BYTE) '\0'}; -static BYTE mng_BACK[5]={ 66, 65, 67, 75, (BYTE) '\0'}; -static BYTE mng_BASI[5]={ 66, 65, 83, 73, (BYTE) '\0'}; -static BYTE mng_CLIP[5]={ 67, 76, 73, 80, (BYTE) '\0'}; -static BYTE mng_CLON[5]={ 67, 76, 79, 78, (BYTE) '\0'}; -static BYTE mng_DEFI[5]={ 68, 69, 70, 73, (BYTE) '\0'}; -static BYTE mng_DHDR[5]={ 68, 72, 68, 82, (BYTE) '\0'}; -static BYTE mng_DISC[5]={ 68, 73, 83, 67, (BYTE) '\0'}; -static BYTE mng_ENDL[5]={ 69, 78, 68, 76, (BYTE) '\0'}; -static BYTE mng_FRAM[5]={ 70, 82, 65, 77, (BYTE) '\0'}; -static BYTE mng_IEND[5]={ 73, 69, 78, 68, (BYTE) '\0'}; -static BYTE mng_IHDR[5]={ 73, 72, 68, 82, (BYTE) '\0'}; -static BYTE mng_JHDR[5]={ 74, 72, 68, 82, (BYTE) '\0'}; -static BYTE mng_LOOP[5]={ 76, 79, 79, 80, (BYTE) '\0'}; -static BYTE mng_MAGN[5]={ 77, 65, 71, 78, (BYTE) '\0'}; -static BYTE mng_MEND[5]={ 77, 69, 78, 68, (BYTE) '\0'}; -static BYTE mng_MOVE[5]={ 77, 79, 86, 69, (BYTE) '\0'}; -static BYTE mng_PAST[5]={ 80, 65, 83, 84, (BYTE) '\0'}; -static BYTE mng_PLTE[5]={ 80, 76, 84, 69, (BYTE) '\0'}; -static BYTE mng_SAVE[5]={ 83, 65, 86, 69, (BYTE) '\0'}; -static BYTE mng_SEEK[5]={ 83, 69, 69, 75, (BYTE) '\0'}; -static BYTE mng_SHOW[5]={ 83, 72, 79, 87, (BYTE) '\0'}; -static BYTE mng_TERM[5]={ 84, 69, 82, 77, (BYTE) '\0'}; -static BYTE mng_bKGD[5]={ 98, 75, 71, 68, (BYTE) '\0'}; -static BYTE mng_cHRM[5]={ 99, 72, 82, 77, (BYTE) '\0'}; -static BYTE mng_gAMA[5]={103, 65, 77, 65, (BYTE) '\0'}; -static BYTE mng_iCCP[5]={105, 67, 67, 80, (BYTE) '\0'}; -static BYTE mng_nEED[5]={110, 69, 69, 68, (BYTE) '\0'}; -static BYTE mng_pHYg[5]={112, 72, 89, 103, (BYTE) '\0'}; -static BYTE mng_vpAg[5]={118, 112, 65, 103, (BYTE) '\0'}; -static BYTE mng_pHYs[5]={112, 72, 89, 115, (BYTE) '\0'}; -static BYTE mng_sBIT[5]={115, 66, 73, 84, (BYTE) '\0'}; -static BYTE mng_sRGB[5]={115, 82, 71, 66, (BYTE) '\0'}; -static BYTE mng_tRNS[5]={116, 82, 78, 83, (BYTE) '\0'}; +static uint8_t mng_MHDR[5]={ 77, 72, 68, 82, (uint8_t) '\0'}; +static uint8_t mng_BACK[5]={ 66, 65, 67, 75, (uint8_t) '\0'}; +static uint8_t mng_BASI[5]={ 66, 65, 83, 73, (uint8_t) '\0'}; +static uint8_t mng_CLIP[5]={ 67, 76, 73, 80, (uint8_t) '\0'}; +static uint8_t mng_CLON[5]={ 67, 76, 79, 78, (uint8_t) '\0'}; +static uint8_t mng_DEFI[5]={ 68, 69, 70, 73, (uint8_t) '\0'}; +static uint8_t mng_DHDR[5]={ 68, 72, 68, 82, (uint8_t) '\0'}; +static uint8_t mng_DISC[5]={ 68, 73, 83, 67, (uint8_t) '\0'}; +static uint8_t mng_ENDL[5]={ 69, 78, 68, 76, (uint8_t) '\0'}; +static uint8_t mng_FRAM[5]={ 70, 82, 65, 77, (uint8_t) '\0'}; +static uint8_t mng_IEND[5]={ 73, 69, 78, 68, (uint8_t) '\0'}; +static uint8_t mng_IHDR[5]={ 73, 72, 68, 82, (uint8_t) '\0'}; +static uint8_t mng_JHDR[5]={ 74, 72, 68, 82, (uint8_t) '\0'}; +static uint8_t mng_LOOP[5]={ 76, 79, 79, 80, (uint8_t) '\0'}; +static uint8_t mng_MAGN[5]={ 77, 65, 71, 78, (uint8_t) '\0'}; +static uint8_t mng_MEND[5]={ 77, 69, 78, 68, (uint8_t) '\0'}; +static uint8_t mng_MOVE[5]={ 77, 79, 86, 69, (uint8_t) '\0'}; +static uint8_t mng_PAST[5]={ 80, 65, 83, 84, (uint8_t) '\0'}; +static uint8_t mng_PLTE[5]={ 80, 76, 84, 69, (uint8_t) '\0'}; +static uint8_t mng_SAVE[5]={ 83, 65, 86, 69, (uint8_t) '\0'}; +static uint8_t mng_SEEK[5]={ 83, 69, 69, 75, (uint8_t) '\0'}; +static uint8_t mng_SHOW[5]={ 83, 72, 79, 87, (uint8_t) '\0'}; +static uint8_t mng_TERM[5]={ 84, 69, 82, 77, (uint8_t) '\0'}; +static uint8_t mng_bKGD[5]={ 98, 75, 71, 68, (uint8_t) '\0'}; +static uint8_t mng_cHRM[5]={ 99, 72, 82, 77, (uint8_t) '\0'}; +static uint8_t mng_gAMA[5]={103, 65, 77, 65, (uint8_t) '\0'}; +static uint8_t mng_iCCP[5]={105, 67, 67, 80, (uint8_t) '\0'}; +static uint8_t mng_nEED[5]={110, 69, 69, 68, (uint8_t) '\0'}; +static uint8_t mng_pHYg[5]={112, 72, 89, 103, (uint8_t) '\0'}; +static uint8_t mng_vpAg[5]={118, 112, 65, 103, (uint8_t) '\0'}; +static uint8_t mng_pHYs[5]={112, 72, 89, 115, (uint8_t) '\0'}; +static uint8_t mng_sBIT[5]={115, 66, 73, 84, (uint8_t) '\0'}; +static uint8_t mng_sRGB[5]={115, 82, 71, 66, (uint8_t) '\0'}; +static uint8_t mng_tRNS[5]={116, 82, 78, 83, (uint8_t) '\0'}; #if defined(JNG_SUPPORTED) -static BYTE mng_IDAT[5]={ 73, 68, 65, 84, (BYTE) '\0'}; -static BYTE mng_JDAT[5]={ 74, 68, 65, 84, (BYTE) '\0'}; -static BYTE mng_JDAA[5]={ 74, 68, 65, 65, (BYTE) '\0'}; -static BYTE mng_JdAA[5]={ 74, 100, 65, 65, (BYTE) '\0'}; -static BYTE mng_JSEP[5]={ 74, 83, 69, 80, (BYTE) '\0'}; -static BYTE mng_oFFs[5]={111, 70, 70, 115, (BYTE) '\0'}; +static uint8_t mng_IDAT[5]={ 73, 68, 65, 84, (uint8_t) '\0'}; +static uint8_t mng_JDAT[5]={ 74, 68, 65, 84, (uint8_t) '\0'}; +static uint8_t mng_JDAA[5]={ 74, 68, 65, 65, (uint8_t) '\0'}; +static uint8_t mng_JdAA[5]={ 74, 100, 65, 65, (uint8_t) '\0'}; +static uint8_t mng_JSEP[5]={ 74, 83, 69, 80, (uint8_t) '\0'}; +static uint8_t mng_oFFs[5]={111, 70, 70, 115, (uint8_t) '\0'}; #endif -static BYTE mng_hIST[5]={104, 73, 83, 84, (BYTE) '\0'}; -static BYTE mng_iTXt[5]={105, 84, 88, 116, (BYTE) '\0'}; -static BYTE mng_sPLT[5]={115, 80, 76, 84, (BYTE) '\0'}; -static BYTE mng_sTER[5]={115, 84, 69, 82, (BYTE) '\0'}; -static BYTE mng_tEXt[5]={116, 69, 88, 116, (BYTE) '\0'}; -static BYTE mng_tIME[5]={116, 73, 77, 69, (BYTE) '\0'}; -static BYTE mng_zTXt[5]={122, 84, 88, 116, (BYTE) '\0'}; +static uint8_t mng_hIST[5]={104, 73, 83, 84, (uint8_t) '\0'}; +static uint8_t mng_iTXt[5]={105, 84, 88, 116, (uint8_t) '\0'}; +static uint8_t mng_sPLT[5]={115, 80, 76, 84, (uint8_t) '\0'}; +static uint8_t mng_sTER[5]={115, 84, 69, 82, (uint8_t) '\0'}; +static uint8_t mng_tEXt[5]={116, 69, 88, 116, (uint8_t) '\0'}; +static uint8_t mng_tIME[5]={116, 73, 77, 69, (uint8_t) '\0'}; +static uint8_t mng_zTXt[5]={122, 84, 88, 116, (uint8_t) '\0'}; // -------------------------------------------------------------------------- @@ -187,7 +187,7 @@ static BYTE mng_zTXt[5]={122, 84, 88, 116, (BYTE) '\0'}; Convert a chunk name to a unique ID */ static eChunckType -mng_GetChunckType(const BYTE *mChunkName) { +mng_GetChunckType(const uint8_t *mChunkName) { if(memcmp(mChunkName, mng_MHDR, 4) == 0) { return MHDR; } @@ -282,7 +282,7 @@ mng_CountPNGChunks(FreeImageIO *io, fi_handle handle, long inPos, unsigned *m_To long mPos; BOOL mEnd = FALSE; DWORD mLength = 0; - BYTE mChunkName[5]; + uint8_t mChunkName[5]; *m_TotalBytesOfChunks = 0; @@ -355,10 +355,10 @@ Retrieve the position of a chunk in a PNG stream @return Returns TRUE if successful, returns FALSE otherwise */ static BOOL -mng_FindChunk(FIMEMORY *hPngMemory, BYTE *chunk_name, long offset, DWORD *start_pos, DWORD *next_pos) { +mng_FindChunk(FIMEMORY *hPngMemory, uint8_t *chunk_name, long offset, DWORD *start_pos, DWORD *next_pos) { DWORD mLength = 0; - BYTE *data = NULL; + uint8_t *data = NULL; DWORD size_in_bytes = 0; *start_pos = 0; @@ -418,7 +418,7 @@ Remove a chunk located at (start_pos, next_pos) in the PNG stream */ static BOOL mng_CopyRemoveChunks(FIMEMORY *hPngMemory, DWORD start_pos, DWORD next_pos) { - BYTE *data = NULL; + uint8_t *data = NULL; DWORD size_in_bytes = 0; // length of the chunk to remove @@ -437,7 +437,7 @@ mng_CopyRemoveChunks(FIMEMORY *hPngMemory, DWORD start_pos, DWORD next_pos) { // new file length unsigned buffer_size = size_in_bytes + chunk_length; - BYTE *buffer = (BYTE*)malloc(buffer_size * sizeof(BYTE)); + uint8_t *buffer = (uint8_t*)malloc(buffer_size * sizeof(uint8_t)); if(!buffer) { return FALSE; } @@ -462,8 +462,8 @@ Insert a chunk just before the inNextChunkName chunk @return Returns TRUE if successfull, returns FALSE otherwise */ static BOOL -mng_CopyInsertChunks(FIMEMORY *hPngMemory, BYTE *inNextChunkName, BYTE *inInsertChunk, DWORD inChunkLength, DWORD start_pos, DWORD next_pos) { - BYTE *data = NULL; +mng_CopyInsertChunks(FIMEMORY *hPngMemory, uint8_t *inNextChunkName, uint8_t *inInsertChunk, DWORD inChunkLength, DWORD start_pos, DWORD next_pos) { + uint8_t *data = NULL; DWORD size_in_bytes = 0; // length of the chunk to check @@ -482,7 +482,7 @@ mng_CopyInsertChunks(FIMEMORY *hPngMemory, BYTE *inNextChunkName, BYTE *inInsert // new file length unsigned buffer_size = inChunkLength + size_in_bytes; - BYTE *buffer = (BYTE*)malloc(buffer_size * sizeof(BYTE)); + uint8_t *buffer = (uint8_t*)malloc(buffer_size * sizeof(uint8_t)); if(!buffer) { return FALSE; } @@ -504,7 +504,7 @@ mng_CopyInsertChunks(FIMEMORY *hPngMemory, BYTE *inNextChunkName, BYTE *inInsert } static BOOL -mng_RemoveChunk(FIMEMORY *hPngMemory, BYTE *chunk_name) { +mng_RemoveChunk(FIMEMORY *hPngMemory, uint8_t *chunk_name) { BOOL bResult = FALSE; DWORD start_pos = 0; @@ -524,7 +524,7 @@ mng_RemoveChunk(FIMEMORY *hPngMemory, BYTE *chunk_name) { } static BOOL -mng_InsertChunk(FIMEMORY *hPngMemory, BYTE *inNextChunkName, BYTE *inInsertChunk, unsigned chunk_length) { +mng_InsertChunk(FIMEMORY *hPngMemory, uint8_t *inNextChunkName, uint8_t *inInsertChunk, unsigned chunk_length) { BOOL bResult = FALSE; DWORD start_pos = 0; @@ -571,7 +571,7 @@ Write a chunk in a PNG stream from the current position. @param hPngMemory PNG stream handle */ static void -mng_WriteChunk(BYTE *chunk_name, BYTE *chunk_data, DWORD length, FIMEMORY *hPngMemory) { +mng_WriteChunk(uint8_t *chunk_name, uint8_t *chunk_data, DWORD length, FIMEMORY *hPngMemory) { DWORD crc_file = 0; // write a PNG chunk ... // - length @@ -610,10 +610,10 @@ The image is assumed to be a greyscale image. @param hPngMemory Output memory stream */ static void -mng_WritePNGStream(DWORD jng_width, DWORD jng_height, BYTE jng_alpha_sample_depth, BYTE *mChunk, DWORD mLength, FIMEMORY *hPngMemory) { +mng_WritePNGStream(DWORD jng_width, DWORD jng_height, uint8_t jng_alpha_sample_depth, uint8_t *mChunk, DWORD mLength, FIMEMORY *hPngMemory) { // PNG grayscale IDAT format - BYTE data[14]; + uint8_t data[14]; // wrap the IDAT chunk as a PNG stream @@ -700,16 +700,16 @@ Read a tEXt chunk and extract the key/value pair. @return Returns TRUE if successful, returns FALSE otherwise */ static BOOL -mng_SetMetadata_tEXt(tEXtMAP &key_value_pair, const BYTE *mChunk, DWORD mLength) { +mng_SetMetadata_tEXt(tEXtMAP &key_value_pair, const uint8_t *mChunk, DWORD mLength) { std::string key; std::string value; - BYTE *buffer = (BYTE*)malloc(mLength * sizeof(BYTE)); + uint8_t *buffer = (uint8_t*)malloc(mLength * sizeof(uint8_t)); if(!buffer) { return FALSE; } DWORD pos = 0; - memset(buffer, 0, mLength * sizeof(BYTE)); + memset(buffer, 0, mLength * sizeof(uint8_t)); for(DWORD i = 0; i < mLength; i++) { buffer[pos++] = mChunk[i]; @@ -717,7 +717,7 @@ mng_SetMetadata_tEXt(tEXtMAP &key_value_pair, const BYTE *mChunk, DWORD mLength) if(key.size() == 0) { key = (char*)buffer; pos = 0; - memset(buffer, 0, mLength * sizeof(BYTE)); + memset(buffer, 0, mLength * sizeof(uint8_t)); } else { break; } @@ -745,12 +745,12 @@ Load a FIBITMAP from a MNG or a JNG stream FIBITMAP* mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, int flags = 0) { DWORD mLength = 0; - BYTE mChunkName[5]; - BYTE *mChunk = NULL; + uint8_t mChunkName[5]; + uint8_t *mChunk = NULL; DWORD crc_file; long LastOffset; long mOrigPos; - BYTE *PLTE_file_chunk = NULL; // whole PLTE chunk (lentgh, name, array, crc) + uint8_t *PLTE_file_chunk = NULL; // whole PLTE chunk (lentgh, name, array, crc) DWORD PLTE_file_size = 0; // size of PLTE chunk BOOL m_HasGlobalPalette = FALSE; // may turn to TRUE in PLTE chunk @@ -765,14 +765,14 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in // --- DWORD jng_width = 0; DWORD jng_height = 0; - BYTE jng_color_type = 0; - BYTE jng_image_sample_depth = 0; - BYTE jng_image_compression_method = 0; + uint8_t jng_color_type = 0; + uint8_t jng_image_sample_depth = 0; + uint8_t jng_image_compression_method = 0; - BYTE jng_alpha_sample_depth = 0; - BYTE jng_alpha_compression_method = 0; - BYTE jng_alpha_filter_method = 0; - BYTE jng_alpha_interlace_method = 0; + uint8_t jng_alpha_sample_depth = 0; + uint8_t jng_alpha_compression_method = 0; + uint8_t jng_alpha_filter_method = 0; + uint8_t jng_alpha_interlace_method = 0; DWORD mng_frame_width = 0; DWORD mng_frame_height = 0; @@ -816,7 +816,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in mChunkName[4] = '\0'; if(mLength > 0) { - mChunk = (BYTE*)realloc(mChunk, mLength); + mChunk = (uint8_t*)realloc(mChunk, mLength); if(!mChunk) { FreeImage_OutputMessageProc(format_id, "Error while parsing %s chunk: out of memory", mChunkName); throw (const char*)NULL; @@ -886,7 +886,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in case PLTE: // Global m_HasGlobalPalette = TRUE; PLTE_file_size = mLength + 12; // (lentgh, name, array, crc) = (4, 4, mLength, 4) - PLTE_file_chunk = (BYTE*)realloc(PLTE_file_chunk, PLTE_file_size); + PLTE_file_chunk = (uint8_t*)realloc(PLTE_file_chunk, PLTE_file_size); if(!PLTE_file_chunk) { FreeImage_OutputMessageProc(format_id, "Error while parsing %s chunk: out of memory", mChunkName); throw (const char*)NULL; @@ -925,7 +925,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in FreeImage_SeekMemory(hPngMemory, 0, SEEK_SET); FreeImage_WriteMemory(g_png_signature, 1, 8, hPngMemory); - mChunk = (BYTE*)realloc(mChunk, m_TotalBytesOfChunks); + mChunk = (uint8_t*)realloc(mChunk, m_TotalBytesOfChunks); if(!mChunk) { FreeImage_OutputMessageProc(format_id, "Error while parsing %s chunk: out of memory", mChunkName); throw (const char*)NULL; @@ -968,7 +968,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in jng_color_type = mChunk[8]; jng_image_sample_depth = mChunk[9]; jng_image_compression_method = mChunk[10]; - //BYTE jng_image_interlace_method = mChunk[11]; // for debug only + //uint8_t jng_image_interlace_method = mChunk[11]; // for debug only jng_alpha_sample_depth = mChunk[12]; jng_alpha_compression_method = mChunk[13]; @@ -1013,7 +1013,7 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in // load the PNG alpha layer if(mHasIDAT) { - BYTE *data = NULL; + uint8_t *data = NULL; DWORD size_in_bytes = 0; // get a pointer to the IDAT buffer @@ -1052,13 +1052,13 @@ mng_ReadChunks(int format_id, FreeImageIO *io, fi_handle handle, long Offset, in case bKGD: memcpy(&bk_red, &mChunk[0], 2); mng_SwapShort(&bk_red); - rgbBkColor.rgbRed = (BYTE)bk_red; + rgbBkColor.rgbRed = (uint8_t)bk_red; memcpy(&bk_green, &mChunk[2], 2); mng_SwapShort(&bk_green); - rgbBkColor.rgbGreen = (BYTE)bk_green; + rgbBkColor.rgbGreen = (uint8_t)bk_green; memcpy(&bk_blue, &mChunk[4], 2); mng_SwapShort(&bk_blue); - rgbBkColor.rgbBlue = (BYTE)bk_blue; + rgbBkColor.rgbBlue = (uint8_t)bk_blue; hasBkColor = TRUE; break; @@ -1143,17 +1143,17 @@ BOOL mng_WriteJNG(int format_id, FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int flags) { DWORD jng_width = 0; DWORD jng_height = 0; - BYTE jng_color_type = 0; - BYTE jng_image_sample_depth = 8; - BYTE jng_image_compression_method = 8; // 8: ISO-10918-1 Huffman-coded baseline JPEG. - BYTE jng_image_interlace_method = 0; + uint8_t jng_color_type = 0; + uint8_t jng_image_sample_depth = 8; + uint8_t jng_image_compression_method = 8; // 8: ISO-10918-1 Huffman-coded baseline JPEG. + uint8_t jng_image_interlace_method = 0; - BYTE jng_alpha_sample_depth = 0; - BYTE jng_alpha_compression_method = 0; - BYTE jng_alpha_filter_method = 0; - BYTE jng_alpha_interlace_method = 0; + uint8_t jng_alpha_sample_depth = 0; + uint8_t jng_alpha_compression_method = 0; + uint8_t jng_alpha_filter_method = 0; + uint8_t jng_alpha_interlace_method = 0; - BYTE buffer[16]; + uint8_t buffer[16]; FIMEMORY *hJngMemory = NULL; FIMEMORY *hJpegMemory = NULL; @@ -1231,7 +1231,7 @@ mng_WriteJNG(int format_id, FreeImageIO *io, FIBITMAP *dib, fi_handle handle, in dib_rgb = NULL; } { - BYTE *jpeg_data = NULL; + uint8_t *jpeg_data = NULL; DWORD size_in_bytes = 0; // get a pointer to the stream buffer @@ -1269,7 +1269,7 @@ mng_WriteJNG(int format_id, FreeImageIO *io, FIBITMAP *dib, fi_handle handle, in bResult = mng_FindChunk(hPngMemory, mng_IDAT, offset, &start_pos, &next_pos); if(!bResult) break; - BYTE *png_data = NULL; + uint8_t *png_data = NULL; DWORD size_in_bytes = 0; // get a pointer to the stream buffer @@ -1291,7 +1291,7 @@ mng_WriteJNG(int format_id, FreeImageIO *io, FIBITMAP *dib, fi_handle handle, in // write the JNG on output stream { - BYTE *jng_data = NULL; + uint8_t *jng_data = NULL; DWORD size_in_bytes = 0; FreeImage_AcquireMemory(hJngMemory, &jng_data, &size_in_bytes); io->write_proc(jng_data, 1, size_in_bytes, handle); diff --git a/libs/freeimage/src/FreeImage/MemoryIO.cpp b/libs/freeimage/src/FreeImage/MemoryIO.cpp index cda97e1e71..bcac67d57d 100644 --- a/libs/freeimage/src/FreeImage/MemoryIO.cpp +++ b/libs/freeimage/src/FreeImage/MemoryIO.cpp @@ -30,11 +30,11 @@ // ===================================================================== FIMEMORY * DLL_CALLCONV -FreeImage_OpenMemory(BYTE *data, DWORD size_in_bytes) { +FreeImage_OpenMemory(uint8_t *data, DWORD size_in_bytes) { // allocate a memory handle FIMEMORY *stream = (FIMEMORY*)malloc(sizeof(FIMEMORY)); if(stream) { - stream->data = (BYTE*)malloc(sizeof(FIMEMORYHEADER)); + stream->data = (uint8_t*)malloc(sizeof(FIMEMORYHEADER)); if(stream->data) { FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(stream->data); @@ -45,7 +45,7 @@ FreeImage_OpenMemory(BYTE *data, DWORD size_in_bytes) { if(data && size_in_bytes) { // wrap a user buffer mem_header->delete_me = FALSE; - mem_header->data = (BYTE*)data; + mem_header->data = (uint8_t*)data; mem_header->data_length = mem_header->file_length = size_in_bytes; } else { mem_header->delete_me = TRUE; @@ -113,11 +113,11 @@ FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, i // ===================================================================== BOOL DLL_CALLCONV -FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes) { +FreeImage_AcquireMemory(FIMEMORY *stream, uint8_t **data, DWORD *size_in_bytes) { if (stream) { FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(stream->data); - *data = (BYTE*)mem_header->data; + *data = (uint8_t*)mem_header->data; *size_in_bytes = mem_header->file_length; return TRUE; } diff --git a/libs/freeimage/src/FreeImage/MultiPage.cpp b/libs/freeimage/src/FreeImage/MultiPage.cpp index ee5b481c35..c246692957 100644 --- a/libs/freeimage/src/FreeImage/MultiPage.cpp +++ b/libs/freeimage/src/FreeImage/MultiPage.cpp @@ -440,9 +440,9 @@ FreeImage_SaveMultiBitmapToHandle(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, { // read the compressed data - BYTE *compressed_data = (BYTE*)malloc(i->getSize() * sizeof(BYTE)); + uint8_t *compressed_data = (uint8_t*)malloc(i->getSize() * sizeof(uint8_t)); - header->m_cachefile.readFile((BYTE *)compressed_data, i->getReference(), i->getSize()); + header->m_cachefile.readFile((uint8_t *)compressed_data, i->getReference(), i->getSize()); // uncompress the data @@ -593,7 +593,7 @@ FreeImage_SavePageToBlock(MULTIBITMAPHEADER *header, FIBITMAP *data) { } DWORD compressed_size = 0; - BYTE *compressed_data = NULL; + uint8_t *compressed_data = NULL; // compress the bitmap data @@ -756,7 +756,7 @@ FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *page, BOOL changed) { // compress the data DWORD compressed_size = 0; - BYTE *compressed_data = NULL; + uint8_t *compressed_data = NULL; // open a memory handle FIMEMORY *hmem = FreeImage_OpenMemory(); diff --git a/libs/freeimage/src/FreeImage/NNQuantizer.cpp b/libs/freeimage/src/FreeImage/NNQuantizer.cpp index dac4a2cdec..092bad23b8 100644 --- a/libs/freeimage/src/FreeImage/NNQuantizer.cpp +++ b/libs/freeimage/src/FreeImage/NNQuantizer.cpp @@ -337,7 +337,7 @@ void NNQuantizer::getSample(long pos, int *b, int *g, int *r) { int x = pos % img_line; int y = pos / img_line; - BYTE *bits = FreeImage_GetScanLine(dib_ptr, y) + x; + uint8_t *bits = FreeImage_GetScanLine(dib_ptr, y) + x; *b = bits[FI_RGBA_BLUE] << netbiasshift; *g = bits[FI_RGBA_GREEN] << netbiasshift; @@ -480,9 +480,9 @@ FIBITMAP* NNQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserve RGBQUAD *new_pal = FreeImage_GetPalette(new_dib); for (int j = 0; j < netsize; j++) { - new_pal[j].rgbBlue = (BYTE)network[j][FI_RGBA_BLUE]; - new_pal[j].rgbGreen = (BYTE)network[j][FI_RGBA_GREEN]; - new_pal[j].rgbRed = (BYTE)network[j][FI_RGBA_RED]; + new_pal[j].rgbBlue = (uint8_t)network[j][FI_RGBA_BLUE]; + new_pal[j].rgbGreen = (uint8_t)network[j][FI_RGBA_GREEN]; + new_pal[j].rgbRed = (uint8_t)network[j][FI_RGBA_RED]; } inxbuild(); @@ -490,11 +490,11 @@ FIBITMAP* NNQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserve // 6) Write output image using inxsearch(b,g,r) for (WORD rows = 0; rows < img_height; rows++) { - BYTE *new_bits = FreeImage_GetScanLine(new_dib, rows); - BYTE *bits = FreeImage_GetScanLine(dib_ptr, rows); + uint8_t *new_bits = FreeImage_GetScanLine(new_dib, rows); + uint8_t *bits = FreeImage_GetScanLine(dib_ptr, rows); for (WORD cols = 0; cols < img_width; cols++) { - new_bits[cols] = (BYTE)inxsearch(bits[FI_RGBA_BLUE], bits[FI_RGBA_GREEN], bits[FI_RGBA_RED]); + new_bits[cols] = (uint8_t)inxsearch(bits[FI_RGBA_BLUE], bits[FI_RGBA_GREEN], bits[FI_RGBA_RED]); bits += 3; } diff --git a/libs/freeimage/src/FreeImage/PixelAccess.cpp b/libs/freeimage/src/FreeImage/PixelAccess.cpp index c0582a540a..185763c3ba 100644 --- a/libs/freeimage/src/FreeImage/PixelAccess.cpp +++ b/libs/freeimage/src/FreeImage/PixelAccess.cpp @@ -26,7 +26,7 @@ // ---------------------------------------------------------- -BYTE * DLL_CALLCONV +uint8_t * DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline) { if(!FreeImage_HasPixels(dib)) { return NULL; @@ -35,21 +35,21 @@ FreeImage_GetScanLine(FIBITMAP *dib, int scanline) { } BOOL DLL_CALLCONV -FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value) { - BYTE shift; +FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, uint8_t *value) { + uint8_t shift; if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return FALSE; if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); switch(FreeImage_GetBPP(dib)) { case 1: *value = (bits[x >> 3] & (0x80 >> (x & 0x07))) != 0; break; case 4: - shift = (BYTE)((1 - x % 2) << 2); + shift = (uint8_t)((1 - x % 2) << 2); *value = (bits[x >> 1] & (0x0F << shift)) >> shift; break; case 8: @@ -71,7 +71,7 @@ FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) { return FALSE; if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); switch(FreeImage_GetBPP(dib)) { case 16: @@ -79,14 +79,14 @@ FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) { bits += 2*x; WORD *pixel = (WORD *)bits; if((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) { - value->rgbBlue = (BYTE)((((*pixel & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); - value->rgbGreen = (BYTE)((((*pixel & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); - value->rgbRed = (BYTE)((((*pixel & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); + value->rgbBlue = (uint8_t)((((*pixel & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F); + value->rgbGreen = (uint8_t)((((*pixel & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F); + value->rgbRed = (uint8_t)((((*pixel & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F); value->rgbReserved = 0; } else { - value->rgbBlue = (BYTE)((((*pixel & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); - value->rgbGreen = (BYTE)((((*pixel & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); - value->rgbRed = (BYTE)((((*pixel & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); + value->rgbBlue = (uint8_t)((((*pixel & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F); + value->rgbGreen = (uint8_t)((((*pixel & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F); + value->rgbRed = (uint8_t)((((*pixel & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F); value->rgbReserved = 0; } break; @@ -116,21 +116,21 @@ FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) { } BOOL DLL_CALLCONV -FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value) { - BYTE shift; +FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, uint8_t *value) { + uint8_t shift; if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return FALSE; if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); switch(FreeImage_GetBPP(dib)) { case 1: *value ? bits[x >> 3] |= (0x80 >> (x & 0x7)) : bits[x >> 3] &= (0xFF7F >> (x & 0x7)); break; case 4: - shift = (BYTE)((1 - x % 2) << 2); + shift = (uint8_t)((1 - x % 2) << 2); bits[x >> 1] &= ~(0x0F << shift); bits[x >> 1] |= ((*value & 0x0F) << shift); break; @@ -153,7 +153,7 @@ FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) { return FALSE; if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) { - BYTE *bits = FreeImage_GetScanLine(dib, y); + uint8_t *bits = FreeImage_GetScanLine(dib, y); switch(FreeImage_GetBPP(dib)) { case 16: diff --git a/libs/freeimage/src/FreeImage/PluginBMP.cpp b/libs/freeimage/src/FreeImage/PluginBMP.cpp index ceae053893..a27760a1ea 100644 --- a/libs/freeimage/src/FreeImage/PluginBMP.cpp +++ b/libs/freeimage/src/FreeImage/PluginBMP.cpp @@ -30,12 +30,12 @@ // Constants + headers // ---------------------------------------------------------- -static const BYTE RLE_COMMAND = 0; -static const BYTE RLE_ENDOFLINE = 0; -static const BYTE RLE_ENDOFBITMAP = 1; -static const BYTE RLE_DELTA = 2; +static const uint8_t RLE_COMMAND = 0; +static const uint8_t RLE_ENDOFLINE = 0; +static const uint8_t RLE_ENDOFBITMAP = 1; +static const uint8_t RLE_DELTA = 2; -static const BYTE BI_ALPHABITFIELDS = 6; // compression: Bit field (this value is valid in Windows CE .NET 4.0 and later) +static const uint8_t BI_ALPHABITFIELDS = 6; // compression: Bit field (this value is valid in Windows CE .NET 4.0 and later) typedef struct tagBITMAPINFOOS2_1X_HEADER { DWORD biSize; @@ -147,7 +147,7 @@ LoadPixelData(FreeImageIO *io, fi_handle handle, FIBITMAP *dib, int height, unsi #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB if (bit_count == 24 || bit_count == 32) { for(unsigned y = 0; y < FreeImage_GetHeight(dib); y++) { - BYTE *pixel = FreeImage_GetScanLine(dib, y); + uint8_t *pixel = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < FreeImage_GetWidth(dib); x++) { INPLACESWAP(pixel[0], pixel[2]); pixel += (bit_count >> 3); @@ -171,42 +171,42 @@ Load image pixels for 4-bit RLE compressed dib static BOOL LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBITMAP *dib) { int status_byte = 0; - BYTE second_byte = 0; + uint8_t second_byte = 0; int bits = 0; - BYTE *pixels = NULL; // temporary 8-bit buffer + uint8_t *pixels = NULL; // temporary 8-bit buffer try { height = abs(height); - pixels = (BYTE*)malloc(width * height * sizeof(BYTE)); + pixels = (uint8_t*)malloc(width * height * sizeof(uint8_t)); if(!pixels) throw(1); - memset(pixels, 0, width * height * sizeof(BYTE)); + memset(pixels, 0, width * height * sizeof(uint8_t)); - BYTE *q = pixels; - BYTE *end = pixels + height * width; + uint8_t *q = pixels; + uint8_t *end = pixels + height * width; for (int scanline = 0; scanline < height; ) { if (q < pixels || q >= end) { break; } - if(io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&status_byte, sizeof(uint8_t), 1, handle) != 1) { throw(1); } if (status_byte != 0) { status_byte = (int)MIN((size_t)status_byte, (size_t)(end - q)); // Encoded mode - if(io->read_proc(&second_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&second_byte, sizeof(uint8_t), 1, handle) != 1) { throw(1); } for (int i = 0; i < status_byte; i++) { - *q++=(BYTE)((i & 0x01) ? (second_byte & 0x0f) : ((second_byte >> 4) & 0x0f)); + *q++=(uint8_t)((i & 0x01) ? (second_byte & 0x0f) : ((second_byte >> 4) & 0x0f)); } bits += status_byte; } else { // Escape mode - if(io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&status_byte, sizeof(uint8_t), 1, handle) != 1) { throw(1); } switch (status_byte) { @@ -228,13 +228,13 @@ LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBI { // read the delta values - BYTE delta_x = 0; - BYTE delta_y = 0; + uint8_t delta_x = 0; + uint8_t delta_y = 0; - if(io->read_proc(&delta_x, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&delta_x, sizeof(uint8_t), 1, handle) != 1) { throw(1); } - if(io->read_proc(&delta_y, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&delta_y, sizeof(uint8_t), 1, handle) != 1) { throw(1); } @@ -252,17 +252,17 @@ LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBI status_byte = (int)MIN((size_t)status_byte, (size_t)(end - q)); for (int i = 0; i < status_byte; i++) { if ((i & 0x01) == 0) { - if(io->read_proc(&second_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&second_byte, sizeof(uint8_t), 1, handle) != 1) { throw(1); } } - *q++=(BYTE)((i & 0x01) ? (second_byte & 0x0f) : ((second_byte >> 4) & 0x0f)); + *q++=(uint8_t)((i & 0x01) ? (second_byte & 0x0f) : ((second_byte >> 4) & 0x0f)); } bits += status_byte; // Read pad byte if (((status_byte & 0x03) == 1) || ((status_byte & 0x03) == 2)) { - BYTE padding = 0; - if(io->read_proc(&padding, sizeof(BYTE), 1, handle) != 1) { + uint8_t padding = 0; + if(io->read_proc(&padding, sizeof(uint8_t), 1, handle) != 1) { throw(1); } } @@ -275,8 +275,8 @@ LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBI { // Convert to 4-bit for(int y = 0; y < height; y++) { - const BYTE *src = (BYTE*)pixels + y * width; - BYTE *dst = FreeImage_GetScanLine(dib, y); + const uint8_t *src = (uint8_t*)pixels + y * width; + uint8_t *dst = FreeImage_GetScanLine(dib, y); BOOL hinibble = TRUE; @@ -313,19 +313,19 @@ Load image pixels for 8-bit RLE compressed dib */ static BOOL LoadPixelDataRLE8(FreeImageIO *io, fi_handle handle, int width, int height, FIBITMAP *dib) { - BYTE status_byte = 0; - BYTE second_byte = 0; + uint8_t status_byte = 0; + uint8_t second_byte = 0; int scanline = 0; int bits = 0; for (;;) { - if( io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) { + if( io->read_proc(&status_byte, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } switch (status_byte) { case RLE_COMMAND : - if(io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&status_byte, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } @@ -342,13 +342,13 @@ LoadPixelDataRLE8(FreeImageIO *io, fi_handle handle, int width, int height, FIBI { // read the delta values - BYTE delta_x = 0; - BYTE delta_y = 0; + uint8_t delta_x = 0; + uint8_t delta_y = 0; - if(io->read_proc(&delta_x, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&delta_x, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } - if(io->read_proc(&delta_y, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&delta_y, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } @@ -368,16 +368,16 @@ LoadPixelDataRLE8(FreeImageIO *io, fi_handle handle, int width, int height, FIBI int count = MIN((int)status_byte, width - bits); - BYTE *sline = FreeImage_GetScanLine(dib, scanline); + uint8_t *sline = FreeImage_GetScanLine(dib, scanline); - if(io->read_proc((void *)(sline + bits), sizeof(BYTE) * count, 1, handle) != 1) { + if(io->read_proc((void *)(sline + bits), sizeof(uint8_t) * count, 1, handle) != 1) { return FALSE; } // align run length to even number of bytes if ((status_byte & 1) == 1) { - if(io->read_proc(&second_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&second_byte, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } } @@ -398,9 +398,9 @@ LoadPixelDataRLE8(FreeImageIO *io, fi_handle handle, int width, int height, FIBI int count = MIN((int)status_byte, width - bits); - BYTE *sline = FreeImage_GetScanLine(dib, scanline); + uint8_t *sline = FreeImage_GetScanLine(dib, scanline); - if(io->read_proc(&second_byte, sizeof(BYTE), 1, handle) != 1) { + if(io->read_proc(&second_byte, sizeof(uint8_t), 1, handle) != 1) { return FALSE; } @@ -1008,9 +1008,9 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE bmp_signature1[] = { 0x42, 0x4D }; - BYTE bmp_signature2[] = { 0x42, 0x41 }; - BYTE signature[2] = { 0, 0 }; + uint8_t bmp_signature1[] = { 0x42, 0x4D }; + uint8_t bmp_signature2[] = { 0x42, 0x41 }; + uint8_t signature[2] = { 0, 0 }; io->read_proc(signature, 1, sizeof(bmp_signature1), handle); @@ -1119,8 +1119,8 @@ On return, the function will return the real size of the target buffer, which sh @return Returns the target buffer size */ static int -RLEEncodeLine(BYTE *target, BYTE *source, int size) { - BYTE buffer[256]; +RLEEncodeLine(uint8_t *target, uint8_t *source, int size) { + uint8_t buffer[256]; int buffer_size = 0; int target_pos = 0; @@ -1152,13 +1152,13 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { break; case RLE_ENDOFBITMAP : - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; target[target_pos++] = buffer[0]; break; default : target[target_pos++] = RLE_COMMAND; - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; memcpy(target + target_pos, buffer, buffer_size); // prepare for next run @@ -1173,7 +1173,7 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { // write the continuous data - target[target_pos++] = (BYTE)((j - i) + 1); + target[target_pos++] = (uint8_t)((j - i) + 1); target[target_pos++] = source[i]; buffer_size = 0; @@ -1185,7 +1185,7 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { // write what we have target[target_pos++] = RLE_COMMAND; - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; memcpy(target + target_pos, buffer, buffer_size); // prepare for next run @@ -1205,7 +1205,7 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { if (buffer_size == 254) { target[target_pos++] = RLE_COMMAND; - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; memcpy(target + target_pos, buffer, buffer_size); // prepare for next run @@ -1229,13 +1229,13 @@ RLEEncodeLine(BYTE *target, BYTE *source, int size) { break; case RLE_ENDOFBITMAP : - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; target[target_pos++] = buffer[0]; break; default : target[target_pos++] = RLE_COMMAND; - target[target_pos++] = (BYTE)buffer_size; + target[target_pos++] = (uint8_t)buffer_size; memcpy(target + target_pos, buffer, buffer_size); // prepare for next run @@ -1361,7 +1361,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void // write the bitmap data... if RLE compression is enable, use it if ((dst_bpp == 8) && ((flags & BMP_SAVE_RLE) == BMP_SAVE_RLE)) { - BYTE *buffer = (BYTE*)malloc(dst_pitch * 2 * sizeof(BYTE)); + uint8_t *buffer = (uint8_t*)malloc(dst_pitch * 2 * sizeof(uint8_t)); for (unsigned i = 0; i < dst_height; ++i) { int size = RLEEncodeLine(buffer, FreeImage_GetScanLine(dib, i), FreeImage_GetLine(dib)); @@ -1387,7 +1387,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void WORD pad = 0; WORD pixel; for(unsigned y = 0; y < dst_height; y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < dst_width; x++) { pixel = ((WORD *)line)[x]; SwapShort(&pixel); @@ -1408,7 +1408,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void DWORD pad = 0; FILE_BGR bgr; for(unsigned y = 0; y < dst_height; y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < dst_width; x++) { RGBTRIPLE *triple = ((RGBTRIPLE *)line)+x; bgr.b = triple->rgbtBlue; @@ -1427,7 +1427,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } else if (bpp == 32) { FILE_BGRA bgra; for(unsigned y = 0; y < dst_height; y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < dst_width; x++) { RGBQUAD *quad = ((RGBQUAD *)line)+x; bgra.b = quad->rgbBlue; @@ -1446,7 +1446,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } else { for (unsigned y = 0; y < dst_height; y++) { - BYTE *line = (BYTE*)FreeImage_GetScanLine(dib, y); + uint8_t *line = (uint8_t*)FreeImage_GetScanLine(dib, y); if (io->write_proc(line, dst_pitch, 1, handle) != 1) { return FALSE; diff --git a/libs/freeimage/src/FreeImage/PluginGIF.cpp b/libs/freeimage/src/FreeImage/PluginGIF.cpp index 8fe0422b31..b1c823bdc8 100644 --- a/libs/freeimage/src/FreeImage/PluginGIF.cpp +++ b/libs/freeimage/src/FreeImage/PluginGIF.cpp @@ -51,7 +51,7 @@ struct GIFinfo { //only really used when reading size_t global_color_table_offset; int global_color_table_size; - BYTE background_color; + uint8_t background_color; std::vector<size_t> application_extension_offsets; std::vector<size_t> comment_extension_offsets; std::vector<size_t> graphic_control_extension_offsets; @@ -79,11 +79,11 @@ public: StringTable(); ~StringTable(); void Initialize(int minCodeSize); - BYTE *FillInputBuffer(int len); + uint8_t *FillInputBuffer(int len); void CompressStart(int bpp, int width); - int CompressEnd(BYTE *buf); //0-4 bytes - bool Compress(BYTE *buf, int *len); - bool Decompress(BYTE *buf, int *len); + int CompressEnd(uint8_t *buf); //0-4 bytes + bool Compress(uint8_t *buf, int *len); + bool Decompress(uint8_t *buf, int *len); void Done(void); protected: @@ -105,7 +105,7 @@ protected: int* m_strmap; //input buffer - BYTE *m_buffer; + uint8_t *m_buffer; int m_bufferSize, m_bufferRealSize, m_bufferPos, m_bufferShift; void ClearCompressorTable(void); @@ -220,14 +220,14 @@ void StringTable::Initialize(int minCodeSize) ClearDecompressorTable(); } -BYTE *StringTable::FillInputBuffer(int len) +uint8_t *StringTable::FillInputBuffer(int len) { if( m_buffer == NULL ) { - m_buffer = new(std::nothrow) BYTE[len]; + m_buffer = new(std::nothrow) uint8_t[len]; m_bufferRealSize = len; } else if( len > m_bufferRealSize ) { delete [] m_buffer; - m_buffer = new(std::nothrow) BYTE[len]; + m_buffer = new(std::nothrow) uint8_t[len]; m_bufferRealSize = len; } m_bufferSize = len; @@ -246,7 +246,7 @@ void StringTable::CompressStart(int bpp, int width) ClearCompressorTable(); } -int StringTable::CompressEnd(BYTE *buf) +int StringTable::CompressEnd(uint8_t *buf) { int len = 0; @@ -254,7 +254,7 @@ int StringTable::CompressEnd(BYTE *buf) m_partial |= m_prefix << m_partialSize; m_partialSize += m_codeSize; while( m_partialSize >= 8 ) { - *buf++ = (BYTE)m_partial; + *buf++ = (uint8_t)m_partial; m_partial >>= 8; m_partialSize -= 8; len++; @@ -264,7 +264,7 @@ int StringTable::CompressEnd(BYTE *buf) m_partial |= m_endCode << m_partialSize; m_partialSize += m_codeSize; while( m_partialSize > 0 ) { - *buf++ = (BYTE)m_partial; + *buf++ = (uint8_t)m_partial; m_partial >>= 8; m_partialSize -= 8; len++; @@ -275,14 +275,14 @@ int StringTable::CompressEnd(BYTE *buf) return len; } -bool StringTable::Compress(BYTE *buf, int *len) +bool StringTable::Compress(uint8_t *buf, int *len) { if( m_bufferSize == 0 || m_done ) { return false; } int mask = (1 << m_bpp) - 1; - BYTE *bufpos = buf; + uint8_t *bufpos = buf; while( m_bufferPos < m_bufferSize ) { //get the current pixel value char ch = (char)((m_buffer[m_bufferPos] >> m_bufferShift) & mask); @@ -299,7 +299,7 @@ bool StringTable::Compress(BYTE *buf, int *len) m_partialSize += m_codeSize; //grab full bytes for the output buffer while( m_partialSize >= 8 && bufpos - buf < *len ) { - *bufpos++ = (BYTE)m_partial; + *bufpos++ = (uint8_t)m_partial; m_partial >>= 8; m_partialSize -= 8; } @@ -365,13 +365,13 @@ bool StringTable::Compress(BYTE *buf, int *len) return true; } -bool StringTable::Decompress(BYTE *buf, int *len) +bool StringTable::Decompress(uint8_t *buf, int *len) { if( m_bufferSize == 0 || m_done ) { return false; } - BYTE *bufpos = buf; + uint8_t *bufpos = buf; for( ; m_bufferPos < m_bufferSize; m_bufferPos++ ) { m_partial |= (int)m_buffer[m_bufferPos] << m_partialSize; m_partialSize += 8; @@ -495,9 +495,9 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE GIF89a[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61 }; // ASCII code for "GIF89a" - BYTE GIF87a[] = { 0x47, 0x49, 0x46, 0x38, 0x37, 0x61 }; // ASCII code for "GIF87a" - BYTE signature[6] = { 0, 0, 0, 0, 0, 0 }; + uint8_t GIF89a[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61 }; // ASCII code for "GIF89a" + uint8_t GIF87a[] = { 0x47, 0x49, 0x46, 0x38, 0x37, 0x61 }; // ASCII code for "GIF87a" + uint8_t signature[6] = { 0, 0, 0, 0, 0, 0 }; io->read_proc(signature, 1, 6, handle); @@ -542,7 +542,7 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) { //Logical Screen Descriptor io->seek_proc(handle, 4, SEEK_CUR); - BYTE packed; + uint8_t packed; if( io->read_proc(&packed, 1, 1, handle) < 1 ) { throw "EOF reading Logical Screen Descriptor"; } @@ -560,7 +560,7 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) { //Scan through all the rest of the blocks, saving offsets size_t gce_offset = 0; - BYTE block = 0; + uint8_t block = 0; while( block != GIF_BLOCK_TRAILER ) { if( io->read_proc(&block, 1, 1, handle) < 1 ) { throw "EOF reading blocks"; @@ -584,7 +584,7 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) { //LZW Minimum Code Size io->seek_proc(handle, 1, SEEK_CUR); } else if( block == GIF_BLOCK_EXTENSION ) { - BYTE ext; + uint8_t ext; if( io->read_proc(&ext, 1, 1, handle) < 1 ) { throw "EOF reading extension"; } @@ -604,7 +604,7 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) { } //Data Sub-blocks - BYTE len; + uint8_t len; if( io->read_proc(&len, 1, 1, handle) < 1 ) { throw "EOF reading sub-block"; } @@ -637,7 +637,7 @@ Close(FreeImageIO *io, fi_handle handle, void *data) { if( !info->read ) { //Trailer - BYTE b = GIF_BLOCK_TRAILER; + uint8_t b = GIF_BLOCK_TRAILER; io->write_proc(&b, 1, 1, handle); } @@ -673,7 +673,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { bool have_transparent = false, no_local_palette = false, interlaced = false; int disposal_method = GIF_DISPOSAL_LEAVE, delay_time = 0, transparent_color = 0; WORD left, top, width, height; - BYTE packed, b; + uint8_t packed, b; WORD w; //playback pages to generate what the user would see for this frame @@ -791,7 +791,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { have_transparent = false; if( FreeImage_IsTransparent(pagedib) ) { int count = FreeImage_GetTransparencyCount(pagedib); - BYTE *table = FreeImage_GetTransparencyTable(pagedib); + uint8_t *table = FreeImage_GetTransparencyTable(pagedib); for( int i = 0; i < count; i++ ) { if( table[i] == 0 ) { have_transparent = true; @@ -807,7 +807,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { break; // If data is corrupt, don't calculate in invalid scanline } scanline = (RGBQUAD *)FreeImage_GetScanLine(dib, scanidx) + info.left; - BYTE *pageline = FreeImage_GetScanLine(pagedib, info.height - y - 1); + uint8_t *pageline = FreeImage_GetScanLine(pagedib, info.height - y - 1); for( x = 0; x < info.width; x++ ) { if( !have_transparent || *pageline != transparent_color ) { *scanline = pal[*pageline]; @@ -902,9 +902,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { } else { //its legal to have no palette, but we're going to generate *something* for( int i = 0; i < 256; i++ ) { - pal[i].rgbRed = (BYTE)i; - pal[i].rgbGreen = (BYTE)i; - pal[i].rgbBlue = (BYTE)i; + pal[i].rgbRed = (uint8_t)i; + pal[i].rgbGreen = (uint8_t)i; + pal[i].rgbBlue = (uint8_t)i; } } @@ -915,8 +915,8 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { //Image Data Sub-blocks int x = 0, xpos = 0, y = 0, shift = 8 - bpp, mask = (1 << bpp) - 1, interlacepass = 0; - BYTE *scanline = FreeImage_GetScanLine(dib, height - 1); - BYTE buf[4096]; + uint8_t *scanline = FreeImage_GetScanLine(dib, height - 1); + uint8_t buf[4096]; io->read_proc(&b, 1, 1, handle); while( b ) { io->read_proc(stringtable->FillInputBuffer(b), b, 1, handle); @@ -1046,7 +1046,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { if( have_transparent ) { int size = 1 << bpp; if( transparent_color <= size ) { - BYTE table[256]; + uint8_t table[256]; memset(table, 0xFF, size); table[transparent_color] = 0; FreeImage_SetTransparencyTable(dib, table, size); @@ -1054,7 +1054,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { } } FreeImage_SetMetadataEx(FIMD_ANIMATION, dib, "FrameTime", ANIMTAG_FRAMETIME, FIDT_LONG, 1, 4, &delay_time); - b = (BYTE)disposal_method; + b = (uint8_t)disposal_method; FreeImage_SetMetadataEx(FIMD_ANIMATION, dib, "DisposalMethod", ANIMTAG_DISPOSALMETHOD, FIDT_BYTE, 1, 1, &b); delete stringtable; @@ -1082,7 +1082,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } try { - BYTE packed, b; + uint8_t packed, b; WORD w; FITAG *tag; @@ -1102,16 +1102,16 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void top = *(WORD *)FreeImage_GetTagValue(tag); } if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "NoLocalPalette", FIDT_BYTE, &tag) ) { - no_local_palette = *(BYTE *)FreeImage_GetTagValue(tag) ? true : false; + no_local_palette = *(uint8_t *)FreeImage_GetTagValue(tag) ? true : false; } if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "Interlaced", FIDT_BYTE, &tag) ) { - interlaced = *(BYTE *)FreeImage_GetTagValue(tag) ? true : false; + interlaced = *(uint8_t *)FreeImage_GetTagValue(tag) ? true : false; } if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "FrameTime", FIDT_LONG, &tag) ) { delay_time = *(LONG *)FreeImage_GetTagValue(tag); } if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "DisposalMethod", FIDT_BYTE, &tag) ) { - disposal_method = *(BYTE *)FreeImage_GetTagValue(tag); + disposal_method = *(uint8_t *)FreeImage_GetTagValue(tag); } RGBQUAD *pal = FreeImage_GetPalette(dib); @@ -1186,7 +1186,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void background_color.rgbGreen == globalpalette[i].rgbGreen && background_color.rgbBlue == globalpalette[i].rgbBlue ) { - b = (BYTE)i; + b = (uint8_t)i; break; } } @@ -1240,7 +1240,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void char *value = (char *)FreeImage_GetTagValue(tag); io->write_proc((void *)"\x21\xFE", 2, 1, handle); while( length > 0 ) { - b = (BYTE)(length >= 255 ? 255 : length); + b = (uint8_t)(length >= 255 ? 255 : length); io->write_proc(&b, 1, 1, handle); io->write_proc(value, b, 1, handle); value += b; @@ -1258,7 +1258,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void //Graphic Control Extension if( FreeImage_IsTransparent(dib) ) { int count = FreeImage_GetTransparencyCount(dib); - BYTE *table = FreeImage_GetTransparencyTable(dib); + uint8_t *table = FreeImage_GetTransparencyTable(dib); for( int i = 0; i < count; i++ ) { if( table[i] == 0 ) { have_transparent = true; @@ -1268,7 +1268,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } } io->write_proc((void *)"\x21\xF9\x04", 3, 1, handle); - b = (BYTE)((disposal_method << 2) & GIF_PACKED_GCE_DISPOSAL); + b = (uint8_t)((disposal_method << 2) & GIF_PACKED_GCE_DISPOSAL); if( have_transparent ) b |= GIF_PACKED_GCE_HAVETRANS; io->write_proc(&b, 1, 1, handle); //Notes about delay time for GIFs: @@ -1280,7 +1280,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void SwapShort(&w); #endif io->write_proc(&w, 2, 1, handle); - b = (BYTE)transparent_color; + b = (uint8_t)transparent_color; io->write_proc(&b, 1, 1, handle); b = 0; io->write_proc(&b, 1, 1, handle); @@ -1309,7 +1309,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void //LZW Minimum Code Size - b = (BYTE)(bpp == 1 ? 2 : bpp); + b = (uint8_t)(bpp == 1 ? 2 : bpp); io->write_proc(&b, 1, 1, handle); StringTable *stringtable = new(std::nothrow) StringTable; stringtable->Initialize(b); @@ -1317,7 +1317,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void //Image Data Sub-blocks int y = 0, interlacepass = 0, line = FreeImage_GetLine(dib); - BYTE buf[255], *bufptr = buf; //255 is the max sub-block length + uint8_t buf[255], *bufptr = buf; //255 is the max sub-block length int size = sizeof(buf); b = sizeof(buf); while( y < output_height ) { @@ -1343,7 +1343,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } } size = (int)(bufptr - buf); - BYTE last[4]; + uint8_t last[4]; w = (WORD)stringtable->CompressEnd(last); if( size + w >= sizeof(buf) ) { //one last full size sub-block @@ -1351,14 +1351,14 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void io->write_proc(buf, size, 1, handle); io->write_proc(last, sizeof(buf) - size, 1, handle); //and possibly a tiny additional sub-block - b = (BYTE)(w - (sizeof(buf) - size)); + b = (uint8_t)(w - (sizeof(buf) - size)); if( b > 0 ) { io->write_proc(&b, 1, 1, handle); io->write_proc(last + w - b, b, 1, handle); } } else { //last sub-block less than full size - b = (BYTE)(size + w); + b = (uint8_t)(size + w); io->write_proc(&b, 1, 1, handle); io->write_proc(buf, size, 1, handle); io->write_proc(last, w, 1, handle); diff --git a/libs/freeimage/src/FreeImage/PluginICO.cpp b/libs/freeimage/src/FreeImage/PluginICO.cpp index 85fc57c391..d34c49fde4 100644 --- a/libs/freeimage/src/FreeImage/PluginICO.cpp +++ b/libs/freeimage/src/FreeImage/PluginICO.cpp @@ -42,10 +42,10 @@ typedef struct tagICONHEADER { } ICONHEADER; typedef struct tagICONDIRECTORYENTRY { - BYTE bWidth; // width of the image - BYTE bHeight; // height of the image (times 2) - BYTE bColorCount; // number of colors in image (0 if >=8bpp) - BYTE bReserved; // reserved + uint8_t bWidth; // width of the image + uint8_t bHeight; // height of the image (times 2) + uint8_t bColorCount; // number of colors in image (0 if >=8bpp) + uint8_t bReserved; // reserved WORD wPlanes; // color Planes WORD wBitCount; // bits per pixel DWORD dwBytesInRes; // how many bytes in this resource? @@ -115,8 +115,8 @@ Vista icon support */ static BOOL IsPNG(FreeImageIO *io, fi_handle handle) { - BYTE png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; - BYTE signature[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + uint8_t png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; + uint8_t signature[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; long tell = io->tell_proc(handle); io->read_proc(&signature, 1, 8, handle); @@ -344,7 +344,7 @@ LoadStandardIcon(FreeImageIO *io, fi_handle handle, int flags, BOOL header_only) #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB if (bit_count == 24 || bit_count == 32) { for(int y = 0; y < height; y++) { - BYTE *pixel = FreeImage_GetScanLine(dib, y); + uint8_t *pixel = FreeImage_GetScanLine(dib, y); for(int x = 0; x < width; x++) { INPLACESWAP(pixel[0], pixel[2]); pixel += (bit_count>>3); @@ -365,7 +365,7 @@ LoadStandardIcon(FreeImageIO *io, fi_handle handle, int flags, BOOL header_only) } int width_and = WidthBytes(width); - BYTE *line_and = (BYTE *)malloc(width_and); + uint8_t *line_and = (uint8_t *)malloc(width_and); if( line_and == NULL ) { FreeImage_Unload(dib32); @@ -498,7 +498,7 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { if (bit_count == 16) { WORD pixel; for(unsigned y = 0; y < FreeImage_GetHeight(dib); y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < FreeImage_GetWidth(dib); x++) { pixel = ((WORD *)line)[x]; SwapShort(&pixel); @@ -512,7 +512,7 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { if (bit_count == 24) { FILE_BGR bgr; for(unsigned y = 0; y < FreeImage_GetHeight(dib); y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < FreeImage_GetWidth(dib); x++) { RGBTRIPLE *triple = ((RGBTRIPLE *)line)+x; bgr.b = triple->rgbtBlue; @@ -525,7 +525,7 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { } else if (bit_count == 32) { FILE_BGRA bgra; for(unsigned y = 0; y < FreeImage_GetHeight(dib); y++) { - BYTE *line = FreeImage_GetScanLine(dib, y); + uint8_t *line = FreeImage_GetScanLine(dib, y); for(unsigned x = 0; x < FreeImage_GetWidth(dib); x++) { RGBQUAD *quad = ((RGBQUAD *)line)+x; bgra.b = quad->rgbBlue; @@ -541,13 +541,13 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { #if defined(FREEIMAGE_BIGENDIAN) || FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB { #endif - BYTE *xor_mask = FreeImage_GetBits(dib); + uint8_t *xor_mask = FreeImage_GetBits(dib); io->write_proc(xor_mask, size_xor, 1, handle); #if defined(FREEIMAGE_BIGENDIAN) || FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB } #endif // AND mask - BYTE *and_mask = (BYTE*)malloc(size_and); + uint8_t *and_mask = (uint8_t*)malloc(size_and); if(!and_mask) { return FALSE; } @@ -558,7 +558,7 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { // create the AND mask from the alpha channel int width_and = WidthBytes(width); - BYTE *and_bits = and_mask; + uint8_t *and_bits = and_mask; // clear the mask memset(and_mask, 0, size_and); @@ -579,10 +579,10 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { else if(bit_count <= 8) { // create the AND mask from the transparency table - BYTE *trns = FreeImage_GetTransparencyTable(dib); + uint8_t *trns = FreeImage_GetTransparencyTable(dib); int width_and = WidthBytes(width); - BYTE *and_bits = and_mask; + uint8_t *and_bits = and_mask; // clear the mask memset(and_mask, 0, size_and); @@ -591,10 +591,10 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { case 1: { for(int y = 0; y < height; y++) { - BYTE *bits = (BYTE*)FreeImage_GetScanLine(dib, y); + uint8_t *bits = (uint8_t*)FreeImage_GetScanLine(dib, y); for(int x = 0; x < width; x++) { // get pixel at (x, y) - BYTE index = (bits[x >> 3] & (0x80 >> (x & 0x07))) != 0; + uint8_t index = (bits[x >> 3] & (0x80 >> (x & 0x07))) != 0; if(trns[index] != 0xFF) { // set any transparent color to full transparency and_bits[x >> 3] |= (0x80 >> (x & 0x7)); @@ -608,11 +608,11 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { case 4: { for(int y = 0; y < height; y++) { - BYTE *bits = (BYTE*)FreeImage_GetScanLine(dib, y); + uint8_t *bits = (uint8_t*)FreeImage_GetScanLine(dib, y); for(int x = 0; x < width; x++) { // get pixel at (x, y) - BYTE shift = (BYTE)((1 - x % 2) << 2); - BYTE index = (bits[x >> 1] & (0x0F << shift)) >> shift; + uint8_t shift = (uint8_t)((1 - x % 2) << 2); + uint8_t index = (bits[x >> 1] & (0x0F << shift)) >> shift; if(trns[index] != 0xFF) { // set any transparent color to full transparency and_bits[x >> 3] |= (0x80 >> (x & 0x7)); @@ -626,10 +626,10 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) { case 8: { for(int y = 0; y < height; y++) { - BYTE *bits = (BYTE*)FreeImage_GetScanLine(dib, y); + uint8_t *bits = (uint8_t*)FreeImage_GetScanLine(dib, y); for(int x = 0; x < width; x++) { // get pixel at (x, y) - BYTE index = bits[x]; + uint8_t index = bits[x]; if(trns[index] != 0xFF) { // set any transparent color to full transparency and_bits[x >> 3] |= (0x80 >> (x & 0x7)); @@ -723,15 +723,15 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void // convert internal format to ICONDIRENTRY // take into account Vista icons whose size is 256x256 const BITMAPINFOHEADER *bmih = FreeImage_GetInfoHeader(icon_dib); - icon_list[k].bWidth = (bmih->biWidth > 255) ? 0 : (BYTE)bmih->biWidth; - icon_list[k].bHeight = (bmih->biHeight > 255) ? 0 : (BYTE)bmih->biHeight; + icon_list[k].bWidth = (bmih->biWidth > 255) ? 0 : (uint8_t)bmih->biWidth; + icon_list[k].bHeight = (bmih->biHeight > 255) ? 0 : (uint8_t)bmih->biHeight; icon_list[k].bReserved = 0; icon_list[k].wPlanes = bmih->biPlanes; icon_list[k].wBitCount = bmih->biBitCount; if( (icon_list[k].wPlanes * icon_list[k].wBitCount) >= 8 ) { icon_list[k].bColorCount = 0; } else { - icon_list[k].bColorCount = (BYTE)(1 << (icon_list[k].wPlanes * icon_list[k].wBitCount)); + icon_list[k].bColorCount = (uint8_t)(1 << (icon_list[k].wPlanes * icon_list[k].wBitCount)); } // initial guess (correct only for standard icons) icon_list[k].dwBytesInRes = CalculateImageSize(icon_dib); diff --git a/libs/freeimage/src/FreeImage/PluginJPEG.cpp b/libs/freeimage/src/FreeImage/PluginJPEG.cpp index 4dbd5d26a6..dc76574723 100644 --- a/libs/freeimage/src/FreeImage/PluginJPEG.cpp +++ b/libs/freeimage/src/FreeImage/PluginJPEG.cpp @@ -425,9 +425,9 @@ jpeg_freeimage_dst (j_compress_ptr cinfo, fi_handle outfile, FreeImageIO *io) { Read JPEG_COM marker (comment) */ static BOOL -jpeg_read_comment(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { +jpeg_read_comment(FIBITMAP *dib, const uint8_t *dataptr, unsigned int datalen) { size_t length = datalen; - BYTE *profile = (BYTE*)dataptr; + uint8_t *profile = (uint8_t*)dataptr; // read the comment char *value = (char*)malloc((length + 1) * sizeof(char)); @@ -469,7 +469,7 @@ Handy subroutine to test whether a saved marker is an ICC profile marker. static BOOL marker_is_icc(jpeg_saved_marker_ptr marker) { // marker identifying string "ICC_PROFILE" (null-terminated) - const BYTE icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 }; + const uint8_t icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 }; if(marker->marker == ICC_MARKER) { // verify the identifying string @@ -510,7 +510,7 @@ jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr, unsigned *i unsigned total_length; const int MAX_SEQ_NO = 255; // sufficient since marker numbers are bytes - BYTE marker_present[MAX_SEQ_NO+1]; // 1 if marker found + uint8_t marker_present[MAX_SEQ_NO+1]; // 1 if marker found unsigned data_length[MAX_SEQ_NO+1]; // size of profile data in marker unsigned data_offset[MAX_SEQ_NO+1]; // offset for data in marker @@ -597,7 +597,7 @@ jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr, unsigned *i Read JPEG_APPD marker (IPTC or Adobe Photoshop profile) */ static BOOL -jpeg_read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { +jpeg_read_iptc_profile(FIBITMAP *dib, const uint8_t *dataptr, unsigned int datalen) { return read_iptc_profile(dib, dataptr, datalen); } @@ -609,14 +609,14 @@ jpeg_read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) @return Returns TRUE if successful, FALSE otherwise */ static BOOL -jpeg_read_xmp_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { +jpeg_read_xmp_profile(FIBITMAP *dib, const uint8_t *dataptr, unsigned int datalen) { // marker identifying string for XMP (null terminated) const char *xmp_signature = "http://ns.adobe.com/xap/1.0/"; // XMP signature is 29 bytes long const size_t xmp_signature_size = strlen(xmp_signature) + 1; size_t length = datalen; - BYTE *profile = (BYTE*)dataptr; + uint8_t *profile = (uint8_t*)dataptr; if(length <= xmp_signature_size) { // avoid reading corrupted or empty data @@ -662,23 +662,23 @@ jpeg_read_xmp_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) @return Returns TRUE if successful, FALSE otherwise */ static BOOL -jpeg_read_jfxx(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) { +jpeg_read_jfxx(FIBITMAP *dib, const uint8_t *dataptr, unsigned int datalen) { if(datalen < 6) { return FALSE; } const int id_length = 5; - const BYTE *data = dataptr + id_length; + const uint8_t *data = dataptr + id_length; unsigned remaining = datalen - id_length; - const BYTE type = *data; + const uint8_t type = *data; ++data, --remaining; switch(type) { case JFXX_TYPE_JPEG: { // load the thumbnail - FIMEMORY* hmem = FreeImage_OpenMemory(const_cast<BYTE*>(data), remaining); + FIMEMORY* hmem = FreeImage_OpenMemory(const_cast<uint8_t*>(data), remaining); FIBITMAP* thumbnail = FreeImage_LoadFromMemory(FIF_JPEG, hmem); FreeImage_CloseMemory(hmem); // store the thumbnail @@ -741,7 +741,7 @@ read_markers(j_decompress_ptr cinfo, FIBITMAP *dib) { } // ICC profile - BYTE *icc_profile = NULL; + uint8_t *icc_profile = NULL; unsigned icc_length = 0; if( jpeg_read_icc_profile(cinfo, &icc_profile, &icc_length) ) { @@ -772,7 +772,7 @@ jpeg_write_comment(j_compress_ptr cinfo, FIBITMAP *dib) { if(NULL != tag_value) { for(long i = 0; i < (long)strlen(tag_value); i+= MAX_BYTES_IN_MARKER) { - jpeg_write_marker(cinfo, JPEG_COM, (BYTE*)tag_value + i, MIN((long)strlen(tag_value + i), MAX_BYTES_IN_MARKER)); + jpeg_write_marker(cinfo, JPEG_COM, (uint8_t*)tag_value + i, MIN((long)strlen(tag_value + i), MAX_BYTES_IN_MARKER)); } return TRUE; } @@ -786,25 +786,25 @@ jpeg_write_comment(j_compress_ptr cinfo, FIBITMAP *dib) { static BOOL jpeg_write_icc_profile(j_compress_ptr cinfo, FIBITMAP *dib) { // marker identifying string "ICC_PROFILE" (null-terminated) - BYTE icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 }; + uint8_t icc_signature[12] = { 0x49, 0x43, 0x43, 0x5F, 0x50, 0x52, 0x4F, 0x46, 0x49, 0x4C, 0x45, 0x00 }; FIICCPROFILE *iccProfile = FreeImage_GetICCProfile(dib); if (iccProfile->size && iccProfile->data) { // ICC_HEADER_SIZE: ICC signature is 'ICC_PROFILE' + 2 bytes - BYTE *profile = (BYTE*)malloc((iccProfile->size + ICC_HEADER_SIZE) * sizeof(BYTE)); + uint8_t *profile = (uint8_t*)malloc((iccProfile->size + ICC_HEADER_SIZE) * sizeof(uint8_t)); if(profile == NULL) return FALSE; memcpy(profile, icc_signature, 12); for(long i = 0; i < (long)iccProfile->size; i += MAX_DATA_BYTES_IN_MARKER) { unsigned length = MIN((long)(iccProfile->size - i), MAX_DATA_BYTES_IN_MARKER); // sequence number - profile[12] = (BYTE) ((i / MAX_DATA_BYTES_IN_MARKER) + 1); + profile[12] = (uint8_t) ((i / MAX_DATA_BYTES_IN_MARKER) + 1); // number of markers - profile[13] = (BYTE) (iccProfile->size / MAX_DATA_BYTES_IN_MARKER + 1); + profile[13] = (uint8_t) (iccProfile->size / MAX_DATA_BYTES_IN_MARKER + 1); - memcpy(profile + ICC_HEADER_SIZE, (BYTE*)iccProfile->data + i, length); + memcpy(profile + ICC_HEADER_SIZE, (uint8_t*)iccProfile->data + i, length); jpeg_write_marker(cinfo, ICC_MARKER, profile, (length + ICC_HEADER_SIZE)); } @@ -826,7 +826,7 @@ jpeg_write_iptc_profile(j_compress_ptr cinfo, FIBITMAP *dib) { const unsigned tag_length = 26; if(FreeImage_GetMetadataCount(FIMD_IPTC, dib)) { - BYTE *profile = NULL; + uint8_t *profile = NULL; unsigned profile_size = 0; // create a binary profile @@ -836,15 +836,15 @@ jpeg_write_iptc_profile(j_compress_ptr cinfo, FIBITMAP *dib) { for(long i = 0; i < (long)profile_size; i += 65517L) { unsigned length = MIN((long)profile_size - i, 65517L); unsigned roundup = length & 0x01; // needed for Photoshop - BYTE *iptc_profile = (BYTE*)malloc(length + roundup + tag_length); + uint8_t *iptc_profile = (uint8_t*)malloc(length + roundup + tag_length); if(iptc_profile == NULL) break; // Photoshop identification string memcpy(&iptc_profile[0], "Photoshop 3.0\x0", 14); // 8BIM segment type memcpy(&iptc_profile[14], "8BIM\x04\x04\x0\x0\x0\x0", 10); // segment size - iptc_profile[24] = (BYTE)(length >> 8); - iptc_profile[25] = (BYTE)(length & 0xFF); + iptc_profile[24] = (uint8_t)(length >> 8); + iptc_profile[25] = (uint8_t)(length & 0xFF); // segment data memcpy(&iptc_profile[tag_length], &profile[i], length); if(roundup) @@ -876,7 +876,7 @@ jpeg_write_xmp_profile(j_compress_ptr cinfo, FIBITMAP *dib) { FreeImage_GetMetadata(FIMD_XMP, dib, g_TagLib_XMPFieldName, &tag_xmp); if(tag_xmp) { - const BYTE *tag_value = (BYTE*)FreeImage_GetTagValue(tag_xmp); + const uint8_t *tag_value = (uint8_t*)FreeImage_GetTagValue(tag_xmp); if(NULL != tag_value) { // XMP signature is 29 bytes long @@ -884,7 +884,7 @@ jpeg_write_xmp_profile(j_compress_ptr cinfo, FIBITMAP *dib) { DWORD tag_length = FreeImage_GetTagLength(tag_xmp); - BYTE *profile = (BYTE*)malloc((tag_length + xmp_header_size) * sizeof(BYTE)); + uint8_t *profile = (uint8_t*)malloc((tag_length + xmp_header_size) * sizeof(uint8_t)); if(profile == NULL) return FALSE; memcpy(profile, xmp_signature, xmp_header_size); @@ -911,13 +911,13 @@ jpeg_write_xmp_profile(j_compress_ptr cinfo, FIBITMAP *dib) { static BOOL jpeg_write_exif_profile_raw(j_compress_ptr cinfo, FIBITMAP *dib) { // marker identifying string for Exif = "Exif\0\0" - BYTE exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; + uint8_t exif_signature[6] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; FITAG *tag_exif = NULL; FreeImage_GetMetadata(FIMD_EXIF_RAW, dib, g_TagLib_ExifRawFieldName, &tag_exif); if(tag_exif) { - const BYTE *tag_value = (BYTE*)FreeImage_GetTagValue(tag_exif); + const uint8_t *tag_value = (uint8_t*)FreeImage_GetTagValue(tag_exif); // verify the identifying string if(memcmp(exif_signature, tag_value, sizeof(exif_signature)) != 0) { @@ -928,7 +928,7 @@ jpeg_write_exif_profile_raw(j_compress_ptr cinfo, FIBITMAP *dib) { if(NULL != tag_value) { DWORD tag_length = FreeImage_GetTagLength(tag_exif); - BYTE *profile = (BYTE*)malloc(tag_length * sizeof(BYTE)); + uint8_t *profile = (uint8_t*)malloc(tag_length * sizeof(uint8_t)); if(profile == NULL) return FALSE; for(DWORD i = 0; i < tag_length; i += 65504L) { @@ -981,13 +981,13 @@ jpeg_write_jfxx(j_compress_ptr cinfo, FIBITMAP *dib) { return FALSE; } - BYTE* thData = NULL; + uint8_t* thData = NULL; DWORD thSize = 0; FreeImage_AcquireMemory(stream, &thData, &thSize); - BYTE id_length = 5; //< "JFXX" - BYTE type = JFXX_TYPE_JPEG; + uint8_t id_length = 5; //< "JFXX" + uint8_t type = JFXX_TYPE_JPEG; DWORD totalsize = id_length + sizeof(type) + thSize; jpeg_write_m_header(cinfo, JPEG_APP0, totalsize); @@ -1005,10 +1005,10 @@ jpeg_write_jfxx(j_compress_ptr cinfo, FIBITMAP *dib) { freeimage_dst_ptr dest = (freeimage_dst_ptr) cinfo->dest; - BYTE* & out = dest->pub.next_output_byte; + uint8_t* & out = dest->pub.next_output_byte; size_t & bufRemain = dest->pub.free_in_buffer; - const BYTE *thData_end = thData + thSize; + const uint8_t *thData_end = thData + thSize; while(thData < thData_end) { *(out)++ = *(thData)++; @@ -1115,8 +1115,8 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE jpeg_signature[] = { 0xFF, 0xD8 }; - BYTE signature[2] = { 0, 0 }; + uint8_t jpeg_signature[] = { 0xFF, 0xD8 }; + uint8_t signature[2] = { 0, 0 }; io->read_proc(signature, 1, sizeof(jpeg_signature), handle); @@ -1252,9 +1252,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { RGBQUAD *colors = FreeImage_GetPalette(dib); for (int i = 0; i < 256; i++) { - colors[i].rgbRed = (BYTE)i; - colors[i].rgbGreen = (BYTE)i; - colors[i].rgbBlue = (BYTE)i; + colors[i].rgbRed = (uint8_t)i; + colors[i].rgbGreen = (uint8_t)i; + colors[i].rgbBlue = (uint8_t)i; } } } @@ -1309,9 +1309,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { for(unsigned x = 0; x < cinfo.output_width; x++) { WORD K = (WORD)src[3]; - dst[FI_RGBA_RED] = (BYTE)((K * src[0]) / 255); // C -> R - dst[FI_RGBA_GREEN] = (BYTE)((K * src[1]) / 255); // M -> G - dst[FI_RGBA_BLUE] = (BYTE)((K * src[2]) / 255); // Y -> B + dst[FI_RGBA_RED] = (uint8_t)((K * src[0]) / 255); // C -> R + dst[FI_RGBA_GREEN] = (uint8_t)((K * src[1]) / 255); // M -> G + dst[FI_RGBA_BLUE] = (uint8_t)((K * src[2]) / 255); // Y -> B src += 4; dst += 3; } @@ -1585,7 +1585,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void if(color_type == FIC_RGB) { // 24-bit RGB image : need to swap red and blue channels unsigned pitch = FreeImage_GetPitch(dib); - BYTE *target = (BYTE*)malloc(pitch * sizeof(BYTE)); + uint8_t *target = (uint8_t*)malloc(pitch * sizeof(uint8_t)); if (target == NULL) { throw FI_MSG_ERROR_MEMORY; } @@ -1595,7 +1595,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void memcpy(target, FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1), pitch); #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR // swap R and B channels - BYTE *target_p = target; + uint8_t *target_p = target; for(unsigned x = 0; x < cinfo.image_width; x++) { INPLACESWAP(target_p[0], target_p[2]); target_p += 3; @@ -1608,7 +1608,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } else if(color_type == FIC_CMYK) { unsigned pitch = FreeImage_GetPitch(dib); - BYTE *target = (BYTE*)malloc(pitch * sizeof(BYTE)); + uint8_t *target = (uint8_t*)malloc(pitch * sizeof(uint8_t)); if (target == NULL) { throw FI_MSG_ERROR_MEMORY; } @@ -1617,7 +1617,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void // get a copy of the scanline memcpy(target, FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1), pitch); - BYTE *target_p = target; + uint8_t *target_p = target; for(unsigned x = 0; x < cinfo.image_width; x++) { // CMYK pixels are inverted target_p[0] = ~target_p[0]; // C @@ -1644,18 +1644,18 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void else if(color_type == FIC_PALETTE) { // 8-bit palettized images are converted to 24-bit images RGBQUAD *palette = FreeImage_GetPalette(dib); - BYTE *target = (BYTE*)malloc(cinfo.image_width * 3); + uint8_t *target = (uint8_t*)malloc(cinfo.image_width * 3); if (target == NULL) { throw FI_MSG_ERROR_MEMORY; } while (cinfo.next_scanline < cinfo.image_height) { - BYTE *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1); + uint8_t *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1); FreeImage_ConvertLine8To24(target, source, cinfo.image_width, palette); #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR // swap R and B channels - BYTE *target_p = target; + uint8_t *target_p = target; for(unsigned x = 0; x < cinfo.image_width; x++) { INPLACESWAP(target_p[0], target_p[2]); target_p += 3; @@ -1671,18 +1671,18 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void else if(color_type == FIC_MINISWHITE) { // reverse 8-bit greyscale image, so reverse grey value on the fly unsigned i; - BYTE reverse[256]; - BYTE *target = (BYTE *)malloc(cinfo.image_width); + uint8_t reverse[256]; + uint8_t *target = (uint8_t *)malloc(cinfo.image_width); if (target == NULL) { throw FI_MSG_ERROR_MEMORY; } for(i = 0; i < 256; i++) { - reverse[i] = (BYTE)(255 - i); + reverse[i] = (uint8_t)(255 - i); } while(cinfo.next_scanline < cinfo.image_height) { - BYTE *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1); + uint8_t *source = FreeImage_GetScanLine(dib, FreeImage_GetHeight(dib) - cinfo.next_scanline - 1); for(i = 0; i < cinfo.image_width; i++) { target[i] = reverse[ source[i] ]; } diff --git a/libs/freeimage/src/FreeImage/PluginPNG.cpp b/libs/freeimage/src/FreeImage/PluginPNG.cpp index c64f12d465..9a00c23e19 100644 --- a/libs/freeimage/src/FreeImage/PluginPNG.cpp +++ b/libs/freeimage/src/FreeImage/PluginPNG.cpp @@ -270,8 +270,8 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; - BYTE signature[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + uint8_t png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; + uint8_t signature[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; io->read_proc(&signature, 1, 8, handle); @@ -521,7 +521,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { try { // check to see if the file is in fact a PNG file - BYTE png_check[PNG_BYTES_TO_CHECK]; + uint8_t png_check[PNG_BYTES_TO_CHECK]; io->read_proc(png_check, PNG_BYTES_TO_CHECK, 1, handle); @@ -620,7 +620,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { for(int i = 0; i < palette_entries; i++) { palette[i].rgbRed = palette[i].rgbGreen = - palette[i].rgbBlue = (BYTE)((i * 255) / (palette_entries - 1)); + palette[i].rgbBlue = (uint8_t)((i * 255) / (palette_entries - 1)); } } break; @@ -648,19 +648,19 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { if((color_type == PNG_COLOR_TYPE_GRAY) && trans_color) { // single transparent color if (trans_color->gray < 256) { - BYTE table[256]; + uint8_t table[256]; memset(table, 0xFF, 256); table[trans_color->gray] = 0; FreeImage_SetTransparencyTable(dib, table, 256); } // check for a full transparency table, too else if ((trans_alpha) && (pixel_depth <= 8)) { - FreeImage_SetTransparencyTable(dib, (BYTE *)trans_alpha, num_trans); + FreeImage_SetTransparencyTable(dib, (uint8_t *)trans_alpha, num_trans); } } else if((color_type == PNG_COLOR_TYPE_PALETTE) && trans_alpha) { // transparency table - FreeImage_SetTransparencyTable(dib, (BYTE *)trans_alpha, num_trans); + FreeImage_SetTransparencyTable(dib, (uint8_t *)trans_alpha, num_trans); } } @@ -675,9 +675,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { RGBQUAD rgbBkColor; if (png_get_bKGD(png_ptr, info_ptr, &image_background)) { - rgbBkColor.rgbRed = (BYTE)image_background->red; - rgbBkColor.rgbGreen = (BYTE)image_background->green; - rgbBkColor.rgbBlue = (BYTE)image_background->blue; + rgbBkColor.rgbRed = (uint8_t)image_background->red; + rgbBkColor.rgbGreen = (uint8_t)image_background->green; + rgbBkColor.rgbBlue = (uint8_t)image_background->blue; rgbBkColor.rgbReserved = 0; FreeImage_SetBackgroundColor(dib, &rgbBkColor); @@ -1048,7 +1048,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void } if ((pixel_depth == 32) && (!has_alpha_channel)) { - BYTE *buffer = (BYTE *)malloc(width * 3); + uint8_t *buffer = (uint8_t *)malloc(width * 3); // transparent conversion to 24-bit // the number of passes is either 1 for non-interlaced images, or 7 for interlaced images diff --git a/libs/freeimage/src/FreeImage/PluginWebP.cpp b/libs/freeimage/src/FreeImage/PluginWebP.cpp index 5ea29facf0..1e3a265407 100644 --- a/libs/freeimage/src/FreeImage/PluginWebP.cpp +++ b/libs/freeimage/src/FreeImage/PluginWebP.cpp @@ -86,7 +86,7 @@ data/data_size is the segment of data to write, and 'picture' is for reference (and so one can make use of picture->custom_ptr). */ static int -WebP_MemoryWriter(const BYTE *data, size_t data_size, const WebPPicture* const picture) { +WebP_MemoryWriter(const uint8_t *data, size_t data_size, const WebPPicture* const picture) { FIMEMORY *hmem = (FIMEMORY*)picture->custom_ptr; return data_size ? (FreeImage_WriteMemory(data, 1, (unsigned)data_size, hmem) == data_size) : 0; } @@ -122,9 +122,9 @@ MimeType() { static BOOL DLL_CALLCONV Validate(FreeImageIO *io, fi_handle handle) { - BYTE riff_signature[4] = { 0x52, 0x49, 0x46, 0x46 }; - BYTE webp_signature[4] = { 0x57, 0x45, 0x42, 0x50 }; - BYTE signature[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + uint8_t riff_signature[4] = { 0x52, 0x49, 0x46, 0x46 }; + uint8_t webp_signature[4] = { 0x57, 0x45, 0x42, 0x50 }; + uint8_t signature[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; io->read_proc(signature, 1, 12, handle); @@ -277,14 +277,14 @@ DecodeImage(WebPData *webp_image, int flags) { // fill the dib with the decoded data - const BYTE *src_bitmap = output_buffer->u.RGBA.rgba; + const uint8_t *src_bitmap = output_buffer->u.RGBA.rgba; const unsigned src_pitch = (unsigned)output_buffer->u.RGBA.stride; switch(bpp) { case 24: for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = src_bitmap + y * src_pitch; - BYTE *dst_bits = (BYTE*)FreeImage_GetScanLine(dib, height-1-y); + const uint8_t *src_bits = src_bitmap + y * src_pitch; + uint8_t *dst_bits = (uint8_t*)FreeImage_GetScanLine(dib, height-1-y); for(unsigned x = 0; x < width; x++) { dst_bits[FI_RGBA_BLUE] = src_bits[0]; // B dst_bits[FI_RGBA_GREEN] = src_bits[1]; // G @@ -296,8 +296,8 @@ DecodeImage(WebPData *webp_image, int flags) { break; case 32: for(unsigned y = 0; y < height; y++) { - const BYTE *src_bits = src_bitmap + y * src_pitch; - BYTE *dst_bits = (BYTE*)FreeImage_GetScanLine(dib, height-1-y); + const uint8_t *src_bits = src_bitmap + y * src_pitch; + uint8_t *dst_bits = (uint8_t*)FreeImage_GetScanLine(dib, height-1-y); for(unsigned x = 0; x < width; x++) { dst_bits[FI_RGBA_BLUE] = src_bits[0]; // B dst_bits[FI_RGBA_GREEN] = src_bits[1]; // G @@ -499,7 +499,7 @@ EncodeImage(FIMEMORY *hmem, FIBITMAP *dib, int flags) { // convert dib buffer to output stream - const BYTE *bits = FreeImage_GetBits(dib); + const uint8_t *bits = FreeImage_GetBits(dib); #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR switch(bpp) { @@ -582,7 +582,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void throw (1); } // store the blob into the mux - BYTE *data = NULL; + uint8_t *data = NULL; DWORD data_size = 0; FreeImage_AcquireMemory(hmem, &data, &data_size); webp_image.bytes = data; diff --git a/libs/freeimage/src/FreeImage/WuQuantizer.cpp b/libs/freeimage/src/FreeImage/WuQuantizer.cpp index 3704b2b922..c84f1c593e 100644 --- a/libs/freeimage/src/FreeImage/WuQuantizer.cpp +++ b/libs/freeimage/src/FreeImage/WuQuantizer.cpp @@ -108,7 +108,7 @@ WuQuantizer::Hist3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2, int R if (FreeImage_GetBPP(m_dib) == 24) { for(y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(m_dib, y); + uint8_t *bits = FreeImage_GetScanLine(m_dib, y); for(x = 0; x < width; x++) { inr = (bits[FI_RGBA_RED] >> 3) + 1; @@ -127,7 +127,7 @@ WuQuantizer::Hist3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2, int R } } else { for(y = 0; y < height; y++) { - BYTE *bits = FreeImage_GetScanLine(m_dib, y); + uint8_t *bits = FreeImage_GetScanLine(m_dib, y); for(x = 0; x < width; x++) { inr = (bits[FI_RGBA_RED] >> 3) + 1; @@ -182,7 +182,7 @@ WuQuantizer::Hist3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2, int R void WuQuantizer::M3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2) { unsigned ind1, ind2; - BYTE i, r, g, b; + uint8_t i, r, g, b; LONG line, line_r, line_g, line_b; LONG area[33], area_r[33], area_g[33], area_b[33]; float line2, area2[33]; @@ -241,7 +241,7 @@ WuQuantizer::Vol( Box *cube, LONG *mmt ) { // (depending on dir) LONG -WuQuantizer::Bottom(Box *cube, BYTE dir, LONG *mmt) { +WuQuantizer::Bottom(Box *cube, uint8_t dir, LONG *mmt) { switch(dir) { case FI_RGBA_RED: @@ -272,7 +272,7 @@ WuQuantizer::Bottom(Box *cube, BYTE dir, LONG *mmt) { // r1, g1, or b1 (depending on dir) LONG -WuQuantizer::Top(Box *cube, BYTE dir, int pos, LONG *mmt) { +WuQuantizer::Top(Box *cube, uint8_t dir, int pos, LONG *mmt) { switch(dir) { case FI_RGBA_RED: @@ -325,7 +325,7 @@ WuQuantizer::Var(Box *cube) { // so we drop the minus sign and MAXIMIZE the sum of the two terms. float -WuQuantizer::Maximize(Box *cube, BYTE dir, int first, int last , int *cut, LONG whole_r, LONG whole_g, LONG whole_b, LONG whole_w) { +WuQuantizer::Maximize(Box *cube, uint8_t dir, int first, int last , int *cut, LONG whole_r, LONG whole_g, LONG whole_b, LONG whole_w) { LONG half_r, half_g, half_b, half_w; int i; float temp; @@ -375,7 +375,7 @@ WuQuantizer::Maximize(Box *cube, BYTE dir, int first, int last , int *cut, LONG bool WuQuantizer::Cut(Box *set1, Box *set2) { - BYTE dir; + uint8_t dir; int cutr, cutg, cutb; LONG whole_r = Vol(set1, mr); @@ -431,11 +431,11 @@ WuQuantizer::Cut(Box *set1, Box *set2) { void -WuQuantizer::Mark(Box *cube, int label, BYTE *tag) { +WuQuantizer::Mark(Box *cube, int label, uint8_t *tag) { for (int r = cube->r0 + 1; r <= cube->r1; r++) { for (int g = cube->g0 + 1; g <= cube->g1; g++) { for (int b = cube->b0 + 1; b <= cube->b1; b++) { - tag[INDEX(r, g, b)] = (BYTE)label; + tag[INDEX(r, g, b)] = (uint8_t)label; } } } @@ -444,7 +444,7 @@ WuQuantizer::Mark(Box *cube, int label, BYTE *tag) { // Wu Quantization algorithm FIBITMAP * WuQuantizer::Quantize(int PaletteSize, int ReserveSize, RGBQUAD *ReservePalette) { - BYTE *tag = NULL; + uint8_t *tag = NULL; try { Box cube[MAXCOLOR]; @@ -512,20 +512,20 @@ WuQuantizer::Quantize(int PaletteSize, int ReserveSize, RGBQUAD *ReservePalette) RGBQUAD *new_pal = FreeImage_GetPalette(new_dib); - tag = (BYTE*) malloc(SIZE_3D * sizeof(BYTE)); + tag = (uint8_t*) malloc(SIZE_3D * sizeof(uint8_t)); if (tag == NULL) { throw FI_MSG_ERROR_MEMORY; } - memset(tag, 0, SIZE_3D * sizeof(BYTE)); + memset(tag, 0, SIZE_3D * sizeof(uint8_t)); for (k = 0; k < PaletteSize ; k++) { Mark(&cube[k], k, tag); weight = Vol(&cube[k], wt); if (weight) { - new_pal[k].rgbRed = (BYTE)(((float)Vol(&cube[k], mr) / (float)weight) + 0.5f); - new_pal[k].rgbGreen = (BYTE)(((float)Vol(&cube[k], mg) / (float)weight) + 0.5f); - new_pal[k].rgbBlue = (BYTE)(((float)Vol(&cube[k], mb) / (float)weight) + 0.5f); + new_pal[k].rgbRed = (uint8_t)(((float)Vol(&cube[k], mr) / (float)weight) + 0.5f); + new_pal[k].rgbGreen = (uint8_t)(((float)Vol(&cube[k], mg) / (float)weight) + 0.5f); + new_pal[k].rgbBlue = (uint8_t)(((float)Vol(&cube[k], mb) / (float)weight) + 0.5f); } else { // Error: bogus box 'k' @@ -536,7 +536,7 @@ WuQuantizer::Quantize(int PaletteSize, int ReserveSize, RGBQUAD *ReservePalette) int npitch = FreeImage_GetPitch(new_dib); for (unsigned y = 0; y < height; y++) { - BYTE *new_bits = FreeImage_GetBits(new_dib) + (y * npitch); + uint8_t *new_bits = FreeImage_GetBits(new_dib) + (y * npitch); for (unsigned x = 0; x < width; x++) { new_bits[x] = tag[Qadd[y*width + x]]; diff --git a/libs/freeimage/src/FreeImage/ZLibInterface.cpp b/libs/freeimage/src/FreeImage/ZLibInterface.cpp index 8a79c2590a..571777c278 100644 --- a/libs/freeimage/src/FreeImage/ZLibInterface.cpp +++ b/libs/freeimage/src/FreeImage/ZLibInterface.cpp @@ -37,7 +37,7 @@ which must be at least 0.1% larger than source_size plus 12 bytes. @see FreeImage_ZLibUncompress */ DWORD DLL_CALLCONV -FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { +FreeImage_ZLibCompress(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size) { uLongf dest_len = (uLongf)target_size; int zerr = compress(target, &dest_len, source, source_size); @@ -69,7 +69,7 @@ compression library. @see FreeImage_ZLibCompress */ DWORD DLL_CALLCONV -FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { +FreeImage_ZLibUncompress(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size) { uLongf dest_len = (uLongf)target_size; int zerr = uncompress(target, &dest_len, source, source_size); @@ -100,7 +100,7 @@ which must be at least 0.1% larger than source_size plus 24 bytes. @see FreeImage_ZLibCompress */ DWORD DLL_CALLCONV -FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { +FreeImage_ZLibGZip(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size) { uLongf dest_len = (uLongf)target_size - 12; DWORD crc = crc32(0L, NULL, 0); @@ -115,7 +115,7 @@ FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_s return 0; case Z_OK: { // patch header, setup crc and length (stolen from mod_trace_output) - BYTE *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code + uint8_t *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code crc = crc32(crc, source, source_size); memcpy(target + 4 + dest_len, &crc, 4); memcpy(target + 8 + dest_len, &source_size, 4); @@ -176,7 +176,7 @@ static int checkheader(z_stream *stream) { } DWORD DLL_CALLCONV -FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size) { +FreeImage_ZLibGUnzip(uint8_t *target, DWORD target_size, uint8_t *source, DWORD source_size) { DWORD src_len = source_size; DWORD dest_len = target_size; int zerr = Z_DATA_ERROR; @@ -217,7 +217,7 @@ If source is NULL, this function returns the required initial value for the crc. @return Returns the new crc value */ DWORD DLL_CALLCONV -FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size) { +FreeImage_ZLibCRC32(DWORD crc, uint8_t *source, DWORD source_size) { return crc32(crc, source, source_size); } diff --git a/libs/freeimage/src/FreeImage/tmoColorConvert.cpp b/libs/freeimage/src/FreeImage/tmoColorConvert.cpp index 5323830bda..e71ccee2aa 100644 --- a/libs/freeimage/src/FreeImage/tmoColorConvert.cpp +++ b/libs/freeimage/src/FreeImage/tmoColorConvert.cpp @@ -137,7 +137,7 @@ ConvertInPlaceRGBFToYxy(FIBITMAP *dib) { const unsigned height = FreeImage_GetHeight(dib); const unsigned pitch = FreeImage_GetPitch(dib); - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(unsigned y = 0; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(unsigned x = 0; x < width; x++) { @@ -182,7 +182,7 @@ ConvertInPlaceYxyToRGBF(FIBITMAP *dib) { const unsigned height = FreeImage_GetHeight(dib); const unsigned pitch = FreeImage_GetPitch(dib); - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(unsigned y = 0; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(unsigned x = 0; x < width; x++) { @@ -236,7 +236,7 @@ LuminanceFromYxy(FIBITMAP *Yxy, float *maxLum, float *minLum, float *worldLum) { float max_lum = 0, min_lum = 0; double sum = 0; - BYTE *bits = (BYTE*)FreeImage_GetBits(Yxy); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Yxy); for(unsigned y = 0; y < height; y++) { const FIRGBF *pixel = (FIRGBF*)bits; for(unsigned x = 0; x < width; x++) { @@ -278,20 +278,20 @@ ClampConvertRGBFTo24(FIBITMAP *src) { const unsigned src_pitch = FreeImage_GetPitch(src); const unsigned dst_pitch = FreeImage_GetPitch(dst); - BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBF *src_pixel = (FIRGBF*)src_bits; - BYTE *dst_pixel = (BYTE*)dst_bits; + uint8_t *dst_pixel = (uint8_t*)dst_bits; for(unsigned x = 0; x < width; x++) { const float red = (src_pixel[x].red > 1) ? 1 : src_pixel[x].red; const float green = (src_pixel[x].green > 1) ? 1 : src_pixel[x].green; const float blue = (src_pixel[x].blue > 1) ? 1 : src_pixel[x].blue; - dst_pixel[FI_RGBA_RED] = (BYTE)(255.0F * red + 0.5F); - dst_pixel[FI_RGBA_GREEN] = (BYTE)(255.0F * green + 0.5F); - dst_pixel[FI_RGBA_BLUE] = (BYTE)(255.0F * blue + 0.5F); + dst_pixel[FI_RGBA_RED] = (uint8_t)(255.0F * red + 0.5F); + dst_pixel[FI_RGBA_GREEN] = (uint8_t)(255.0F * green + 0.5F); + dst_pixel[FI_RGBA_BLUE] = (uint8_t)(255.0F * blue + 0.5F); dst_pixel += 3; } src_bits += src_pitch; @@ -325,8 +325,8 @@ ConvertRGBFToY(FIBITMAP *src) { const unsigned dst_pitch = FreeImage_GetPitch(dst); - BYTE *src_bits = (BYTE*)FreeImage_GetBits(src); - BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst); + uint8_t *src_bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *dst_bits = (uint8_t*)FreeImage_GetBits(dst); for(unsigned y = 0; y < height; y++) { const FIRGBF *src_pixel = (FIRGBF*)src_bits; @@ -365,7 +365,7 @@ LuminanceFromY(FIBITMAP *dib, float *maxLum, float *minLum, float *Lav, float *L float max_lum = -1e20F, min_lum = 1e20F; double sumLum = 0, sumLogLum = 0; - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(unsigned y = 0; y < height; y++) { const float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { @@ -400,7 +400,7 @@ static void findMaxMinPercentile(FIBITMAP *Y, float minPrct, float *minLum, floa std::vector<float> vY(width * height); - BYTE *bits = (BYTE*)FreeImage_GetBits(Y); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Y); for(y = 0; y < height; y++) { float *pixel = (float*)bits; for(x = 0; x < width; x++) { @@ -447,7 +447,7 @@ NormalizeY(FIBITMAP *Y, float minPrct, float maxPrct) { findMaxMinPercentile(Y, minPrct, &minLum, maxPrct, &maxLum); } else { maxLum = -1e20F, minLum = 1e20F; - BYTE *bits = (BYTE*)FreeImage_GetBits(Y); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Y); for(y = 0; y < height; y++) { const float *pixel = (float*)bits; for(x = 0; x < width; x++) { @@ -463,7 +463,7 @@ NormalizeY(FIBITMAP *Y, float minPrct, float maxPrct) { // normalize to range 0..1 const float divider = maxLum - minLum; - BYTE *bits = (BYTE*)FreeImage_GetBits(Y); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Y); for(y = 0; y < height; y++) { float *pixel = (float*)bits; for(x = 0; x < width; x++) { diff --git a/libs/freeimage/src/FreeImage/tmoDrago03.cpp b/libs/freeimage/src/FreeImage/tmoDrago03.cpp index de7639db61..9ddd866d95 100644 --- a/libs/freeimage/src/FreeImage/tmoDrago03.cpp +++ b/libs/freeimage/src/FreeImage/tmoDrago03.cpp @@ -94,7 +94,7 @@ ToneMappingDrago03(FIBITMAP *dib, const float maxLum, const float avgLum, float Normal tone mapping of every pixel further acceleration is obtained by a Padé approximation of log(x + 1) */ - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(y = 0; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(x = 0; x < width; x++) { @@ -163,10 +163,10 @@ ToneMappingDrago03(FIBITMAP *dib, const float maxLum, const float avgLum, float /** Normal tone mapping of every pixel for the remaining right and bottom bands */ - BYTE *bits; + uint8_t *bits; // right band - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); for(y = 0; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(x = max_width; x < width; x++) { @@ -180,7 +180,7 @@ ToneMappingDrago03(FIBITMAP *dib, const float maxLum, const float avgLum, float bits += pitch; } // bottom band - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); for(y = max_height; y < height; y++) { FIRGBF *pixel = (FIRGBF*)bits; for(x = 0; x < max_width; x++) { @@ -226,7 +226,7 @@ REC709GammaCorrection(FIBITMAP *dib, const float gammaval) { const unsigned height = FreeImage_GetHeight(dib); const unsigned pitch = FreeImage_GetPitch(dib); - BYTE *bits = (BYTE*)FreeImage_GetBits(dib); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(dib); for(unsigned y = 0; y < height; y++) { float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { diff --git a/libs/freeimage/src/FreeImage/tmoFattal02.cpp b/libs/freeimage/src/FreeImage/tmoFattal02.cpp index e543fa5f3d..59cbe074ad 100644 --- a/libs/freeimage/src/FreeImage/tmoFattal02.cpp +++ b/libs/freeimage/src/FreeImage/tmoFattal02.cpp @@ -428,7 +428,7 @@ static FIBITMAP* LogLuminance(FIBITMAP *Y) { // find max & min luminance values float maxLum = -1e20F, minLum = 1e20F; - BYTE *bits = (BYTE*)FreeImage_GetBits(H); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(H); for(unsigned y = 0; y < height; y++) { const float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { @@ -443,7 +443,7 @@ static FIBITMAP* LogLuminance(FIBITMAP *Y) { // normalize to range 0..100 and take the logarithm const float scale = 100.F / (maxLum - minLum); - bits = (BYTE*)FreeImage_GetBits(H); + bits = (uint8_t*)FreeImage_GetBits(H); for(unsigned y = 0; y < height; y++) { float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { @@ -471,7 +471,7 @@ static void ExpLuminance(FIBITMAP *Y) { const unsigned height = FreeImage_GetHeight(Y); const unsigned pitch = FreeImage_GetPitch(Y); - BYTE *bits = (BYTE*)FreeImage_GetBits(Y); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(Y); for(unsigned y = 0; y < height; y++) { float *pixel = (float*)bits; for(unsigned x = 0; x < width; x++) { @@ -644,9 +644,9 @@ FreeImage_TmoFattal02(FIBITMAP *dib, double color_saturation, double attenuation const unsigned rgb_pitch = FreeImage_GetPitch(src); const unsigned y_pitch = FreeImage_GetPitch(Yin); - BYTE *bits = (BYTE*)FreeImage_GetBits(src); - BYTE *bits_yin = (BYTE*)FreeImage_GetBits(Yin); - BYTE *bits_yout = (BYTE*)FreeImage_GetBits(Yout); + uint8_t *bits = (uint8_t*)FreeImage_GetBits(src); + uint8_t *bits_yin = (uint8_t*)FreeImage_GetBits(Yin); + uint8_t *bits_yout = (uint8_t*)FreeImage_GetBits(Yout); for(unsigned y = 0; y < height; y++) { float *Lin = (float*)bits_yin; diff --git a/libs/freeimage/src/FreeImage/tmoReinhard05.cpp b/libs/freeimage/src/FreeImage/tmoReinhard05.cpp index 34c5c67a83..33998d34b6 100644 --- a/libs/freeimage/src/FreeImage/tmoReinhard05.cpp +++ b/libs/freeimage/src/FreeImage/tmoReinhard05.cpp @@ -74,7 +74,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo int i; unsigned x, y; - BYTE *bits = NULL, *Ybits = NULL; + uint8_t *bits = NULL, *Ybits = NULL; // get statistics about the data (but only if its really needed) @@ -98,8 +98,8 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo // tone map image - bits = (BYTE*)FreeImage_GetBits(dib); - Ybits = (BYTE*)FreeImage_GetBits(Y); + bits = (uint8_t*)FreeImage_GetBits(dib); + Ybits = (uint8_t*)FreeImage_GetBits(Y); if((a == 1) && (c == 0)) { // when using default values, use a fastest code @@ -131,7 +131,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo Cav[0] = Cav[1] = Cav[2] = 0; if((a != 1) && (c != 0)) { // channel averages are not needed when (a == 1) or (c == 0) - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); for(y = 0; y < height; y++) { float *color = (float*)bits; for(x = 0; x < width; x++) { @@ -151,7 +151,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo // perform tone mapping - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); for(y = 0; y < height; y++) { const float *Y = (float*)Ybits; float *color = (float*)bits; @@ -179,7 +179,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo // normalize intensities if(max_color != min_color) { - bits = (BYTE*)FreeImage_GetBits(dib); + bits = (uint8_t*)FreeImage_GetBits(dib); const float range = max_color - min_color; for(y = 0; y < height; y++) { float *color = (float*)bits; |