gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11765: Code style cleanups and docu


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11765: Code style cleanups and documentation.
Date: Mon, 18 Jan 2010 09:40:02 +0100
User-agent: Bazaar (2.0.2)

------------------------------------------------------------
revno: 11765 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2010-01-18 09:40:02 +0100
message:
  Code style cleanups and documentation.
modified:
  libbase/ClockTime.cpp
  libbase/GnashImage.cpp
  libbase/GnashImage.h
  libbase/GnashImageGif.cpp
  libbase/GnashImageGif.h
  libbase/GnashImageJpeg.cpp
  libbase/GnashImagePng.h
  libbase/IOChannel.cpp
  libbase/IOChannel.h
  libbase/WallClockTimer.cpp
  libbase/curl_adapter.cpp
  libbase/log.cpp
  libbase/log.h
  libbase/noseek_fd_adapter.cpp
  libbase/ogl.h
  libbase/rc.cpp
  libbase/sharedlib.cpp
  libbase/utf8.cpp
  libbase/utf8.h
  libbase/zlib_adapter.cpp
  libbase/zlib_adapter.h
  libcore/LineStyle.cpp
  libcore/LineStyle.h
  libcore/MovieClip.cpp
  libcore/MovieLoader.cpp
  libcore/MovieLoader.h
  libcore/RGBA.cpp
  libcore/RGBA.h
  libcore/event_id.cpp
  libcore/event_id.h
  libcore/movie_root.cpp
  libcore/swf/DefineTextTag.cpp
=== modified file 'libbase/ClockTime.cpp'
--- a/libbase/ClockTime.cpp     2010-01-11 06:41:38 +0000
+++ b/libbase/ClockTime.cpp     2010-01-18 07:18:49 +0000
@@ -25,8 +25,8 @@
 ///
 /// Namespace clocktime contains a unified source for wall clock time: this
 /// is used mainly for the timing of movie advances and in the ActionScript
-/// Date class. FPS profiling also uses clocktime:: for a relatively high 
resolution,
-/// robust timer.
+/// Date class. FPS profiling also uses clocktime:: for a relatively high
+/// resolution, robust timer.
 ///
 /// The boost::date_time has the great advantage of handling portability 
itself,
 /// as well as being able to handle a much larger range of true dates. Its
@@ -64,7 +64,7 @@
     // Divisor to convert ticks to milliseconds
     const int denominator = time_duration::ticks_per_second() / 1000.0;
     
-       return elapsed.ticks() / denominator;
+    return elapsed.ticks() / denominator;
 }
 
 boost::int32_t
@@ -109,7 +109,7 @@
 clocktime::getTicks()
 {
     // This needs to return milliseconds. Does it?
-       return timeGetTime();
+    return timeGetTime();
 }
 
 # else // not _WIN32
@@ -119,16 +119,16 @@
 clocktime::getTicks()
 {
 
-       struct timeval tv;
-       
-       gettimeofday(&tv, 0);
-
-       boost::uint64_t result = static_cast<boost::uint64_t>(tv.tv_sec) * 
1000000L;
-
-       // Time Unit: microsecond
-       result += tv.tv_usec;
-
-       return static_cast<boost::uint64_t>(result / 1000.0);
+    struct timeval tv;
+    
+    gettimeofday(&tv, 0);
+
+    boost::uint64_t result = static_cast<boost::uint64_t>(tv.tv_sec) * 
1000000L;
+
+    // Time Unit: microsecond
+    result += tv.tv_usec;
+
+    return static_cast<boost::uint64_t>(result / 1000.0);
 }
 
 # endif // not WIN32
@@ -222,12 +222,11 @@
     // should normally be specified as NULL. The tz_dsttime field has
     // never been used under Linux; it has not been and will not be
     // supported by libc or glibc."
-    // Still, mancansa d'asu, t'acuma i buoi (Mangels Esel, Ochsen 
einspannen...)
     //
     // In practice this appears to return the present time offset including 
dst,
-    // so adding the dst of the time specified (we do this a couple of lines 
down)
-    // gives the correct result when it's not presently dst, the wrong one when
-    // it is.
+    // so adding the dst of the time specified (we do this a couple of lines
+    // down) gives the correct result when it's not presently dst, the wrong
+    // one when it is.
     struct timeval tv;
     struct timezone tz;
     gettimeofday(&tv, &tz);
@@ -241,15 +240,14 @@
     // The problem here as for gettimeofday: the offset also includes dst.
     struct timeb tb;
     
-    ftime (&tb);
+    ftime(&tb);
+
     // tb.timezone is number of minutes west of GMT
     offset = -tb.timezone;
-    //gnash::log_debug("Using ftime. Offset is %d", offset);
 
 # else
 
     offset = 0; // No idea.
-    //gnash::log_debug("Cannot find offset. Offset is %d", offset);
 
 # endif
 

=== modified file 'libbase/GnashImage.cpp'
--- a/libbase/GnashImage.cpp    2010-01-11 06:41:38 +0000
+++ b/libbase/GnashImage.cpp    2010-01-18 07:20:07 +0000
@@ -139,8 +139,9 @@
 }
 
 
