summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/slave/png_slave.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/slave/png_slave.cpp b/noncore/graphics/opie-eye/slave/png_slave.cpp
index 86e1cdc..21555b4 100644
--- a/noncore/graphics/opie-eye/slave/png_slave.cpp
+++ b/noncore/graphics/opie-eye/slave/png_slave.cpp
@@ -45,49 +45,50 @@ static const char* colors[] = {
QT_TR_NOOP("Unknown"),
QT_TR_NOOP("RGB"),
QT_TR_NOOP("Palette"),
QT_TR_NOOP("Grayscale/Alpha"),
QT_TR_NOOP("Unknown"),
QT_TR_NOOP("RGB/Alpha")
};
// and compressions
static const char* compressions[] =
{
QT_TR_NOOP("Deflate")
};
// interlaced modes
static const char* interlaceModes[] = {
QT_TR_NOOP("None"),
QT_TR_NOOP("Adam7")
};
static void read_comment( const QString& inf,
bool readComments, QString& str ) {
QFile f(inf);
- f.open(IO_ReadOnly);
+ if (!f.exists()) return;
+ if (!f.open(IO_ReadOnly)) return;
if (f.size() < 26) return;
// the technical group will be read from the first 26 bytes. If the file
// is smaller, we can't even read this.
uchar *data = new uchar[f.size()+1];
f.readBlock(reinterpret_cast<char*>(data), f.size());
data[f.size()]='\n';
// find the start
if (data[0] == 137 && data[1] == 80 && data[2] == 78 && data[3] == 71 &&
data[4] == 13 && data[5] == 10 && data[6] == 26 && data[7] == 10 )
{
// ok
// the IHDR chunk should be the first
if (!strncmp((char*)&data[12], "IHDR", 4))
{
// we found it, get the dimensions
ulong x,y;
x = (data[16]<<24) + (data[17]<<16) + (data[18]<<8) + data[19];
y = (data[20]<<24) + (data[21]<<16) + (data[22]<<8) + data[23];
uint type = data[25];
uint bpp = data[24];