mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
png: make verify_header public (nw)
This commit is contained in:
parent
f67038d5ad
commit
23d9d21250
@ -413,21 +413,6 @@ private:
|
||||
return ((samples[pnginfo.color_type] * pnginfo.bit_depth) + 7) >> 3;
|
||||
}
|
||||
|
||||
static png_error verify_header(util::core_file &fp)
|
||||
{
|
||||
uint8_t signature[8];
|
||||
|
||||
/* read 8 bytes */
|
||||
if (fp.read(signature, 8) != 8)
|
||||
return PNGERR_FILE_TRUNCATED;
|
||||
|
||||
/* return an error if we don't match */
|
||||
if (memcmp(signature, PNG_Signature, 8) != 0)
|
||||
return PNGERR_BAD_SIGNATURE;
|
||||
|
||||
return PNGERR_NONE;
|
||||
}
|
||||
|
||||
static png_error read_chunk(util::core_file &fp, std::unique_ptr<std::uint8_t []> &data, std::uint32_t &type, std::uint32_t &length)
|
||||
{
|
||||
std::uint8_t tempbuff[4];
|
||||
@ -705,6 +690,21 @@ public:
|
||||
return PNGERR_NONE;
|
||||
}
|
||||
|
||||
png_error verify_header(util::core_file &fp)
|
||||
{
|
||||
uint8_t signature[8];
|
||||
|
||||
/* read 8 bytes */
|
||||
if (fp.read(signature, 8) != 8)
|
||||
return PNGERR_FILE_TRUNCATED;
|
||||
|
||||
/* return an error if we don't match */
|
||||
if (memcmp(signature, PNG_Signature, 8) != 0)
|
||||
return PNGERR_BAD_SIGNATURE;
|
||||
|
||||
return PNGERR_NONE;
|
||||
}
|
||||
|
||||
png_error read_file(util::core_file &fp)
|
||||
{
|
||||
// initialize the data structures
|
||||
@ -755,6 +755,17 @@ constexpr unsigned png_private::ADAM7_Y_OFFS[7];
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
verify_header - verify PNG file header from a
|
||||
core stream
|
||||
-------------------------------------------------*/
|
||||
|
||||
png_error png_info::verify_header(util::core_file &fp)
|
||||
{
|
||||
return png_private(*this).verify_header(fp);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
read_file - read a PNG from a core stream
|
||||
-------------------------------------------------*/
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
|
||||
~png_info() { free_data(); }
|
||||
|
||||
png_error verify_header(util::core_file &fp);
|
||||
png_error read_file(util::core_file &fp);
|
||||
png_error copy_to_bitmap(bitmap_argb32 &bitmap, bool &hasalpha);
|
||||
png_error expand_buffer_8bit();
|
||||
|
Loading…
Reference in New Issue
Block a user