mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 04:07:34 +00:00
LibGfx: Use size_t for the Streamer offset and sizes
This commit is contained in:
parent
9c786cd7e0
commit
3aca84a299
1 changed files with 9 additions and 9 deletions
|
@ -117,7 +117,7 @@ struct PNGLoadingContext {
|
||||||
Vector<Scanline> scanlines;
|
Vector<Scanline> scanlines;
|
||||||
RefPtr<Gfx::Bitmap> bitmap;
|
RefPtr<Gfx::Bitmap> bitmap;
|
||||||
u8* decompression_buffer { nullptr };
|
u8* decompression_buffer { nullptr };
|
||||||
int decompression_buffer_size { 0 };
|
size_t decompression_buffer_size { 0 };
|
||||||
Vector<u8> compressed_data;
|
Vector<u8> compressed_data;
|
||||||
Vector<PaletteEntry> palette_data;
|
Vector<PaletteEntry> palette_data;
|
||||||
Vector<u8> palette_transparency_data;
|
Vector<u8> palette_transparency_data;
|
||||||
|
@ -125,7 +125,7 @@ struct PNGLoadingContext {
|
||||||
|
|
||||||
class Streamer {
|
class Streamer {
|
||||||
public:
|
public:
|
||||||
Streamer(const u8* data, int size)
|
Streamer(const u8* data, size_t size)
|
||||||
: m_data_ptr(data)
|
: m_data_ptr(data)
|
||||||
, m_size_remaining(size)
|
, m_size_remaining(size)
|
||||||
{
|
{
|
||||||
|
@ -134,7 +134,7 @@ public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool read(T& value)
|
bool read(T& value)
|
||||||
{
|
{
|
||||||
if (m_size_remaining < (int)sizeof(T))
|
if (m_size_remaining < sizeof(T))
|
||||||
return false;
|
return false;
|
||||||
value = *((const NetworkOrdered<T>*)m_data_ptr);
|
value = *((const NetworkOrdered<T>*)m_data_ptr);
|
||||||
m_data_ptr += sizeof(T);
|
m_data_ptr += sizeof(T);
|
||||||
|
@ -142,7 +142,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool read_bytes(u8* buffer, int count)
|
bool read_bytes(u8* buffer, size_t count)
|
||||||
{
|
{
|
||||||
if (m_size_remaining < count)
|
if (m_size_remaining < count)
|
||||||
return false;
|
return false;
|
||||||
|
@ -152,7 +152,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wrap_bytes(ByteBuffer& buffer, int count)
|
bool wrap_bytes(ByteBuffer& buffer, size_t count)
|
||||||
{
|
{
|
||||||
if (m_size_remaining < count)
|
if (m_size_remaining < count)
|
||||||
return false;
|
return false;
|
||||||
|
@ -165,11 +165,11 @@ public:
|
||||||
bool at_end() const { return !m_size_remaining; }
|
bool at_end() const { return !m_size_remaining; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const u8* m_data_ptr;
|
const u8* m_data_ptr { nullptr };
|
||||||
int m_size_remaining;
|
size_t m_size_remaining { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
static RefPtr<Gfx::Bitmap> load_png_impl(const u8*, int);
|
static RefPtr<Gfx::Bitmap> load_png_impl(const u8*, size_t);
|
||||||
static bool process_chunk(Streamer&, PNGLoadingContext& context, bool decode_size_only);
|
static bool process_chunk(Streamer&, PNGLoadingContext& context, bool decode_size_only);
|
||||||
|
|
||||||
RefPtr<Gfx::Bitmap> load_png(const StringView& path)
|
RefPtr<Gfx::Bitmap> load_png(const StringView& path)
|
||||||
|
@ -621,7 +621,7 @@ static bool decode_png_bitmap(PNGLoadingContext& context)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RefPtr<Gfx::Bitmap> load_png_impl(const u8* data, int data_size)
|
static RefPtr<Gfx::Bitmap> load_png_impl(const u8* data, size_t data_size)
|
||||||
{
|
{
|
||||||
PNGLoadingContext context;
|
PNGLoadingContext context;
|
||||||
context.data = data;
|
context.data = data;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue