Author: post
Date: 2009-08-06 16:48:14 +0200 (Thu, 06 Aug 2009)
New Revision: 98
Modified:
RawSpeed/DngDecoder.cpp
RawSpeed/RawDecoderException.h
RawSpeed/TiffIFD.cpp
RawSpeed/TiffParserException.cpp
RawSpeed/TiffParserException.h
Log:
- More error reporting on DNGs. Please ignore the usual line ending changes in
the diff ;)
Modified: RawSpeed/DngDecoder.cpp
===================================================================
--- RawSpeed/DngDecoder.cpp 2009-08-04 19:30:54 UTC (rev 97)
+++ RawSpeed/DngDecoder.cpp 2009-08-06 14:48:14 UTC (rev 98)
@@ -228,7 +228,7 @@
errors = slices.errors;
if (errors.size()>=nTiles)
ThrowRDE("DNG Decoding: Too many errors encountered. Giving
up.\nFirst Error:%s",errors[0]);
- } catch (TiffParserException) {
+ } catch (TiffParserException e) {
TiffEntry *offsets = raw->getEntry(STRIPOFFSETS);
TiffEntry *counts = raw->getEntry(STRIPBYTECOUNTS);
@@ -239,13 +239,13 @@
ThrowRDE("DNG Decoder: Byte count number does not match strip size:
count:%u, stips:%u ",counts->count, offsets->count);
}
- ThrowRDE("DNG Decoder: Unsupported format.");
+ ThrowRDE("DNG Decoder: Unsupported format:\n%s", e.what());
}
} else {
ThrowRDE("DNG Decoder: Unknown compression: %u",compression);
}
- } catch (TiffParserException) {
- ThrowRDE("DNG Decoder: Image could not be read.");
+ } catch (TiffParserException e) {
+ ThrowRDE("DNG Decoder: Image could not be read:\n%s", e.what());
}
iPoint2D new_size(mRaw->dim.x, mRaw->dim.y);
#ifndef PRINT_INFO
Modified: RawSpeed/RawDecoderException.h
===================================================================
--- RawSpeed/RawDecoderException.h 2009-08-04 19:30:54 UTC (rev 97)
+++ RawSpeed/RawDecoderException.h 2009-08-06 14:48:14 UTC (rev 98)
@@ -1,3 +1,25 @@
+/*
+ RawSpeed - RAW file decoder.
+
+ Copyright (C) 2009 Klaus Post
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
+
+ http://www.klauspost.com
+*/
+
#pragma once
void ThrowRDE(const char* fmt, ...);
@@ -8,4 +30,4 @@
RawDecoderException(const string _msg) : runtime_error(_msg) {
_RPT1(0, "RawDecompressor Exception: %s\n", _msg.c_str());
}
-};
+};
Modified: RawSpeed/TiffIFD.cpp
===================================================================
--- RawSpeed/TiffIFD.cpp 2009-08-04 19:30:54 UTC (rev 97)
+++ RawSpeed/TiffIFD.cpp 2009-08-06 14:48:14 UTC (rev 98)
@@ -1,22 +1,22 @@
#include "StdAfx.h"
#include "TiffIFD.h"
-/*
- RawSpeed - RAW file decoder.
-
- Copyright (C) 2009 Klaus Post
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
+/*
+ RawSpeed - RAW file decoder.
+
+ Copyright (C) 2009 Klaus Post
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
http://www.klauspost.com
@@ -87,7 +87,8 @@
if (mEntry.find(tag) != mEntry.end()) {
return mEntry[tag];
}
- throw TiffParserException("TIFF Parser entry not found.");
+ ThrowTPE("TiffIFD: TIFF Parser entry 0x%x not found.", tag);
+ return 0;
}
bool TiffIFD::hasEntry(TiffTag tag) {
Modified: RawSpeed/TiffParserException.cpp
===================================================================
--- RawSpeed/TiffParserException.cpp 2009-08-04 19:30:54 UTC (rev 97)
+++ RawSpeed/TiffParserException.cpp 2009-08-06 14:48:14 UTC (rev 98)
@@ -1,28 +1,43 @@
#include "StdAfx.h"
#include "TiffParserException.h"
-/*
- RawSpeed - RAW file decoder.
-
- Copyright (C) 2009 Klaus Post
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
+#ifndef WIN32
+#include <stdarg.h>
+#define vsprintf_s(...) vsnprintf(__VA_ARGS__)
+#endif
+
+/*
+ RawSpeed - RAW file decoder.
+
+ Copyright (C) 2009 Klaus Post
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
http://www.klauspost.com
*/
+
TiffParserException::TiffParserException(const string _msg) :
runtime_error(_msg) {
_RPT1(0, "TIFF Exception: %s\n", _msg.c_str());
};
+void ThrowTPE(const char* fmt, ...) {
+ va_list val;
+ va_start(val, fmt);
+ char buf[8192];
+ vsprintf_s(buf, 8192, fmt, val);
+ va_end(val);
+ _RPT1(0, "EXCEPTION: %s\n",buf);
+ throw TiffParserException(buf);
+}
Modified: RawSpeed/TiffParserException.h
===================================================================
--- RawSpeed/TiffParserException.h 2009-08-04 19:30:54 UTC (rev 97)
+++ RawSpeed/TiffParserException.h 2009-08-06 14:48:14 UTC (rev 98)
@@ -15,16 +15,18 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
-
- http://www.klauspost.com
-*/
-#pragma once
-
-class TiffParserException : public std::runtime_error
-{
-public:
- TiffParserException(const string _msg);
- //~TiffParserException(void);
-// const string msg;
-};
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
+
+ http://www.klauspost.com
+*/
+#pragma once
+
+void ThrowTPE(const char* fmt, ...);
+
+class TiffParserException : public std::runtime_error
+{
+public:
+ TiffParserException(const string _msg);
+ //~TiffParserException(void);
+// const string msg;
+};
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit