summaryrefslogtreecommitdiff
path: root/libopie2/opiemm
authorerik <erik>2007-01-22 22:56:12 (UTC)
committer erik <erik>2007-01-22 22:56:12 (UTC)
commit9b4871054d01a47b4c546952a0948553413840d6 (patch) (side-by-side diff)
tree4e0248489c2790cf4225a116cfb903b637d4cdf0 /libopie2/opiemm
parentf60301bab1f8aa3693089036a3791a01ae6f9db8 (diff)
downloadopie-9b4871054d01a47b4c546952a0948553413840d6.zip
opie-9b4871054d01a47b4c546952a0948553413840d6.tar.gz
opie-9b4871054d01a47b4c546952a0948553413840d6.tar.bz2
Every file in this commit makes a call to a function which returns a value.
Each file also didn't check the return value. This commit changes it so that every single non-checked call in these files is checked.
Diffstat (limited to 'libopie2/opiemm') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiemm/opieexif.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/libopie2/opiemm/opieexif.cpp b/libopie2/opiemm/opieexif.cpp
index de49937..653216c 100644
--- a/libopie2/opiemm/opieexif.cpp
+++ b/libopie2/opiemm/opieexif.cpp
@@ -196,25 +196,25 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode)
if (( unsigned ) got != itemlen-2){
return false;
}
SectionsRead++;
switch(marker){
case M_SOS: // stop before hitting compressed data
// If reading entire image is requested, read the rest of the data.
if (ReadMode & READ_IMAGE){
unsigned long size;
- size = QMAX( 0ul, infile.size()-infile.at() );
+ size = infile.size()-infile.at();
Data = (uchar *)malloc(size);
if (Data == NULL){
return false;
}
got = infile.readBlock((char*)Data, size);
if (( unsigned ) got != size){
return false;
}
Sections[SectionsRead].Data = Data;
Sections[SectionsRead].Size = size;
@@ -800,25 +800,29 @@ ExifData::ExifData()
ExifData::~ExifData()
{
}
//--------------------------------------------------------------------------
// process a EXIF jpeg file
//--------------------------------------------------------------------------
bool ExifData::scan(const QString & path)
{
int ret;
QFile f(path);
- f.open(IO_ReadOnly);
+ if ( !f.open(IO_ReadOnly) ) {
+ owarn << "Unable to open file " << f.name() << " readonly" << oendl;
+ DiscardData();
+ return false;
+ }
// Scan the JPEG headers.
ret = ReadJpegSections(f, READ_EXIF);
if (ret == false){
owarn << "Not JPEG file!" << oendl;
DiscardData();
f.close();
return false;
}
f.close();
DiscardData();