summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
Side-by-side diff
Diffstat (limited to 'noncore/graphics/opie-eye/slave/jpeg_slave.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/slave/jpeg_slave.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
index 086b47f..fb7d5de 100644
--- a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
+++ b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp
@@ -1,19 +1,23 @@
#include "jpeg_slave.h"
-
#include "thumbnailtool.h"
PHUNK_VIEW_INTERFACE( "JPEG", JpegSlave )
-#include <qtopia/timestring.h>
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/timestring.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qobject.h>
#include <qimage.h>
/**
exif.h
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
@@ -110,25 +114,25 @@ public:
int getCompressionLevel() { return CompressionLevel; }
QString getUserComment() { return UserComment; }
QString getComment() { return Comment; }
QImage getThumbnail();
bool isThumbnailSane();
bool isNullThumbnail() { return !isThumbnailSane(); }
};
class FatalError {
const char* ex;
public:
FatalError(const char* s) { ex = s; }
- void debug_print() const { qWarning("exception: %s", ex ); }
+ void debug_print() const { owarn << "exception: " << ex << "" << oendl; }
};
static unsigned char * LastExifRefd;
static int ExifSettingsLength;
static double FocalplaneXRes;
static double FocalplaneUnits;
static int MotorolaOrder = 0;
static int SectionsRead;
//static int HaveAll;
@@ -253,25 +257,25 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode)
int marker = 0;
int got;
unsigned int ll,lh;
unsigned int itemlen;
uchar * Data;
for (a=0;a<7;a++){
marker = infile.getch();
if (marker != 0xff) break;
if (a >= 6){
- qWarning( "too many padding bytes" );
+ owarn << "too many padding bytes" << oendl;
return false;
}
}
if (marker == 0xff){
// 0xff is legal padding, but if we get that many, something's wrong.
return false;
}
Sections[SectionsRead].Type = marker;
@@ -318,25 +322,25 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode)
return false;
}
Sections[SectionsRead].Data = Data;
Sections[SectionsRead].Size = size;
Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER;
SectionsRead ++;
//HaveAll = 1;
}
return true;
case M_EOI: // in case it's a tables-only JPEG stream
- qWarning( "No image in jpeg!" );
+ owarn << "No image in jpeg!" << oendl;
return false;
case M_COM: // Comment section
// pieczy 2002-02-12
// now the User comment goes to UserComment
// so we can store a Comment section also in READ_EXIF mode
process_COM(Data, itemlen);
break;
case M_JFIF:
// Regular jpegs always have this tag, exif images have the exif
// marker instead, althogh ACDsee will write images with both markers.
@@ -717,25 +721,25 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa
if (DIR_ENTRY_ADDR(DirStart, NumDirEntries) + 4 <= OffsetBase+ExifLength){
Offset = Get32u(DIR_ENTRY_ADDR(DirStart, NumDirEntries));
// There is at least one jpeg from an HP camera having an Offset of almost MAXUINT.
// Adding OffsetBase to it produces an overflow, so compare with ExifLength here.
// See http://bugs.kde.org/show_bug.cgi?id=54542
if (Offset && Offset < ExifLength){
SubdirStart = OffsetBase + Offset;
if (SubdirStart > OffsetBase+ExifLength){
if (SubdirStart < OffsetBase+ExifLength+20){
// Jhead 1.3 or earlier would crop the whole directory!
// As Jhead produces this form of format incorrectness,
// I'll just let it pass silently
- qWarning( "Thumbnail removed with Jhead 1.3 or earlier" );
+ owarn << "Thumbnail removed with Jhead 1.3 or earlier" << oendl;
}else{
return;
}
}else{
if (SubdirStart <= OffsetBase+ExifLength){
ProcessExifDir(SubdirStart, OffsetBase, ExifLength);
}
}
}
}else{
// The exif header ends before the last next directory pointer.
}
@@ -904,25 +908,25 @@ ExifData::ExifData()
//--------------------------------------------------------------------------
bool ExifData::scan(const QString & path)
{
int ret;
QFile f(path);
f.open(IO_ReadOnly);
// Scan the JPEG headers.
ret = ReadJpegSections(f, READ_EXIF);
if (ret == false){
- qWarning( "Not JPEG file!" );
+ owarn << "Not JPEG file!" << oendl;
DiscardData();
f.close();
return false;
}
f.close();
DiscardData();
//now make the strings clean,
// for exmaple my Casio is a "QV-4000 "
CameraMake = CameraMake.stripWhiteSpace();
CameraModel = CameraModel.stripWhiteSpace();
UserComment = UserComment.stripWhiteSpace();