[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9869: Fixes for more robustness iss
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9869: Fixes for more robustness issues and code cleanup. |
Date: |
Mon, 29 Sep 2008 20:52:44 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9869
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2008-09-29 20:52:44 +0200
message:
Fixes for more robustness issues and code cleanup.
modified:
libbase/GnashImageJpeg.cpp
libbase/image.cpp
------------------------------------------------------------
revno: 9860.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-09-29 19:43:56 +0200
message:
Don't call finishImage() manually in readSWFJpeg3 as it's called in the
JpegImageInput dtor when it goes out of scope, and a longjmp on error
makes a mess.
modified:
libbase/image.cpp
------------------------------------------------------------
revno: 9860.1.5
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-09-29 20:11:43 +0200
message:
Split long lines.
modified:
libbase/image.cpp
------------------------------------------------------------
revno: 9860.1.6
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-09-29 20:15:50 +0200
message:
Close compressor on error so that it's closed for the next startImage().
Fixes an abort.
modified:
libbase/GnashImageJpeg.cpp
=== modified file 'libbase/GnashImageJpeg.cpp'
--- a/libbase/GnashImageJpeg.cpp 2008-09-22 07:49:56 +0000
+++ b/libbase/GnashImageJpeg.cpp 2008-09-29 18:15:50 +0000
@@ -437,6 +437,11 @@
{
log_debug("Long jump: banzaaaaaai!");
_errorOccurred = msg;
+
+ // Mark the compressor as closed so we can open another image
+ // with this instance. We should throw on any errors, so there
+ // should be no further activity on the current image.
+ if (_compressorOpened) _compressorOpened = false;
std::longjmp(_jmpBuf, 1);
}
=== modified file 'libbase/image.cpp'
--- a/libbase/image.cpp 2008-09-15 11:46:35 +0000
+++ b/libbase/image.cpp 2008-09-29 18:11:43 +0000
@@ -182,7 +182,8 @@
//
// Write the given image to the given out stream, in jpeg format.
- void writeImageData(FileType type, boost::shared_ptr<IOChannel> out,
image::ImageBase* image, int quality)
+ void writeImageData(FileType type, boost::shared_ptr<IOChannel> out,
+ image::ImageBase* image, int quality)
{
const size_t width = image->width();
@@ -193,10 +194,12 @@
switch (type)
{
case GNASH_FILETYPE_PNG:
- outChannel = PngImageOutput::create(out, width, height,
quality);
+ outChannel = PngImageOutput::create(out, width,
+ height, quality);
break;
case GNASH_FILETYPE_JPEG:
- outChannel = JpegImageOutput::create(out, width, height,
quality);
+ outChannel = JpegImageOutput::create(out, width,
+ height, quality);
break;
default:
log_error("Requested to write image as unsupported filetype");
@@ -218,7 +221,8 @@
}
// See gnash.h for file types.
- std::auto_ptr<ImageBase> readImageData(boost::shared_ptr<IOChannel> in,
FileType type)
+ std::auto_ptr<ImageBase> readImageData(
+ boost::shared_ptr<IOChannel> in, FileType type)
{
std::auto_ptr<ImageBase> im (NULL);
std::auto_ptr<ImageInput> inChannel;
@@ -260,9 +264,11 @@
}
catch (std::bad_alloc& e)
{
- // This should be caught here because ~JpegImageInput can also
throw
- // an exception on stack unwinding and this confuses remote
catchers.
- log_error("Out of memory while trying to create %dx%d image",
width, height);
+ // This should be caught here because ~JpegImageInput can also
+ // throw an exception on stack unwinding and this confuses
+ // remote catchers.
+ log_error("Out of memory while trying to create %dx%d image",
+ width, height);
return im;
}
@@ -281,8 +287,8 @@
loader.startImage();
- std::auto_ptr<ImageBase> im(new
image::ImageRGB(loader.getWidth(), loader.getHeight()));
-
+ std::auto_ptr<ImageBase> im(
+ new image::ImageRGB(loader.getWidth(), loader.getHeight()));
for (size_t y = 0, height = loader.getHeight(); y < height;
y++) {
loader.readScanline(im->scanline(y));
@@ -296,20 +302,25 @@
// For reading SWF JPEG3-style image data, like ordinary JPEG,
// but stores the data in ImageRGBA format.
- std::auto_ptr<ImageRGBA>
readSWFJpeg3(boost::shared_ptr<gnash::IOChannel> in)
+ std::auto_ptr<ImageRGBA> readSWFJpeg3(
+ boost::shared_ptr<gnash::IOChannel> in)
{
std::auto_ptr<ImageRGBA> im(NULL);
// Calling with headerBytes as 0 has a special effect...
- std::auto_ptr<JpegImageInput> j_in (
JpegImageInput::createSWFJpeg2HeaderOnly(in, 0) );
- if ( ! j_in.get() ) return im;
-
+ std::auto_ptr<JpegImageInput> j_in(
+ JpegImageInput::createSWFJpeg2HeaderOnly(in, 0));
+
+ // If this isn't true, we should have thrown.
+ assert(j_in.get());
+
j_in->startImage();
im.reset(new image::ImageRGBA(j_in->getWidth(),
j_in->getHeight()));
- boost::scoped_array<boost::uint8_t> line ( new
boost::uint8_t[3*j_in->getWidth()] );
+ boost::scoped_array<boost::uint8_t> line (
+ new boost::uint8_t[3 * j_in->getWidth()]);
for (size_t y = 0; y < j_in->getHeight(); y++)
{
@@ -325,8 +336,6 @@
}
}
- j_in->finishImage();
-
return im;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9869: Fixes for more robustness issues and code cleanup.,
Benjamin Wolsey <=