Fresco/Berlin/src PNG.cc,1.5,1.6 RasterImpl.cc,1.4,1.5
Neil John Pilgrim <[email protected]>
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Berlin/src
In directory purcel:/tmp/cvs-serv31030/Berlin/src
Modified Files:
PNG.cc RasterImpl.cc
Log Message:
Better error handling if rasters are not located, or are invalid.
Closes bug178.
Index: PNG.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/src/PNG.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- PNG.cc 2 Jun 2002 23:42:19 -0000 1.5
+++ PNG.cc 9 Feb 2003 19:03:54 -0000 1.6
@@ -157,7 +157,6 @@
}
inline unsigned char **PNG::Decoder::decode()
-
{
Trace trace("PNGDecoder::decode");
if (!_valid)
@@ -352,7 +351,10 @@
{
unsigned char **rows = 0;
std::ifstream ifs(file.c_str());
- if (!ifs) std::cerr << "PNG : file " << file << " unreadable" << std::endl;
+ if (!ifs.is_open())
+ {
+ std::cerr << "PNG : file " << file << " unreadable" << std::endl;
+ }
else
{
Decoder decoder(ifs.rdbuf(), _rpng, _rinfo, _rend);
Index: RasterImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/src/RasterImpl.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- RasterImpl.cc 4 Jan 2003 13:47:18 -0000 1.4
+++ RasterImpl.cc 9 Feb 2003 19:03:54 -0000 1.5
@@ -35,21 +35,20 @@
Prague::Path path = RCManager::get_path("rasterpath");
std::string pngfile = path.lookup_file(file);
if (pngfile.empty())
- {
- std::cerr << "RasterImpl Warning : can't find '" << file << "' in current rasterpath" << std::endl;
- pngfile = path.lookup_file("berlin-128.png");
- }
+ {
+ std::cerr << "RasterImpl Warning : can't find '" << file
+ << "' in current rasterpath" << std::endl;
+ throw CreationFailureException();
+ }
+
_rows = _png.read(pngfile);
- if (!_rows)
- {
- std::cerr << "RasterImpl error: can't read " << pngfile << std::endl;
- pngfile = path.lookup_file("berlin-128.png");
- _rows = _png.read(pngfile);
- if (!_rows) {
- std::cerr << "RasterImpl fatal error: can't read " << pngfile << std::endl;
- exit(-1);
- }
- }
+
+ if (_rows == 0)
+ {
+ std::cerr << "RasterImpl Warning : can't read '" << file
+ << "' in current rasterpath" << std::endl;
+ throw CreationFailureException();
+ }
}
RasterImpl::~RasterImpl() { Trace trace("RasterImpl::~RasterImpl");}
void RasterImpl::clear()