From: Mikko Rasa Date: Sun, 27 Nov 2022 10:13:08 +0000 (+0200) Subject: Use standard fixed size integer types X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=2ed9d7a0a96638bdf0614c1cf858719e7ced40d3;p=libs%2Fgui.git Use standard fixed size integer types Those in quartzloader.cpp are apparently Apple's types and are appropriate there. --- diff --git a/source/graphics/bmploader.cpp b/source/graphics/bmploader.cpp index 582edc6..8a6c7a0 100644 --- a/source/graphics/bmploader.cpp +++ b/source/graphics/bmploader.cpp @@ -1,5 +1,5 @@ #include "bmploader.h" -#include +#include using namespace std; @@ -15,7 +15,7 @@ void read_full(Msp::IO::Base &io, char *buffer, unsigned size) template T decode(const char *data) { - const Msp::UInt8 *udata = reinterpret_cast(data); + const uint8_t *udata = reinterpret_cast(data); T result = 0; for(unsigned i=0; i(bm_header+10); + unsigned data_offset = decode(bm_header+10); char dib_header[124]; read_full(io, dib_header, 12); - unsigned dib_length = min(decode(dib_header), sizeof(dib_header)); + unsigned dib_length = min(decode(dib_header), sizeof(dib_header)); if(dib_length<40) throw bad_image_data("DIB header too short (very old bmp file?)"); read_full(io, dib_header+12, dib_length-12); - data.width = decode(dib_header+4); - Int32 height = decode(dib_header+8); + data.width = decode(dib_header+4); + int32_t height = decode(dib_header+8); data.height = abs(height); - unsigned color_planes = decode(dib_header+12); + unsigned color_planes = decode(dib_header+12); if(color_planes!=1) throw bad_image_data("color_planes!=1"); - unsigned bits_per_pixel = decode(dib_header+14); - unsigned compression = decode(dib_header+16); + unsigned bits_per_pixel = decode(dib_header+14); + unsigned compression = decode(dib_header+16); if(compression) throw unsupported_image_format("compression not supported");