-void ImageRGBA::setPixel(size_t x, size_t y, boost::uint8_t r, boost::uint8_t 
g, boost::uint8_t b, boost::uint8_t a)
-// Set the pixel at the given position.
+void
+ImageRGBA::setPixel(size_t x, size_t y, boost::uint8_t r, boost::uint8_t g,
+        boost::uint8_t b, boost::uint8_t a)
 {
     assert(x < _width);
     assert(y < _height);

=== modified file 'libbase/GnashImage.h'
--- a/libbase/GnashImage.h      2010-01-11 06:41:38 +0000
+++ b/libbase/GnashImage.h      2010-01-18 07:40:53 +0000
@@ -51,10 +51,10 @@
 /// The types of images handled in Gnash.
 enum ImageType
 {
-       GNASH_IMAGE_INVALID,
-       GNASH_IMAGE_RGB,
-       GNASH_IMAGE_RGBA,
-       GNASH_IMAGE_ALPHA
+    GNASH_IMAGE_INVALID,
+    GNASH_IMAGE_RGB,
+    GNASH_IMAGE_RGBA,
+    GNASH_IMAGE_ALPHA
 };
 
 
@@ -298,39 +298,39 @@
 public:
 
     /// Construct an ImageInput object to read from an IOChannel.
-       //
-       /// @param in   The stream to read data from. Ownership is shared
+    //
+    /// @param in   The stream to read data from. Ownership is shared
     ///             between caller and ImageInput, so it is freed
     ///             automatically when the last owner is destroyed.
-       ImageInput(boost::shared_ptr<IOChannel> in) :
-           _inStream(in),
-           _type(GNASH_IMAGE_INVALID)
-       {}
+    ImageInput(boost::shared_ptr<IOChannel> in) :
+        _inStream(in),
+        _type(GNASH_IMAGE_INVALID)
+    {}
 
-       virtual ~ImageInput() {}
+    virtual ~ImageInput() {}
 
     /// Begin processing the image data.
     virtual void read() = 0;
 
-       /// Get the image's height in pixels.
+    /// Get the image's height in pixels.
     //
     /// @return     The height of the image in pixels.
-       virtual size_t getHeight() const = 0;
+    virtual size_t getHeight() const = 0;
 
-       /// Get the image's width in pixels.
+    /// Get the image's width in pixels.
     //
     /// @return     The width of the image in pixels.
-       virtual size_t getWidth() const = 0;
+    virtual size_t getWidth() const = 0;
 
-       /// Get number of components (channels)
+    /// Get number of components (channels)
     //
-       /// @return     The number of components, e.g. 3 for RGB
-       virtual size_t getComponents() const = 0;
+    /// @return     The number of components, e.g. 3 for RGB
+    virtual size_t getComponents() const = 0;
 
-       /// Read a scanline's worth of image data into the given buffer.
+    /// Read a scanline's worth of image data into the given buffer.
     //
     /// @param rgbData  The buffer for writing raw RGB data to.
-       virtual void readScanline(unsigned char* rgbData) = 0;
+    virtual void readScanline(unsigned char* rgbData) = 0;
 
     /// Get the ImageType of the image.
     //

=== modified file 'libbase/GnashImageGif.cpp'
--- a/libbase/GnashImageGif.cpp 2010-01-11 06:41:38 +0000
+++ b/libbase/GnashImageGif.cpp 2010-01-18 07:40:53 +0000
@@ -110,21 +110,20 @@
     // Is there a multi-dimensional smart array? It's silly to
     // have to allocate each row separately and can mean a lot
     // of reallocation.
-    do
-    {
-        if (DGifGetRecordType(_gif, &record) != GIF_OK)
-        {
+    do {
+
+        if (DGifGetRecordType(_gif, &record) != GIF_OK) {
             throw ParserException(_("GIF: Error retrieving record type"));
         }
         
-        switch (record)
-        {
+        switch (record) {
+
             case IMAGE_DESC_RECORD_TYPE:
             {
                 // Fill the _gif->Image fields 
-                if (DGifGetImageDesc(_gif) != GIF_OK)
-                {
-                    throw ParserException(_("GIF: Error retrieving image 
description"));
+                if (DGifGetImageDesc(_gif) != GIF_OK) {
+                    throw ParserException(_("GIF: Error retrieving image "
+                                "description"));
                 }
                 const int backgroundColor = _gif->SBackGroundColor;
 
@@ -136,12 +135,12 @@
                 const size_t screenHeight = getHeight();
 
                 // Set all the pixels to the background colour.
-                for (size_t i = 0; i < screenHeight; ++i)
-                {
+                for (size_t i = 0; i < screenHeight; ++i) {
                     // Set the width dimension of the array
                     _gifData[i].reset(new GifPixelType[screenWidth]);
                     // Fill all the pixels with the background color.
-                    std::memset(_gifData[i].get(), backgroundColor, 
screenWidth);
+                    std::memset(_gifData[i].get(), backgroundColor,
+                            screenWidth);
                 }
                 
                 // The position of the image on the GIF 'screen'
@@ -151,15 +150,15 @@
                 const size_t imageLeft = _gif->Image.Left;
                 
                 if (imageHeight + imageTop > screenHeight ||
-                    imageWidth + imageLeft > screenWidth)
-                {
-                    throw ParserException(_("GIF: invalid image data (bounds 
outside GIF screen)"));
+                    imageWidth + imageLeft > screenWidth) {
+                    throw ParserException(_("GIF: invalid image data "
+                                "(bounds outside GIF screen)"));
                 }
 
                 // Handle interlaced data in four passes.
-                if (_gif->Image.Interlace)
-                {
-                    log_debug(_("Found interlaced GIF (%d x %d)"), 
screenWidth, screenHeight);
+                if (_gif->Image.Interlace) {
+                    log_debug(_("Found interlaced GIF (%d x %d)"),
+                            screenWidth, screenHeight);
 
                     // The order of interlaced GIFs.
                     static const int interlacedOffsets[] =
@@ -167,15 +166,18 @@
                     static const int interlacedJumps[] =
                                             { 8, 8, 4, 2 };
 
-                    for (size_t i = 0; i < 4; ++i)
-                    {
-                                   for (size_t j = imageTop + 
interlacedOffsets[i];
-                                               j < imageTop + imageHeight;
-                                               j += interlacedJumps[i])
-                                   {
-                            if (DGifGetLine(_gif, &_gifData[j][imageLeft], 
imageWidth) != GIF_OK)
-                            {
-                                throw ParserException(_("GIF: failed reading 
pixel data"));
+                    for (size_t i = 0; i < 4; ++i) {
+
+                        for (size_t j = imageTop + interlacedOffsets[i];
+                                    j < imageTop + imageHeight;
+                                    j += interlacedJumps[i]) {
+
+                            if (DGifGetLine(_gif, &_gifData[j][imageLeft],
+                                        imageWidth) != GIF_OK) {
+
+                                throw ParserException(_("GIF: failed reading "
+                                            "pixel data"));
+
                             }
                         }
                     }
@@ -183,13 +185,15 @@
                 }
 
                 // Non-interlaced data.
-                log_debug(_("Found non-interlaced GIF (%d x %d)"), 
screenWidth, screenHeight);
-                for (size_t i = imageTop; i < imageHeight; ++i)
-                {
+                log_debug(_("Found non-interlaced GIF (%d x %d)"),
+                        screenWidth, screenHeight);
+
+                for (size_t i = imageTop; i < imageHeight; ++i) {
                     // Read the gif data into the gif array.
-                    if (DGifGetLine(_gif, &_gifData[i][imageLeft], imageWidth) 
!= GIF_OK)
-                    {
-                        throw ParserException(_("GIF: failed reading pixel 
data"));
+                    if (DGifGetLine(_gif, &_gifData[i][imageLeft], imageWidth)
+                            != GIF_OK) {
+                        throw ParserException(_("GIF: failed reading "
+                                    "pixel data"));
                     }                    
                 }
                 break;
@@ -198,13 +202,11 @@
                 // Skip all extension records.
                 GifByteType* extension;
                 int extCode;
-                       DGifGetExtension(_gif, &extCode, &extension);
-                   while (extension)
-                   {
-                       if (DGifGetExtensionNext(_gif, &extension) == GIF_ERROR)
-                       {
-                           break;
-                       }
+                DGifGetExtension(_gif, &extCode, &extension);
+                while (extension) {
+                    if (DGifGetExtensionNext(_gif, &extension) == GIF_ERROR) {
+                        break;
+                    }
                 }
                 break;         
             default:

=== modified file 'libbase/GnashImageGif.h'
--- a/libbase/GnashImageGif.h   2010-01-11 06:41:38 +0000
+++ b/libbase/GnashImageGif.h   2010-01-18 07:40:53 +0000
@@ -42,39 +42,39 @@
 
 public:
 
-       /// Construct a GifImageInput object to read from an IOChannel.
-       //
-       /// @param in   The stream to read GIF data from. Ownership is shared
+    /// Construct a GifImageInput object to read from an IOChannel.
+    //
+    /// @param in   The stream to read GIF data from. Ownership is shared
     ///             between caller and GifImageInput, so it is freed
     ///             automatically when the last owner is destroyed.
-       GifImageInput(boost::shared_ptr<IOChannel> in);
-       
-       ~GifImageInput();
+    GifImageInput(boost::shared_ptr<IOChannel> in);
+    
+    ~GifImageInput();
 
     /// Begin processing the image data.
     void read();
 
-       /// Get the image's height in pixels.
+    /// Get the image's height in pixels.
     //
     /// @return     The height of the image in pixels.
-       size_t getHeight() const;
+    size_t getHeight() const;
 
-       /// Get the image's width in pixels.
+    /// Get the image's width in pixels.
     //
     /// @return     The width of the image in pixels.
-       size_t getWidth() const;
+    size_t getWidth() const;
 
-       /// Get number of components (channels)
+    /// Get number of components (channels)
     //
-       /// @return     The number of components, e.g. 3 for RGB
-       size_t getComponents() const { return 3; }
+    /// @return     The number of components, e.g. 3 for RGB
+    size_t getComponents() const { return 3; }
 
-       /// Read a scanline's worth of image data into the given buffer.
+    /// Read a scanline's worth of image data into the given buffer.
     //
     /// The amount of data read is getWidth() * getComponents().
-       ///
+    ///
     /// @param rgbData  The buffer for writing raw RGB data to.
-       void readScanline(unsigned char* rgb_data);
+    void readScanline(unsigned char* rgb_data);
 
 
     /// Create a GifImageInput and transfer ownership to the caller.
@@ -89,12 +89,12 @@
     }
 
 private:
-       
+    
     /// Initialize gif_lib
     void init();
 
-       // State needed for input.
-       GifFileType* _gif;
+    // State needed for input.
+    GifFileType* _gif;
     
     // A counter for keeping track of the last row copied.
     size_t _currentRow;

=== modified file 'libbase/GnashImageJpeg.cpp'
--- a/libbase/GnashImageJpeg.cpp        2010-01-14 23:33:20 +0000
+++ b/libbase/GnashImageJpeg.cpp        2010-01-18 07:40:53 +0000
@@ -66,12 +66,12 @@
 jpeg_error_exit(j_common_ptr cinfo)
 {
 
-       // Set a flag to stop parsing 
-       JpegImageInput* in = static_cast<JpegImageInput*>(cinfo->client_data);
-       
-       
in->errorOccurred(cinfo->err->jpeg_message_table[cinfo->err->msg_code]); 
+    // Set a flag to stop parsing 
+    JpegImageInput* in = static_cast<JpegImageInput*>(cinfo->client_data);
+    
+    in->errorOccurred(cinfo->err->jpeg_message_table[cinfo->err->msg_code]); 
 
-       //log_error("failing to abort jpeg parser here (would need a long-jump 
call)");
+    //log_error("failing to abort jpeg parser here (would need a long-jump 
call)");
 }
 
 
@@ -79,10 +79,10 @@
 static void
 setup_jpeg_err(jpeg_error_mgr* jerr)
 {
-       // Set up defaults.
-       jpeg_std_error(jerr);
+    // Set up defaults.
+    jpeg_std_error(jerr);
 
-       jerr->error_exit = jpeg_error_exit;
+    jerr->error_exit = jpeg_error_exit;
 }
 
 // Helper object for reading jpeg image data.  Basically a thin
@@ -93,305 +93,305 @@
 class rw_source_IOChannel
 {
 public:
-       jpeg_source_mgr m_pub;          /* public fields */
-
-       // Constructor.
-       rw_source_IOChannel(boost::shared_ptr<IOChannel> in)
-               :
-               _ownSourceStream(false),
-               m_in_stream(in),
-               m_start_of_file(true)
-       {
-               init();
-       }
-
-       ~rw_source_IOChannel()
-       {
-       }
-
-       static void init_source(j_decompress_ptr cinfo)
-       {
-               rw_source_IOChannel*    src = (rw_source_IOChannel*) cinfo->src;
-               src->m_start_of_file = true;
-       }
-
-       // Read data into our input buffer.  Client calls this
-       // when it needs more data from the file.
-       static jpeg_bool_t fill_input_buffer(j_decompress_ptr cinfo)
-       {
-               rw_source_IOChannel*    src = (rw_source_IOChannel*) cinfo->src;
-
-               // TODO: limit read as requested by caller
-               size_t  bytes_read = src->m_in_stream->read(src->m_buffer, 
IO_BUF_SIZE);
-
-               if (bytes_read <= 0) {
-                       // Is the file completely empty?
-                       if (src->m_start_of_file) {
-                               // Treat this as a fatal error.
-                               log_error(_("JPEG: Empty jpeg source stream."));
-                               return false;
-                       }
-                       // warn("jpeg end-of-stream");
-
-                       // Insert a fake EOI marker.
-                       src->m_buffer[0] = (JOCTET) 0xFF;
-                       src->m_buffer[1] = (JOCTET) JPEG_EOI;
-                       bytes_read = 2;
-               }
-
-               // Hack to work around SWF bug: sometimes data
-               // starts with FFD9FFD8, when it should be
-               // FFD8FFD9!
-               if (src->m_start_of_file && bytes_read >= 4)
-               {
-                       if (src->m_buffer[0] == 0xFF
-                           && src->m_buffer[1] == 0xD9 
-                           && src->m_buffer[2] == 0xFF
-                           && src->m_buffer[3] == 0xD8)
-                       {
-                               src->m_buffer[1] = 0xD8;
-                               src->m_buffer[3] = 0xD9;
-                       }
-               }
-
-               // Expose buffer state to clients.
-               src->m_pub.next_input_byte = src->m_buffer;
-               src->m_pub.bytes_in_buffer = bytes_read;
-               src->m_start_of_file = false;
-
-               return true;
-       }
-
-       // Called by client when it wants to advance past some
-       // uninteresting data.
-       static void     skip_input_data(j_decompress_ptr cinfo, long num_bytes)
-       {
-               rw_source_IOChannel* src = (rw_source_IOChannel*) cinfo->src;
-
-               // According to jpeg docs, large skips are
-               // infrequent.  So let's just do it the simple
-               // way.
-               if (num_bytes > 0) {
-                       while (num_bytes > 
static_cast<long>(src->m_pub.bytes_in_buffer)) {
-                               num_bytes -= 
static_cast<long>(src->m_pub.bytes_in_buffer);
-                               fill_input_buffer(cinfo);
-                       }
-                       // Handle remainder.
-                       src->m_pub.next_input_byte += (size_t) num_bytes;
-                       src->m_pub.bytes_in_buffer -= (size_t) num_bytes;
-               }
-       }
-
-       static void term_source(j_decompress_ptr /* cinfo */)
-       {
-       }
-
-
-       void    discardPartialBuffer()
-       {
-               // Discard existing bytes in our buffer.
-               m_pub.bytes_in_buffer = 0;
-               m_pub.next_input_byte = NULL;
-       }
-
-       /// Set up the given decompress object to read from the given
-       /// stream.
-       ///
-       /// @param instream
-       ///     Stream to read from. Ownership always shared with caller.
-       ///
-       static void setup(jpeg_decompress_struct* cinfo, 
boost::shared_ptr<IOChannel> instream)
-       {
-               // assert(cinfo->src == NULL);
-               rw_source_IOChannel* source = new rw_source_IOChannel(instream);
-               cinfo->src = (jpeg_source_mgr*)source;
-       }
+    jpeg_source_mgr    m_pub;        /* public fields */
+
+    // Constructor.
+    explicit rw_source_IOChannel(boost::shared_ptr<IOChannel> in)
+        :
+        _ownSourceStream(false),
+        m_in_stream(in),
+        m_start_of_file(true)
+    {
+        init();
+    }
+
+    ~rw_source_IOChannel()
+    {
+    }
+
+    static void init_source(j_decompress_ptr cinfo)
+    {
+        rw_source_IOChannel*    src = (rw_source_IOChannel*) cinfo->src;
+        src->m_start_of_file = true;
+    }
+
+    // Read data into our input buffer.  Client calls this
+    // when it needs more data from the file.
+    static jpeg_bool_t fill_input_buffer(j_decompress_ptr cinfo)
+    {
+        rw_source_IOChannel*    src = (rw_source_IOChannel*) cinfo->src;
+
+        // TODO: limit read as requested by caller
+        size_t    bytes_read = src->m_in_stream->read(src->m_buffer, 
IO_BUF_SIZE);
+
+        if (bytes_read <= 0) {
+            // Is the file completely empty?
+            if (src->m_start_of_file) {
+                // Treat this as a fatal error.
+                log_error(_("JPEG: Empty jpeg source stream."));
+                return false;
+            }
+            // warn("jpeg end-of-stream");
+
+            // Insert a fake EOI marker.
+            src->m_buffer[0] = (JOCTET) 0xFF;
+            src->m_buffer[1] = (JOCTET) JPEG_EOI;
+            bytes_read = 2;
+        }
+
+        // Hack to work around SWF bug: sometimes data
+        // starts with FFD9FFD8, when it should be
+        // FFD8FFD9!
+        if (src->m_start_of_file && bytes_read >= 4)
+        {
+            if (src->m_buffer[0] == 0xFF
+                && src->m_buffer[1] == 0xD9 
+                && src->m_buffer[2] == 0xFF
+                && src->m_buffer[3] == 0xD8)
+            {
+                src->m_buffer[1] = 0xD8;
+                src->m_buffer[3] = 0xD9;
+            }
+        }
+
+        // Expose buffer state to clients.
+        src->m_pub.next_input_byte = src->m_buffer;
+        src->m_pub.bytes_in_buffer = bytes_read;
+        src->m_start_of_file = false;
+
+        return true;
+    }
+
+    // Called by client when it wants to advance past some
+    // uninteresting data.
+    static void    skip_input_data(j_decompress_ptr cinfo, long num_bytes)
+    {
+        rw_source_IOChannel* src = (rw_source_IOChannel*) cinfo->src;
+
+        // According to jpeg docs, large skips are
+        // infrequent.  So let's just do it the simple
+        // way.
+        if (num_bytes > 0) {
+            while (num_bytes > static_cast<long>(src->m_pub.bytes_in_buffer)) {
+                num_bytes -= static_cast<long>(src->m_pub.bytes_in_buffer);
+                fill_input_buffer(cinfo);
+            }
+            // Handle remainder.
+            src->m_pub.next_input_byte += (size_t) num_bytes;
+            src->m_pub.bytes_in_buffer -= (size_t) num_bytes;
+        }
+    }
+
+    static void term_source(j_decompress_ptr /* cinfo */)
+    {
+    }
+
+
+    void    discardPartialBuffer()
+    {
+        // Discard existing bytes in our buffer.
+        m_pub.bytes_in_buffer = 0;
+        m_pub.next_input_byte = NULL;
+    }
+
+    /// Set up the given decompress object to read from the given
+    /// stream.
+    ///
+    /// @param instream
+    ///     Stream to read from. Ownership always shared with caller.
+    ///
+    static void setup(jpeg_decompress_struct* cinfo, 
boost::shared_ptr<IOChannel> instream)
+    {
+        // assert(cinfo->src == NULL);
+        rw_source_IOChannel* source = new rw_source_IOChannel(instream);
+        cinfo->src = (jpeg_source_mgr*)source;
+    }
 
 private:
 
-       void init()
-       {
-               // fill in function pointers...
-               m_pub.init_source = init_source;
-               m_pub.fill_input_buffer = fill_input_buffer;
-               m_pub.skip_input_data = skip_input_data;
-               m_pub.resync_to_restart = jpeg_resync_to_restart;       // use 
default method
-               m_pub.term_source = term_source;
-               m_pub.bytes_in_buffer = 0;
-               m_pub.next_input_byte = NULL;
-       }
+    void init()
+    {
+        // fill in function pointers...
+        m_pub.init_source = init_source;
+        m_pub.fill_input_buffer = fill_input_buffer;
+        m_pub.skip_input_data = skip_input_data;
+        m_pub.resync_to_restart = jpeg_resync_to_restart;    // use default 
method
+        m_pub.term_source = term_source;
+        m_pub.bytes_in_buffer = 0;
+        m_pub.next_input_byte = NULL;
+    }
 
-       bool _ownSourceStream;
-       
-       // Source stream
-       boost::shared_ptr<IOChannel> m_in_stream;
-       bool    m_start_of_file;                /* have we gotten any data yet? 
*/
-       JOCTET  m_buffer[IO_BUF_SIZE];          /* start of buffer */
+    bool _ownSourceStream;
+    
+    // Source stream
+    boost::shared_ptr<IOChannel> m_in_stream;
+    bool    m_start_of_file;        /* have we gotten any data yet? */
+    JOCTET    m_buffer[IO_BUF_SIZE];        /* start of buffer */
 
 
 };
 
 
 JpegImageInput::JpegImageInput(boost::shared_ptr<IOChannel> in)
-       :
+    :
     ImageInput(in),
-       _errorOccurred(false),
-       _compressorOpened(false)
+    _errorOccurred(false),
+    _compressorOpened(false)
 {
-       setup_jpeg_err(&m_jerr);
-       m_cinfo.err = &m_jerr;
-       m_cinfo.client_data = this;
-
-       // Initialize decompression object.
-       jpeg_create_decompress(&m_cinfo);
-
-       rw_source_IOChannel::setup(&m_cinfo, in);
+    setup_jpeg_err(&m_jerr);
+    m_cinfo.err = &m_jerr;
+    m_cinfo.client_data = this;
+
+    // Initialize decompression object.
+    jpeg_create_decompress(&m_cinfo);
+
+    rw_source_IOChannel::setup(&m_cinfo, in);
 }
 
 
 JpegImageInput::~JpegImageInput()
 {
-       finishImage();
-
-       rw_source_IOChannel* src = 
reinterpret_cast<rw_source_IOChannel*>(m_cinfo.src);
-       delete src;
-       m_cinfo.src = NULL;
-
-       jpeg_destroy_decompress(&m_cinfo);
+    finishImage();
+
+    rw_source_IOChannel* src = 
reinterpret_cast<rw_source_IOChannel*>(m_cinfo.src);
+    delete src;
+    m_cinfo.src = NULL;
+
+    jpeg_destroy_decompress(&m_cinfo);
 }
 
 
 void
 JpegImageInput::discardPartialBuffer()
 {
-       rw_source_IOChannel* src = (rw_source_IOChannel*) m_cinfo.src;
+    rw_source_IOChannel* src = (rw_source_IOChannel*) m_cinfo.src;
 
-       // We only have to discard the input buffer after reading the tables.
-       if (src)
-       {
-               src->discardPartialBuffer();
-       }
+    // We only have to discard the input buffer after reading the tables.
+    if (src)
+    {
+        src->discardPartialBuffer();
+    }
 }
 
 
 void
 JpegImageInput::readHeader(unsigned int maxHeaderBytes)
 {
-       if ( setjmp(_jmpBuf) )
-       {
-               std::stringstream ss;
-               ss << _("Internal jpeg error: ") << _errorOccurred;
-               throw ParserException(ss.str());
-       }
-
-       if ( maxHeaderBytes )
-       {
-               // Read the encoding tables.
-               // TODO: how to limit reads ?
-               int ret = jpeg_read_header(&m_cinfo, FALSE);
-               switch (ret)
-               {
-                       case JPEG_SUSPENDED: // suspended due to lack of data
-                               throw ParserException(_("Lack of data during 
JPEG header parsing"));
-                               break;
-                       case JPEG_HEADER_OK: // Found valid image datastream
-                               break;
-                       case JPEG_HEADER_TABLES_ONLY: // Found valid 
table-specs-only datastream
-                               break;
-                       default:
-                               log_debug(_("unexpected: jpeg_read_header 
returned %d [%s:%d]"),
-                                           ret, __FILE__, __LINE__);
-                               break;
-               }
-
-               if (_errorOccurred)
-               {
-                       std::stringstream ss;
-                       ss << _("Internal jpeg error: ") << _errorOccurred;
-                       throw ParserException(ss.str());
-               }
-
-       }
-
-       // Don't start reading any image data!
-       // App does that manually using start_image.
+    if ( setjmp(_jmpBuf) )
+    {
+        std::stringstream ss;
+        ss << _("Internal jpeg error: ") << _errorOccurred;
+        throw ParserException(ss.str());
+    }
+
+    if ( maxHeaderBytes )
+    {
+        // Read the encoding tables.
+        // TODO: how to limit reads ?
+        int ret = jpeg_read_header(&m_cinfo, FALSE);
+        switch (ret)
+        {
+            case JPEG_SUSPENDED: // suspended due to lack of data
+                throw ParserException(_("Lack of data during JPEG header 
parsing"));
+                break;
+            case JPEG_HEADER_OK: // Found valid image datastream
+                break;
+            case JPEG_HEADER_TABLES_ONLY: // Found valid table-specs-only 
datastream
+                break;
+            default:
+                log_debug(_("unexpected: jpeg_read_header returned %d 
[%s:%d]"),
+                            ret, __FILE__, __LINE__);
+                break;
+        }
+
+        if (_errorOccurred)
+        {
+            std::stringstream ss;
+            ss << _("Internal jpeg error: ") << _errorOccurred;
+            throw ParserException(ss.str());
+        }
+
+    }
+
+    // Don't start reading any image data!
+    // App does that manually using start_image.
 }
 
 
 void
 JpegImageInput::read()
 {
-       assert(!_compressorOpened);
-
-       if ( setjmp(_jmpBuf) )
-       {
-               std::stringstream ss;
-               ss << _("Internal jpeg error: ") << _errorOccurred;
-               throw ParserException(ss.str());
-       }
-
-
-       // hack, FIXME
-       static const int stateReady = 202;      /* found SOS, ready for 
start_decompress */
-       while (m_cinfo.global_state != stateReady)
-       {
-               int ret = jpeg_read_header(&m_cinfo, FALSE);
-               switch (ret)
-               {
-                       case JPEG_SUSPENDED: // suspended due to lack of data
-                               throw ParserException(_("lack of data during 
JPEG header parsing"));
-                               break;
-                       case JPEG_HEADER_OK: // Found valid image datastream
-                               break;
-                       case JPEG_HEADER_TABLES_ONLY: // Found valid 
table-specs-only datastream
-                               break;
-                       default:
-                               log_debug(_("unexpected: jpeg_read_header 
returned %d [%s:%d]"),
-                                       ret, __FILE__, __LINE__);
-                               break;
-               }
-       }
-
-       if (_errorOccurred)
-       {
-               std::stringstream ss;
-               ss << _("Internal jpeg error during header parsing: ") << 
_errorOccurred;
-               throw ParserException(ss.str());
-       }
-
-       jpeg_start_decompress(&m_cinfo);
-
-       if (_errorOccurred)
-       {
-               std::stringstream ss;
-               ss << _("Internal jpeg error during decompression: ") << 
_errorOccurred;
-               throw ParserException(ss.str());
-       }
-
-       _compressorOpened = true;
-       
-       // Until this point the type should be GNASH_IMAGE_INVALID.
-       // It's possible to create transparent JPEG data by merging an
-       // alpha channel, but that is handled explicitly elsewhere.
-       _type = GNASH_IMAGE_RGB;
+    assert(!_compressorOpened);
+
+    if ( setjmp(_jmpBuf) )
+    {
+        std::stringstream ss;
+        ss << _("Internal jpeg error: ") << _errorOccurred;
+        throw ParserException(ss.str());
+    }
+
+
+    // hack, FIXME
+    static const int stateReady = 202;    /* found SOS, ready for 
start_decompress */
+    while (m_cinfo.global_state != stateReady)
+    {
+        int ret = jpeg_read_header(&m_cinfo, FALSE);
+        switch (ret)
+        {
+            case JPEG_SUSPENDED: // suspended due to lack of data
+                throw ParserException(_("lack of data during JPEG header 
parsing"));
+                break;
+            case JPEG_HEADER_OK: // Found valid image datastream
+                break;
+            case JPEG_HEADER_TABLES_ONLY: // Found valid table-specs-only 
datastream
+                break;
+            default:
+                log_debug(_("unexpected: jpeg_read_header returned %d 
[%s:%d]"),
+                        ret, __FILE__, __LINE__);
+                break;
+        }
+    }
+
+    if (_errorOccurred)
+    {
+        std::stringstream ss;
+        ss << _("Internal jpeg error during header parsing: ") << 
_errorOccurred;
+        throw ParserException(ss.str());
+    }
+
+    jpeg_start_decompress(&m_cinfo);
+
+    if (_errorOccurred)
+    {
+        std::stringstream ss;
+        ss << _("Internal jpeg error during decompression: ") << 
_errorOccurred;
+        throw ParserException(ss.str());
+    }
+
+    _compressorOpened = true;
+    
+    // Until this point the type should be GNASH_IMAGE_INVALID.
+    // It's possible to create transparent JPEG data by merging an
+    // alpha channel, but that is handled explicitly elsewhere.
+    _type = GNASH_IMAGE_RGB;
 }
 
 
 void
 JpegImageInput::finishImage()
 {
-       if ( setjmp(_jmpBuf) )
-       {
-               std::stringstream ss;
-               ss << _("Internal jpeg error: ") << _errorOccurred;
-               throw ParserException(ss.str());
-       }
+    if ( setjmp(_jmpBuf) )
+    {
+        std::stringstream ss;
+        ss << _("Internal jpeg error: ") << _errorOccurred;
+        throw ParserException(ss.str());
+    }
 
-       if (_compressorOpened)
-       {
-               jpeg_finish_decompress(&m_cinfo);
-               _compressorOpened = false;
-       }
+    if (_compressorOpened)
+    {
+        jpeg_finish_decompress(&m_cinfo);
+        _compressorOpened = false;
+    }
 }
 
 
@@ -399,8 +399,8 @@
 size_t
 JpegImageInput::getHeight() const
 {
-       assert(_compressorOpened);
-       return m_cinfo.output_height;
+    assert(_compressorOpened);
+    return m_cinfo.output_height;
 }
 
 
@@ -408,55 +408,55 @@
 size_t
 JpegImageInput::getWidth() const
 {
-       assert(_compressorOpened);
-       return m_cinfo.output_width;
+    assert(_compressorOpened);
+    return m_cinfo.output_width;
 }
 
 
 size_t
 JpegImageInput::getComponents() const
 {
-       assert(_compressorOpened);
-       return m_cinfo.output_components;
+    assert(_compressorOpened);
+    return m_cinfo.output_components;
 }
 
 
 void
 JpegImageInput::readScanline(unsigned char* rgb_data)
 {
-       assert(_compressorOpened);
+    assert(_compressorOpened);
 
-       assert(m_cinfo.output_scanline < m_cinfo.output_height);
-       int     lines_read = jpeg_read_scanlines(&m_cinfo, &rgb_data, 1);
-       assert(lines_read == 1);
-       lines_read = lines_read;        // avoid warning in NDEBUG
-       // Expand grayscale to RGB
-       if (m_cinfo.out_color_space == JCS_GRAYSCALE)
-       {
-               size_t w = getWidth();
-               unsigned char* src = rgb_data + w - 1;
-               unsigned char* dst = rgb_data + (w * 3) - 1;
-               for (;  w;  w--, src--)
-               {
-                       *dst-- = *src;
-                       *dst-- = *src;
-                       *dst-- = *src;
-               }
-       }       
+    assert(m_cinfo.output_scanline < m_cinfo.output_height);
+    int    lines_read = jpeg_read_scanlines(&m_cinfo, &rgb_data, 1);
+    assert(lines_read == 1);
+    lines_read = lines_read;    // avoid warning in NDEBUG
+    // Expand grayscale to RGB
+    if (m_cinfo.out_color_space == JCS_GRAYSCALE)
+    {
+        size_t w = getWidth();
+        unsigned char* src = rgb_data + w - 1;
+        unsigned char* dst = rgb_data + (w * 3) - 1;
+        for (;  w;  w--, src--)
+        {
+            *dst-- = *src;
+            *dst-- = *src;
+            *dst-- = *src;
+        }
+    }    
 }
 
 
 void
 JpegImageInput::errorOccurred(const char* msg)
 {
-       log_debug("Long jump: banzaaaaaai!");
-       _errorOccurred = msg;
+    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);
+    std::longjmp(_jmpBuf, 1);
 }
 
 std::auto_ptr<GnashImage>
@@ -487,95 +487,95 @@
 class rw_dest_IOChannel
 {
 public:
-       struct jpeg_destination_mgr     m_pub;  /* public fields */
-
-       /// Constructor. 
-       //
-       /// The caller is responsible for closing
-       /// the output stream after it's done using us.
-       ///
-       /// @param out
-       ///     The output stream, externally owned.
-       ///
-       rw_dest_IOChannel(IOChannel& out)
-               :
-               m_out_stream(out)
-       {
-               // fill in function pointers...
-               m_pub.init_destination = init_destination;
-               m_pub.empty_output_buffer = empty_output_buffer;
-               m_pub.term_destination = term_destination;
-
-               m_pub.next_output_byte = m_buffer;
-               m_pub.free_in_buffer = IO_BUF_SIZE;
-       }
-
-       static void init_destination(j_compress_ptr cinfo)
-       {
-               rw_dest_IOChannel*      dest = (rw_dest_IOChannel*) cinfo->dest;
-               assert(dest);
-
-               dest->m_pub.next_output_byte = dest->m_buffer;
-               dest->m_pub.free_in_buffer = IO_BUF_SIZE;
-       }
-
-       // Set up the given compress object to write to the given
-       // output stream.
-       static void setup(j_compress_ptr cinfo, IOChannel& outstream)
-       {
-               cinfo->dest = (jpeg_destination_mgr*) (new 
rw_dest_IOChannel(outstream));
-       }
-
-       /// Write the output buffer into the stream.
-       static jpeg_bool_t empty_output_buffer(j_compress_ptr cinfo)
-       {
-               rw_dest_IOChannel*      dest = (rw_dest_IOChannel*) cinfo->dest;
-               assert(dest);
-
-               if (dest->m_out_stream.write(dest->m_buffer, IO_BUF_SIZE) != 
IO_BUF_SIZE)
-               {
-                       // Error.
-                       log_error(_("jpeg::rw_dest_IOChannel couldn't write 
data."));
-                       return false;
-               }
-
-               dest->m_pub.next_output_byte = dest->m_buffer;
-               dest->m_pub.free_in_buffer = IO_BUF_SIZE;
-
-               return true;
-       }
-
-       /// Terminate the destination. 
-       //
-       /// Flush any leftover data, and make sure we get deleted.
-       ///
-       static void term_destination(j_compress_ptr cinfo)
-       {
-               rw_dest_IOChannel* dest = (rw_dest_IOChannel*) cinfo->dest;
-               assert(dest);
-
-               // Write any remaining data.
-               int     datacount = IO_BUF_SIZE - dest->m_pub.free_in_buffer;
-               if (datacount > 0) {
-                       if (dest->m_out_stream.write(dest->m_buffer, datacount) 
!= datacount)
-                       {
-                               // Error.
-                               
log_error(_("jpeg::rw_dest_IOChannel::term_destination "
-                                           "couldn't write data."));
-                       }
-               }
-
-               // Clean ourselves up.
-               delete dest;
-               cinfo->dest = NULL;
-       }
-
-private:       
-
-       // Source stream, owned in this context by JpegImageInput
-       IOChannel& m_out_stream;        
-
-       JOCTET m_buffer[IO_BUF_SIZE];           /* start of buffer */
+    struct jpeg_destination_mgr    m_pub;    /* public fields */
+
+    /// Constructor. 
+    //
+    /// The caller is responsible for closing
+    /// the output stream after it's done using us.
+    ///
+    /// @param out
+    ///    The output stream, externally owned.
+    ///
+    rw_dest_IOChannel(IOChannel& out)
+        :
+        m_out_stream(out)
+    {
+        // fill in function pointers...
+        m_pub.init_destination = init_destination;
+        m_pub.empty_output_buffer = empty_output_buffer;
+        m_pub.term_destination = term_destination;
+
+        m_pub.next_output_byte = m_buffer;
+        m_pub.free_in_buffer = IO_BUF_SIZE;
+    }
+
+    static void init_destination(j_compress_ptr cinfo)
+    {
+        rw_dest_IOChannel*    dest = (rw_dest_IOChannel*) cinfo->dest;
+        assert(dest);
+
+        dest->m_pub.next_output_byte = dest->m_buffer;
+        dest->m_pub.free_in_buffer = IO_BUF_SIZE;
+    }
+
+    // Set up the given compress object to write to the given
+    // output stream.
+    static void setup(j_compress_ptr cinfo, IOChannel& outstream)
+    {
+        cinfo->dest = (jpeg_destination_mgr*) (new 
rw_dest_IOChannel(outstream));
+    }
+
+    /// Write the output buffer into the stream.
+    static jpeg_bool_t empty_output_buffer(j_compress_ptr cinfo)
+    {
+        rw_dest_IOChannel*    dest = (rw_dest_IOChannel*) cinfo->dest;
+        assert(dest);
+
+        if (dest->m_out_stream.write(dest->m_buffer, IO_BUF_SIZE) != 
IO_BUF_SIZE)
+        {
+            // Error.
+            log_error(_("jpeg::rw_dest_IOChannel couldn't write data."));
+            return false;
+        }
+
+        dest->m_pub.next_output_byte = dest->m_buffer;
+        dest->m_pub.free_in_buffer = IO_BUF_SIZE;
+
+        return true;
+    }
+
+    /// Terminate the destination. 
+    //
+    /// Flush any leftover data, and make sure we get deleted.
+    ///
+    static void term_destination(j_compress_ptr cinfo)
+    {
+        rw_dest_IOChannel* dest = (rw_dest_IOChannel*) cinfo->dest;
+        assert(dest);
+
+        // Write any remaining data.
+        int    datacount = IO_BUF_SIZE - dest->m_pub.free_in_buffer;
+        if (datacount > 0) {
+            if (dest->m_out_stream.write(dest->m_buffer, datacount) != 
datacount)
+            {
+                // Error.
+                log_error(_("jpeg::rw_dest_IOChannel::term_destination "
+                            "couldn't write data."));
+            }
+        }
+
+        // Clean ourselves up.
+        delete dest;
+        cinfo->dest = NULL;
+    }
+
+private:    
+
+    // Source stream, owned in this context by JpegImageInput
+    IOChannel& m_out_stream;    
+
+    JOCTET m_buffer[IO_BUF_SIZE];        /* start of buffer */
 
 };
 
@@ -584,27 +584,27 @@
     :
     ImageOutput(out, width, height)
 {
-               m_cinfo.err = jpeg_std_error(&m_jerr);
-
-               // Initialize decompression object.
-               jpeg_create_compress(&m_cinfo);
-
-               rw_dest_IOChannel::setup(&m_cinfo, *_outStream);
-               m_cinfo.image_width = _width;
-               m_cinfo.image_height = _height;
-               m_cinfo.input_components = 3;
-               m_cinfo.in_color_space = JCS_RGB;
-               jpeg_set_defaults(&m_cinfo);
-               jpeg_set_quality(&m_cinfo, quality, TRUE);
-
-               jpeg_start_compress(&m_cinfo, TRUE);
+    m_cinfo.err = jpeg_std_error(&m_jerr);
+
+    // Initialize decompression object.
+    jpeg_create_compress(&m_cinfo);
+
+    rw_dest_IOChannel::setup(&m_cinfo, *_outStream);
+    m_cinfo.image_width = _width;
+    m_cinfo.image_height = _height;
+    m_cinfo.input_components = 3;
+    m_cinfo.in_color_space = JCS_RGB;
+    jpeg_set_defaults(&m_cinfo);
+    jpeg_set_quality(&m_cinfo, quality, TRUE);
+
+    jpeg_start_compress(&m_cinfo, TRUE);
 }
 
 
 JpegImageOutput::~JpegImageOutput()
 {
-               jpeg_finish_compress(&m_cinfo);
-               jpeg_destroy_compress(&m_cinfo);
+    jpeg_finish_compress(&m_cinfo);
+    jpeg_destroy_compress(&m_cinfo);
 }
 
 

=== modified file 'libbase/GnashImagePng.h'
--- a/libbase/GnashImagePng.h   2010-01-11 06:41:38 +0000
+++ b/libbase/GnashImagePng.h   2010-01-18 07:40:53 +0000
@@ -44,64 +44,65 @@
 class PngImageInput : public ImageInput
 {
 
-private:
-       // State needed for input.
-    png_structp _pngPtr;
-    png_infop _infoPtr;
-    boost::scoped_array<png_bytep> _rowPtrs;
-    boost::scoped_array<png_byte> _pixelData;
-   
-    // A counter for keeping track of the last row copied.
-    size_t _currentRow;
-
-    void init();
-
-       // Return number of components (i.e. == 3 for RGB
-       // data).
-    size_t getComponents() const;
-
 public:
 
-       /// Construct a PngImageInput object to read from an IOChannel.
-       //
-       /// @param in   The stream to read PNG data from. Ownership is shared
+    /// Construct a PngImageInput object to read from an IOChannel.
+    //
+    /// @param in   The stream to read PNG data from. Ownership is shared
     ///             between caller and JpegImageInput, so it is freed
     ///             automatically when the last owner is destroyed.
-       PngImageInput(boost::shared_ptr<IOChannel> in);
-       
-       ~PngImageInput();
-       
+    PngImageInput(boost::shared_ptr<IOChannel> in);
+    
+    ~PngImageInput();
+    
     /// Begin processing the image data.
     void read();
 
-       /// Get the image's height in pixels.
+    /// Get the image's height in pixels.
     //
     /// @return     The height of the image in pixels.
-       size_t getHeight() const;
+    size_t getHeight() const;
 
-       /// Get the image's width in pixels.
+    /// Get the image's width in pixels.
     //
     /// @return     The width of the image in pixels.
-       size_t getWidth() const;
+    size_t getWidth() const;
 
-       /// Read a scanline's worth of image data into the given buffer.
+    /// Read a scanline's worth of image data into the given buffer.
     //
     /// The amount of data read is getWidth() * getComponents().
-       ///
+    ///
     /// @param rgbData  The buffer for writing raw RGB data to.
-       void readScanline(unsigned char* imageData);
-
+    void readScanline(unsigned char* imageData);
 
     /// Create a PngImageInput and transfer ownership to the caller.
     //
     /// @param in   The IOChannel to read PNG data from.
-    DSOEXPORT static std::auto_ptr<ImageInput> 
create(boost::shared_ptr<IOChannel> in)
+    DSOEXPORT static std::auto_ptr<ImageInput> create(
+            boost::shared_ptr<IOChannel> in)
     {
         std::auto_ptr<ImageInput> ret ( new PngImageInput(in) );
         if (ret.get()) ret->read();
         return ret;
     }
 
+private:
+
+    // State needed for input.
+    png_structp _pngPtr;
+    png_infop _infoPtr;
+    boost::scoped_array<png_bytep> _rowPtrs;
+    boost::scoped_array<png_byte> _pixelData;
+   
+    // A counter for keeping track of the last row copied.
+    size_t _currentRow;
+
+    void init();
+
+    // Return number of components (i.e. == 3 for RGB
+    // data).
+    size_t getComponents() const;
+
 };
 
 // Class object for writing PNG image data.
@@ -112,20 +113,21 @@
 
     /// Create an output object bound to a gnash::IOChannel
     //
-    /// @param out     The IOChannel used for output. Must be kept alive 
throughout
-    ///
+    /// @param out      The IOChannel used for output. Must be kept alive
+    ///                 throughout
     /// @param quality Unused in PNG output
-    PngImageOutput(boost::shared_ptr<IOChannel> out, size_t width, size_t 
height, int quality);
-       
+    PngImageOutput(boost::shared_ptr<IOChannel> out, size_t width,
+            size_t height, int quality);
+    
     ~PngImageOutput();
 
     void writeImageRGB(const unsigned char* rgbData);
-       
+    
     void writeImageRGBA(const unsigned char* rgbaData);
 
     static std::auto_ptr<ImageOutput> create(boost::shared_ptr<IOChannel> out,
             size_t width, size_t height, int quality);
-       
+    
 private:
 
     /// Initialize libpng.
@@ -134,7 +136,7 @@
     /// Libpng structures for image and output state.
     png_structp _pngPtr;
     png_infop _infoPtr;
-       
+    
 };
 
 } // namespace gnash

=== modified file 'libbase/IOChannel.cpp'
--- a/libbase/IOChannel.cpp     2010-01-11 06:41:38 +0000
+++ b/libbase/IOChannel.cpp     2010-01-18 07:33:35 +0000
@@ -29,29 +29,29 @@
 boost::uint32_t
 IOChannel::read_le32() 
 {
-       // read_byte() is boost::uint8_t, so no masks with 0xff are required.
-       boost::uint32_t result = static_cast<boost::uint32_t>(read_byte());
-       result |= static_cast<boost::uint32_t>(read_byte()) << 8;
-       result |= static_cast<boost::uint32_t>(read_byte()) << 16;
-       result |= static_cast<boost::uint32_t>(read_byte()) << 24;
-       return(result);
+    // read_byte() is boost::uint8_t, so no masks with 0xff are required.
+    boost::uint32_t result = static_cast<boost::uint32_t>(read_byte());
+    result |= static_cast<boost::uint32_t>(read_byte()) << 8;
+    result |= static_cast<boost::uint32_t>(read_byte()) << 16;
+    result |= static_cast<boost::uint32_t>(read_byte()) << 24;
+    return(result);
 }
 
 long double
 IOChannel::read_le_double64() 
 {
-       return static_cast<long double> (
-               static_cast<boost::int64_t> (read_le32()) |
-               static_cast<boost::int64_t> (read_le32()) << 32
-       );
+    return static_cast<long double> (
+        static_cast<boost::int64_t> (read_le32()) |
+        static_cast<boost::int64_t> (read_le32()) << 32
+    );
 }
 
 boost::uint16_t
 IOChannel::read_le16()
 {
-       boost::uint16_t result = static_cast<boost::uint16_t>(read_byte());
-       result |= static_cast<boost::uint16_t>(read_byte()) << 8;
-       return(result);
+    boost::uint16_t result = static_cast<boost::uint16_t>(read_byte());
+    result |= static_cast<boost::uint16_t>(read_byte()) << 8;
+    return(result);
 }
 
 void
@@ -66,43 +66,43 @@
 void
 IOChannel::write_le16(boost::uint16_t u)
 {
-       write_byte(static_cast<boost::int8_t>(u));
-       write_byte(static_cast<boost::int8_t>(u>>8));
+    write_byte(static_cast<boost::int8_t>(u));
+    write_byte(static_cast<boost::int8_t>(u>>8));
 }
 
 void
 IOChannel::write_string(const char* src)
 {
-       for (;;)
-       {
-               write_byte(*src);
-               if (*src == 0) break;
-               src++;
-       }
+    for (;;)
+    {
+        write_byte(*src);
+        if (*src == 0) break;
+        src++;
+        }
 }
 
 int
 IOChannel::read_string(char* dst, int max_length) 
 {
-       int i = 0;
-       while (i<max_length)
-       {
-               dst[i] = read_byte();
-               if (dst[i]=='\0') return i;
-               i++;
-       }
-    
-       dst[max_length - 1] = '\0';     // force termination.
-    
-       return -1;
+    int i = 0;
+    while (i<max_length)
+    {
+        dst[i] = read_byte();
+        if (dst[i]=='\0') return i;
+        i++;
+    }
+    
+    dst[max_length - 1] = '\0';    // force termination.
+    
+    return -1;
 }
 
 void
 IOChannel::write_float32(float value)
 {
     union alias {
-        float  f;
-        boost::uint32_t        i;
+        float    f;
+        boost::uint32_t    i;
     } u;
 
     BOOST_STATIC_ASSERT(sizeof(alias) == sizeof(boost::uint32_t));
@@ -115,8 +115,8 @@
 IOChannel::read_float32()
 {
     union {
-        float  f;
-        boost::uint32_t        i;
+        float    f;
+        boost::uint32_t    i;
     } u;
 
     BOOST_STATIC_ASSERT(sizeof(u) == sizeof(u.i));
@@ -128,24 +128,24 @@
 boost::uint8_t
 IOChannel::read_byte()
 {
-       boost::uint8_t u;
-       if ( read(&u, 1) == -1 )
-       {
-               throw IOException("Could not read a single byte from input");
-       }
-       return u;
+    boost::uint8_t u;
+    if ( read(&u, 1) == -1 )
+    {
+        throw IOException("Could not read a single byte from input");
+    }
+    return u;
 }
 
 void
 IOChannel::write_byte(boost::uint8_t u)
 {
-       write(&u, 1); // will trhow on error it seems
+    write(&u, 1); // will trhow on error it seems
 }
 
 std::streamsize
 IOChannel::write(const void* /*src*/, std::streamsize /*num*/)
 {
-       throw IOException("This IOChannel implementation doesn't support 
output");
+    throw IOException("This IOChannel implementation doesn't support output");
 }
 
 } // namespace gnash

=== modified file 'libbase/IOChannel.h'
--- a/libbase/IOChannel.h       2010-01-11 06:41:38 +0000
+++ b/libbase/IOChannel.h       2010-01-18 07:35:15 +0000
@@ -32,8 +32,8 @@
 /// Exception signalling an IO error
 class DSOEXPORT IOException : public GnashException {
 public:
-       IOException(const std::string& s) : GnashException(s) {}
-       IOException() : GnashException("IO error") {}
+    IOException(const std::string& s) : GnashException(s) {}
+    IOException() : GnashException("IO error") {}
 };
 
 /// A virtual IO channel
@@ -41,167 +41,167 @@
 {
 public:
 
-       virtual ~IOChannel() {}
-
-       /// \brief Read a 32-bit word from a little-endian stream.
-       ///     returning it as a native-endian word.
-       //
-       /// Throw IOException on error
-       ///
-       boost::uint32_t read_le32();
-
-       /// \brief Read a 64-bit word from a little-ending stream,
-       /// returning it as a native-endian word.
-       //
-       /// Throw IOException on premature EOF
-       ///
-       /// TODO: define a platform-neutral type for 64 bits.
-       ///
-       long double read_le_double64();
-
-       /// Read a 16-bit word from a little-endian stream.
-       //
-       /// Throw IOException on error
-       ///
-       boost::uint16_t read_le16();
-
-       /// Write a 32-bit word to a little-endian stream.
-       //
-       /// Throw IOException on error
-       ///
-       void write_le32(boost::uint32_t u);
-
-       /// \brief Write a 16-bit word to a little-endian stream.
-       //
-       /// Throw IOException on error
-       ///
-       void write_le16(boost::uint16_t u);
-
-       /// Read a single byte from the stream
-       //
-       /// Throw IOException on error
-       ///
-       boost::uint8_t read_byte();
-
-       /// write a single byte to the stream
-       //
-       /// Throw IOException on error
-       ///
-       void write_byte(boost::uint8_t u);
-
-       /// Read the given number of bytes from the stream
-       //
-       /// Return the number of bytes actually read. 
-       /// EOF might cause it to be < num.
-       ///
-       /// Throw IOException on error
-       ///
-       virtual std::streamsize read(void* dst, std::streamsize num)=0;
-
-       /// Read at most the given number of bytes w/out blocking
-       //
-       /// Throw IOException on error
-       ///
-       /// @return The number of bytes actually read.
-       ///         A short count may mean EOF was hit or 
-       ///         data didn't arrive yet.
-       ///
-       /// Default implementation proxies the call to the
-       /// blocking version.
-       ///
-       virtual std::streamsize readNonBlocking(void* dst, std::streamsize num)
-       {
-               return read(dst, num);
-       }
-
-       /// Write the given number of bytes to the stream
-       //
-       /// Throw IOException on error/unsupported op.
-       ///
-       virtual std::streamsize write(const void* src, std::streamsize num);
-
-       /// \brief Write a 0-terminated string to a stream.
-       //
-       /// Throw IOException on error
-       ///
-       void write_string(const char* src);
-
-       /// \brief
-       /// Read up to max_length characters, returns the number of characters 
-       /// read, or -1 if the string length is longer than max_length.
-       //
-       /// Stops at the first \0 character if it comes before max_length.
-       ///
-       /// Guarantees termination of the string.
-       ///
-       /// @return the number of characters read, or -1 no null-termination
-       ///         was found within max_length
-       ///
-       /// Throw IOException on error
-       ///
-       int     read_string(char* dst, int max_length);
-
-       /// Write a 32-bit float to a stream in little-endian order.
-       //
-       /// NOTE: this currently relies on host FP format being the same
-       ///       as the Flash one (presumably IEEE 754).
-       ///
-       /// Throw IOException on error
-       ///
-       void write_float32(float value);
-
-       /// Read a 32-bit float from a little-endian stream.
-       //
-       /// NOTE: this currently relies on host FP format being the
-       ///       same as the Flash one (presumably IEEE 754).
-       ///
-       /// Throw IOException on error
-       ///
-       float read_float32();
-
-       /// Return current stream position
-       //
-       /// Throw IOException on error
-       ///
-       virtual std::streampos tell() const = 0;
-
-       /// Seek to the specified position
-       //
-       /// 
-       /// Throw IOException on error
-       ///
-       /// @return true on success, or false on failure.
-       ///
-       virtual bool seek(std::streampos p) = 0;
-
-       /// Seek to the end of the stream
-       //
-       /// Throw IOException on error
-       ///
-       virtual void go_to_end() = 0;
-
-       /// Return true if the end of the stream has been reached.
-       //
-       /// Throw IOException on error
-       ///
-       virtual bool eof() const = 0;
-    
-       /// Return true if the stream is in an error state
-       //
-       /// When the stream is in an error state there's nothing
-       /// you can do about it, just delete it and log the error.
-       virtual bool bad() const = 0;
-    
-       /// Get the size of the stream (unreliably).
-       //
-       /// Size of stream is unreliable as not all input
-       /// channels have a mechanism to advertise size,
-       /// and some have one but isn't necessarely truthful
-       /// (a few HTTP severs are bogus in this reguard).
-       ///
-       /// @return unreliable input size, (size_t)-1 if not known. 
-       ///
-       virtual size_t size() const { return static_cast<size_t>(-1); }
+    virtual ~IOChannel() {}
+
+    /// \brief Read a 32-bit word from a little-endian stream.
+    ///    returning it as a native-endian word.
+    //
+    /// Throw IOException on error
+    ///
+    boost::uint32_t read_le32();
+
+    /// \brief Read a 64-bit word from a little-ending stream,
+    /// returning it as a native-endian word.
+    //
+    /// Throw IOException on premature EOF
+    ///
+    /// TODO: define a platform-neutral type for 64 bits.
+    ///
+    long double read_le_double64();
+
+    /// Read a 16-bit word from a little-endian stream.
+    //
+    /// Throw IOException on error
+    ///
+    boost::uint16_t read_le16();
+
+    /// Write a 32-bit word to a little-endian stream.
+    //
+    /// Throw IOException on error
+    ///
+    void write_le32(boost::uint32_t u);
+
+    /// \brief Write a 16-bit word to a little-endian stream.
+    //
+    /// Throw IOException on error
+    ///
+    void write_le16(boost::uint16_t u);
+
+    /// Read a single byte from the stream
+    //
+    /// Throw IOException on error
+    ///
+    boost::uint8_t read_byte();
+
+    /// write a single byte to the stream
+    //
+    /// Throw IOException on error
+    ///
+    void write_byte(boost::uint8_t u);
+
+    /// Read the given number of bytes from the stream
+    //
+    /// Return the number of bytes actually read. 
+    /// EOF might cause it to be < num.
+    ///
+    /// Throw IOException on error
+    ///
+    virtual std::streamsize read(void* dst, std::streamsize num)=0;
+
+    /// Read at most the given number of bytes w/out blocking
+    //
+    /// Throw IOException on error
+    ///
+    /// @return The number of bytes actually read.
+    ///         A short count may mean EOF was hit or 
+    ///         data didn't arrive yet.
+    ///
+    /// Default implementation proxies the call to the
+    /// blocking version.
+    ///
+    virtual std::streamsize readNonBlocking(void* dst, std::streamsize num)
+    {
+        return read(dst, num);
+    }
+
+    /// Write the given number of bytes to the stream
+    //
+    /// Throw IOException on error/unsupported op.
+    ///
+    virtual std::streamsize write(const void* src, std::streamsize num);
+
+    /// \brief Write a 0-terminated string to a stream.
+    //
+    /// Throw IOException on error
+    ///
+    void write_string(const char* src);
+
+    /// \brief
+    /// Read up to max_length characters, returns the number of characters 
+    /// read, or -1 if the string length is longer than max_length.
+    //
+    /// Stops at the first \0 character if it comes before max_length.
+    ///
+    /// Guarantees termination of the string.
+    ///
+    /// @return the number of characters read, or -1 no null-termination
+    ///         was found within max_length
+    ///
+    /// Throw IOException on error
+    ///
+    int    read_string(char* dst, int max_length);
+
+    /// Write a 32-bit float to a stream in little-endian order.
+    //
+    /// NOTE: this currently relies on host FP format being the same
+        ///       as the Flash one (presumably IEEE 754).
+    ///
+    /// Throw IOException on error
+    ///
+    void write_float32(float value);
+
+    /// Read a 32-bit float from a little-endian stream.
+    //
+    /// NOTE: this currently relies on host FP format being the
+        ///       same as the Flash one (presumably IEEE 754).
+    ///
+    /// Throw IOException on error
+    ///
+    float read_float32();
+
+    /// Return current stream position
+    //
+    /// Throw IOException on error
+    ///
+    virtual std::streampos tell() const = 0;
+
+    /// Seek to the specified position
+    //
+    /// 
+    /// Throw IOException on error
+    ///
+    /// @return true on success, or false on failure.
+    ///
+    virtual bool seek(std::streampos p) = 0;
+
+    /// Seek to the end of the stream
+    //
+    /// Throw IOException on error
+    ///
+    virtual void go_to_end() = 0;
+
+    /// Return true if the end of the stream has been reached.
+    //
+    /// Throw IOException on error
+    ///
+    virtual bool eof() const = 0;
+    
+    /// Return true if the stream is in an error state
+    //
+    /// When the stream is in an error state there's nothing
+    /// you can do about it, just delete it and log the error.
+    virtual bool bad() const = 0;
+    
+    /// Get the size of the stream (unreliably).
+    //
+    /// Size of stream is unreliable as not all input
+    /// channels have a mechanism to advertise size,
+    /// and some have one but isn't necessarely truthful
+    /// (a few HTTP severs are bogus in this reguard).
+    ///
+    /// @return unreliable input size, (size_t)-1 if not known. 
+    ///
+    virtual size_t size() const { return static_cast<size_t>(-1); }
    
 };
 

=== modified file 'libbase/WallClockTimer.cpp'
--- a/libbase/WallClockTimer.cpp        2010-01-11 06:41:38 +0000
+++ b/libbase/WallClockTimer.cpp        2010-01-18 07:33:35 +0000
@@ -29,26 +29,26 @@
 namespace gnash {
 
 WallClockTimer::WallClockTimer()
-       :
-       startTimer(clocktime::getTicks())
+    :
+    startTimer(clocktime::getTicks())
 {
 }
 
 void
 WallClockTimer::restart()
 {
-       startTimer = clocktime::getTicks();
+    startTimer = clocktime::getTicks();
 }
 
 boost::uint32_t
 WallClockTimer::elapsed() const
 {
-       boost::uint64_t currTime = clocktime::getTicks();
-       
-       // be aware of time glitches
-       if ( currTime <= startTimer ) return 0;
+    boost::uint64_t currTime = clocktime::getTicks();
+    
+    // be aware of time glitches
+    if ( currTime <= startTimer ) return 0;
 
-       return currTime - startTimer;
+    return currTime - startTimer;
 
 }
 

=== modified file 'libbase/curl_adapter.cpp'
--- a/libbase/curl_adapter.cpp  2010-01-11 06:41:38 +0000
+++ b/libbase/curl_adapter.cpp  2010-01-18 07:30:59 +0000
@@ -45,9 +45,9 @@
 NetworkAdapter::makeStream(const std::string& /*url*/, 
         const std::string& /*cachefile*/)
 {
-       log_error(_("libcurl is not available, but "
-                   "Gnash has attempted to use the curl adapter"));
-       return std::auto_ptr<IOChannel>();
+    log_error(_("libcurl is not available, but "
+                "Gnash has attempted to use the curl adapter"));
+    return std::auto_ptr<IOChannel>();
 }
 
 std::auto_ptr<IOChannel>
@@ -107,121 +107,121 @@
 
 public:
 
-       /// Get CurlSession singleton
-       static CurlSession& get();
+    /// Get CurlSession singleton
+    static CurlSession& get();
 
-       /// Get the shared handle
-       CURLSH* getSharedHandle() { return _shandle; }
+    /// Get the shared handle
+    CURLSH* getSharedHandle() { return _shandle; }
 
 private:
 
-       /// Initialize a libcurl session
-       //
-       /// A libcurl session consists in a shared handle
-       /// sharing DNS cache and COOKIES.
-       ///
-       /// Also, global libcurl initialization function will
-       /// be invoked, so MAKE SURE NOT TO CONSTRUCT multiple
-       /// CurlSession instances in a multithreaded environment!
-       ///
-       /// AGAIN: this is NOT thread-safe !
-       ///
-       CurlSession();
-
-       /// Cleanup curl session stuff (including global lib init)
-       ~CurlSession();
-
-
-       // the libcurl share handle, for sharing cookies
-       CURLSH* _shandle;
-
-       // mutex protecting share state
-       boost::mutex _shareMutex;
-       boost::mutex::scoped_lock _shareMutexLock;
-
-       // mutex protecting shared cookies
-       boost::mutex _cookieMutex;
-       boost::mutex::scoped_lock _cookieMutexLock;
-
-       // mutex protecting shared dns cache
-       boost::mutex _dnscacheMutex;
-       boost::mutex::scoped_lock _dnscacheMutexLock;
-
-       /// Import cookies, if requested
-       //
-       /// This method will lookup GNASH_COOKIES_IN
-       /// in the environment, and if existing, will
-       /// parse the file sending each line to a fake
-       /// easy handle created ad-hoc
-       ///
-       void importCookies();
-
-       /// Export cookies, if requested
-       //
-       /// This method will lookup GNASH_COOKIES_OUT
-       /// in the environment, and if existing, will
-       /// create the file writing any cookie currently
-       /// in the jar
-       ///
-       void exportCookies();
-
-       /// Shared handle data locking function
-       void lockSharedHandle(CURL* handle, curl_lock_data data,
+    /// Initialize a libcurl session
+    //
+    /// A libcurl session consists in a shared handle
+    /// sharing DNS cache and COOKIES.
+    ///
+    /// Also, global libcurl initialization function will
+    /// be invoked, so MAKE SURE NOT TO CONSTRUCT multiple
+    /// CurlSession instances in a multithreaded environment!
+    ///
+    /// AGAIN: this is NOT thread-safe !
+    ///
+    CurlSession();
+
+    /// Cleanup curl session stuff (including global lib init)
+    ~CurlSession();
+
+
+    // the libcurl share handle, for sharing cookies
+    CURLSH* _shandle;
+
+    // mutex protecting share state
+    boost::mutex _shareMutex;
+    boost::mutex::scoped_lock _shareMutexLock;
+
+    // mutex protecting shared cookies
+    boost::mutex _cookieMutex;
+    boost::mutex::scoped_lock _cookieMutexLock;
+
+    // mutex protecting shared dns cache
+    boost::mutex _dnscacheMutex;
+    boost::mutex::scoped_lock _dnscacheMutexLock;
+
+    /// Import cookies, if requested
+    //
+    /// This method will lookup GNASH_COOKIES_IN
+    /// in the environment, and if existing, will
+    /// parse the file sending each line to a fake
+    /// easy handle created ad-hoc
+    ///
+    void importCookies();
+
+    /// Export cookies, if requested
+    //
+    /// This method will lookup GNASH_COOKIES_OUT
+    /// in the environment, and if existing, will
+    /// create the file writing any cookie currently
+    /// in the jar
+    ///
+    void exportCookies();
+
+    /// Shared handle data locking function
+    void lockSharedHandle(CURL* handle, curl_lock_data data,
             curl_lock_access access);
 
-       /// Shared handle data unlocking function
-       void unlockSharedHandle(CURL* handle, curl_lock_data data);
+    /// Shared handle data unlocking function
+    void unlockSharedHandle(CURL* handle, curl_lock_data data);
 
-       /// Shared handle locking function
-       static void lockSharedHandleWrapper(CURL* handle, curl_lock_data data,
+    /// Shared handle locking function
+    static void lockSharedHandleWrapper(CURL* handle, curl_lock_data data,
             curl_lock_access access, void* userptr)
-       {
-               CurlSession* ci = static_cast<CurlSession*>(userptr);
-               ci->lockSharedHandle(handle, data, access);
-       }
+    {
+        CurlSession* ci = static_cast<CurlSession*>(userptr);
+        ci->lockSharedHandle(handle, data, access);
+    }
 
-       /// Shared handle unlocking function
-       static void unlockSharedHandleWrapper(CURL* handle, curl_lock_data data,
+    /// Shared handle unlocking function
+    static void unlockSharedHandleWrapper(CURL* handle, curl_lock_data data,
             void* userptr)
-       {
-               // data defines what data libcurl wants to unlock, and you must
+    {
+        // data defines what data libcurl wants to unlock, and you must
         // make sure that only one lock is given at any time for each kind
         // of data.
-               // userptr is the pointer you set with CURLSHOPT_USERDATA. 
-               CurlSession* ci = static_cast<CurlSession*>(userptr);
-               ci->unlockSharedHandle(handle, data);
-       }
+        // userptr is the pointer you set with CURLSHOPT_USERDATA. 
+        CurlSession* ci = static_cast<CurlSession*>(userptr);
+        ci->unlockSharedHandle(handle, data);
+    }
 
 };
 
 CurlSession&
 CurlSession::get()
 {
-       static CurlSession cs;
-       return cs;
+    static CurlSession cs;
+    return cs;
 }
 
 CurlSession::~CurlSession()
 {
-       log_debug("~CurlSession");
-       exportCookies();
+    log_debug("~CurlSession");
+    exportCookies();
 
-       CURLSHcode code;
-       int retries=0;
-       while ( (code=curl_share_cleanup(_shandle)) != CURLSHE_OK )
-       {
-               if ( ++retries > 10 )
-               {
-                       log_error("Failed cleaning up share handle: %s. Giving 
up after "
+    CURLSHcode code;
+    int retries=0;
+    while ( (code=curl_share_cleanup(_shandle)) != CURLSHE_OK )
+    {
+        if ( ++retries > 10 )
+        {
+            log_error("Failed cleaning up share handle: %s. Giving up after "
                     "%d retries.", curl_share_strerror(code), retries);
-                       break;
-               }
-               log_error("Failed cleaning up share handle: %s. Will try again 
in "
+            break;
+        }
+        log_error("Failed cleaning up share handle: %s. Will try again in "
                 "a second.", curl_share_strerror(code));
-               gnashSleep(1000000);
-       }
-       _shandle = 0;
-       curl_global_cleanup();
+        gnashSleep(1000000);
+    }
+    _shandle = 0;
+    curl_global_cleanup();
 }
 
 #if BOOST_VERSION < 103500
@@ -231,142 +231,142 @@
 #endif
 
 CurlSession::CurlSession()
-       :
-       _shandle(0),
-       _shareMutex(),
-       _shareMutexLock(_shareMutex, GNASH_DEFER_LOCK), // start unlocked
-       _cookieMutex(),
-       _cookieMutexLock(_cookieMutex, GNASH_DEFER_LOCK), // start unlocked
-       _dnscacheMutex(),
-       _dnscacheMutexLock(_dnscacheMutex, GNASH_DEFER_LOCK) // start unlocked
+    :
+    _shandle(0),
+    _shareMutex(),
+    _shareMutexLock(_shareMutex, GNASH_DEFER_LOCK), // start unlocked
+    _cookieMutex(),
+    _cookieMutexLock(_cookieMutex, GNASH_DEFER_LOCK), // start unlocked
+    _dnscacheMutex(),
+    _dnscacheMutexLock(_dnscacheMutex, GNASH_DEFER_LOCK) // start unlocked
 {
-       // TODO: handle an error here (throw an exception)
-       curl_global_init(CURL_GLOBAL_ALL);
+    // TODO: handle an error here (throw an exception)
+    curl_global_init(CURL_GLOBAL_ALL);
 
-       _shandle = curl_share_init();
-       if (! _shandle) {
-               throw GnashException("Failure initializing curl share handle");
+    _shandle = curl_share_init();
+    if (! _shandle) {
+        throw GnashException("Failure initializing curl share handle");
     }
 
-       CURLSHcode ccode;
+    CURLSHcode ccode;
 
-       // Register share locking function
-       ccode = curl_share_setopt(_shandle, CURLSHOPT_LOCKFUNC,
+    // Register share locking function
+    ccode = curl_share_setopt(_shandle, CURLSHOPT_LOCKFUNC,
             lockSharedHandleWrapper);
-       if ( ccode != CURLSHE_OK ) {
-               throw GnashException(curl_share_strerror(ccode));
-       }
+    if ( ccode != CURLSHE_OK ) {
+        throw GnashException(curl_share_strerror(ccode));
+    }
 
-       // Register share unlocking function
-       ccode = curl_share_setopt(_shandle, CURLSHOPT_UNLOCKFUNC,
+    // Register share unlocking function
+    ccode = curl_share_setopt(_shandle, CURLSHOPT_UNLOCKFUNC,
             unlockSharedHandleWrapper);
-       if ( ccode != CURLSHE_OK ) {
-               throw GnashException(curl_share_strerror(ccode));
-       }
-
-       // Activate sharing of cookies and DNS cache
-       ccode = curl_share_setopt(_shandle, CURLSHOPT_SHARE, 
CURL_LOCK_DATA_COOKIE);
-       if ( ccode != CURLSHE_OK ) {
-               throw GnashException(curl_share_strerror(ccode));
-       }
-
-       // Activate sharing of DNS cache (since we're there..)
-       ccode = curl_share_setopt(_shandle, CURLSHOPT_SHARE, 
CURL_LOCK_DATA_DNS);
-       if ( ccode != CURLSHE_OK ) {
-               throw GnashException(curl_share_strerror(ccode));
-       }
-
-       // Pass ourselves as the userdata
-       ccode = curl_share_setopt(_shandle, CURLSHOPT_USERDATA, this);
-       if ( ccode != CURLSHE_OK ) {
-               throw GnashException(curl_share_strerror(ccode));
-       }
-
-       importCookies();
+    if ( ccode != CURLSHE_OK ) {
+        throw GnashException(curl_share_strerror(ccode));
+    }
+
+    // Activate sharing of cookies and DNS cache
+    ccode = curl_share_setopt(_shandle, CURLSHOPT_SHARE, 
CURL_LOCK_DATA_COOKIE);
+    if ( ccode != CURLSHE_OK ) {
+        throw GnashException(curl_share_strerror(ccode));
+    }
+
+    // Activate sharing of DNS cache (since we're there..)
+    ccode = curl_share_setopt(_shandle, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
+    if ( ccode != CURLSHE_OK ) {
+        throw GnashException(curl_share_strerror(ccode));
+    }
+
+    // Pass ourselves as the userdata
+    ccode = curl_share_setopt(_shandle, CURLSHOPT_USERDATA, this);
+    if ( ccode != CURLSHE_OK ) {
+        throw GnashException(curl_share_strerror(ccode));
+    }
+
+    importCookies();
 }
 
 void
 CurlSession::lockSharedHandle(CURL* handle, curl_lock_data data,
         curl_lock_access access)
 {
-       UNUSED(handle); // possibly being the 'easy' handle triggering the 
request ?
+    UNUSED(handle); // possibly being the 'easy' handle triggering the request 
?
 
-       // data defines what data libcurl wants to lock, and you must make
+    // data defines what data libcurl wants to lock, and you must make
     // sure that only one lock is given at any time for each kind of data.
-       // access defines what access type libcurl wants, shared or single.
-
-       // TODO: see if we may make use of the 'access' parameter
-       UNUSED(access);
-
-       switch (data)
-       {
-               case CURL_LOCK_DATA_DNS:
-                       //log_debug("Locking DNS cache mutex");
-                       _dnscacheMutexLock.lock();
-                       //log_debug("DNS cache mutex locked");
-                       break;
-               case CURL_LOCK_DATA_COOKIE:
-                       //log_debug("Locking cookies mutex");
-                       _cookieMutexLock.lock(); 
-                       //log_debug("Cookies mutex locked");
-                       break;
-               case CURL_LOCK_DATA_SHARE:
-                       //log_debug("Locking share mutex");
-                       _shareMutexLock.lock(); 
-                       //log_debug("Share mutex locked");
-                       break;
-               case CURL_LOCK_DATA_SSL_SESSION:
-                       log_error("lockSharedHandle: SSL session locking "
+    // access defines what access type libcurl wants, shared or single.
+
+    // TODO: see if we may make use of the 'access' parameter
+    UNUSED(access);
+
+    switch (data)
+    {
+        case CURL_LOCK_DATA_DNS:
+            //log_debug("Locking DNS cache mutex");
+            _dnscacheMutexLock.lock();
+            //log_debug("DNS cache mutex locked");
+            break;
+        case CURL_LOCK_DATA_COOKIE:
+            //log_debug("Locking cookies mutex");
+            _cookieMutexLock.lock(); 
+            //log_debug("Cookies mutex locked");
+            break;
+        case CURL_LOCK_DATA_SHARE:
+            //log_debug("Locking share mutex");
+            _shareMutexLock.lock(); 
+            //log_debug("Share mutex locked");
+            break;
+        case CURL_LOCK_DATA_SSL_SESSION:
+            log_error("lockSharedHandle: SSL session locking "
                     "unsupported");
-                       break;
-               case CURL_LOCK_DATA_CONNECT:
-                       log_error("lockSharedHandle: connect locking 
unsupported");
-                       break;
-               case CURL_LOCK_DATA_LAST:
-                       log_error("lockSharedHandle: last locking unsupported 
?!");
-                       break;
-               default:
-                       log_error("lockSharedHandle: unknown shared data %d", 
data);
-                       break;
-       }
+            break;
+        case CURL_LOCK_DATA_CONNECT:
+            log_error("lockSharedHandle: connect locking unsupported");
+            break;
+        case CURL_LOCK_DATA_LAST:
+            log_error("lockSharedHandle: last locking unsupported ?!");
+            break;
+        default:
+            log_error("lockSharedHandle: unknown shared data %d", data);
+            break;
+    }
 }
 
 void
 CurlSession::unlockSharedHandle(CURL* handle, curl_lock_data data)
 {
-       UNUSED(handle); // possibly being the 'easy' handle triggering the 
request ?
+    UNUSED(handle); // possibly being the 'easy' handle triggering the request 
?
 
-       // data defines what data libcurl wants to lock, and you must make
+    // data defines what data libcurl wants to lock, and you must make
     // sure that only one lock is given at any time for each kind of data.
-       switch (data)
-       {
-               case CURL_LOCK_DATA_DNS:
-                       //log_debug("Unlocking DNS cache mutex");
-                       _dnscacheMutexLock.unlock();
-                       break;
-               case CURL_LOCK_DATA_COOKIE:
-                       //log_debug("Unlocking cookies mutex");
-                       _cookieMutexLock.unlock();
-                       break;
-               case CURL_LOCK_DATA_SHARE:
-                       //log_debug("Unlocking share mutex");
-                       _shareMutexLock.unlock();
-                       break;
-               case CURL_LOCK_DATA_SSL_SESSION:
-                       log_error("unlockSharedHandle: SSL session locking "
+    switch (data)
+    {
+        case CURL_LOCK_DATA_DNS:
+            //log_debug("Unlocking DNS cache mutex");
+            _dnscacheMutexLock.unlock();
+            break;
+        case CURL_LOCK_DATA_COOKIE:
+            //log_debug("Unlocking cookies mutex");
+            _cookieMutexLock.unlock();
+            break;
+        case CURL_LOCK_DATA_SHARE:
+            //log_debug("Unlocking share mutex");
+            _shareMutexLock.unlock();
+            break;
+        case CURL_LOCK_DATA_SSL_SESSION:
+            log_error("unlockSharedHandle: SSL session locking "
                     "unsupported");
-                       break;
-               case CURL_LOCK_DATA_CONNECT:
-                       log_error("unlockSharedHandle: connect locking 
unsupported");
-                       break;
-               case CURL_LOCK_DATA_LAST:
-                       log_error("unlockSharedHandle: last locking unsupported 
?!");
-                       break;
-               default:
-                       std::cerr << "unlockSharedHandle: unknown shared data " 
<<
+            break;
+        case CURL_LOCK_DATA_CONNECT:
+            log_error("unlockSharedHandle: connect locking unsupported");
+            break;
+        case CURL_LOCK_DATA_LAST:
+            log_error("unlockSharedHandle: last locking unsupported ?!");
+            break;
+        default:
+            std::cerr << "unlockSharedHandle: unknown shared data " <<
                 data << std::endl;
-                       break;
-       }
+            break;
+    }
 }
 
 
@@ -382,122 +382,122 @@
 
 public:
 
-       typedef std::map<std::string, std::string> PostData;
-
-       /// Open a stream from the specified URL
-       CurlStreamFile(const std::string& url, const std::string& cachefile);
-
-       /// Open a stream from the specified URL posting the specified variables
-       //
-       /// @param url
-       ///     The url to post to.
-       ///
-       /// @param vars
-       ///     The url-encoded post data.
-       ///
-       CurlStreamFile(const std::string& url, const std::string& vars,
+    typedef std::map<std::string, std::string> PostData;
+
+    /// Open a stream from the specified URL
+    CurlStreamFile(const std::string& url, const std::string& cachefile);
+
+    /// Open a stream from the specified URL posting the specified variables
+    //
+    /// @param url
+    ///    The url to post to.
+    ///
+    /// @param vars
+    ///    The url-encoded post data.
+    ///
+    CurlStreamFile(const std::string& url, const std::string& vars,
             const std::string& cachefile);
-       
-       CurlStreamFile(const std::string& url, const std::string& vars,
-                      const NetworkAdapter::RequestHeaders& headers,
+    
+    CurlStreamFile(const std::string& url, const std::string& vars,
+                   const NetworkAdapter::RequestHeaders& headers,
                    const std::string& cachefile);
 
-       ~CurlStreamFile();
-
-       // See dox in IOChannel.h
-       virtual std::streamsize read(void *dst, std::streamsize bytes);
-
-       // See dox in IOChannel.h
-       virtual std::streamsize readNonBlocking(void *dst, std::streamsize 
bytes);
-
-       // See dox in IOChannel.h
-       virtual bool eof() const;
-
-       // See dox in IOChannel.h
-       virtual bool bad() const {
-               return _error;
-       }
-
-       /// Report global position within the file
-       virtual std::streampos tell() const;
-
-       /// Put read pointer at given position
-       virtual bool seek(std::streampos pos);
-
-       /// Put read pointer at eof
-       virtual void go_to_end();
-
-       /// Returns the size of the stream
-       //
-       /// If size of the stream is unknown, 0 is returned.
-       /// In that case you might try calling this function
-       /// again after filling the cache a bit...
-       ///
-       /// Another approach might be filling the cache ourselves
-       /// aiming at obtaining a useful value.
-       ///
-       virtual size_t size() const;
+    ~CurlStreamFile();
+
+    // See dox in IOChannel.h
+    virtual std::streamsize read(void *dst, std::streamsize bytes);
+
+    // See dox in IOChannel.h
+    virtual std::streamsize readNonBlocking(void *dst, std::streamsize bytes);
+
+    // See dox in IOChannel.h
+    virtual bool eof() const;
+
+    // See dox in IOChannel.h
+    virtual bool bad() const {
+        return _error;
+    }
+
+    /// Report global position within the file
+    virtual std::streampos tell() const;
+
+    /// Put read pointer at given position
+    virtual bool seek(std::streampos pos);
+
+    /// Put read pointer at eof
+    virtual void go_to_end();
+
+    /// Returns the size of the stream
+    //
+    /// If size of the stream is unknown, 0 is returned.
+    /// In that case you might try calling this function
+    /// again after filling the cache a bit...
+    ///
+    /// Another approach might be filling the cache ourselves
+    /// aiming at obtaining a useful value.
+    ///
+    virtual size_t size() const;
 
 private:
 
-       void init(const std::string& url, const std::string& cachefile);
-
-       // Use this file to cache data
-       FILE* _cache;
-
-       // _cache file descriptor
-       int _cachefd;
-
-       // we keep a copy here to be sure the char*
-       // is alive for the whole CurlStreamFile lifetime
-       // TODO: don't really do this :)
-       std::string _url;
-
-       // the libcurl easy handle
-       CURL *_handle;
-
-       // the libcurl multi handle
-       CURLM *_mhandle;
-
-       // transfer in progress
-       int _running;
-
-       // stream error
-       // false on no error.
-       // Example of errors would be:
-       //      404 - file not found
-       //      timeout occurred
-       bool _error;
-
-       // Post data. Empty if no POST has been requested
-       std::string _postdata;
-
-       // Current size of cached data
+    void init(const std::string& url, const std::string& cachefile);
+
+    // Use this file to cache data
+    FILE* _cache;
+
+    // _cache file descriptor
+    int _cachefd;
+
+    // we keep a copy here to be sure the char*
+    // is alive for the whole CurlStreamFile lifetime
+    // TODO: don't really do this :)
+    std::string _url;
+
+    // the libcurl easy handle
+    CURL *_handle;
+
+    // the libcurl multi handle
+    CURLM *_mhandle;
+
+    // transfer in progress
+    int _running;
+
+    // stream error
+    // false on no error.
+    // Example of errors would be:
+    //    404 - file not found
+    //    timeout occurred
+    bool _error;
+
+    // Post data. Empty if no POST has been requested
+    std::string _postdata;
+
+    // Current size of cached data
     size_t _cached;
 
-       /// Total stream size.
-       //
-       /// This will be 0 until known
-       ///
-       mutable size_t _size;
-
-       // Attempt at filling the cache up to the given size.
-       // Will call libcurl routines to fetch data.
-       void fillCache(std::streamsize size);
-
-       // Process pending curl messages (handles 404)
-       void processMessages();
-
-       // Filling the cache as much as possible w/out blocking.
-       // Will call libcurl routines to fetch data.
-       void fillCacheNonBlocking();
-
-       // Append sz bytes to the cache
+    /// Total stream size.
+    //
+    /// This will be 0 until known
+    ///
+    mutable size_t _size;
+
+    // Attempt at filling the cache up to the given size.
+    // Will call libcurl routines to fetch data.
+    void fillCache(std::streamsize size);
+
+    // Process pending curl messages (handles 404)
+    void processMessages();
+
+    // Filling the cache as much as possible w/out blocking.
+    // Will call libcurl routines to fetch data.
+    void fillCacheNonBlocking();
+
+    // Append sz bytes to the cache
     std::streamsize cache(void *from, std::streamsize sz);
 
-       // Callback for libcurl, will be called
-       // by fillCache() and will call cache()
-       static size_t recv(void *buf, size_t size, size_t nmemb, void *userp);
+    // Callback for libcurl, will be called
+    // by fillCache() and will call cache()
+    static size_t recv(void *buf, size_t size, size_t nmemb, void *userp);
 
     // List of custom headers for this stream.
     struct curl_slist *_customHeaders;
@@ -515,11 +515,11 @@
 CurlStreamFile::recv(void *buf, size_t size, size_t nmemb, void *userp)
 {
 #ifdef GNASH_CURL_VERBOSE
-       log_debug("curl write callback called for (%d) bytes",
-               size * nmemb);
+    log_debug("curl write callback called for (%d) bytes",
+        size * nmemb);
 #endif
-       CurlStreamFile* stream = static_cast<CurlStreamFile*>(userp);
-       return stream->cache(buf, size * nmemb);
+    CurlStreamFile* stream = static_cast<CurlStreamFile*>(userp);
+    return stream->cache(buf, size * nmemb);
 }
 
 
@@ -527,57 +527,57 @@
 std::streamsize
 CurlStreamFile::cache(void *from, std::streamsize size)
 {
-       // take note of current position
-       long curr_pos = std::ftell(_cache);
+    // take note of current position
+    long curr_pos = std::ftell(_cache);
 
-       // seek to the end
-       std::fseek(_cache, 0, SEEK_END);
+    // seek to the end
+    std::fseek(_cache, 0, SEEK_END);
 
     std::streamsize wrote = std::fwrite(from, 1, size, _cache);
-       if ( wrote < 1 )
-       {
+    if ( wrote < 1 )
+    {
 
         boost::format fmt = boost::format("writing to cache file: requested "
                                           "%d, wrote %d (%s)") %
                                           size % wrote % std::strerror(errno);
-               throw GnashException(fmt.str());
-       }
-
-       // Set the size of cached data
-       _cached = std::ftell(_cache);
-
-       // reset position for next read
-       std::fseek(_cache, curr_pos, SEEK_SET);
-
-       return wrote;
+        throw GnashException(fmt.str());
+    }
+
+    // Set the size of cached data
+    _cached = std::ftell(_cache);
+
+    // reset position for next read
+    std::fseek(_cache, curr_pos, SEEK_SET);
+
+    return wrote;
 }
 
 /*private*/
 void
 CurlStreamFile::fillCacheNonBlocking()
 {
-       if ( ! _running )
-       {
+    if ( ! _running )
+    {
 #if GNASH_CURL_VERBOSE
-               log_debug("Not running: fillCacheNonBlocking returning");
+        log_debug("Not running: fillCacheNonBlocking returning");
 #endif
-               return;
-       }
-
-       CURLMcode mcode;
-
-       do
-       {
-               mcode = curl_multi_perform(_mhandle, &_running);
-       } while (mcode == CURLM_CALL_MULTI_PERFORM); // && _running ?
-
-       if (mcode != CURLM_OK)
-       {
-               throw GnashException(curl_multi_strerror(mcode));
-       }
-
-       // handle 404
-       processMessages();
+        return;
+    }
+
+    CURLMcode mcode;
+
+    do
+    {
+        mcode = curl_multi_perform(_mhandle, &_running);
+    } while (mcode == CURLM_CALL_MULTI_PERFORM); // && _running ?
+
+    if (mcode != CURLM_OK)
+    {
+        throw GnashException(curl_multi_strerror(mcode));
+    }
+
+    // handle 404
+    processMessages();
 }
 
 
@@ -592,87 +592,87 @@
 
     assert(size >= 0);
 
-       if ( ! _running || _cached >= static_cast<size_t>(size)) {
+    if ( ! _running || _cached >= static_cast<size_t>(size)) {
 #if GNASH_CURL_VERBOSE
         if (!_running) log_debug("Not running: returning");
         else log_debug("Already enough bytes cached: returning");
 #endif
-           return;
-       }
-
-       fd_set readfd, writefd, exceptfd;
-       int maxfd;
-       CURLMcode mcode;
-       timeval tv;
-
-       // Hard-coded slect timeout.
-       // This number is kept low to give more thread switch
-       // opportunities while waiting for a load.
-       const long maxSleepUsec = 10000;  // 1/100 of a second
-
-       const unsigned int userTimeout = static_cast<unsigned int>(
-                       
RcInitFile::getDefaultInstance().getStreamsTimeout()*1000);
+        return;
+    }
+
+    fd_set readfd, writefd, exceptfd;
+    int maxfd;
+    CURLMcode mcode;
+    timeval tv;
+
+    // Hard-coded slect timeout.
+    // This number is kept low to give more thread switch
+    // opportunities while waiting for a load.
+    const long maxSleepUsec = 10000;  // 1/100 of a second
+
+    const unsigned int userTimeout = static_cast<unsigned int>(
+            RcInitFile::getDefaultInstance().getStreamsTimeout()*1000);
 
 #ifdef GNASH_CURL_VERBOSE
         log_debug("User timeout is %u milliseconds", userTimeout);
 #endif
 
-       WallClockTimer lastProgress; // timer since last progress
-       while (_running)
-       {
-
-               fillCacheNonBlocking(); // NOTE: will handle 404
-
-               // Do this here to avoid calling select()
-               // when we have enough bytes anyway, or
-               // we reached EOF
-               if (_cached >= static_cast<size_t>(size) || !_running) break; 
+    WallClockTimer lastProgress; // timer since last progress
+    while (_running)
+    {
+
+        fillCacheNonBlocking(); // NOTE: will handle 404
+
+        // Do this here to avoid calling select()
+        // when we have enough bytes anyway, or
+        // we reached EOF
+        if (_cached >= static_cast<size_t>(size) || !_running) break; 
 
 #if GNASH_CURL_VERBOSE
-               //log_debug("cached: %d, size: %d", _cached, size);
+        //log_debug("cached: %d, size: %d", _cached, size);
 #endif
 
-               mcode = curl_multi_fdset(_mhandle, &readfd, &writefd, 
+        mcode = curl_multi_fdset(_mhandle, &readfd, &writefd, 
                 &exceptfd, &maxfd);
 
-               if (mcode != CURLM_OK) {
-                       // This is a serious error, not just a failure to add 
any
-                       // fds.
-                       throw GnashException(curl_multi_strerror(mcode));
-               }
+        if (mcode != CURLM_OK) {
+            // This is a serious error, not just a failure to add any
+            // fds.
+            throw GnashException(curl_multi_strerror(mcode));
+        }
 
 #ifdef GNASH_CURL_VERBOSE
-               log_debug("Max fd: %d", maxfd);
+        log_debug("Max fd: %d", maxfd);
 #endif
 
-               // A value of -1 means no file descriptors were added.
-               if (maxfd < 0) {
+        // A value of -1 means no file descriptors were added.
+        if (maxfd < 0) {
 #if GNASH_CURL_VERBOSE
-                       log_debug("No filedescriptors; breaking");
+            log_debug("No filedescriptors; breaking");
 #endif
-                       break;
-               }
-
-               FD_ZERO(&readfd);
-               FD_ZERO(&writefd);
-               FD_ZERO(&exceptfd);
-
-               tv.tv_sec = 0;
-               tv.tv_usec = maxSleepUsec;
+            break;
+        }
+
+        FD_ZERO(&readfd);
+        FD_ZERO(&writefd);
+        FD_ZERO(&exceptfd);
+
+        tv.tv_sec = 0;
+        tv.tv_usec = maxSleepUsec;
 
 #ifdef GNASH_CURL_VERBOSE
-               log_debug("select() with %d milliseconds timeout", 
maxSleepUsec*1000);
+        log_debug("select() with %d milliseconds timeout", maxSleepUsec*1000);
 #endif
 
-               // Wait for data on the filedescriptors until a timeout set
-               // in gnashrc.
-               int ret = select(maxfd + 1, &readfd, &writefd, &exceptfd, &tv);
+        // Wait for data on the filedescriptors until a timeout set
+        // in gnashrc.
+        int ret = select(maxfd + 1, &readfd, &writefd, &exceptfd, &tv);
 
 // select() will always fail on OS/2 and AmigaOS4 as we can't select
 // on file descriptors, only on sockets
 #if !defined(__OS2__) && !defined(__amigaos4__)
-               if ( ret == -1 )
-               {
+        if ( ret == -1 )
+        {
             if ( errno == EINTR )
             {
                 // we got interupted by a signal
@@ -690,11 +690,11 @@
                     % _url % strerror(errno);
                 throw GnashException(fmt.str());
             }
-               }
+        }
 #endif
-               if ( ! ret )
-               {
-                       // timeout
+        if ( ! ret )
+        {
+            // timeout
 #ifdef GNASH_CURL_VERBOSE
             log_debug("select() timed out, elapsed is %u",
                     lastProgress.elapsed());
@@ -703,29 +703,29 @@
             {
                 log_error(_("Timeout (%u milliseconds) while loading "
                             "from url %s"), userTimeout, _url);
-                               // TODO: should we set _error here ?
+                // TODO: should we set _error here ?
                 return;
             }
-               }
-               else
-               {
+        }
+        else
+        {
 #ifdef GNASH_CURL_VERBOSE
             log_debug("FD activity, resetting progress timer");
 #endif
             lastProgress.restart();
-               }
-
-
-               // TODO: check if we timedout or got some data
-               //       if we did timeout, check the clock to see
-               //       if we expired the user Timeout, otherwise
-               //       reset the timer...
-
-       }
-
-       // Processing messages is already done by fillCacheNonBlocking,
-       // so we might likely avoid it here.
-       processMessages();
+        }
+
+
+        // TODO: check if we timedout or got some data
+        //       if we did timeout, check the clock to see
+        //       if we expired the user Timeout, otherwise
+        //       reset the timer...
+
+    }
+
+    // Processing messages is already done by fillCacheNonBlocking,
+    // so we might likely avoid it here.
+    processMessages();
 
 }
 
@@ -733,48 +733,48 @@
 void
 CurlStreamFile::processMessages()
 {
-       CURLMsg *curl_msg;
-       
-       // The number of messages left in the queue (not used by us).
-       int msgs;
-       while ((curl_msg = curl_multi_info_read(_mhandle, &msgs)))
-       {
-
-               // Only for completed transactions
-               if (curl_msg->msg == CURLMSG_DONE) {
-
-                       // HTTP transaction succeeded
-                       if (curl_msg->data.result == CURLE_OK) {
-
-                               long code;
-
-                               // Check HTTP response
-                               curl_easy_getinfo(curl_msg->easy_handle,
-                                                 CURLINFO_RESPONSE_CODE, 
&code);
-
-                               if ( code >= 400 ) {
-                                       log_error ("HTTP response %ld from url 
%s",
-                                                                   code, _url);
-                                       _error = true;
-                                       _running = false;
-                               }
-                               else {
-                                       log_debug ("HTTP response %ld from url 
%s",
-                                                                   code, _url);
-                               }
-
-                       }
-                       else {
-
-                               // Transaction failed, pass on curl error.
-                               log_error("CURL: %s", curl_easy_strerror(
-                                                           
curl_msg->data.result));
-                               _error = true;
-                       }
-
-               }
-
-       }
+    CURLMsg *curl_msg;
+    
+    // The number of messages left in the queue (not used by us).
+    int msgs;
+    while ((curl_msg = curl_multi_info_read(_mhandle, &msgs)))
+    {
+
+        // Only for completed transactions
+        if (curl_msg->msg == CURLMSG_DONE) {
+
+            // HTTP transaction succeeded
+            if (curl_msg->data.result == CURLE_OK) {
+
+                long code;
+
+                // Check HTTP response
+                curl_easy_getinfo(curl_msg->easy_handle,
+                          CURLINFO_RESPONSE_CODE, &code);
+
+                if ( code >= 400 ) {
+                    log_error ("HTTP response %ld from url %s",
+                                        code, _url);
+                    _error = true;
+                    _running = false;
+                }
+                else {
+                    log_debug ("HTTP response %ld from url %s",
+                                        code, _url);
+                }
+
+            }
+            else {
+
+                // Transaction failed, pass on curl error.
+                log_error("CURL: %s", curl_easy_strerror(
+                                    curl_msg->data.result));
+                _error = true;
+            }
+
+        }
+
+    }
 }
 
 
@@ -784,18 +784,18 @@
 {
     _customHeaders = 0;
 
-       _url = url;
-       _running = 1;
-       _error = false;
-
-       _cached = 0;
-       _size = 0;
-
-       _handle = curl_easy_init();
-       _mhandle = curl_multi_init();
+    _url = url;
+    _running = 1;
+    _error = false;
+
+    _cached = 0;
+    _size = 0;
+
+    _handle = curl_easy_init();
+    _mhandle = curl_multi_init();
 
     const RcInitFile& rcfile = RcInitFile::getDefaultInstance();
-       
+    
     if (!cachefile.empty()) {
         _cache = std::fopen(cachefile.c_str(), "w+b");
         if (!_cache) {
@@ -807,64 +807,64 @@
     }
     else _cache = std::tmpfile();
 
-       if ( ! _cache ) {
-               throw GnashException("Could not create temporary cache file");
-       }
-       _cachefd = fileno(_cache);
-
-       CURLcode ccode;
-
-       // Override cURL's default verification of SSL certificates
-       // This is insecure, so log security warning.
-       // Equivalent to curl -k or curl --insecure.
-       if (rcfile.insecureSSL())
-       {
+    if ( ! _cache ) {
+        throw GnashException("Could not create temporary cache file");
+    }
+    _cachefd = fileno(_cache);
+
+    CURLcode ccode;
+
+    // Override cURL's default verification of SSL certificates
+    // This is insecure, so log security warning.
+    // Equivalent to curl -k or curl --insecure.
+    if (rcfile.insecureSSL())
+    {
         log_security(_("Allowing connections to SSL sites with invalid "
-         "certificates"));             
-
-               ccode = curl_easy_setopt(_handle, CURLOPT_SSL_VERIFYPEER, 0);
-               if ( ccode != CURLE_OK ) {
-                       throw GnashException(curl_easy_strerror(ccode));
-               }
-
-               ccode = curl_easy_setopt(_handle, CURLOPT_SSL_VERIFYHOST, 0);
-               if ( ccode != CURLE_OK ) {
-                       throw GnashException(curl_easy_strerror(ccode));
-               }
-       }
-
-       // Get shared data
-       ccode = curl_easy_setopt(_handle, CURLOPT_SHARE,
+         "certificates"));        
+
+        ccode = curl_easy_setopt(_handle, CURLOPT_SSL_VERIFYPEER, 0);
+        if ( ccode != CURLE_OK ) {
+            throw GnashException(curl_easy_strerror(ccode));
+        }
+
+        ccode = curl_easy_setopt(_handle, CURLOPT_SSL_VERIFYHOST, 0);
+        if ( ccode != CURLE_OK ) {
+            throw GnashException(curl_easy_strerror(ccode));
+        }
+    }
+
+    // Get shared data
+    ccode = curl_easy_setopt(_handle, CURLOPT_SHARE,
             CurlSession::get().getSharedHandle());
 
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // Set expiration time for DNS cache entries, in seconds
-       // 0 disables caching
-       // -1 makes cache entries never expire
-       // default is 60
-       //
-       // NOTE: this snippet is here just as a placeholder for whoever
-       //       will feel a need to make this parametrizable
-       //
-       ccode = curl_easy_setopt(_handle, CURLOPT_DNS_CACHE_TIMEOUT, 60);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       ccode = curl_easy_setopt(_handle, CURLOPT_USERAGENT, "Gnash-" VERSION);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // Set expiration time for DNS cache entries, in seconds
+    // 0 disables caching
+    // -1 makes cache entries never expire
+    // default is 60
+    //
+    // NOTE: this snippet is here just as a placeholder for whoever
+    //       will feel a need to make this parametrizable
+    //
+    ccode = curl_easy_setopt(_handle, CURLOPT_DNS_CACHE_TIMEOUT, 60);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    ccode = curl_easy_setopt(_handle, CURLOPT_USERAGENT, "Gnash-" VERSION);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
 
 #ifdef GNASH_CURL_VERBOSE
-       // for verbose operations
-       ccode = curl_easy_setopt(_handle, CURLOPT_VERBOSE, 1);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
+    // for verbose operations
+    ccode = curl_easy_setopt(_handle, CURLOPT_VERBOSE, 1);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
 #endif
 
 /* from libcurl-tutorial(3)
@@ -872,88 +872,88 @@
 to TRUE for all handles. Everything will work fine except that timeouts
 are not honored during the DNS lookup - which you can  work  around  by
 */
-       ccode = curl_easy_setopt(_handle, CURLOPT_NOSIGNAL, true);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // set url
-       ccode = curl_easy_setopt(_handle, CURLOPT_URL, _url.c_str());
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       //curl_easy_setopt(_handle, CURLOPT_NOPROGRESS, false);
-
-
-       // set write data and function
-       ccode = curl_easy_setopt(_handle, CURLOPT_WRITEDATA, this);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       ccode = curl_easy_setopt(_handle, CURLOPT_WRITEFUNCTION,
-               CurlStreamFile::recv);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       ccode = curl_easy_setopt(_handle, CURLOPT_FOLLOWLOCATION, 1);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       //fillCache(32); // pre-cache 32 bytes
-       //curl_multi_perform(_mhandle, &_running);
+    ccode = curl_easy_setopt(_handle, CURLOPT_NOSIGNAL, true);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // set url
+    ccode = curl_easy_setopt(_handle, CURLOPT_URL, _url.c_str());
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    //curl_easy_setopt(_handle, CURLOPT_NOPROGRESS, false);
+
+
+    // set write data and function
+    ccode = curl_easy_setopt(_handle, CURLOPT_WRITEDATA, this);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    ccode = curl_easy_setopt(_handle, CURLOPT_WRITEFUNCTION,
+        CurlStreamFile::recv);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    ccode = curl_easy_setopt(_handle, CURLOPT_FOLLOWLOCATION, 1);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    //fillCache(32); // pre-cache 32 bytes
+    //curl_multi_perform(_mhandle, &_running);
 }
 
 /*public*/
 CurlStreamFile::CurlStreamFile(const std::string& url,
         const std::string& cachefile)
 {
-       log_debug("CurlStreamFile %p created", this);
-       init(url, cachefile);
+    log_debug("CurlStreamFile %p created", this);
+    init(url, cachefile);
 
-       // CURLMcode ret =
-       CURLMcode mcode = curl_multi_add_handle(_mhandle, _handle);
-       if ( mcode != CURLM_OK ) {
-               throw GnashException(curl_multi_strerror(mcode));
-       }
+    // CURLMcode ret =
+    CURLMcode mcode = curl_multi_add_handle(_mhandle, _handle);
+    if ( mcode != CURLM_OK ) {
+        throw GnashException(curl_multi_strerror(mcode));
+    }
 }
 
 /*public*/
 CurlStreamFile::CurlStreamFile(const std::string& url, const std::string& vars,
        const std::string& cachefile)
 {
-       log_debug("CurlStreamFile %p created", this);
-       init(url, cachefile);
-
-       _postdata = vars;
-
-       CURLcode ccode;
-
-       ccode = curl_easy_setopt(_handle, CURLOPT_POST, 1);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // libcurl needs to access the POSTFIELDS during 'perform' operations,
-       // so we must use a string whose lifetime is ensured to be longer then
-       // the multihandle itself.
-       // The _postdata member should meet this requirement
-       ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDS, 
_postdata.c_str());
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // This is to support binary strings as postdata
-       // NOTE: in version 7.11.1 CURLOPT_POSTFIELDSIZE_LARGE was added
-       //       this one takes a long, that one takes a curl_off_t
-       //
-       ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDSIZE, 
_postdata.size());
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
+    log_debug("CurlStreamFile %p created", this);
+    init(url, cachefile);
+
+    _postdata = vars;
+
+    CURLcode ccode;
+
+    ccode = curl_easy_setopt(_handle, CURLOPT_POST, 1);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // libcurl needs to access the POSTFIELDS during 'perform' operations,
+    // so we must use a string whose lifetime is ensured to be longer then
+    // the multihandle itself.
+    // The _postdata member should meet this requirement
+    ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDS, _postdata.c_str());
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // This is to support binary strings as postdata
+    // NOTE: in version 7.11.1 CURLOPT_POSTFIELDSIZE_LARGE was added
+    //       this one takes a long, that one takes a curl_off_t
+    //
+    ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDSIZE, _postdata.size());
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
 
     // Disable sending an Expect: header, as some older HTTP/1.1
     // don't implement them, and some (namely lighttpd/1.4.19,
@@ -966,10 +966,10 @@
         throw GnashException(curl_easy_strerror(ccode));
     }
 
-       CURLMcode mcode = curl_multi_add_handle(_mhandle, _handle);
-       if ( mcode != CURLM_OK ) {
-               throw GnashException(curl_multi_strerror(mcode));
-       }
+    CURLMcode mcode = curl_multi_add_handle(_mhandle, _handle);
+    if ( mcode != CURLM_OK ) {
+        throw GnashException(curl_multi_strerror(mcode));
+    }
 
 }
 
@@ -978,10 +978,10 @@
         const NetworkAdapter::RequestHeaders& headers,
         const std::string& cachefile)
 {
-       log_debug("CurlStreamFile %p created", this);
-       init(url, cachefile);
+    log_debug("CurlStreamFile %p created", this);
+    init(url, cachefile);
 
-       _postdata = vars;
+    _postdata = vars;
 
     // Disable sending an Expect: header, as some older HTTP/1.1
     // don't implement them, and some (namely lighttpd/1.4.19,
@@ -1004,40 +1004,40 @@
         _customHeaders = curl_slist_append(_customHeaders, os.str().c_str());
     }
 
-       CURLcode ccode;
+    CURLcode ccode;
 
     ccode = curl_easy_setopt(_handle, CURLOPT_HTTPHEADER, _customHeaders);
     if ( ccode != CURLE_OK ) {
         throw GnashException(curl_easy_strerror(ccode));
     }
 
-       ccode = curl_easy_setopt(_handle, CURLOPT_POST, 1);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // libcurl needs to access the POSTFIELDS during 'perform' operations,
-       // so we must use a string whose lifetime is ensured to be longer then
-       // the multihandle itself.
-       // The _postdata member should meet this requirement
-       ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDS, 
_postdata.c_str());
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // This is to support binary strings as postdata
-       // NOTE: in version 7.11.1 CURLOPT_POSTFIELDSIZE_LARGE was added
-       //       this one takes a long, that one takes a curl_off_t
-       //
-       ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDSIZE, 
_postdata.size());
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       CURLMcode mcode = curl_multi_add_handle(_mhandle, _handle);
-       if ( mcode != CURLM_OK ) {
-               throw GnashException(curl_multi_strerror(mcode));
-       }
+    ccode = curl_easy_setopt(_handle, CURLOPT_POST, 1);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // libcurl needs to access the POSTFIELDS during 'perform' operations,
+    // so we must use a string whose lifetime is ensured to be longer then
+    // the multihandle itself.
+    // The _postdata member should meet this requirement
+    ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDS, _postdata.c_str());
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // This is to support binary strings as postdata
+    // NOTE: in version 7.11.1 CURLOPT_POSTFIELDSIZE_LARGE was added
+    //       this one takes a long, that one takes a curl_off_t
+    //
+    ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDSIZE, _postdata.size());
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    CURLMcode mcode = curl_multi_add_handle(_mhandle, _handle);
+    if ( mcode != CURLM_OK ) {
+        throw GnashException(curl_multi_strerror(mcode));
+    }
 
 }
 
@@ -1045,11 +1045,11 @@
 /*public*/
 CurlStreamFile::~CurlStreamFile()
 {
-       log_debug("CurlStreamFile %p deleted", this);
-       curl_multi_remove_handle(_mhandle, _handle);
-       curl_easy_cleanup(_handle);
-       curl_multi_cleanup(_mhandle);
-       std::fclose(_cache);
+    log_debug("CurlStreamFile %p deleted", this);
+    curl_multi_remove_handle(_mhandle, _handle);
+    curl_easy_cleanup(_handle);
+    curl_multi_cleanup(_mhandle);
+    std::fclose(_cache);
     if ( _customHeaders ) curl_slist_free_all(_customHeaders); 
 }
 
@@ -1057,20 +1057,20 @@
 std::streamsize
 CurlStreamFile::read(void *dst, std::streamsize bytes)
 {
-       if ( eof() || _error ) return 0;
-
-#ifdef GNASH_CURL_VERBOSE
-       log_debug ("read(%d) called", bytes);
-#endif
-
-       fillCache(bytes + tell());
-       if ( _error ) return 0; // error can be set by fillCache
-
-#ifdef GNASH_CURL_VERBOSE
-       log_debug("_cache.tell = %d", tell());
-#endif
-
-       return std::fread(dst, 1, bytes, _cache);
+    if ( eof() || _error ) return 0;
+
+#ifdef GNASH_CURL_VERBOSE
+    log_debug ("read(%d) called", bytes);
+#endif
+
+    fillCache(bytes + tell());
+    if ( _error ) return 0; // error can be set by fillCache
+
+#ifdef GNASH_CURL_VERBOSE
+    log_debug("_cache.tell = %d", tell());
+#endif
+
+    return std::fread(dst, 1, bytes, _cache);
 
 }
 
@@ -1079,29 +1079,29 @@
 CurlStreamFile::readNonBlocking(void *dst, std::streamsize bytes)
 {
 #ifdef GNASH_CURL_VERBOSE
-       log_debug ("readNonBlocking(%d) called", bytes);
+    log_debug ("readNonBlocking(%d) called", bytes);
 #endif
 
-       if ( eof() || _error ) return 0;
+    if ( eof() || _error ) return 0;
 
-       fillCacheNonBlocking();
-       if ( _error )
-       {
-               // I guess an exception would be thrown in this case ?
-               log_error("curl adaptor's fillCacheNonBlocking set _error "
+    fillCacheNonBlocking();
+    if ( _error )
+    {
+        // I guess an exception would be thrown in this case ?
+        log_error("curl adaptor's fillCacheNonBlocking set _error "
                 "rather then throwing an exception");
-               return 0; 
-       }
+        return 0; 
+    }
 
     std::streamsize actuallyRead = std::fread(dst, 1, bytes, _cache);
-       if ( _running )
-       {
-               // if we're still running drop any eof flag
-               // on the cache
-               clearerr(_cache);
-       }
+    if ( _running )
+    {
+        // if we're still running drop any eof flag
+        // on the cache
+        clearerr(_cache);
+    }
 
-       return actuallyRead;
+    return actuallyRead;
 
 }
 
@@ -1109,12 +1109,12 @@
 bool
 CurlStreamFile::eof() const
 {
-       bool ret = ( ! _running && feof(_cache) );
+    bool ret = ( ! _running && feof(_cache) );
 
 #ifdef GNASH_CURL_VERBOSE
-       log_debug("eof() returning %d", ret);
+    log_debug("eof() returning %d", ret);
 #endif
-       return ret;
+    return ret;
 
 }
 
@@ -1125,10 +1125,10 @@
     std::streampos ret = std::ftell(_cache);
 
 #ifdef GNASH_CURL_VERBOSE
-       log_debug("tell() returning %ld", ret);
+    log_debug("tell() returning %ld", ret);
 #endif
 
-       return ret;
+    return ret;
 
 }
 
@@ -1140,26 +1140,26 @@
     assert(pos >= 0);
 
 #ifdef GNASH_CURL_WARN_SEEKSBACK
-       if ( pos < tell() ) {
-               log_debug("Warning: seek backward requested (%ld from %ld)",
-                       pos, tell());
-       }
+    if ( pos < tell() ) {
+        log_debug("Warning: seek backward requested (%ld from %ld)",
+            pos, tell());
+    }
 #endif
 
-       fillCache(pos);
-       if (_error) return false; // error can be set by fillCache
+    fillCache(pos);
+    if (_error) return false; // error can be set by fillCache
 
-       if (_cached < static_cast<size_t>(pos))
-       {
-               log_error ("Warning: could not cache anough bytes on seek: %d "
+    if (_cached < static_cast<size_t>(pos))
+    {
+        log_error ("Warning: could not cache anough bytes on seek: %d "
                 "requested, %d cached", pos, _cached);
-               return false; 
-       }
+        return false; 
+    }
 
-       if (std::fseek(_cache, pos, SEEK_SET) == -1) {
-               log_error("Warning: fseek failed");
-               return false;
-       }
+    if (std::fseek(_cache, pos, SEEK_SET) == -1) {
+        log_error("Warning: fseek failed");
+        return false;
+    }
    
     return true;
 
@@ -1169,18 +1169,18 @@
 void
 CurlStreamFile::go_to_end()
 {
-       CURLMcode mcode;
-       while (_running > 0)
-       {
-               do
-               {
-                       mcode=curl_multi_perform(_mhandle, &_running);
-               } while ( mcode == CURLM_CALL_MULTI_PERFORM );
+    CURLMcode mcode;
+    while (_running > 0)
+    {
+        do
+        {
+            mcode=curl_multi_perform(_mhandle, &_running);
+        } while ( mcode == CURLM_CALL_MULTI_PERFORM );
 
-               if ( mcode != CURLM_OK )
-               {
-                       throw IOException(curl_multi_strerror(mcode));
-               }
+        if ( mcode != CURLM_OK )
+        {
+            throw IOException(curl_multi_strerror(mcode));
+        }
 
         long code;
         curl_easy_getinfo(_handle, CURLINFO_RESPONSE_CODE, &code);
@@ -1189,136 +1189,136 @@
             throw IOException("File not found");
         }
 
-       }
+    }
 
-       if (std::fseek(_cache, 0, SEEK_END) == -1) {
-               throw IOException("NetworkAdapter: fseek to end failed");
-       } 
+    if (std::fseek(_cache, 0, SEEK_END) == -1) {
+        throw IOException("NetworkAdapter: fseek to end failed");
+    } 
 }
 
 /*public*/
 size_t
 CurlStreamFile::size() const
 {
-       if ( ! _size )
-       {
-               double size;
-               CURLcode ret = curl_easy_getinfo(_handle,
+    if ( ! _size )
+    {
+        double size;
+        CURLcode ret = curl_easy_getinfo(_handle,
                 CURLINFO_CONTENT_LENGTH_DOWNLOAD, &size);
-               if (ret == CURLE_OK) {
+        if (ret == CURLE_OK) {
             assert(size <= std::numeric_limits<size_t>::max());
             _size = static_cast<size_t>(size);
         }
-       }
+    }
 
 #ifdef GNASH_CURL_VERBOSE
-       log_debug("get_stream_size() returning %lu", _size);
+    log_debug("get_stream_size() returning %lu", _size);
 #endif
 
-       return _size;
+    return _size;
 
 }
 
 void
 CurlSession::importCookies()
 {
-       const char* cookiesIn = std::getenv("GNASH_COOKIES_IN");
-       if ( ! cookiesIn ) return; // nothing to do
-
-       ////////////////////////////////////////////////////////////////
-       //
-       // WARNING: what we're doing here is an ugly hack
-       //
-       // We'll be creating a fake easy handle for the sole purpos
-       // of importing cookies. Tests conducted against 7.15.5-CVS
-       // resulted in this working if a CURLOPT_URL is given, even
-       // if invalid (but non-0!), while wouldn't if NO CURLOPT_URL
-       // is given, with both cases returning the same CURLcode on
-       // _perform (URL using bad/illegal format or missing URL)
-       //
-       // TODO: instead, we should be reading the input file
-       //       ourselves and use CURLOPT_COOKIELIST to send
-       //       each line. Doing so should not require a
-       //       _perform call.
-       //
-       ////////////////////////////////////////////////////////////////
-
-       // Create a fake handle for purpose of importing data
-       CURL* fakeHandle = curl_easy_init(); // errors to handle here ?
-       CURLcode ccode;
-
-       // Configure the fake handle to use the share (shared cookies in 
particular..)
-       ccode = curl_easy_setopt(fakeHandle, CURLOPT_SHARE, getSharedHandle());
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // Configure the fake handle to read cookies from the specified file
-       ccode = curl_easy_setopt(fakeHandle, CURLOPT_COOKIEFILE, cookiesIn);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // need to pass a non-zero URL string for COOKIEFILE to
-       // be really parsed
-       ccode = curl_easy_setopt(fakeHandle, CURLOPT_URL, "");
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // perform, to activate actual cookie file parsing
-       //
-       // NOTE: curl_easy_perform is expected to return an
-       //       "URL using bad/illegal format or missing URL" error,
-       //       there's no way to detect actual cookies import errors
-       //       other then using curl debugging output routines
-       //
-       log_debug("Importing cookies from file '%s'", cookiesIn);
-       curl_easy_perform(fakeHandle);
-
-       curl_easy_cleanup(fakeHandle);
+    const char* cookiesIn = std::getenv("GNASH_COOKIES_IN");
+    if ( ! cookiesIn ) return; // nothing to do
+
+    ////////////////////////////////////////////////////////////////
+    //
+    // WARNING: what we're doing here is an ugly hack
+    //
+    // We'll be creating a fake easy handle for the sole purpos
+    // of importing cookies. Tests conducted against 7.15.5-CVS
+    // resulted in this working if a CURLOPT_URL is given, even
+    // if invalid (but non-0!), while wouldn't if NO CURLOPT_URL
+    // is given, with both cases returning the same CURLcode on
+    // _perform (URL using bad/illegal format or missing URL)
+    //
+    // TODO: instead, we should be reading the input file
+    //       ourselves and use CURLOPT_COOKIELIST to send
+    //       each line. Doing so should not require a
+    //       _perform call.
+    //
+    ////////////////////////////////////////////////////////////////
+
+    // Create a fake handle for purpose of importing data
+    CURL* fakeHandle = curl_easy_init(); // errors to handle here ?
+    CURLcode ccode;
+
+    // Configure the fake handle to use the share (shared cookies in 
particular..)
+    ccode = curl_easy_setopt(fakeHandle, CURLOPT_SHARE, getSharedHandle());
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // Configure the fake handle to read cookies from the specified file
+    ccode = curl_easy_setopt(fakeHandle, CURLOPT_COOKIEFILE, cookiesIn);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // need to pass a non-zero URL string for COOKIEFILE to
+    // be really parsed
+    ccode = curl_easy_setopt(fakeHandle, CURLOPT_URL, "");
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // perform, to activate actual cookie file parsing
+    //
+    // NOTE: curl_easy_perform is expected to return an
+    //       "URL using bad/illegal format or missing URL" error,
+    //       there's no way to detect actual cookies import errors
+    //       other then using curl debugging output routines
+    //
+    log_debug("Importing cookies from file '%s'", cookiesIn);
+    curl_easy_perform(fakeHandle);
+
+    curl_easy_cleanup(fakeHandle);
 
 }
 
 void
 CurlSession::exportCookies()
 {
-       const char* cookiesOut = std::getenv("GNASH_COOKIES_OUT");
-       if ( ! cookiesOut ) return; // nothing to do
-
-       ////////////////////////////////////////////////////////////////
-       //
-       // WARNING: what we're doing here is an ugly hack
-       //
-       // We'll be creating a fake easy handle for the sole purpose
-       // of exporting cookies. Tests conducted against 7.15.5-CVS
-       // resulted in this working w/out a CURLOPT_URL and w/out a
-       // curl_easy_perform.
-       // 
-       // NOTE: the "correct" way would be to use CURLOPT_COOKIELIST
-       //       with the "FLUSH" special string as value, but that'd
-       //       be only supported by version 7.17.1
-       //
-       ////////////////////////////////////////////////////////////////
-
-       CURL* fakeHandle = curl_easy_init(); // errors to handle here ?
-       CURLcode ccode;
-
-       // Configure the fake handle to use the share (shared cookies in 
particular..)
-       ccode = curl_easy_setopt(fakeHandle, CURLOPT_SHARE, getSharedHandle());
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // Configure the fake handle to write cookies to the specified file
-       ccode = curl_easy_setopt(fakeHandle, CURLOPT_COOKIEJAR , cookiesOut);
-       if ( ccode != CURLE_OK ) {
-               throw GnashException(curl_easy_strerror(ccode));
-       }
-
-       // Cleanup, to trigger actual cookie file flushing
-       log_debug("Exporting cookies file '%s'", cookiesOut);
-       curl_easy_cleanup(fakeHandle);
+    const char* cookiesOut = std::getenv("GNASH_COOKIES_OUT");
+    if ( ! cookiesOut ) return; // nothing to do
+
+    ////////////////////////////////////////////////////////////////
+    //
+    // WARNING: what we're doing here is an ugly hack
+    //
+    // We'll be creating a fake easy handle for the sole purpose
+    // of exporting cookies. Tests conducted against 7.15.5-CVS
+    // resulted in this working w/out a CURLOPT_URL and w/out a
+    // curl_easy_perform.
+    // 
+    // NOTE: the "correct" way would be to use CURLOPT_COOKIELIST
+    //       with the "FLUSH" special string as value, but that'd
+    //       be only supported by version 7.17.1
+    //
+    ////////////////////////////////////////////////////////////////
+
+    CURL* fakeHandle = curl_easy_init(); // errors to handle here ?
+    CURLcode ccode;
+
+    // Configure the fake handle to use the share (shared cookies in 
particular..)
+    ccode = curl_easy_setopt(fakeHandle, CURLOPT_SHARE, getSharedHandle());
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // Configure the fake handle to write cookies to the specified file
+    ccode = curl_easy_setopt(fakeHandle, CURLOPT_COOKIEJAR , cookiesOut);
+    if ( ccode != CURLE_OK ) {
+        throw GnashException(curl_easy_strerror(ccode));
+    }
+
+    // Cleanup, to trigger actual cookie file flushing
+    log_debug("Exporting cookies file '%s'", cookiesOut);
+    curl_easy_cleanup(fakeHandle);
 
 }
 
@@ -1333,18 +1333,18 @@
 NetworkAdapter::makeStream(const std::string& url, const std::string& 
cachefile)
 {
 #ifdef GNASH_CURL_VERBOSE
-       log_debug("making curl stream for %s", url);
+    log_debug("making curl stream for %s", url);
 #endif
 
-       std::auto_ptr<IOChannel> stream;
+    std::auto_ptr<IOChannel> stream;
 
-       try {
-               stream.reset(new CurlStreamFile(url, cachefile));
-       }
-       catch (const std::exception& ex) {
-               log_error("curl stream: %s", ex.what());
-       }
-       return stream;
+    try {
+        stream.reset(new CurlStreamFile(url, cachefile));
+    }
+    catch (const std::exception& ex) {
+        log_error("curl stream: %s", ex.what());
+    }
+    return stream;
 }
 
 std::auto_ptr<IOChannel>
@@ -1352,18 +1352,18 @@
         const std::string& cachefile)
 {
 #ifdef GNASH_CURL_VERBOSE
-       log_debug("making curl stream for %s", url);
+    log_debug("making curl stream for %s", url);
 #endif
 
-       std::auto_ptr<IOChannel> stream;
+    std::auto_ptr<IOChannel> stream;
 
-       try {
-               stream.reset(new CurlStreamFile(url, postdata, cachefile));
-       }
-       catch (const std::exception& ex) {
-               log_error("curl stream: %s", ex.what());
-       }
-       return stream;
+    try {
+        stream.reset(new CurlStreamFile(url, postdata, cachefile));
+    }
+    catch (const std::exception& ex) {
+        log_error("curl stream: %s", ex.what());
+    }
+    return stream;
 }
 
 std::auto_ptr<IOChannel>
@@ -1371,14 +1371,14 @@
         const RequestHeaders& headers, const std::string& cachefile)
 {
 
-       std::auto_ptr<IOChannel> stream;
+    std::auto_ptr<IOChannel> stream;
 
-       try {
-               stream.reset(new CurlStreamFile(url, postdata, headers, 
cachefile));
-       }
-       catch (const std::exception& ex) {
-               log_error("curl stream: %s", ex.what());
-       }
+    try {
+        stream.reset(new CurlStreamFile(url, postdata, headers, cachefile));
+    }
+    catch (const std::exception& ex) {
+        log_error("curl stream: %s", ex.what());
+    }
 
     return stream;
 

=== modified file 'libbase/log.cpp'
--- a/libbase/log.cpp   2010-01-11 06:41:38 +0000
+++ b/libbase/log.cpp   2010-01-18 07:30:25 +0000
@@ -54,29 +54,29 @@
 hexify(const unsigned char *p, size_t length, bool ascii)
 {
 
-       const std::vector<unsigned char> bytes(p, p + length);
+    const std::vector<unsigned char> bytes(p, p + length);
 
-       std::ostringstream ss;
-       
-       // For hex output, fill single-digit numbers with a leading 0.
-       if (!ascii) ss << std::hex << std::setfill('0');
-       
-       for (std::vector<unsigned char>::const_iterator i = bytes.begin(),
+    std::ostringstream ss;
+    
+    // For hex output, fill single-digit numbers with a leading 0.
+    if (!ascii) ss << std::hex << std::setfill('0');
+    
+    for (std::vector<unsigned char>::const_iterator i = bytes.begin(),
             e = bytes.end(); i != e; ++i)
-           {
-               if (ascii) {
-                   if (std::isprint(*i) || *i == 0xd) {
-                               ss << *i;
-                   }
-                   else ss << ".";
-               }
-               else  {
-                   // Not ascii
-                   ss << std::setw(2) << static_cast<int>(*i) << " ";  
-               }
-       }       
-       
-       return ss.str();
+        {
+        if (ascii) {
+            if (std::isprint(*i) || *i == 0xd) {
+                ss << *i;
+            }
+            else ss << ".";
+        }
+        else  {
+            // Not ascii
+            ss << std::setw(2) << static_cast<int>(*i) << " ";    
+        }
+    }    
+    
+    return ss.str();
 
 }
 
@@ -86,11 +86,11 @@
 
     const char fmt[] = "%H:%M:%S";
 
-       time_t t;
-       char buf[sizeof(fmt)];
+    time_t t;
+    char buf[sizeof(fmt)];
 
-       std::time(&t);
-       std::strftime(buf, sizeof(buf), fmt, std::localtime(&t));
+    std::time(&t);
+    std::strftime(buf, sizeof(buf), fmt, std::localtime(&t));
 
     static std::map<int, int> threadMap;
     int tid = get_thread_id();
@@ -101,20 +101,20 @@
         // TODO: notify actual thread id for index
     }
 
-       o << getpid() << ":" << htid << "] " << buf;
-       return o;
+    o << getpid() << ":" << htid << "] " << buf;
+    return o;
 
 }
 
 LogFile&
 LogFile::getDefaultInstance()
 {
-       static LogFile o;
-       return o;
+    static LogFile o;
+    return o;
 }
 
 namespace {
-       LogFile& dbglogfile = LogFile::getDefaultInstance();
+    LogFile& dbglogfile = LogFile::getDefaultInstance();
 }
 
 // boost format functions to process the objects
@@ -123,147 +123,147 @@
 void
 processLog_trace(const boost::format& fmt)
 {
-       dbglogfile.log(N_("TRACE"), fmt.str());
+    dbglogfile.log(N_("TRACE"), fmt.str());
 }
 
 void
 processLog_debug(const boost::format& fmt)
 {
-       if (dbglogfile.getVerbosity() < LogFile::LOG_DEBUG) return;
-       dbglogfile.log(N_("DEBUG"), fmt.str());
+    if (dbglogfile.getVerbosity() < LogFile::LOG_DEBUG) return;
+    dbglogfile.log(N_("DEBUG"), fmt.str());
 }
 
 void
 processLog_abc(const boost::format& fmt)
 {
-       if (dbglogfile.getVerbosity() < LogFile::LOG_EXTRA) return;
-       dbglogfile.log(N_("ABC"), fmt.str());
+    if (dbglogfile.getVerbosity() < LogFile::LOG_EXTRA) return;
+    dbglogfile.log(N_("ABC"), fmt.str());
 }
 
 void
 processLog_parse(const boost::format& fmt)
 {
-       dbglogfile.log(fmt.str());
+    dbglogfile.log(fmt.str());
 }
 
 void
 processLog_network(const boost::format& fmt)
 {
-       dbglogfile.log(N_("NETWORK"), fmt.str());
+    dbglogfile.log(N_("NETWORK"), fmt.str());
 }
 
 void
 processLog_error(const boost::format& fmt)
 {
-       dbglogfile.log(N_("ERROR"), fmt.str());
+    dbglogfile.log(N_("ERROR"), fmt.str());
 }
 
 void
 processLog_unimpl(const boost::format& fmt)
 {
-       dbglogfile.log(N_("UNIMPLEMENTED"), fmt.str());
+    dbglogfile.log(N_("UNIMPLEMENTED"), fmt.str());
 }
 
 void
 processLog_security(const boost::format& fmt)
 {
-       dbglogfile.log(N_("SECURITY"), fmt.str());
+    dbglogfile.log(N_("SECURITY"), fmt.str());
 }
 
 void
 processLog_swferror(const boost::format& fmt)
 {
-       dbglogfile.log(N_("MALFORMED SWF"), fmt.str());
+    dbglogfile.log(N_("MALFORMED SWF"), fmt.str());
 }
 
 void
 processLog_amferror(const boost::format& fmt)
 {
-       dbglogfile.log(N_("MALFORMED AMF"), fmt.str());
+    dbglogfile.log(N_("MALFORMED AMF"), fmt.str());
 }
 
 void
 processLog_aserror(const boost::format& fmt)
 {
-       dbglogfile.log(N_("ACTIONSCRIPT ERROR"), fmt.str());
+    dbglogfile.log(N_("ACTIONSCRIPT ERROR"), fmt.str());
 }
 
 void
 processLog_action(const boost::format& fmt)
 {
-       bool stamp = dbglogfile.getStamp();
-       dbglogfile.setStamp(false);
-       dbglogfile.log(fmt.str());
-       dbglogfile.setStamp(stamp);
+    bool stamp = dbglogfile.getStamp();
+    dbglogfile.setStamp(false);
+    dbglogfile.log(fmt.str());
+    dbglogfile.setStamp(stamp);
 }
 
 void
 LogFile::log(const std::string& msg)
 {
 
-       boost::mutex::scoped_lock lock(_ioMutex);
-
-       if ( !_verbose ) return; // nothing to do if not verbose
-
-       if (openLogIfNeeded())
-       {
-               if (_stamp) {
-                       _outstream << timestamp << ": " << msg << "\n";
-               } else {
-                       _outstream << msg << "\n";
-               }
-       }
-       else // log to stdout
-       {
-               if (_stamp) {
-                       cout << timestamp << " " << msg << endl;
-               } else {
-                       cout << msg << endl;
-               }
-       }
-       
-       if (_listener)
-       {
-           (*_listener)(msg);
-       }
+    boost::mutex::scoped_lock lock(_ioMutex);
+
+    if ( !_verbose ) return; // nothing to do if not verbose
+
+    if (openLogIfNeeded())
+    {
+        if (_stamp) {
+            _outstream << timestamp << ": " << msg << "\n";
+        } else {
+            _outstream << msg << "\n";
+        }
+    }
+    else // log to stdout
+    {
+        if (_stamp) {
+            cout << timestamp << " " << msg << endl;
+        } else {
+            cout << msg << endl;
+        }
+    }
+    
+    if (_listener)
+    {
+        (*_listener)(msg);
+    }
 }
 
 inline void
 LogFile::log(const std::string& label, const std::string& msg)
 {
-       log(label + ": " + msg);
+    log(label + ": " + msg);
 }
 
 void
 LogFile::setLogFilename(const std::string& fname)
 {
-       closeLog();
-       _logFilename = fname;
+    closeLog();
+    _logFilename = fname;
 }
 
 void
 LogFile::setWriteDisk(bool use)
 {
-       if (!use) closeLog();
-       _write = use;
+    if (!use) closeLog();
+    _write = use;
 }
 
 // Default constructor
 LogFile::LogFile()
-       :
-       _verbose(0),
-       _actiondump(false),
-       _parserdump(false),
-       _state(CLOSED),
-       _stamp(true),
-       _write(false),
-       _listener(NULL)
+    :
+    _verbose(0),
+    _actiondump(false),
+    _parserdump(false),
+    _state(CLOSED),
+    _stamp(true),
+    _write(false),
+    _listener(NULL)
 {
 }
 
 LogFile::~LogFile()
 {
-       if (_state == OPEN) closeLog();
+    if (_state == OPEN) closeLog();
 }
 
 bool
@@ -290,7 +290,7 @@
     // by the public log_xxx functions that log themselves
 
     if (_state != CLOSED) {
-       cout << "Closing previously opened stream" << endl;
+    cout << "Closing previously opened stream" << endl;
         _outstream.close();
         _state = CLOSED;
     }
@@ -298,14 +298,14 @@
     // Append, don't truncate, the log file
     _outstream.open(filespec.c_str(), std::ios::app|std::ios::out); // ios::out
     if( _outstream.fail() ) {
-       // Can't use log_error here...
+    // Can't use log_error here...
         cout << "ERROR: can't open debug log file " << filespec << 
             " for appending." << endl;
         return false;
     }       
 
-       _filespec = filespec;
-       _state = OPEN;
+    _filespec = filespec;
+    _state = OPEN;
 
     return true;
 }
@@ -313,28 +313,28 @@
 bool
 LogFile::closeLog()
 {
-       boost::mutex::scoped_lock lock(_ioMutex);
-       if (_state == OPEN) {
-               _outstream.flush();
-               _outstream.close();
-       }
-       _state = CLOSED;
+    boost::mutex::scoped_lock lock(_ioMutex);
+    if (_state == OPEN) {
+        _outstream.flush();
+        _outstream.close();
+    }
+    _state = CLOSED;
 
-       return true;
+    return true;
 }
 
 bool
 LogFile::removeLog()
 {
-       if (_state == OPEN) {
-               _outstream.close();
-       }
+    if (_state == OPEN) {
+        _outstream.close();
+    }
 
     // Ignore the error, we don't care
     unlink(_filespec.c_str());
     _filespec.clear();
 
-       return true;
+    return true;
 }
 
 } // end of gnash namespace

=== modified file 'libbase/log.h'
--- a/libbase/log.h     2010-01-11 06:41:38 +0000
+++ b/libbase/log.h     2010-01-18 07:40:53 +0000
@@ -36,7 +36,7 @@
 
 // Support compilation with (or without) native language support
 #include "gettext.h"
-#define        _(String) gettext (String)
+#define    _(String) gettext (String)
 #define N_(String) gettext_noop (String)
 
 // Macro to prevent repeated logging calls for the same
@@ -86,17 +86,17 @@
     /// Intended for use by log_*(). Thread-safe (locks _ioMutex)
     //
     /// @param label
-    ///                The label string ie: "ERROR" for "ERROR: <msg>"
+    ///        The label string ie: "ERROR" for "ERROR: <msg>"
     ///
     /// @param msg
-    ///                The message string ie: "bah" for "ERROR: bah"
+    ///        The message string ie: "bah" for "ERROR: bah"
     ///
     void log(const std::string& label, const std::string& msg);
 
     /// Intended for use by log_*(). Thread-safe (locks _ioMutex)
     //
     /// @param msg
-    ///                The message to print
+    ///        The message to print
     ///
     void log(const std::string& msg);
     
@@ -407,43 +407,43 @@
     // Only print function tracing messages when multiple -v
     // options have been supplied. 
     __Host_Function_Report__(void) {
-       log_debug("entering");
+    log_debug("entering");
     }
 
     __Host_Function_Report__(char *_func) {
-       func = _func;
-       log_debug("%s enter", func);
+    func = _func;
+    log_debug("%s enter", func);
     }
 
     __Host_Function_Report__(const char *_func) {
-       func = _func;
-       log_debug("%s enter", func);
+    func = _func;
+    log_debug("%s enter", func);
     }
 
     ~__Host_Function_Report__(void) {
-       if (LogFile::getDefaultInstance().getVerbosity() > LogFile::LOG_DEBUG) {
-           log_debug("%s returning", func);
-       }
+    if (LogFile::getDefaultInstance().getVerbosity() > LogFile::LOG_DEBUG) {
+        log_debug("%s returning", func);
+    }
     }
 };
 
 #ifndef HAVE_FUNCTION
-       #ifndef HAVE_func
-               #define dummystr(x) # x
-               #define dummyestr(x) dummystr(x)
-               #define __FUNCTION__ __FILE__":"dummyestr(__LINE__)
-       #else
-               #define __FUNCTION__ __func__   
-       #endif
+    #ifndef HAVE_func
+        #define dummystr(x) # x
+        #define dummyestr(x) dummystr(x)
+        #define __FUNCTION__ __FILE__":"dummyestr(__LINE__)
+    #else
+        #define __FUNCTION__ __func__    
+    #endif
 #endif
 
 #ifndef HAVE_PRETTY_FUNCTION
-       #define __PRETTY_FUNCTION__ __FUNCTION__
+    #define __PRETTY_FUNCTION__ __FUNCTION__
 #endif
 
 #if defined(__cplusplus) && defined(__GNUC__)
 #define GNASH_REPORT_FUNCTION   \
-       gnash::__Host_Function_Report__ __host_function_report__( 
__PRETTY_FUNCTION__)
+    gnash::__Host_Function_Report__ __host_function_report__( 
__PRETTY_FUNCTION__)
 #define GNASH_REPORT_RETURN
 #else
 #define GNASH_REPORT_FUNCTION \

=== modified file 'libbase/noseek_fd_adapter.cpp'
--- a/libbase/noseek_fd_adapter.cpp     2010-01-11 06:41:38 +0000
+++ b/libbase/noseek_fd_adapter.cpp     2010-01-18 07:31:59 +0000
@@ -55,75 +55,75 @@
 
 public:
 
-       /// Open a stream for the specified filedes
-       //
-       /// @param fd
-       ///     A filedescriptor for a stream opened for reading
-       ///
-       /// @param filename
-       ///     An optional filename to use for storing the cache.
-       ///     If NULL the cache would be an unnamed file and
-       ///     would not be accessible after destruction of this 
-       ///     instance.
-       ///
-       NoSeekFile(int fd, const char* filename=NULL);
-
-       ~NoSeekFile();
-
-       // See IOChannel.h for description
-       virtual std::streamsize read(void *dst, std::streamsize bytes);
-
-       // See IOChannel for description
-       virtual bool eof() const;
-
-       // See IOChannel for description
-       virtual bool bad() const { return false; }
-
-       // See IOChannel for description
-       virtual std::streampos tell() const;
-
-       // See IOChannel for description
-       virtual bool seek(std::streampos pos);
-
-       // See IOChannel for description
-       virtual void go_to_end() {
-               throw IOException("noseek_fd_adapter doesn't support seek to 
end");
-       }
+    /// Open a stream for the specified filedes
+    //
+    /// @param fd
+    ///    A filedescriptor for a stream opened for reading
+    ///
+    /// @param filename
+    ///    An optional filename to use for storing the cache.
+    ///    If NULL the cache would be an unnamed file and
+    ///    would not be accessible after destruction of this 
+    ///    instance.
+    ///
+    NoSeekFile(int fd, const char* filename=NULL);
+
+    ~NoSeekFile();
+
+    // See IOChannel.h for description
+    virtual std::streamsize read(void *dst, std::streamsize bytes);
+
+    // See IOChannel for description
+    virtual bool eof() const;
+
+    // See IOChannel for description
+    virtual bool bad() const { return false; }
+
+    // See IOChannel for description
+    virtual std::streampos tell() const;
+
+    // See IOChannel for description
+    virtual bool seek(std::streampos pos);
+
+    // See IOChannel for description
+    virtual void go_to_end() {
+        throw IOException("noseek_fd_adapter doesn't support seek to end");
+    }
 
 private:
 
-       /// Read buffer size
-       static const std::streamsize chunkSize = 512;
-
-       // Open either a temporary file or a named file
-       // (depending on value of _cachefilename)
-       void openCacheFile();
-
-       // Use this file to cache data
-       FILE* _cache;
-
-       // the input file descriptor
-       int _fd;
-
-       // transfer in progress
-       int _running;
-
-       // cache filename
-       const char* _cachefilename;
-
-       // Current size of cached data
+    /// Read buffer size
+    static const std::streamsize chunkSize = 512;
+
+    // Open either a temporary file or a named file
+    // (depending on value of _cachefilename)
+    void openCacheFile();
+
+    // Use this file to cache data
+    FILE* _cache;
+
+    // the input file descriptor
+    int _fd;
+
+    // transfer in progress
+    int _running;
+
+    // cache filename
+    const char* _cachefilename;
+
+    // Current size of cached data
     size_t _cached;
 
-       // Current read buffer
-       char _buf[chunkSize];
-
-       // Attempt at filling the cache up to the given size.
-       void fill_cache(std::streamsize size);
-
-       // Append sz bytes to the cache
+    // Current read buffer
+    char _buf[chunkSize];
+
+    // Attempt at filling the cache up to the given size.
+    void fill_cache(std::streamsize size);
+
+    // Append sz bytes to the cache
     std::streamsize cache(void *from, std::streamsize sz);
 
-       void printInfo();
+    void printInfo();
 
 };
 
@@ -143,20 +143,20 @@
 {
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
-       std::cerr << boost::format("cache(%p, %d) called") % from % sz << 
std::endl;
+    std::cerr << boost::format("cache(%p, %d) called") % from % sz << 
std::endl;
 #endif
-       // take note of current position
+    // take note of current position
     std::streampos curr_pos = std::ftell(_cache);
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
-       std::cerr << boost::format(" current position: %ld)") % curr_pos << 
std::endl;
+    std::cerr << boost::format(" current position: %ld)") % curr_pos << 
std::endl;
 #endif
 
-       // seek to the end
+    // seek to the end
     std::fseek(_cache, 0, SEEK_END);
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
-       std::cerr << boost::format(" after SEEK_END, position: %ld") %
+    std::cerr << boost::format(" after SEEK_END, position: %ld") %
         std::ftell(_cache) << std::endl;
 #endif
 
@@ -164,24 +164,24 @@
 #ifdef GNASH_NOSEEK_FD_VERBOSE
     std::cerr << boost::format(" write %d bytes") % wrote;
 #endif
-       if ( wrote < 1 )
-       {
+    if ( wrote < 1 )
+    {
         boost::format err = boost::format("writing to cache file: "
                 "requested %d, wrote %d (%s)")
             % sz % wrote % std::strerror(errno);
-                       
-               std::cerr << err << std::endl;
-               throw IOException(err.str());
-       }
+            
+        std::cerr << err << std::endl;
+        throw IOException(err.str());
+    }
 
-       _cached += sz;
+    _cached += sz;
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
     std::cerr << boost::format(" after write, position: %ld") % 
         std::ftell(_cache) << std::endl;
 #endif
 
-       // reset position for next read
+    // reset position for next read
     std::fseek(_cache, curr_pos, SEEK_SET);
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
@@ -191,7 +191,7 @@
 
     std::clearerr(_cache);
 
-       return wrote;
+    return wrote;
 }
 
 
@@ -203,84 +203,84 @@
     std::cerr << boost::format(" fill_cache(%d) called") % size << std::endl;
 #endif
 
-       assert(size >= 0);
+    assert(size >= 0);
 
-       // See how big is the cache
-       while (_cached < static_cast<size_t>(size))
-       {
+    // See how big is the cache
+    while (_cached < static_cast<size_t>(size))
+    {
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
         size_t bytesNeeded = size - _cached;
-               bytesNeeded = std::min<size_t>(bytesNeeded, chunkSize);
+        bytesNeeded = std::min<size_t>(bytesNeeded, chunkSize);
         std::cerr << boost::format(" bytes needed = %d") % bytesNeeded <<
             std::endl;
 #endif
 
         std::streamsize bytesRead = ::read(_fd, (void*)_buf, chunkSize);
-               if (bytesRead < 0)
-               {
-                       std::cerr << boost::format(_("Error reading %d bytes 
from "
+        if (bytesRead < 0)
+        {
+            std::cerr << boost::format(_("Error reading %d bytes from "
                         "input stream")) % chunkSize << std::endl;
-                       _running = false;
-                       // this looks like a CRITICAL error (since we don't 
handle it..)
-                       throw IOException("Error reading from input stream");
-               }
+            _running = false;
+            // this looks like a CRITICAL error (since we don't handle it..)
+            throw IOException("Error reading from input stream");
+        }
 
-               if (bytesRead < chunkSize)
-               {
-                       if (bytesRead == 0)
-                       {
+        if (bytesRead < chunkSize)
+        {
+            if (bytesRead == 0)
+            {
 #ifdef GNASH_NOSEEK_FD_VERBOSE
                 std::cerr << "EOF reached" << std::endl;
 #endif
-                               _running = false;
-                               return;
-                       }
-               }
-               cache(_buf, bytesRead);
-       }
+                _running = false;
+                return;
+            }
+        }
+        cache(_buf, bytesRead);
+    }
 }
 
 /*private*/
 void
 NoSeekFile::printInfo()
 {
-       std::cerr << "_cache.tell = " << tell() << std::endl;
+    std::cerr << "_cache.tell = " << tell() << std::endl;
 }
 
 /*private*/
 void
 NoSeekFile::openCacheFile()
 {
-       if ( _cachefilename )
-       {
-               _cache = fopen(_cachefilename, "w+b");
-               if ( ! _cache )
-               {
-                       throw IOException("Could not create cache file " + 
+    if ( _cachefilename )
+    {
+        _cache = fopen(_cachefilename, "w+b");
+        if ( ! _cache )
+        {
+            throw IOException("Could not create cache file " + 
                     std::string(_cachefilename));
-               }
-       }
-       else
-       {
-               _cache = tmpfile();
-               if ( ! _cache ) {
-                       throw IOException("Could not create temporary cache 
file");
-               }
-       }
+        }
+    }
+    else
+    {
+        _cache = tmpfile();
+        if ( ! _cache ) {
+            throw IOException("Could not create temporary cache file");
+        }
+    }
 
 }
 
 /*public*/
 NoSeekFile::NoSeekFile(int fd, const char* filename)
-       :
-       _fd(fd),
-       _running(1),
-       _cachefilename(filename),
-       _cached(0)
+    :
+    _fd(fd),
+    _running(1),
+    _cachefilename(filename),
+    _cached(0)
 {
-       // might throw an exception
-       openCacheFile();
+    // might throw an exception
+    openCacheFile();
 }
 
 /*public*/
@@ -294,46 +294,46 @@
 NoSeekFile::read(void *dst, std::streamsize bytes)
 {
 #ifdef GNASH_NOSEEK_FD_VERBOSE
-       std::cerr << boost::format("read_cache(%d) called") % bytes << 
std::endl;
-#endif
-
-       if (eof())
-       {
-#ifdef GNASH_NOSEEK_FD_VERBOSE
-           std::cerr << "read_cache: at eof!" << std::endl;
-#endif
-               return 0;
-       }
-
-       fill_cache(bytes + tell());
-
-#ifdef GNASH_NOSEEK_FD_VERBOSE
-       printInfo();
+    std::cerr << boost::format("read_cache(%d) called") % bytes << std::endl;
+#endif
+
+    if (eof())
+    {
+#ifdef GNASH_NOSEEK_FD_VERBOSE
+        std::cerr << "read_cache: at eof!" << std::endl;
+#endif
+        return 0;
+    }
+
+    fill_cache(bytes + tell());
+
+#ifdef GNASH_NOSEEK_FD_VERBOSE
+    printInfo();
 #endif
 
     std::streamsize ret = std::fread(dst, 1, bytes, _cache);
 
-       if (ret == 0)
-       {
-               if (std::ferror(_cache))
-               {
+    if (ret == 0)
+    {
+        if (std::ferror(_cache))
+        {
             std::cerr << "an error occurred while reading from cache" <<
                 std::endl;
-               }
+        }
 #if GNASH_NOSEEK_FD_VERBOSE
-               if (std::feof(_cache))
-               {
+        if (std::feof(_cache))
+        {
             std::cerr << "EOF reached while reading from cache" << std::endl;
-               }
+        }
 #endif
-       }
+    }
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
     std::cerr << boost::format("fread from _cache returned %d") % ret <<
         std::endl;
 #endif
 
-       return ret;
+    return ret;
 
 }
 
@@ -341,12 +341,12 @@
 bool
 NoSeekFile::eof() const
 {
-       bool ret = ( ! _running && std::feof(_cache) );
-       
+    bool ret = ( ! _running && std::feof(_cache) );
+    
 #ifdef GNASH_NOSEEK_FD_VERBOSE
-       std::cerr << boost::format("eof() returning %d") % ret << std::endl;
+    std::cerr << boost::format("eof() returning %d") % ret << std::endl;
 #endif
-       return ret;
+    return ret;
 
 }
 
@@ -357,10 +357,10 @@
     std::streampos ret = std::ftell(_cache);
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
-       std::cerr << boost::format("tell() returning %ld") % ret << std::endl;
+    std::cerr << boost::format("tell() returning %ld") % ret << std::endl;
 #endif
 
-       return ret;
+    return ret;
 
 }
 
@@ -369,18 +369,18 @@
 NoSeekFile::seek(std::streampos pos)
 {
 #ifdef GNASH_NOSEEK_FD_WARN_SEEKSBACK
-       if (pos < tell()) {
-               std::cerr << boost::format("Warning: seek backward requested "
-                               "(%ld from %ld)") % pos % tell() << std::endl;
-       }
+    if (pos < tell()) {
+        std::cerr << boost::format("Warning: seek backward requested "
+                        "(%ld from %ld)") % pos % tell() << std::endl;
+    }
 #endif
 
-       fill_cache(pos);
+    fill_cache(pos);
 
-       if (std::fseek(_cache, pos, SEEK_SET) == -1) {
-               std::cerr << "Warning: fseek failed" << std::endl;
-               return false;
-       } 
+    if (std::fseek(_cache, pos, SEEK_SET) == -1) {
+        std::cerr << "Warning: fseek failed" << std::endl;
+        return false;
+    } 
     
     return true;
 
@@ -397,20 +397,20 @@
 make_stream(int fd, const char* cachefilename)
 {
 #ifdef GNASH_NOSEEK_FD_VERBOSE
-       std::cerr << boost::format("making NoSeekFile stream for fd %d") % fd 
<< std::endl;
+    std::cerr << boost::format("making NoSeekFile stream for fd %d") % fd << 
std::endl;
 #endif
 
-       NoSeekFile* stream = NULL;
-
-       try {
-               stream = new NoSeekFile(fd, cachefilename);
-       } catch (const std::exception& ex) {
-               std::cerr << boost::format("NoSeekFile stream: %s") % ex.what() 
<< std::endl;
-               delete stream;
-               return NULL;
-       }
-
-       return stream;
+    NoSeekFile* stream = NULL;
+
+    try {
+        stream = new NoSeekFile(fd, cachefilename);
+    } catch (const std::exception& ex) {
+        std::cerr << boost::format("NoSeekFile stream: %s") % ex.what() << 
std::endl;
+        delete stream;
+        return NULL;
+    }
+
+    return stream;
 }
 
 } // namespace gnash::noseek_fd_adapter

=== modified file 'libbase/ogl.h'
--- a/libbase/ogl.h     2008-03-27 16:12:31 +0000
+++ b/libbase/ogl.h     2010-01-18 07:33:35 +0000
@@ -1,4 +1,4 @@
-// ogl.h       -- by Thatcher Ulrich <address@hidden>
+// ogl.h    -- by Thatcher Ulrich <address@hidden>
 
 // This source code has been donated to the Public Domain.  Do
 // whatever you want with it.
@@ -13,36 +13,36 @@
 
 namespace ogl
 {
-void   open();
-void   close();
+void    open();
+void    close();
 
 // Return true if the specified extension is available.
-bool   check_extension(const char* extension);
+bool    check_extension(const char* extension);
 
 // Return GL_CLAMP, or GL_CLAMP_TO_EDGE_EXT, depending on
 // which is available.  I pretty much always want the
 // GL_CLAMP_TO_EDGE_EXT behavior, but it's not in the OpenGL
 // 1.1 standard, so in those cases I must fall back to
 // GL_CLAMP.
-int    get_clamp_mode();
+int    get_clamp_mode();
 
 // For allocating DMA or video memory, for holding vertex arrays.
-void*  allocate_vertex_memory( int size );     // @@ add a flag for selecting 
AGP vs. video mem?
-void   free_vertex_memory( void* buffer );
+void*    allocate_vertex_memory( int size );    // @@ add a flag for selecting 
AGP vs. video mem?
+void    free_vertex_memory( void* buffer );
 
 // Fences; for synchronizing with the GPU.
-void   gen_fences(int count, unsigned int* fence_array);
-void   set_fence(unsigned int fence_id);
-void   finish_fence(unsigned int fence_id);
+void    gen_fences(int count, unsigned int* fence_array);
+void    set_fence(unsigned int fence_id);
+void    finish_fence(unsigned int fence_id);
 
 // Stream operations; for pushing dynamic vertex data.
-void*  stream_get_vertex_memory(int size);
-void   stream_flush_combiners();       // do this after filling your buffer, 
and before calling glDrawElements()
+void*    stream_get_vertex_memory(int size);
+void    stream_flush_combiners();    // do this after filling your buffer, and 
before calling glDrawElements()
 
 // Rudimentary multitexture stuff.
-void   client_active_texture(int stage);
-void   multi_tex_coord_2f(int stage, float s, float t);
-void   multi_tex_coord_2fv(int stage, float* st);
+void    client_active_texture(int stage);
+void    multi_tex_coord_2f(int stage, float s, float t);
+void    multi_tex_coord_2fv(int stage, float* st);
 }
 
 

=== modified file 'libbase/rc.cpp'
--- a/libbase/rc.cpp    2010-01-11 06:41:38 +0000
+++ b/libbase/rc.cpp    2010-01-18 07:23:41 +0000
@@ -586,36 +586,32 @@
                              % variable % filespec % lineno << endl;
             }
         }
-        else if (noCaseCompare(action, "include") )
-        {
+        else if (noCaseCompare(action, "include")) {
             //cout << "Include directive in " << filespec << endl; 
             // TODO: resolve relative paths ?
             // TODO: skip parsing if already parsed ?
             //       (would mess up user-requested parsing order, but
             //       would be safe in case of circular includes)
             //
-            if ( variable.empty() )
-            {
-                cerr << boost::format(_("Warning: empty include specification 
in rcfile %s, line %d"))
-                    % filespec % lineno << endl;
+            if (variable.empty()) {
+                cerr << boost::format(_("Warning: empty include "
+                            "specification in rcfile %s, line %d"))
+                            % filespec % lineno << endl;
             }
-            else
-            {
-                if ( variable[0] != '/' )
-                {
-                    cerr << boost::format(_("Warning: include specification 
must be an absolute path"
-                        "in rcfile %s, line %d")) % filespec % lineno << endl;
+            else {
+                if ( variable[0] != '/' ) {
+                    cerr << boost::format(_("Warning: include specification "
+                                "must be an absolute path in rcfile %s, "
+                                "line %d")) % filespec % lineno << endl;
                 }
-                else
-                {
+                else {
                     parseFile(variable);
                 }
             }
         }
-        else
-        {
-            cerr << boost::format(_("Warning: unrecognized action \"%s\" in 
rcfile %s, "
-                "line %d")) % action % filespec % lineno << endl;
+        else {
+            cerr << boost::format(_("Warning: unrecognized action \"%s\" in "
+                "rcfile %s, line %d")) % action % filespec % lineno << endl;
         }
     }
 

=== modified file 'libbase/sharedlib.cpp'
--- a/libbase/sharedlib.cpp     2010-01-11 06:41:38 +0000
+++ b/libbase/sharedlib.cpp     2010-01-18 06:21:46 +0000
@@ -60,8 +60,6 @@
 # define PLUGINSDIR "./"
 #endif
 
-using namespace std;
-
 namespace gnash {
 
 SharedLib::SharedLib(const std::string& filespec)
@@ -80,7 +78,7 @@
         log_error (_("Couldn't initialize ltdl: %s"), lt_dlerror());
     }
     
-    string pluginsdir;
+    std::string pluginsdir;
     char *env = std::getenv (envvar.c_str());
     if (env) {
         pluginsdir = env;

=== modified file 'libbase/utf8.cpp'
--- a/libbase/utf8.cpp  2010-01-01 17:48:26 +0000
+++ b/libbase/utf8.cpp  2010-01-18 07:23:41 +0000
@@ -30,34 +30,34 @@
 std::wstring
 utf8::decodeCanonicalString(const std::string& str, int version)
 {
-       
-       std::wstring wstr;
-       
-       std::string::const_iterator it = str.begin(), e = str.end();
-       
-       if (version > 5)
-       {
-               while (boost::uint32_t code = decodeNextUnicodeCharacter(it, e))
-               {
-                   if (code == utf8::invalid)
-                   {
-                           wstr.push_back(static_cast<wchar_t>(INVALID_CHAR));
-                           continue;       
-                   }
-                   wstr.push_back(static_cast<wchar_t>(code));
-               }
-       }
-       else
-       {
-               while (it != str.end())
-               {
-                       // This mangles UTF-8 (UCS4) strings, but is what is
-                       // wanted for SWF5.
-                       wstr.push_back(static_cast<unsigned char>(*it++));
-               }
-       }
-       
-       return wstr;
+    
+    std::wstring wstr;
+    
+    std::string::const_iterator it = str.begin(), e = str.end();
+    
+    if (version > 5)
+    {
+        while (boost::uint32_t code = decodeNextUnicodeCharacter(it, e))
+        {
+            if (code == utf8::invalid)
+            {
+                wstr.push_back(static_cast<wchar_t>(INVALID_CHAR));
+                continue;        
+            }
+            wstr.push_back(static_cast<wchar_t>(code));
+        }
+    }
+    else
+    {
+        while (it != str.end())
+        {
+            // This mangles UTF-8 (UCS4) strings, but is what is
+            // wanted for SWF5.
+            wstr.push_back(static_cast<unsigned char>(*it++));
+        }
+    }
+    
+    return wstr;
 
 }
 
@@ -65,25 +65,25 @@
 utf8::encodeCanonicalString(const std::wstring& wstr, int version)
 {
 
-       std::string str;
-       
-       std::wstring::const_iterator it = wstr.begin();
-       while ( it != wstr.end())
-       {
-               if (version > 5) str.append(encodeUnicodeCharacter(*it++));
-               else str.append(encodeLatin1Character(*it++));
-       }
-       
-       return str;
+    std::string str;
+    
+    std::wstring::const_iterator it = wstr.begin();
+    while ( it != wstr.end())
+    {
+        if (version > 5) str.append(encodeUnicodeCharacter(*it++));
+        else str.append(encodeLatin1Character(*it++));
+    }
+    
+    return str;
 
 }
 
 std::string
 utf8::encodeLatin1Character(boost::uint32_t ucsCharacter)
 {
-       std::string text;
-       text.push_back(static_cast<unsigned char>(ucsCharacter));
-       return text;
+    std::string text;
+    text.push_back(static_cast<unsigned char>(ucsCharacter));
+    return text;
 }
 
 
@@ -91,97 +91,97 @@
 utf8::decodeNextUnicodeCharacter(std::string::const_iterator& it,
                                  const std::string::const_iterator& e)
 {
-       boost::uint32_t uc;
-
-       // Security considerations:
-       //
-       // If we hit a zero byte, we want to return 0 without stepping
-       // the buffer pointer past the 0.
-       //
-       // If we hit an "overlong sequence"; i.e. a character encoded
-       // in a longer multibyte string than is necessary, then we
-       // need to discard the character.  This is so attackers can't
-       // disguise dangerous characters or character sequences --
-       // there is only one valid encoding for each character.
-       //
-       // If we decode characters { 0xD800 .. 0xDFFF } or { 0xFFFE,
-       // 0xFFFF } then we ignore them; they are not valid in UTF-8.
-
-#define FIRST_BYTE(mask, shift)                \
-       /* Post-increment iterator */ \
-       uc = (*it++ & (mask)) << (shift);
-
-#define NEXT_BYTE(shift)                                               \
-                                       \
-       if (it == e || *it == 0) return 0; /* end of buffer, do not advance */  
\
-       if ((*it & 0xC0) != 0x80) return utf8::invalid; /* standard check */    
\
-       /* Post-increment iterator: */          \
-       uc |= (*it++ & 0x3F) << shift;
-
-       if (it == e || *it == 0) return 0;      // End of buffer.  Do not 
advance.
-
-       // Conventional 7-bit ASCII; return and increment iterator:
-       if ((*it & 0x80) == 0) return static_cast<boost::uint32_t>(*it++);
-
-       // Multi-byte sequences
-       if ((*it & 0xE0) == 0xC0)
-       {
-               // Two-byte sequence.
-               FIRST_BYTE(0x1F, 6);
-               NEXT_BYTE(0);
-               if (uc < 0x80) return utf8::invalid;    // overlong
-               return uc;
-       }
-       else if ((*it & 0xF0) == 0xE0)
-       {
-               // Three-byte sequence.
-               FIRST_BYTE(0x0F, 12);
-               NEXT_BYTE(6);
-               NEXT_BYTE(0);
-               if (uc < 0x800) return utf8::invalid;   // overlong
-               if (uc >= 0x0D800 && uc <= 0x0DFFF) return utf8::invalid;       
// not valid ISO 10646
-               if (uc == 0x0FFFE || uc == 0x0FFFF) return utf8::invalid;       
// not valid ISO 10646
-               return uc;
-       }
-       else if ((*it & 0xF8) == 0xF0)
-       {
-               // Four-byte sequence.
-               FIRST_BYTE(0x07, 18);
-               NEXT_BYTE(12);
-               NEXT_BYTE(6);
-               NEXT_BYTE(0);
-               if (uc < 0x010000) return utf8::invalid;        // overlong
-               return uc;
-       }
-       else if ((*it & 0xFC) == 0xF8)
-       {
-               // Five-byte sequence.
-               FIRST_BYTE(0x03, 24);
-               NEXT_BYTE(18);
-               NEXT_BYTE(12);
-               NEXT_BYTE(6);
-               NEXT_BYTE(0);
-               if (uc < 0x0200000) return utf8::invalid;       // overlong
-               return uc;
-       }
-       else if ((*it & 0xFE) == 0xFC)
-       {
-               // Six-byte sequence.
-               FIRST_BYTE(0x01, 30);
-               NEXT_BYTE(24);
-               NEXT_BYTE(18);
-               NEXT_BYTE(12);
-               NEXT_BYTE(6);
-               NEXT_BYTE(0);
-               if (uc < 0x04000000) return utf8::invalid;      // overlong
-               return uc;
-       }
-       else
-       {
-               // Invalid.
-               it++;
-               return utf8::invalid;
-       }
+    boost::uint32_t    uc;
+
+    // Security considerations:
+    //
+    // If we hit a zero byte, we want to return 0 without stepping
+    // the buffer pointer past the 0.
+    //
+    // If we hit an "overlong sequence"; i.e. a character encoded
+    // in a longer multibyte string than is necessary, then we
+    // need to discard the character.  This is so attackers can't
+    // disguise dangerous characters or character sequences --
+    // there is only one valid encoding for each character.
+    //
+    // If we decode characters { 0xD800 .. 0xDFFF } or { 0xFFFE,
+    // 0xFFFF } then we ignore them; they are not valid in UTF-8.
+
+#define FIRST_BYTE(mask, shift)        \
+    /* Post-increment iterator */ \
+    uc = (*it++ & (mask)) << (shift);
+
+#define NEXT_BYTE(shift)                        \
+                    \
+    if (it == e || *it == 0) return 0; /* end of buffer, do not advance */    \
+    if ((*it & 0xC0) != 0x80) return utf8::invalid; /* standard check */    \
+    /* Post-increment iterator: */        \
+    uc |= (*it++ & 0x3F) << shift;
+
+    if (it == e || *it == 0) return 0;    // End of buffer.  Do not advance.
+
+    // Conventional 7-bit ASCII; return and increment iterator:
+    if ((*it & 0x80) == 0) return static_cast<boost::uint32_t>(*it++);
+
+    // Multi-byte sequences
+    if ((*it & 0xE0) == 0xC0)
+    {
+        // Two-byte sequence.
+        FIRST_BYTE(0x1F, 6);
+        NEXT_BYTE(0);
+        if (uc < 0x80) return utf8::invalid;    // overlong
+        return uc;
+    }
+    else if ((*it & 0xF0) == 0xE0)
+    {
+        // Three-byte sequence.
+        FIRST_BYTE(0x0F, 12);
+        NEXT_BYTE(6);
+        NEXT_BYTE(0);
+        if (uc < 0x800) return utf8::invalid;    // overlong
+        if (uc >= 0x0D800 && uc <= 0x0DFFF) return utf8::invalid;    // not 
valid ISO 10646
+        if (uc == 0x0FFFE || uc == 0x0FFFF) return utf8::invalid;    // not 
valid ISO 10646
+        return uc;
+    }
+    else if ((*it & 0xF8) == 0xF0)
+    {
+        // Four-byte sequence.
+        FIRST_BYTE(0x07, 18);
+        NEXT_BYTE(12);
+        NEXT_BYTE(6);
+        NEXT_BYTE(0);
+        if (uc < 0x010000) return utf8::invalid;    // overlong
+        return uc;
+    }
+    else if ((*it & 0xFC) == 0xF8)
+    {
+        // Five-byte sequence.
+        FIRST_BYTE(0x03, 24);
+        NEXT_BYTE(18);
+        NEXT_BYTE(12);
+        NEXT_BYTE(6);
+        NEXT_BYTE(0);
+        if (uc < 0x0200000) return utf8::invalid;    // overlong
+        return uc;
+    }
+    else if ((*it & 0xFE) == 0xFC)
+    {
+        // Six-byte sequence.
+        FIRST_BYTE(0x01, 30);
+        NEXT_BYTE(24);
+        NEXT_BYTE(18);
+        NEXT_BYTE(12);
+        NEXT_BYTE(6);
+        NEXT_BYTE(0);
+        if (uc < 0x04000000) return utf8::invalid;    // overlong
+        return uc;
+    }
+    else
+    {
+        // Invalid.
+        it++;
+        return utf8::invalid;
+    }
 }
 
 // TODO: buffer as std::string; index (iterator); 
@@ -190,59 +190,59 @@
 utf8::encodeUnicodeCharacter(boost::uint32_t ucs_character)
 {
 
-       std::string text;
+    std::string text;
 
-       if (ucs_character <= 0x7F)
-       {
-               // Plain single-byte ASCII.
-               text.push_back(ucs_character);
-       }
-       else if (ucs_character <= 0x7FF)
-       {
-               // Two bytes.
-               text.push_back(0xC0 | (ucs_character >> 6));
-               text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
-       }
-       else if (ucs_character <= 0xFFFF)
-       {
-               // Three bytes.
-               text.push_back(0xE0 | (ucs_character >> 12));
-               text.push_back(0x80 | ((ucs_character >> 6) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
-       }
-       else if (ucs_character <= 0x1FFFFF)
-       {
-               // Four bytes.
-               text.push_back(0xF0 | (ucs_character >> 18));
-               text.push_back(0x80 | ((ucs_character >> 12) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 6) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
-       }
-       else if (ucs_character <= 0x3FFFFFF)
-       {
-               // Five bytes.
-               text.push_back(0xF8 | (ucs_character >> 24));
-               text.push_back(0x80 | ((ucs_character >> 18) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 12) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 6) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
-       }
-       else if (ucs_character <= 0x7FFFFFFF)
-       {
-               // Six bytes.
-               text.push_back(0xFC | (ucs_character >> 30));
-               text.push_back(0x80 | ((ucs_character >> 24) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 18) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 12) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 6) & 0x3F));
-               text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
-       }
-       else
-       {
-               // Invalid char; don't encode anything.
-       }
-       
-       return text;
+    if (ucs_character <= 0x7F)
+    {
+        // Plain single-byte ASCII.
+        text.push_back(ucs_character);
+    }
+    else if (ucs_character <= 0x7FF)
+    {
+        // Two bytes.
+        text.push_back(0xC0 | (ucs_character >> 6));
+        text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
+    }
+    else if (ucs_character <= 0xFFFF)
+    {
+        // Three bytes.
+        text.push_back(0xE0 | (ucs_character >> 12));
+        text.push_back(0x80 | ((ucs_character >> 6) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
+    }
+    else if (ucs_character <= 0x1FFFFF)
+    {
+        // Four bytes.
+        text.push_back(0xF0 | (ucs_character >> 18));
+        text.push_back(0x80 | ((ucs_character >> 12) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 6) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
+    }
+    else if (ucs_character <= 0x3FFFFFF)
+    {
+        // Five bytes.
+        text.push_back(0xF8 | (ucs_character >> 24));
+        text.push_back(0x80 | ((ucs_character >> 18) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 12) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 6) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
+    }
+    else if (ucs_character <= 0x7FFFFFFF)
+    {
+        // Six bytes.
+        text.push_back(0xFC | (ucs_character >> 30));
+        text.push_back(0x80 | ((ucs_character >> 24) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 18) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 12) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 6) & 0x3F));
+        text.push_back(0x80 | ((ucs_character >> 0) & 0x3F));
+    }
+    else
+    {
+        // Invalid char; don't encode anything.
+    }
+    
+    return text;
 }
 
 
@@ -254,72 +254,75 @@
 char*
 utf8::stripBOM(char* in, size_t& size, TextEncoding& encoding)
 {
-       encoding = encUNSPECIFIED;
-       if ( size > 2 )
-       {
-               // need *ptr to be unsigned or cast all 0xNN
-               unsigned char* ptr = reinterpret_cast<unsigned char*>(in);
-
-               if ( *ptr == 0xFF && *(ptr+1) == 0xFE )
-               {
-                       // Text is UTF-16 LE
-                       encoding = encUTF16LE;
-                       in+=2;
-                       size-=2;
-               }
-               else if ( *ptr == 0xFE && *(ptr+1) == 0xFF )
-               {
-                       // Text is UTF-16 BE
-                       encoding = encUTF16BE;
-                       in+=2;
-                       size-=2;
-               }
-               else if ( size > 3 && *ptr == 0xEF && *(ptr+1) == 0xBB && 
*(ptr+2) == 0xBF )
-               {
-                       // Text is UTF-8
-                       encoding = encUTF8;
-                       in+=3;
-                       size-=3;
-               }
-               else if ( size > 4 && *ptr == 0x00 && *(ptr+1) == 0x00 && 
*(ptr+2) == 0xFE && *(ptr+3) == 0xFF )
-               {
-                       // Text is UTF-32 BE
-                       encoding = encUTF32BE;
-                       in+=4;
-                       size-=4;
-               }
-               else if ( size > 4 && *ptr == 0xFF && *(ptr+1) == 0xFE && 
*(ptr+2) == 0x00 && *(ptr+3) == 0x00 )
-               {
-                       // Text is UTF-32 LE
-                       encoding = encUTF32LE;
-                       in+=4;
-                       size-=4;
-               }
-
-               // TODO: check other kinds of boms !
-               // See 
http://en.wikipedia.org/wiki/Byte-order_mark#Representations_of_byte_order_marks_by_encoding
-       }
-
-       return in;
+    encoding = encUNSPECIFIED;
+    if ( size > 2 )
+    {
+        // need *ptr to be unsigned or cast all 0xNN
+        unsigned char* ptr = reinterpret_cast<unsigned char*>(in);
+
+        if ( *ptr == 0xFF && *(ptr+1) == 0xFE )
+        {
+            // Text is UTF-16 LE
+            encoding = encUTF16LE;
+            in+=2;
+            size-=2;
+        }
+        else if ( *ptr == 0xFE && *(ptr+1) == 0xFF )
+        {
+            // Text is UTF-16 BE
+            encoding = encUTF16BE;
+            in+=2;
+            size-=2;
+        }
+        else if (size > 3 && *ptr == 0xEF && *(ptr+1) == 0xBB &&
+                *(ptr+2) == 0xBF )
+        {
+            // Text is UTF-8
+            encoding = encUTF8;
+            in+=3;
+            size-=3;
+        }
+        else if ( size > 4 && *ptr == 0x00 && *(ptr+1) == 0x00 &&
+                *(ptr+2) == 0xFE && *(ptr+3) == 0xFF )
+        {
+            // Text is UTF-32 BE
+            encoding = encUTF32BE;
+            in+=4;
+            size-=4;
+        }
+        else if ( size > 4 && *ptr == 0xFF && *(ptr+1) == 0xFE &&
+                *(ptr+2) == 0x00 && *(ptr+3) == 0x00 )
+        {
+            // Text is UTF-32 LE
+            encoding = encUTF32LE;
+            in+=4;
+            size-=4;
+        }
+
+        // TODO: check other kinds of boms !
+        // See 
http://en.wikipedia.org/wiki/Byte-order_mark#Representations_of_byte_order_marks_by_encoding
+    }
+
+    return in;
 }
 
 const char*
 utf8::textEncodingName(TextEncoding enc)
 {
-       switch (enc)
-       {
-               case encUNSPECIFIED: return "Unspecified";
-               case encUTF8: return "UTF8";
-               case encUTF16BE: return "UTF16BE";
-               case encUTF16LE: return "UTF16LE";
-               case encUTF32BE: return "UTF32BE";
-               case encUTF32LE: return "UTF32LE";
-               case encSCSU: return "SCSU";
-               case encUTF7: return "UTF7";
-               case encUTFEBCDIC: return "UTFEBCDIC";
-               case encBOCU1: return "BOCU1";
-               default: return "INVALID";
-       }
+    switch (enc)
+    {
+        case encUNSPECIFIED: return "Unspecified";
+        case encUTF8: return "UTF8";
+        case encUTF16BE: return "UTF16BE";
+        case encUTF16LE: return "UTF16LE";
+        case encUTF32BE: return "UTF32BE";
+        case encUTF32LE: return "UTF32LE";
+        case encSCSU: return "SCSU";
+        case encUTF7: return "UTF7";
+        case encUTFEBCDIC: return "UTFEBCDIC";
+        case encBOCU1: return "BOCU1";
+        default: return "INVALID";
+    }
 }
 
 

=== modified file 'libbase/utf8.h'
--- a/libbase/utf8.h    2010-01-01 17:48:26 +0000
+++ b/libbase/utf8.h    2010-01-18 07:35:15 +0000
@@ -57,89 +57,89 @@
 {
     static const boost::uint32_t invalid = 
std::numeric_limits<boost::uint32_t>::max();
 
-       /// Converts a std::string with multibyte characters into a 
std::wstring.
-       //
-       /// @return a version-dependent wstring.
-       /// @param str the canonical string to convert.
-       /// @param version the SWF version, used to decide how to decode the 
string.
-       //
-       /// For SWF5, UTF-8 (or any other) multibyte encoded characters are
-       /// converted char by char, mangling the string. 
-       DSOEXPORT std::wstring decodeCanonicalString(const std::string& str, 
int version);
-
-       /// Converts a std::wstring into canonical std::string.
-       //
-       /// @return a version-dependent encoded std::string.
-       /// @param wstr the wide string to convert.
-       /// @param version the SWF version, used to decide how to encode the 
string.
-       ///
-       /// For SWF 5, each character is stored as an 8-bit (at least) char, 
rather
-       /// than converting it to a canonical UTF-8 byte sequence. Gnash can 
then
-       /// distinguish between 8-bit characters, which it handles correctly, 
and 
-       /// multi-byte characters, which are regarded as multiple characters for
-       /// string methods. 
-       DSOEXPORT std::string encodeCanonicalString(const std::wstring& wstr, 
int version);
-
-       /// Return the next Unicode character in the UTF-8 encoded string.
-       //
-       /// Invalid UTF-8 sequences produce a U+FFFD character
-       /// as output.  Advances string iterator past the character
-       /// returned, unless the returned character is '\0', in which
-       /// case the iterator does not advance.
-       DSOEXPORT boost::uint32_t 
decodeNextUnicodeCharacter(std::string::const_iterator& it,
-                                                            const 
std::string::const_iterator& e);
-
-       /// \brief Encodes the given wide character into a canonical
-       /// string, theoretically up to 6 chars in length.
-       DSOEXPORT std::string encodeUnicodeCharacter(boost::uint32_t 
ucs_character);
-       
-       /// Encodes the given wide character into an at least 8-bit character.
-       //
-       /// Allows storage of Latin1 (ISO-8859-1) characters. This
-       /// is the format of SWF5 and below.
-       DSOEXPORT std::string encodeLatin1Character(boost::uint32_t 
ucsCharacter);
-
-       enum TextEncoding {
-               encUNSPECIFIED,
-               encUTF8,
-               encUTF16BE,
-               encUTF16LE,
-               encUTF32BE,
-               encUTF32LE,
-               encSCSU,
-               encUTF7,
-               encUTFEBCDIC,
-               encBOCU1
-       };
-
-       /// Interpret (and skip) Byte Order Mark in input stream
-       //
-       /// This function takes a pointer to a buffer and returns
-       /// the start of actual data after an eventual BOM.
-       /// No conversion is performed, no bytes copy, just skipping of
-       /// the BOM snippet and interpretation of it returned to the
-       /// encoding input parameter.
-       ///
-       /// See http://en.wikipedia.org/wiki/Byte-order_mark
-       ///
-       /// @param in
-       ///     The input buffer.
-       ///
-       /// @param size
-       ///     Size of the input buffer, will be decremented by the
-       ///     size of the BOM, if any.
-       ///
-       /// @param encoding
-       ///     Output parameter, will always be set.
-       ///     encUNSPECIFIED if no BOM is found.
-       ///
-       /// @returns
-       ///     A pointer either equal to 'in' or some bytes inside it.
-       ///
-       DSOEXPORT char* stripBOM(char* in, size_t& size, TextEncoding& 
encoding);
-
-       /// Return name of a text encoding
-       DSOEXPORT const char* textEncodingName(TextEncoding enc);
+    /// Converts a std::string with multibyte characters into a std::wstring.
+    //
+    /// @return a version-dependent wstring.
+    /// @param str the canonical string to convert.
+    /// @param version the SWF version, used to decide how to decode the 
string.
+    //
+    /// For SWF5, UTF-8 (or any other) multibyte encoded characters are
+    /// converted char by char, mangling the string. 
+    DSOEXPORT std::wstring decodeCanonicalString(const std::string& str, int 
version);
+
+    /// Converts a std::wstring into canonical std::string.
+    //
+    /// @return a version-dependent encoded std::string.
+    /// @param wstr the wide string to convert.
+    /// @param version the SWF version, used to decide how to encode the 
string.
+    ///
+    /// For SWF 5, each character is stored as an 8-bit (at least) char, rather
+    /// than converting it to a canonical UTF-8 byte sequence. Gnash can then
+    /// distinguish between 8-bit characters, which it handles correctly, and 
+    /// multi-byte characters, which are regarded as multiple characters for
+    /// string methods. 
+    DSOEXPORT std::string encodeCanonicalString(const std::wstring& wstr, int 
version);
+
+    /// Return the next Unicode character in the UTF-8 encoded string.
+    //
+    /// Invalid UTF-8 sequences produce a U+FFFD character
+    /// as output.  Advances string iterator past the character
+    /// returned, unless the returned character is '\0', in which
+    /// case the iterator does not advance.
+    DSOEXPORT boost::uint32_t 
decodeNextUnicodeCharacter(std::string::const_iterator& it,
+                                                         const 
std::string::const_iterator& e);
+
+    /// \brief Encodes the given wide character into a canonical
+    /// string, theoretically up to 6 chars in length.
+    DSOEXPORT std::string encodeUnicodeCharacter(boost::uint32_t 
ucs_character);
+    
+    /// Encodes the given wide character into an at least 8-bit character.
+    //
+    /// Allows storage of Latin1 (ISO-8859-1) characters. This
+    /// is the format of SWF5 and below.
+    DSOEXPORT std::string encodeLatin1Character(boost::uint32_t ucsCharacter);
+
+    enum TextEncoding {
+        encUNSPECIFIED,
+        encUTF8,
+        encUTF16BE,
+        encUTF16LE,
+        encUTF32BE,
+        encUTF32LE,
+        encSCSU,
+        encUTF7,
+        encUTFEBCDIC,
+        encBOCU1
+    };
+
+    /// Interpret (and skip) Byte Order Mark in input stream
+    //
+    /// This function takes a pointer to a buffer and returns
+    /// the start of actual data after an eventual BOM.
+    /// No conversion is performed, no bytes copy, just skipping of
+    /// the BOM snippet and interpretation of it returned to the
+    /// encoding input parameter.
+    ///
+    /// See http://en.wikipedia.org/wiki/Byte-order_mark
+    ///
+    /// @param in
+    ///    The input buffer.
+    ///
+    /// @param size
+    ///    Size of the input buffer, will be decremented by the
+    ///    size of the BOM, if any.
+    ///
+    /// @param encoding
+    ///    Output parameter, will always be set.
+    ///    encUNSPECIFIED if no BOM is found.
+    ///
+    /// @returns
+    ///    A pointer either equal to 'in' or some bytes inside it.
+    ///
+    DSOEXPORT char* stripBOM(char* in, size_t& size, TextEncoding& encoding);
+
+    /// Return name of a text encoding
+    DSOEXPORT const char* textEncodingName(TextEncoding enc);
 }
 
 

=== modified file 'libbase/zlib_adapter.cpp'
--- a/libbase/zlib_adapter.cpp  2009-09-18 01:32:01 +0000
+++ b/libbase/zlib_adapter.cpp  2010-01-18 07:15:41 +0000
@@ -1,4 +1,4 @@
-// zlib_adapter.cpp    -- Thatcher Ulrich 2003
+// zlib_adapter.cpp    -- Thatcher Ulrich 2003
 
 // This source code has been donated to the Public Domain.  Do
 // whatever you want with it.
@@ -25,17 +25,17 @@
 // Stubs, in case client doesn't want to link to zlib.
 namespace zlib_adapter
 {
-       std::auto_ptr<IOChannel> make_inflater(std::auto_ptr<IOChannel> /*in*/)
-       {
-               abort(); // callers should check this themselves
-               return std::auto_ptr<IOChannel>(NULL);
-       }
+    std::auto_ptr<IOChannel> make_inflater(std::auto_ptr<IOChannel> /*in*/)
+    {
+        abort(); // callers should check this themselves
+        return std::auto_ptr<IOChannel>(NULL);
+    }
 
-       IOChannel* make_deflater(IOChannel* /*out*/)
-       {
-               abort(); // callers should check this themselves
-               return NULL;
-       }
+    IOChannel* make_deflater(IOChannel* /*out*/)
+    {
+        abort(); // callers should check this themselves
+        return NULL;
+    }
 }
 
 
@@ -52,79 +52,79 @@
 {
 public:
 
-       /// Constructor.
-       InflaterIOChannel(std::auto_ptr<IOChannel> in);
-
-       ~InflaterIOChannel() {
-               rewind_unused_bytes();
-               inflateEnd(&(m_zstream));
-       }
-
-       // See dox in IOChannel
-       virtual bool seek(std::streampos pos);
-
-       // See dox in IOChannel
-       virtual std::streamsize read(void* dst, std::streamsize bytes)
-       {
-               if (m_error) return 0;
-               return inflate_from_stream(dst, bytes);
-       }
-
-       // See dox in IOChannel
-       virtual void go_to_end();
-
-       // See dox in IOChannel
-       virtual std::streampos tell() const
-       {
-               return m_logical_stream_pos;
-       }
-
-       // See dox in IOChannel
-       virtual bool eof() const
-       {
-               return m_at_eof;
-       }
-
-       // See dox in IOChannel
-       virtual bool bad() const
-       {
-               return m_error;
-       }
+    /// Constructor.
+    InflaterIOChannel(std::auto_ptr<IOChannel> in);
+
+    ~InflaterIOChannel() {
+        rewind_unused_bytes();
+        inflateEnd(&(m_zstream));
+    }
+
+    // See dox in IOChannel
+    virtual bool seek(std::streampos pos);
+
+    // See dox in IOChannel
+    virtual std::streamsize read(void* dst, std::streamsize bytes)
+    {
+        if (m_error) return 0;
+        return inflate_from_stream(dst, bytes);
+    }
+
+    // See dox in IOChannel
+    virtual void go_to_end();
+
+    // See dox in IOChannel
+    virtual std::streampos tell() const
+    {
+        return m_logical_stream_pos;
+    }
+
+    // See dox in IOChannel
+    virtual bool eof() const
+    {
+        return m_at_eof;
+    }
+
+    // See dox in IOChannel
+    virtual bool bad() const
+    {
+        return m_error;
+    }
 
 private:
 
     static const int ZBUF_SIZE = 4096;
 
-       std::auto_ptr<IOChannel> m_in;
+    std::auto_ptr<IOChannel> m_in;
 
-       // position of the input stream where we started inflating.
+    // position of the input stream where we started inflating.
     std::streampos m_initial_stream_pos;
-       
+    
     unsigned char m_rawdata[ZBUF_SIZE];
-       
+    
     z_stream m_zstream;
 
-       // current stream position of uncompressed data.
+    // current stream position of uncompressed data.
     std::streampos m_logical_stream_pos;
 
-       bool m_at_eof;
-       bool m_error;
+    bool m_at_eof;
+    bool m_error;
 
-       /// Discard current results and rewind to the beginning.
-       //
-       //
-       /// Necessary in order to seek backwards.
-       ///
-       /// might throw a ParserException if unable to reset the uderlying
-       /// stream to original position.
-       ///
-       void reset();
+    /// Discard current results and rewind to the beginning.
+    //
+    //
+    /// Necessary in order to seek backwards.
+    ///
+    /// might throw a ParserException if unable to reset the uderlying
+    /// stream to original position.
+    ///
+    void reset();
 
     std::streamsize inflate_from_stream(void* dst, std::streamsize bytes);
 
-       // If we have unused bytes in our input buffer, rewind
-       // to before they started.
-       void rewind_unused_bytes();
+    // If we have unused bytes in our input buffer, rewind
+    // to before they started.
+    void rewind_unused_bytes();
 
 };
 
@@ -133,241 +133,241 @@
 void
 InflaterIOChannel::rewind_unused_bytes()
 {
-       if (m_zstream.avail_in > 0)
-       {
-               int     pos = m_in->tell();
-               int     rewound_pos = pos - m_zstream.avail_in;
-               assert(pos >= 0);
-               assert(pos >= m_initial_stream_pos);
-               assert(rewound_pos >= 0);
-               assert(rewound_pos >= m_initial_stream_pos);
+    if (m_zstream.avail_in > 0)
+    {
+        int    pos = m_in->tell();
+        int    rewound_pos = pos - m_zstream.avail_in;
+        assert(pos >= 0);
+        assert(pos >= m_initial_stream_pos);
+        assert(rewound_pos >= 0);
+        assert(rewound_pos >= m_initial_stream_pos);
 
-               m_in->seek(rewound_pos);
-       }
+        m_in->seek(rewound_pos);
+    }
 }
 
 void
 InflaterIOChannel::reset()
 {
-       m_error = 0;
-       m_at_eof = 0;
-       int     err = inflateReset(&m_zstream);
-       if (err != Z_OK) {
-               log_error("inflater_impl::reset() inflateReset() returned %d", 
err);
-               m_error = 1;
-               return;
-       }
-
-       m_zstream.next_in = 0;
-       m_zstream.avail_in = 0;
-
-       m_zstream.next_out = 0;
-       m_zstream.avail_out = 0;
-
-       // Rewind the underlying stream.
-       if (!m_in->seek(m_initial_stream_pos))
-       {
-               std::stringstream ss;
-               ss << "inflater_impl::reset: unable to seek underlying "
+    m_error = 0;
+    m_at_eof = 0;
+    int    err = inflateReset(&m_zstream);
+    if (err != Z_OK) {
+        log_error("inflater_impl::reset() inflateReset() returned %d", err);
+        m_error = 1;
+        return;
+    }
+
+    m_zstream.next_in = 0;
+    m_zstream.avail_in = 0;
+
+    m_zstream.next_out = 0;
+    m_zstream.avail_out = 0;
+
+    // Rewind the underlying stream.
+    if (!m_in->seek(m_initial_stream_pos))
+    {
+        std::stringstream ss;
+        ss << "inflater_impl::reset: unable to seek underlying "
             "stream to position " <<  m_initial_stream_pos;
-               throw ParserException(ss.str());
-       }
+        throw ParserException(ss.str());
+    }
 
-       m_logical_stream_pos = m_initial_stream_pos;
+    m_logical_stream_pos = m_initial_stream_pos;
 }
 
 std::streamsize
 InflaterIOChannel::inflate_from_stream(void* dst, std::streamsize bytes)
 {
 
-       assert(bytes);
-
-       if (m_error) return 0;
-
-       m_zstream.next_out = static_cast<unsigned char*>(dst);
-       m_zstream.avail_out = bytes;
-
-       for (;;)
-       {
-               if (m_zstream.avail_in == 0)
-               {
-                       // Get more raw data.
-                       int     new_bytes = m_in->read(m_rawdata, ZBUF_SIZE);
-                       if (new_bytes == 0)
-                       {
-                               // The cupboard is bare!  We have nothing to 
feed to inflate().
-                               break;
-                       }
-                       else
-                       {
-                               m_zstream.next_in = m_rawdata;
-                               m_zstream.avail_in = new_bytes;
-                       }
-               }
-
-               int     err = inflate(&m_zstream, Z_SYNC_FLUSH);
-               if (err == Z_STREAM_END)
-               {
-                       m_at_eof = true;
-                       break;
-               }
-               if (err == Z_BUF_ERROR)
-               {
-                       std::ostringstream ss;
-                       ss << __FILE__ << ":" << __LINE__ << ": " << 
m_zstream.msg;
-                       log_error("%s", ss.str());
-                       break;
-               }
-               if (err == Z_DATA_ERROR)
-               {
-                       std::ostringstream ss;
-                       ss << __FILE__ << ":" << __LINE__ << ": " << 
m_zstream.msg;
-                       throw ParserException(ss.str());
-                       break;
-               }
-               if (err == Z_MEM_ERROR)
-               {
-                       std::ostringstream ss;
-                       ss << __FILE__ << ":" << __LINE__ << ": " << 
m_zstream.msg;
-                       throw ParserException(ss.str());
-                       break;
-               }
-               if (err != Z_OK)
-               {
-                       // something's wrong.
-                       std::ostringstream ss;
-                       ss << __FILE__ << ":" << __LINE__ << ": " << 
m_zstream.msg;
-                       throw ParserException(ss.str());
-                       //m_error = 1;
-                       break;
-               }
-
-               if (m_zstream.avail_out == 0)
-               {
-                       break;
-               }
-       }
-
-       if (m_error)
-       {
-               return 0;
-       }
-
-       int     bytes_read = bytes - m_zstream.avail_out;
-       m_logical_stream_pos += bytes_read;
-
-       return bytes_read;
+    assert(bytes);
+
+    if (m_error) return 0;
+
+    m_zstream.next_out = static_cast<unsigned char*>(dst);
+    m_zstream.avail_out = bytes;
+
+    for (;;)
+    {
+        if (m_zstream.avail_in == 0)
+        {
+            // Get more raw data.
+            int    new_bytes = m_in->read(m_rawdata, ZBUF_SIZE);
+            if (new_bytes == 0)
+            {
+                // The cupboard is bare!  We have nothing to feed to inflate().
+                break;
+            }
+            else
+            {
+                m_zstream.next_in = m_rawdata;
+                m_zstream.avail_in = new_bytes;
+            }
+        }
+
+        int    err = inflate(&m_zstream, Z_SYNC_FLUSH);
+        if (err == Z_STREAM_END)
+        {
+            m_at_eof = true;
+            break;
+        }
+        if (err == Z_BUF_ERROR)
+        {
+            std::ostringstream ss;
+            ss << __FILE__ << ":" << __LINE__ << ": " << m_zstream.msg;
+            log_error("%s", ss.str());
+            break;
+        }
+        if (err == Z_DATA_ERROR)
+        {
+            std::ostringstream ss;
+            ss << __FILE__ << ":" << __LINE__ << ": " << m_zstream.msg;
+            throw ParserException(ss.str());
+            break;
+        }
+        if (err == Z_MEM_ERROR)
+        {
+            std::ostringstream ss;
+            ss << __FILE__ << ":" << __LINE__ << ": " << m_zstream.msg;
+            throw ParserException(ss.str());
+            break;
+        }
+        if (err != Z_OK)
+        {
+            // something's wrong.
+            std::ostringstream ss;
+            ss << __FILE__ << ":" << __LINE__ << ": " << m_zstream.msg;
+            throw ParserException(ss.str());
+            //m_error = 1;
+            break;
+        }
+
+        if (m_zstream.avail_out == 0)
+        {
+            break;
+        }
+    }
+
+    if (m_error)
+    {
+        return 0;
+    }
+
+    int    bytes_read = bytes - m_zstream.avail_out;
+    m_logical_stream_pos += bytes_read;
+
+    return bytes_read;
 }
 
 void
 InflaterIOChannel::go_to_end()
 {
-       if (m_error)
-       {
-               throw IOException("InflaterIOChannel is in error condition, 
can't seek to end");
-       }
-
-       // Keep reading until we can't read any more.
-
-       unsigned char   temp[ZBUF_SIZE];
-
-       // Seek forwards.
-       for (;;)
-       {
+    if (m_error)
+    {
+        throw IOException("InflaterIOChannel is in error condition, can't seek 
to end");
+    }
+
+    // Keep reading until we can't read any more.
+
+    unsigned char    temp[ZBUF_SIZE];
+
+    // Seek forwards.
+    for (;;)
+    {
         std::streamsize bytes_read = inflate_from_stream(temp, ZBUF_SIZE);
-               if (bytes_read == 0)
-               {
-                       // We've seeked as far as we can.
-                       break;
-               }
-       }
+        if (bytes_read == 0)
+        {
+            // We've seeked as far as we can.
+            break;
+        }
+    }
 }
 
 bool
 InflaterIOChannel::seek(std::streampos pos)
 {
-       if (m_error)
-       {
-           log_debug("Inflater is in error condition");
-               return false;
-       }
+    if (m_error)
+    {
+        log_debug("Inflater is in error condition");
+        return false;
+    }
 
-       // If we're seeking backwards, then restart from the beginning.
-       if (pos < m_logical_stream_pos)
-       {
-               log_debug("inflater reset due to seek back from %d to %d",
+    // If we're seeking backwards, then restart from the beginning.
+    if (pos < m_logical_stream_pos)
+    {
+        log_debug("inflater reset due to seek back from %d to %d",
                 m_logical_stream_pos, pos );
-               reset();
-       }
-
-       unsigned char temp[ZBUF_SIZE];
-
-       // Now seek forwards, by just reading data in blocks.
-       while (m_logical_stream_pos < pos)
-       {
+        reset();
+    }
+
+    unsigned char temp[ZBUF_SIZE];
+
+    // Now seek forwards, by just reading data in blocks.
+    while (m_logical_stream_pos < pos)
+    {
         std::streamsize to_read = pos - m_logical_stream_pos;
-               assert(to_read > 0);
+        assert(to_read > 0);
 
         std::streamsize readNow = std::min<std::streamsize>(to_read, 
ZBUF_SIZE);
-               assert(readNow > 0);
+        assert(readNow > 0);
 
         std::streamsize bytes_read = inflate_from_stream(temp, readNow);
-               assert(bytes_read <= readNow);
-               if (bytes_read == 0)
-               {
-                       // Trouble; can't seek any further.
-                       log_debug("Trouble: can't seek any further.. ");
-                       return false;
-                       break;
-               }
-       }
-
-       assert(m_logical_stream_pos == pos);
-
-       return true; 
+        assert(bytes_read <= readNow);
+        if (bytes_read == 0)
+        {
+            // Trouble; can't seek any further.
+            log_debug("Trouble: can't seek any further.. ");
+            return false;
+            break;
+        }
+    }
+
+    assert(m_logical_stream_pos == pos);
+
+    return true; 
 }
 
 InflaterIOChannel::InflaterIOChannel(std::auto_ptr<IOChannel> in)
-       :
-       m_in(in),
-       m_initial_stream_pos(m_in->tell()),
-       m_logical_stream_pos(m_initial_stream_pos),
-       m_at_eof(false),
-       m_error(0)
+    :
+    m_in(in),
+    m_initial_stream_pos(m_in->tell()),
+    m_logical_stream_pos(m_initial_stream_pos),
+    m_at_eof(false),
+    m_error(0)
 {
-       assert(m_in.get());
-
-       m_zstream.zalloc = (alloc_func)0;
-       m_zstream.zfree = (free_func)0;
-       m_zstream.opaque = (voidpf)0;
-
-       m_zstream.next_in  = 0;
-       m_zstream.avail_in = 0;
-
-       m_zstream.next_out = 0;
-       m_zstream.avail_out = 0;
-
-       int     err = inflateInit(&m_zstream);
-       if (err != Z_OK) {
-               log_error("inflater_impl::ctor() inflateInit() returned %d", 
err);
-               m_error = 1;
-               return;
-       }
-
-       // Ready to go!
+    assert(m_in.get());
+
+    m_zstream.zalloc = (alloc_func)0;
+    m_zstream.zfree = (free_func)0;
+    m_zstream.opaque = (voidpf)0;
+
+    m_zstream.next_in  = 0;
+    m_zstream.avail_in = 0;
+
+    m_zstream.next_out = 0;
+    m_zstream.avail_out = 0;
+
+    int    err = inflateInit(&m_zstream);
+    if (err != Z_OK) {
+        log_error("inflater_impl::ctor() inflateInit() returned %d", err);
+        m_error = 1;
+        return;
+    }
+
+    // Ready to go!
 }
 
 
 
 std::auto_ptr<IOChannel> make_inflater(std::auto_ptr<IOChannel> in)
 {
-       assert(in.get());
-       return std::auto_ptr<IOChannel> (new InflaterIOChannel(in));
+    assert(in.get());
+    return std::auto_ptr<IOChannel> (new InflaterIOChannel(in));
 }
 
 
 // @@ TODO
-// IOChannel*  make_deflater(IOChannel* out) { ... }
+// IOChannel*    make_deflater(IOChannel* out) { ... }
 
 }
 

=== modified file 'libbase/zlib_adapter.h'
--- a/libbase/zlib_adapter.h    2008-06-09 13:31:51 +0000
+++ b/libbase/zlib_adapter.h    2010-01-18 07:35:15 +0000
@@ -1,4 +1,4 @@
-// zlib_adapter.h      -- Thatcher Ulrich 2003
+// zlib_adapter.h    -- Thatcher Ulrich 2003
 
 // This source code has been donated to the Public Domain.  Do
 // whatever you want with it.
@@ -20,24 +20,25 @@
 /// Code to wrap zlib compression/decompression around an IOChannel stream.
 namespace zlib_adapter
 {
-       // NOTE: these functions will return NULL if
-       // HAVE_ZLIB_H is not defined
-
-       /// \brief
-       /// Returns a read-only IOChannel stream that inflates the remaining
-       /// content of the given input stream, as you read data from the
-       /// new stream.
-       //
-       ///
-       DSOEXPORT std::auto_ptr<IOChannel> 
make_inflater(std::auto_ptr<IOChannel> in);
-
-       /// \brief
-       /// Returns a write-only IOChannel stream that deflates the remaining
-       /// content of the given input stream.
-       //
-       /// TODO: take and return by auto_ptr
-       ///
-       DSOEXPORT IOChannel*    make_deflater(IOChannel* out);
+    // NOTE: these functions will return NULL if
+    // HAVE_ZLIB_H is not defined
+
+    /// \brief
+    /// Returns a read-only IOChannel stream that inflates the remaining
+    /// content of the given input stream, as you read data from the
+    /// new stream.
+    //
+    ///
+    DSOEXPORT std::auto_ptr<IOChannel>
+        make_inflater(std::auto_ptr<IOChannel> in);
+
+    /// \brief
+    /// Returns a write-only IOChannel stream that deflates the remaining
+    /// content of the given input stream.
+    //
+    /// TODO: take and return by auto_ptr
+    ///
+    DSOEXPORT IOChannel* make_deflater(IOChannel* out);
 
 } // namespace gnash.zlib_adapter
 } // namespace gnash

=== modified file 'libcore/LineStyle.cpp'
--- a/libcore/LineStyle.cpp     2010-01-14 12:03:17 +0000
+++ b/libcore/LineStyle.cpp     2010-01-18 06:21:14 +0000
@@ -1,11 +1,25 @@
+// LineStyle.cpp   Line style types.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+// Based on public domain work by Thatcher Ulrich <address@hidden> 2003
 // styles.cpp   -- Thatcher Ulrich <address@hidden> 2003
 
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// Fill and line style types.
-
-
 #include "LineStyle.h"
 #include "log.h"
 #include "SWFStream.h"
@@ -17,12 +31,6 @@
 
 namespace gnash {
 
-
-//
-// LineStyle
-//
-
-    
 LineStyle::LineStyle()
     :
     m_width(0),

=== modified file 'libcore/LineStyle.h'
--- a/libcore/LineStyle.h       2010-01-14 12:05:50 +0000
+++ b/libcore/LineStyle.h       2010-01-18 06:21:14 +0000
@@ -1,10 +1,23 @@
-// LineStyle.h    -- Thatcher Ulrich <address@hidden> 2003
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// line style types.
-
+// LineStyle.h   Line style types.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+// Based on public domain work by Thatcher Ulrich <address@hidden> 2003
 
 #ifndef GNASH_LINESTYLE_H
 #define GNASH_LINESTYLE_H

=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp     2010-01-14 11:45:08 +0000
+++ b/libcore/MovieClip.cpp     2010-01-18 07:13:09 +0000
@@ -97,7 +97,7 @@
 
 public:
 
-    ConstructEvent(MovieClip* nTarget)
+    explicit ConstructEvent(MovieClip* nTarget)
         :
         _target(nTarget)
     {}
@@ -355,7 +355,7 @@
 class BoundsFinder
 {
 public:
-    BoundsFinder(SWFRect& b) : _bounds(b) {}
+    explicit BoundsFinder(SWFRect& b) : _bounds(b) {}
 
     void operator() (DisplayObject* ch) {
         // don't include bounds of unloaded DisplayObjects
@@ -636,7 +636,7 @@
         return;
     }
 
-    if (id.is_button_event() && ! isEnabled()) {
+    if (isButtonEvent(id) && !isEnabled()) {
 #ifdef GNASH_DEBUG
         log_debug(_("Sprite %s ignored button-like event %s as not 'enabled'"),
             getTarget(), id);
@@ -706,14 +706,14 @@
     }
 
     // Check for member function.
-    if (!id.is_key_event()) {
+    if (!isKeyEvent(id)) {
         callMethod(getObject(this), id.functionKey());
     }
 
     // TODO: if this was UNLOAD release as much memory as possible ?
-    //             Verify if this is possible, in particular check order in
-    //             which unload handlers of parent and childs is performed
-    //             and wheter unload of child can access members of parent.
+    // Verify if this is possible, in particular check order in
+    // which unload handlers of parent and childs is performed
+    // and whether unload of child can access members of parent.
 
 }
 
@@ -2123,7 +2123,7 @@
     as_environment& _env;
 
 public:
-    EnumerateVisitor(as_environment& env)
+    explicit EnumerateVisitor(as_environment& env)
         :
         _env(env)
     {}

=== modified file 'libcore/MovieLoader.cpp'
--- a/libcore/MovieLoader.cpp   2009-11-22 09:41:56 +0000
+++ b/libcore/MovieLoader.cpp   2010-01-18 06:32:07 +0000
@@ -1,3 +1,22 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
 #include "log.h"
 #include "MovieFactory.h"
 #include "movie_root.h"

=== modified file 'libcore/MovieLoader.h'
--- a/libcore/MovieLoader.h     2010-01-11 06:41:38 +0000
+++ b/libcore/MovieLoader.h     2010-01-18 06:32:07 +0000
@@ -19,11 +19,11 @@
 #ifndef GNASH_MOVIE_LOADER_H
 #define GNASH_MOVIE_LOADER_H
 
-#include "URL.h" // for Request composition
-#include "as_object.h" // for setReachable inline
-#include "movie_definition.h" // for use in intrusive_ptr (inline)
-#include "MovieClip.h" // for MovieClip::VariablesMethod type
-#include "smart_ptr.h" // for intrusive_ptr
+#include "URL.h"
+#include "as_object.h" 
+#include "movie_definition.h" 
+#include "MovieClip.h" 
+#include "smart_ptr.h"
 
 #include <list>
 #include <string>

=== modified file 'libcore/RGBA.cpp'
--- a/libcore/RGBA.cpp  2010-01-14 11:29:45 +0000
+++ b/libcore/RGBA.cpp  2010-01-18 06:38:43 +0000
@@ -1,7 +1,22 @@
-// types.h    -- Thatcher Ulrich <address@hidden> 2003
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
+// RGBA.cpp: RGBA color handling.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+// 
 
 #include "RGBA.h"
 #include "GnashNumeric.h"

=== modified file 'libcore/RGBA.h'
--- a/libcore/RGBA.h    2010-01-14 11:29:45 +0000
+++ b/libcore/RGBA.h    2010-01-18 06:38:37 +0000
@@ -1,12 +1,25 @@
-// types.h    -- Thatcher Ulrich <address@hidden> 2003
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// Some basic types.
-
-#ifndef GNASH_TYPES_H
-#define GNASH_TYPES_H
+// RGBA.h: RGBA color handling.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+
+#ifndef GNASH_RGBA_H
+#define GNASH_RGBA_H
 
 #include "SWF.h"
 

=== modified file 'libcore/event_id.cpp'
--- a/libcore/event_id.cpp      2010-01-11 06:41:38 +0000
+++ b/libcore/event_id.cpp      2010-01-18 06:21:34 +0000
@@ -1,4 +1,4 @@
-// action.cpp:  ActionScript execution, for Gnash.
+// event_id.cpp:  static ActionScript events for Gnash.
 //
 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
 //   Foundation, Inc
@@ -32,10 +32,6 @@
 
 namespace gnash {
 
-//
-// event_id
-//
-
 const std::string&
 event_id::functionName() const
 {
@@ -98,29 +94,9 @@
 }
 
 bool
-event_id::is_mouse_event() const
-{
-       switch (_id)
-       {
-               case event_id::PRESS:
-               case event_id::RELEASE:
-               case event_id::RELEASE_OUTSIDE:
-               case event_id::MOUSE_UP:
-               case event_id::MOUSE_DOWN:
-               case event_id::ROLL_OVER:
-               case event_id::ROLL_OUT:
-               case event_id::DRAG_OVER:
-               case event_id::DRAG_OUT:
-                       return true;
-               default:
-                       return false;
-       }
-}
-
-bool
-event_id::is_key_event() const
-{
-       switch (_id)
+isKeyEvent(const event_id& e) 
+{
+       switch (e.id())
        {
                case event_id::KEY_DOWN:
                case event_id::KEY_PRESS:
@@ -132,9 +108,9 @@
 }
 
 bool
-event_id::is_button_event() const
+isButtonEvent(const event_id& e)
 {
-       switch (_id)
+       switch (e.id())
        {
                case event_id::PRESS:
                case event_id::RELEASE:

=== modified file 'libcore/event_id.h'
--- a/libcore/event_id.h        2010-01-11 06:41:38 +0000
+++ b/libcore/event_id.h        2010-01-18 06:21:34 +0000
@@ -22,24 +22,38 @@
 #define GNASH_EVENT_ID_H
 
 #include "string_table.h"
-
-#include "GnashKey.h" // for gnash::key::code
+#include "GnashKey.h"
 
 namespace gnash {
 
-/// For keyDown and stuff like that.
-//
-/// Implementation is currently in action.cpp
-///
+
+/// A class to identify 'static' SWF events (system events).
+//
+/// The event process in a SWF comprises the raising of the event itself and
+/// its receipt by a handler. Events may be either dynamically or statically
+/// defined. A dynamic event is handled in ActionScript: an AS-defined
+/// function is called when the event is raised. Dynamic events do not need
+/// event_id.
+//
+/// Event handlers may also be defined statically, for instance in a
+/// PlaceObject2 tag, or by default. System events such as mouse handling,
+/// load milestones, or keyboard events should be sent to appropriate
+/// DisplayObjects. This process uses event_id.
+//
+/// Static events may additionally be handled dynamically (using ActionScript).
+//
+/// The event_id class is used as an identifier for actual events and
+/// and for the signature of an expected event.
 class event_id
 {
 public:
 
+    /// The types of events that are handled by DisplayObjects.
     enum EventCode
     {
         INVALID,
 
-        // These are for buttons & sprites.
+        // These are for buttons and sprites.
         PRESS,
         RELEASE,
         RELEASE_OUTSIDE,
@@ -60,29 +74,37 @@
         KEY_DOWN,
         KEY_UP,
         DATA,
-        
-        CONSTRUCT,
-
-        EVENT_COUNT
+        CONSTRUCT
     };
     
-    event_id() : _id(INVALID), _keyCode(key::INVALID) {}
+    /// Construct an invalid event_id.
+    //
+    /// This is not useful until its values have been set.
+    event_id()
+        :
+        _id(INVALID),
+        _keyCode(key::INVALID)
+    {}
 
+    /// Construct an event_id.
+    //
+    /// @param id       The type of event
+    /// @param c        The key associated with an event (only if this
+    ///                 is a keyboard event).
     event_id(EventCode id, key::code c = key::INVALID)
         :
         _id(id),
         _keyCode(c)
     {
-        // you must supply a key code for KEY_PRESS event
-        // 
-        // we do have a testcase with _id == KEY_PRESS,
+        // We do have a testcase with _id == KEY_PRESS,
         // and keyCode==0(KEY_INVALID)
         // see key_event_test.swf(produced by Ming)
     }
 
-    ///
-    /// @param SWFKey The SWF code matched to the event. This
-    /// must be converted to a unique gnash::key::code.
+    /// Set the key associated with this event.
+    //
+    /// @param SWFKey   The SWF code matched to the event. This
+    ///                 must be converted to a unique gnash::key::code.
     void setKeyCode(boost::uint8_t SWFkey)
     {
         // Lookup the SWFcode in the gnash::key::code table.
@@ -97,13 +119,17 @@
         else _keyCode = static_cast<key::code>(i);
     }
 
-    bool operator==(const event_id& id) const
-    {
+    /// Return whether two event_ids are equal
+    //
+    /// event_ids are equal if both id and keycode match. Keycode is only
+    /// relevant for keyboard events, and must be key::INVALID for other
+    /// event types.
+    bool operator==(const event_id& id) const {
         return _id == id._id && _keyCode == id._keyCode;
     }
 
-    bool operator< (const event_id& id) const
-    {
+    /// Comparator for use in stdlib containers.
+    bool operator< (const event_id& id) const {
         if ( _id < id._id ) return true;
         if ( _id > id._id ) return false;
 
@@ -119,33 +145,15 @@
     /// Return the string_table key of a method-handler function
     /// corresponding to this event.
     string_table::key functionKey() const;
-
-    /// \brief
-    /// Return true if this is a mouse event
-    /// (triggerable with a mouse activity)
-    bool is_mouse_event() const;
-  
-    /// Return true if this is a key event
-    bool is_key_event() const;
-
-    /// Return true if this is a button-like event
+    
+    /// Return the keycode associated with this event_id.
     //
-    /// Button-like events are: PRESS, RELEASE, RELEASE_OUTSIDE,
-    ///                         ROLL_OVER, ROLL_OUT,
-    ///                         DRAG_OVER, DRAG_OUT,
-    ///                         KEY_PRESS
-    ///
-    /// TODO: check if we need anything more
-    ///       The way to test is using the 'enabled'
-    ///       property to see which ones are disabled
-    ///       by setting it to false.
-    ///
-    bool is_button_event() const;
+    /// This should be key::INVALID if the event_id is not a keyboard event.
+    key::code keyCode() const { return _keyCode; }
 
+    /// Return the identifier for this event type.
     EventCode id() const { return _id; }
 
-    key::code keyCode() const { return _keyCode; }
-
 private:
 
     EventCode _id;
@@ -160,12 +168,25 @@
 
 };
 
+
+/// Check whether an event is a button-like event.
+//
+/// @param e        The event to check
+/// @return         True if it is
+bool isButtonEvent(const event_id& e);
+
+/// Check whether an event is a keyboard event.
+//
+/// @param e        The event to check
+/// @return         True if it is
+bool isKeyEvent(const event_id& e);
+
 std::ostream& operator<< (std::ostream& o, const event_id& ev);
 
 } // namespace gnash
 
 
-#endif // GNASH_EVENT_ID_H
+#endif 
 
 
 // Local Variables:

=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp    2010-01-11 06:41:38 +0000
+++ b/libcore/movie_root.cpp    2010-01-18 06:36:32 +0000
@@ -2252,7 +2252,7 @@
     }
 
     const size_t chunksize = 65535;
-    uint8_t chunk[chunksize];
+    boost::uint8_t chunk[chunksize];
 
     size_t actuallyRead = _stream->readNonBlocking(chunk, chunksize);
 

=== modified file 'libcore/swf/DefineTextTag.cpp'
--- a/libcore/swf/DefineTextTag.cpp     2009-11-04 15:03:15 +0000
+++ b/libcore/swf/DefineTextTag.cpp     2010-01-18 06:36:21 +0000
@@ -1,12 +1,24 @@
 // DefineTextTag.cpp:  Read StaticText definitions, for Gnash.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 // Derived from text.cpp       -- Thatcher Ulrich <address@hidden> 2003
 
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// Code for the text tags.
-
 #include "DefineTextTag.h"
 #include "SWFStream.h"
 #include "log.h"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]