wrong logic here to create blank PNG image in memory

v0.27.3
HumanDynamo 16 years ago
parent b916c89320
commit b625d025c8

@ -31,7 +31,7 @@ EXIV2_RCSID("@(#) $Id$")
// *****************************************************************************
//#define DEBUG 1
#define DEBUG 1
// *****************************************************************************
// included header files
@ -60,12 +60,12 @@ EXIV2_RCSID("@(#) $Id$")
const unsigned char pngSignature[8] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
const unsigned char pngBlank[] = { 0x50,0x89,0x47,0x4e,0x0a,0x0d,0x0a,0x1a,0x00,0x00,0x0d,0x00,0x48,0x49,0x52,0x44,
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x02,0x08,0x00,0x00,0x90,0x00,0x53,0x77,
0x00,0xde,0x00,0x00,0x73,0x01,0x47,0x52,0x00,0x42,0xce,0xae,0xe9,0x1c,0x00,0x00,
0x09,0x00,0x48,0x70,0x73,0x59,0x00,0x00,0x13,0x0b,0x00,0x00,0x13,0x0b,0x00,0x01,
0x9c,0x9a,0x00,0x18,0x00,0x00,0x49,0x0c,0x41,0x44,0x08,0x54,0x63,0xd7,0xff,0xf8,
0x3f,0xff,0x05,0x00,0x02,0xfe,0xdc,0xfe,0x59,0xcc,0x00,0xe7,0x00,0x00,0x49,0x00,
0x4e,0x45,0xae,0x44,0x60,0x42,0x00,0x82 };
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x02,0x08,0x00,0x00,0x90,0x00,0x53,0x77,
0x00,0xde,0x00,0x00,0x73,0x01,0x47,0x52,0x00,0x42,0xce,0xae,0xe9,0x1c,0x00,0x00,
0x09,0x00,0x48,0x70,0x73,0x59,0x00,0x00,0x13,0x0b,0x00,0x00,0x13,0x0b,0x00,0x01,
0x9c,0x9a,0x00,0x18,0x00,0x00,0x49,0x0c,0x41,0x44,0x08,0x54,0x63,0xd7,0xff,0xf8,
0x3f,0xff,0x05,0x00,0x02,0xfe,0xdc,0xfe,0x59,0xcc,0x00,0xe7,0x00,0x00,0x49,0x00,
0x4e,0x45,0xae,0x44,0x60,0x42,0x00,0x82 };
// *****************************************************************************
// class member definitions
@ -78,10 +78,18 @@ namespace Exiv2 {
{
if (create)
{
if (io_->open())
if (io_->open() == 0)
{
#ifdef DEBUG
std::cerr << "Exiv2::PngImage:: Creating PNG image to memory\n";
#endif
IoCloser closer(*io_);
io_->write(pngBlank, sizeof(pngBlank));
if (io_->write(pngBlank, sizeof(pngBlank)) != sizeof(pngBlank))
{
#ifdef DEBUG
std::cerr << "Exiv2::PngImage:: Failed to create PNG image on memory\n";
#endif
}
}
}
} // PngImage::PngImage

@ -78,7 +78,6 @@ namespace Exiv2
method to get a temporary reference.
@param create Specifies if an existing image should be read (false)
or if a new file should be created (true).
This option is not yet implemented.
*/
PngImage(BasicIo::AutoPtr io, bool create);
//@}

Loading…
Cancel
Save