summaryrefslogtreecommitdiff
path: root/libopie2/opiemm/opieexif.cpp
Unidiff
Diffstat (limited to 'libopie2/opiemm/opieexif.cpp') (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
@@ -192,33 +192,33 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode)
192 Data[0] = (uchar)lh; 192 Data[0] = (uchar)lh;
193 Data[1] = (uchar)ll; 193 Data[1] = (uchar)ll;
194 194
195 got = infile.readBlock((char*)Data+2, itemlen-2); // Read the whole section. 195 got = infile.readBlock((char*)Data+2, itemlen-2); // Read the whole section.
196 if (( unsigned ) got != itemlen-2){ 196 if (( unsigned ) got != itemlen-2){
197 return false; 197 return false;
198 } 198 }
199 SectionsRead++; 199 SectionsRead++;
200 200
201 switch(marker){ 201 switch(marker){
202 202
203 case M_SOS: // stop before hitting compressed data 203 case M_SOS: // stop before hitting compressed data
204 // If reading entire image is requested, read the rest of the data. 204 // If reading entire image is requested, read the rest of the data.
205 if (ReadMode & READ_IMAGE){ 205 if (ReadMode & READ_IMAGE){
206 unsigned long size; 206 unsigned long size;
207 207
208 size = QMAX( 0ul, infile.size()-infile.at() ); 208 size = infile.size()-infile.at();
209 Data = (uchar *)malloc(size); 209 Data = (uchar *)malloc(size);
210 if (Data == NULL){ 210 if (Data == NULL){
211 return false; 211 return false;
212 } 212 }
213 213
214 got = infile.readBlock((char*)Data, size); 214 got = infile.readBlock((char*)Data, size);
215 if (( unsigned ) got != size){ 215 if (( unsigned ) got != size){
216 return false; 216 return false;
217 } 217 }
218 218
219 Sections[SectionsRead].Data = Data; 219 Sections[SectionsRead].Data = Data;
220 Sections[SectionsRead].Size = size; 220 Sections[SectionsRead].Size = size;
221 Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER; 221 Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER;
222 SectionsRead ++; 222 SectionsRead ++;
223 //HaveAll = 1; 223 //HaveAll = 1;
224 } 224 }
@@ -796,33 +796,37 @@ ExifData::ExifData()
796 CompressionLevel = 0; 796 CompressionLevel = 0;
797 MotorolaOrder = 0; 797 MotorolaOrder = 0;
798} 798}
799 799
800ExifData::~ExifData() 800ExifData::~ExifData()
801{ 801{
802} 802}
803 803
804//-------------------------------------------------------------------------- 804//--------------------------------------------------------------------------
805// process a EXIF jpeg file 805// process a EXIF jpeg file
806//-------------------------------------------------------------------------- 806//--------------------------------------------------------------------------
807bool ExifData::scan(const QString & path) 807bool ExifData::scan(const QString & path)
808{ 808{
809 int ret; 809 int ret;
810 810
811 QFile f(path); 811 QFile f(path);
812 f.open(IO_ReadOnly); 812 if ( !f.open(IO_ReadOnly) ) {
813 owarn << "Unable to open file " << f.name() << " readonly" << oendl;
814 DiscardData();
815 return false;
816 }
813 817
814 // Scan the JPEG headers. 818 // Scan the JPEG headers.
815 ret = ReadJpegSections(f, READ_EXIF); 819 ret = ReadJpegSections(f, READ_EXIF);
816 820
817 if (ret == false){ 821 if (ret == false){
818 owarn << "Not JPEG file!" << oendl; 822 owarn << "Not JPEG file!" << oendl;
819 DiscardData(); 823 DiscardData();
820 f.close(); 824 f.close();
821 return false; 825 return false;
822 } 826 }
823 f.close(); 827 f.close();
824 DiscardData(); 828 DiscardData();
825 829
826 //now make the strings clean, 830 //now make the strings clean,
827 // for exmaple my Casio is a "QV-4000 " 831 // for exmaple my Casio is a "QV-4000 "
828 CameraMake = CameraMake.stripWhiteSpace(); 832 CameraMake = CameraMake.stripWhiteSpace();