--- gnash-0.8.6.orig/libcore/movie_root.cpp	2009-09-13 19:22:17.000000000 -0400
+++ gnash-0.8.6/libcore/movie_root.cpp	2009-12-07 20:16:00.328812604 -0500
@@ -2246,11 +2246,10 @@
     /// If the method is MovieClip::METHOD_NONE, we send no data.
     if (method == MovieClip::METHOD_GET)
     {
-        std::string varsToSend(urlstr);
         /// GET: append data to query string.
         std::string qs = url.querystring();
-        if ( qs.empty() ) varsToSend.insert(0, 1, '?');
-        else varsToSend.insert(0, 1, '&');
+        std::string varsToSend(qs.empty() ? "&" : "?");
+        varsToSend.append(urlstr);
         url.set_querystring(qs + varsToSend);
     }
 
--- gnash-0.8.6.orig/libcore/swf/DefaultTagLoaders.cpp	2009-09-13 19:22:17.000000000 -0400
+++ gnash-0.8.6/libcore/swf/DefaultTagLoaders.cpp	2009-12-08 14:27:15.782474269 -0500
@@ -59,6 +59,8 @@
 namespace gnash {
 namespace SWF {
 
+typedef TagLoadersTable::Loaders::value_type TagPair;
+
 namespace {
     class AddLoader
     {
@@ -67,7 +69,7 @@
             :
             _table(table)
         {}
-        void operator()(const TagLoadersTable::Loaders::value_type& p)
+        void operator()(const TagPair& p)
         {
             _table.registerLoader(p.first, p.second);
         }
@@ -80,152 +82,152 @@
 addDefaultLoaders(TagLoadersTable& table)
 {
 
-    const std::map<TagType, TagLoadersTable::TagLoader> tags =
-        boost::assign::map_list_of
+    const std::vector<TagPair> tags =
+        boost::assign::list_of
 
-    (SWF::END, end_loader)
-    (SWF::DEFINESHAPE, DefineShapeTag::loader)
-    (SWF::FREECHARACTER, fixme_loader) // 03
-    (SWF::PLACEOBJECT, PlaceObject2Tag::loader)
-    (SWF::REMOVEOBJECT, RemoveObjectTag::loader) // 05
-    (SWF::DEFINEBITS, define_bits_jpeg_loader)
-    (SWF::DEFINEBUTTON, DefineButtonTag::loader)
-    (SWF::JPEGTABLES, jpeg_tables_loader)
-    (SWF::SETBACKGROUNDCOLOR, SetBackgroundColorTag::loader)
-    (SWF::DEFINEFONT, DefineFontTag::loader)
-    (SWF::DEFINETEXT, DefineTextTag::loader)
-    (SWF::DOACTION,  DoActionTag::loader)
-    (SWF::DEFINEFONTINFO, DefineFontInfoTag::loader)
+    (TagPair(SWF::END, end_loader))
+    (TagPair(SWF::DEFINESHAPE, DefineShapeTag::loader))
+    (TagPair(SWF::FREECHARACTER, fixme_loader)) // 03
+    (TagPair(SWF::PLACEOBJECT, PlaceObject2Tag::loader))
+    (TagPair(SWF::REMOVEOBJECT, RemoveObjectTag::loader)) // 05
+    (TagPair(SWF::DEFINEBITS, define_bits_jpeg_loader))
+    (TagPair(SWF::DEFINEBUTTON, DefineButtonTag::loader))
+    (TagPair(SWF::JPEGTABLES, jpeg_tables_loader))
+    (TagPair(SWF::SETBACKGROUNDCOLOR, SetBackgroundColorTag::loader))
+    (TagPair(SWF::DEFINEFONT, DefineFontTag::loader))
+    (TagPair(SWF::DEFINETEXT, DefineTextTag::loader))
+    (TagPair(SWF::DOACTION,  DoActionTag::loader))
+    (TagPair(SWF::DEFINEFONTINFO, DefineFontInfoTag::loader))
     // 62
-    (SWF::DEFINEFONTINFO2, DefineFontInfoTag::loader)
-    (SWF::DEFINESOUND, define_sound_loader)
-    (SWF::STARTSOUND, StartSoundTag::loader)
+    (TagPair(SWF::DEFINEFONTINFO2, DefineFontInfoTag::loader))
+    (TagPair(SWF::DEFINESOUND, define_sound_loader))
+    (TagPair(SWF::STARTSOUND, StartSoundTag::loader))
     // 89
-    (SWF::STARTSOUND2, StartSound2Tag::loader)
+    (TagPair(SWF::STARTSOUND2, StartSound2Tag::loader))
 
-    (SWF::STOPSOUND, fixme_loader) // 16 
+    (TagPair(SWF::STOPSOUND, fixme_loader)) // 16 
 
     // 17
-    (SWF::DEFINEBUTTONSOUND, DefineButtonSoundTag::loader)
+    (TagPair(SWF::DEFINEBUTTONSOUND, DefineButtonSoundTag::loader))
     // 18
-    (SWF::SOUNDSTREAMHEAD, sound_stream_head_loader)
+    (TagPair(SWF::SOUNDSTREAMHEAD, sound_stream_head_loader))
     // 19
-    (SWF::SOUNDSTREAMBLOCK, StreamSoundBlockTag::loader)
-    (SWF::DEFINELOSSLESS, define_bits_lossless_2_loader)
-    (SWF::DEFINEBITSJPEG2, define_bits_jpeg2_loader)
-    (SWF::DEFINESHAPE2,  DefineShapeTag::loader)
-    (SWF::DEFINEBUTTONCXFORM, DefineButtonCxformTag::loader) // 23
+    (TagPair(SWF::SOUNDSTREAMBLOCK, StreamSoundBlockTag::loader))
+    (TagPair(SWF::DEFINELOSSLESS, define_bits_lossless_2_loader))
+    (TagPair(SWF::DEFINEBITSJPEG2, define_bits_jpeg2_loader))
+    (TagPair(SWF::DEFINESHAPE2,  DefineShapeTag::loader))
+    (TagPair(SWF::DEFINEBUTTONCXFORM, DefineButtonCxformTag::loader)) // 23
     // "protect" tag; we're not an authoring tool so we don't care.
     // (might be nice to dump the password instead..)
-    (SWF::PROTECT, null_loader)
-    (SWF::PATHSAREPOSTSCRIPT, fixme_loader) // 25
-    (SWF::PLACEOBJECT2,  PlaceObject2Tag::loader)
+    (TagPair(SWF::PROTECT, null_loader))
+    (TagPair(SWF::PATHSAREPOSTSCRIPT, fixme_loader)) // 25
+    (TagPair(SWF::PLACEOBJECT2,  PlaceObject2Tag::loader))
     // 27 - _UNKNOWN_ unimplemented
-    (SWF::REMOVEOBJECT2, RemoveObjectTag::loader) // 28
-    (SWF::SYNCFRAME, fixme_loader) // 29
+    (TagPair(SWF::REMOVEOBJECT2, RemoveObjectTag::loader)) // 28
+    (TagPair(SWF::SYNCFRAME, fixme_loader)) // 29
     // 30 - _UNKNOWN_ unimplemented
-    (SWF::FREEALL, fixme_loader) // 31
-    (SWF::DEFINESHAPE3,  DefineShapeTag::loader)
-    (SWF::DEFINETEXT2, DefineText2Tag::loader)
+    (TagPair(SWF::FREEALL, fixme_loader)) // 31
+    (TagPair(SWF::DEFINESHAPE3,  DefineShapeTag::loader))
+    (TagPair(SWF::DEFINETEXT2, DefineText2Tag::loader))
     // 37
-    (SWF::DEFINEBUTTON2, DefineButton2Tag::loader)
-    (SWF::DEFINEBITSJPEG3, define_bits_jpeg3_loader)
-    (SWF::DEFINELOSSLESS2, define_bits_lossless_2_loader)
-    (SWF::DEFINEEDITTEXT, DefineEditTextTag::loader)
-    (SWF::DEFINEVIDEO, fixme_loader) // 38
-    (SWF::DEFINESPRITE,  sprite_loader)
-    (SWF::NAMECHARACTER, fixme_loader) // 40
-    (SWF::SERIALNUMBER,  serialnumber_loader) // 41
-    (SWF::DEFINETEXTFORMAT, fixme_loader) // 42
-    (SWF::FRAMELABEL,  frame_label_loader) // 43
+    (TagPair(SWF::DEFINEBUTTON2, DefineButton2Tag::loader))
+    (TagPair(SWF::DEFINEBITSJPEG3, define_bits_jpeg3_loader))
+    (TagPair(SWF::DEFINELOSSLESS2, define_bits_lossless_2_loader))
+    (TagPair(SWF::DEFINEEDITTEXT, DefineEditTextTag::loader))
+    (TagPair(SWF::DEFINEVIDEO, fixme_loader)) // 38
+    (TagPair(SWF::DEFINESPRITE,  sprite_loader))
+    (TagPair(SWF::NAMECHARACTER, fixme_loader)) // 40
+    (TagPair(SWF::SERIALNUMBER,  serialnumber_loader)) // 41
+    (TagPair(SWF::DEFINETEXTFORMAT, fixme_loader)) // 42
+    (TagPair(SWF::FRAMELABEL,  frame_label_loader)) // 43
 
     // TODO: Implement, but fixme_loader breaks tests.
-    (SWF::DEFINEBEHAVIOR, fixme_loader) // 44
+    (TagPair(SWF::DEFINEBEHAVIOR, fixme_loader)) // 44
 
-    (SWF::SOUNDSTREAMHEAD2, sound_stream_head_loader) // 45
+    (TagPair(SWF::SOUNDSTREAMHEAD2, sound_stream_head_loader)) // 45
     // 46
-    (SWF::DEFINEMORPHSHAPE, DefineMorphShapeTag::loader)
-    (SWF::FRAMETAG,  fixme_loader) // 47
+    (TagPair(SWF::DEFINEMORPHSHAPE, DefineMorphShapeTag::loader))
+    (TagPair(SWF::FRAMETAG,  fixme_loader)) // 47
     // 48
-    (SWF::DEFINEFONT2, DefineFontTag::loader)
-    (SWF::GENCOMMAND,  fixme_loader) // 49
-    (SWF::DEFINECOMMANDOBJ, fixme_loader) // 50
-    (SWF::CHARACTERSET,  fixme_loader) // 51
-    (SWF::FONTREF, fixme_loader) // 52
+    (TagPair(SWF::DEFINEFONT2, DefineFontTag::loader))
+    (TagPair(SWF::GENCOMMAND,  fixme_loader)) // 49
+    (TagPair(SWF::DEFINECOMMANDOBJ, fixme_loader)) // 50
+    (TagPair(SWF::CHARACTERSET,  fixme_loader)) // 51
+    (TagPair(SWF::FONTREF, fixme_loader)) // 52
 
     // TODO: Implement, but fixme_loader breaks tests.
-    (SWF::DEFINEFUNCTION, fixme_loader) // 53 
-    (SWF::PLACEFUNCTION, fixme_loader) // 54 
-    (SWF::GENTAGOBJECT, fixme_loader) // 55 
+    (TagPair(SWF::DEFINEFUNCTION, fixme_loader)) // 53 
+    (TagPair(SWF::PLACEFUNCTION, fixme_loader)) // 54 
+    (TagPair(SWF::GENTAGOBJECT, fixme_loader)) // 55 
 
-    (SWF::EXPORTASSETS, export_loader) // 56
-    (SWF::IMPORTASSETS, import_loader) // 57
+    (TagPair(SWF::EXPORTASSETS, export_loader)) // 56
+    (TagPair(SWF::IMPORTASSETS, import_loader)) // 57
 
     //  We're not an authoring tool so we don't care.
     // (might be nice to dump the password instead..)
-    (SWF::ENABLEDEBUGGER, null_loader)    // 58
+    (TagPair(SWF::ENABLEDEBUGGER, null_loader))    // 58
 
     // 59
-    (SWF::INITACTION, DoInitActionTag::loader) 
+    (TagPair(SWF::INITACTION, DoInitActionTag::loader)) 
     // 60
-    (SWF::DEFINEVIDEOSTREAM, DefineVideoStreamTag::loader)
+    (TagPair(SWF::DEFINEVIDEOSTREAM, DefineVideoStreamTag::loader))
     // 61
-    (SWF::VIDEOFRAME, VideoFrameTag::loader)
+    (TagPair(SWF::VIDEOFRAME, VideoFrameTag::loader))
 
     // 62, DEFINEFONTINFO2 is done above.
     // We're not an authoring tool.
-    (SWF::DEBUGID, null_loader) // 63
+    (TagPair(SWF::DEBUGID, null_loader)) // 63
 
     //  We're not an authoring tool so we don't care.
     // (might be nice to dump the password instead..)
-    (SWF::ENABLEDEBUGGER2, null_loader)    // 64
-    (SWF::SCRIPTLIMITS, ScriptLimitsTag::loader) //65
+    (TagPair(SWF::ENABLEDEBUGGER2, null_loader))    // 64
+    (TagPair(SWF::SCRIPTLIMITS, ScriptLimitsTag::loader)) //65
 
     // TODO: Fix this, but probably not critical.
-    (SWF::SETTABINDEX, SetTabIndexTag::loader) //66 
+    (TagPair(SWF::SETTABINDEX, SetTabIndexTag::loader)) //66 
 
     // TODO: Alexis reference says these are 83, 84. The 67, 68 comes from
     // Tamarin. Figure out which one is correct (possibly both are).
     // 67
-    (SWF::DEFINESHAPE4_, DefineShapeTag::loader)
+    (TagPair(SWF::DEFINESHAPE4_, DefineShapeTag::loader))
     // 68
-    (SWF::DEFINEMORPHSHAPE2_, DefineMorphShapeTag::loader)
+    (TagPair(SWF::DEFINEMORPHSHAPE2_, DefineMorphShapeTag::loader))
     // 69
-    (SWF::FILEATTRIBUTES, file_attributes_loader)
+    (TagPair(SWF::FILEATTRIBUTES, file_attributes_loader))
     // 70
-    (SWF::PLACEOBJECT3, PlaceObject2Tag::loader)
+    (TagPair(SWF::PLACEOBJECT3, PlaceObject2Tag::loader))
     // 71
-    (SWF::IMPORTASSETS2, import_loader)
+    (TagPair(SWF::IMPORTASSETS2, import_loader))
     // 73
-    (SWF::DEFINEALIGNZONES, DefineFontAlignZonesTag::loader)
+    (TagPair(SWF::DEFINEALIGNZONES, DefineFontAlignZonesTag::loader))
     // 74
-    (SWF::CSMTEXTSETTINGS, CSMTextSettingsTag::loader)
+    (TagPair(SWF::CSMTEXTSETTINGS, CSMTextSettingsTag::loader))
     // 75
-    (SWF::DEFINEFONT3, DefineFontTag::loader)
+    (TagPair(SWF::DEFINEFONT3, DefineFontTag::loader))
     // 77
-    (SWF::METADATA, metadata_loader)
+    (TagPair(SWF::METADATA, metadata_loader))
     // 78
-    (SWF::DEFINESCALINGGRID, DefineScalingGridTag::loader)
+    (TagPair(SWF::DEFINESCALINGGRID, DefineScalingGridTag::loader))
     // 83
-    (SWF::DEFINESHAPE4, DefineShapeTag::loader)
+    (TagPair(SWF::DEFINESHAPE4, DefineShapeTag::loader))
     // 84
-    (SWF::DEFINEMORPHSHAPE2, DefineMorphShapeTag::loader)
+    (TagPair(SWF::DEFINEMORPHSHAPE2, DefineMorphShapeTag::loader))
     // 88
-    (SWF::DEFINEFONTNAME, DefineFontNameTag::loader)
+    (TagPair(SWF::DEFINEFONTNAME, DefineFontNameTag::loader))
     // 777
-    (SWF::REFLEX, reflex_loader)
+    (TagPair(SWF::REFLEX, reflex_loader))
 
 #ifdef ENABLE_AVM2
     // The following tags are AVM2 only.
     // 72 -- AS3 codeblock.
-    (SWF::DOABC, DoABCTag::loader) 
+    (TagPair(SWF::DOABC, DoABCTag::loader)) 
     // 76
-    (SWF::SYMBOLCLASS, SymbolClassTag::loader)
+    (TagPair(SWF::SYMBOLCLASS, SymbolClassTag::loader))
     // 82
-    (SWF::DOABCDEFINE, DoABCTag::loader)
+    (TagPair(SWF::DOABCDEFINE, DoABCTag::loader))
     // 86
-    (SWF::DEFINESCENEANDFRAMELABELDATA,
-            DefineSceneAndFrameLabelDataTag::loader)
+    (TagPair(SWF::DEFINESCENEANDFRAMELABELDATA,
+            DefineSceneAndFrameLabelDataTag::loader))
 #endif
     ;
 
--- gnash-0.8.6.orig/libcore/asobj/flash/media/Microphone_as.cpp	2009-09-13 19:22:17.000000000 -0400
+++ gnash-0.8.6/libcore/asobj/flash/media/Microphone_as.cpp	2009-12-08 21:53:00.552333428 -0500
@@ -339,7 +339,7 @@
         return as_value(50.0);
     } else {
         gain = ((ptr->get_gain())*(0.8333333333333)) + 50;
-        gain = round(gain);
+        gain = std::floor(gain + 0.5);
         return as_value(gain);
     }
 #endif
--- gnash-0.8.6.orig/libcore/as_value.cpp	2009-09-13 19:22:17.000000000 -0400
+++ gnash-0.8.6/libcore/as_value.cpp	2009-12-09 00:05:30.187055696 -0500
@@ -2385,7 +2385,7 @@
 }
 
 bool
-as_value::readAMF0(const boost::uint8_t *&b, const boost::uint8_t *end,
+as_value::readAMF0(const boost::uint8_t *&b, const boost::uint8_t *const end,
         int inType, std::vector<as_object*>& objRefs, VM& vm)
 {
 	return amf0_read_value(b, end, *this, inType, objRefs, vm);
--- gnash-0.8.6.orig/libcore/SWFMatrix.cpp	2009-09-13 19:22:16.000000000 -0400
+++ gnash-0.8.6/libcore/SWFMatrix.cpp	2009-12-07 17:16:03.846022059 -0500
@@ -192,8 +192,8 @@
 // Set the scale & rotation part of the SWFMatrix.
 // angle in radians.
 {
-    double   cos_angle = cos(angle);
-    double   sin_angle = sin(angle);
+    double   cos_angle = std::cos(angle);
+    double   sin_angle = std::sin(angle);
     sx  = DoubleToFixed16(x_scale * cos_angle);
     shy = DoubleToFixed16(y_scale * -sin_angle);
     shx = DoubleToFixed16(x_scale * sin_angle);
@@ -203,9 +203,9 @@
 void
 SWFMatrix::set_x_scale(double xscale)
 {
-    double rot_x = atan2((double)shx, (double)sx);
-    sx  =  DoubleToFixed16(xscale * cos(rot_x));
-    shx =  DoubleToFixed16(xscale * sin(rot_x)); 
+    double rot_x = std::atan2((double)shx, (double)sx);
+    sx  =  DoubleToFixed16(xscale * std::cos(rot_x));
+    shx =  DoubleToFixed16(xscale * std::sin(rot_x)); 
 }
 
 void
@@ -227,15 +227,15 @@
 void
 SWFMatrix::set_rotation(double rotation)
 {   
-    double rot_x = atan2((double)shx,    (double)sx);
-    double rot_y = atan2((double)(-shy), (double)sy);
+    double rot_x = std::atan2((double)shx,    (double)sx);
+    double rot_y = std::atan2((double)(-shy), (double)sy);
     double scale_x = get_x_scale();
     double scale_y = get_y_scale();
  
-    sx  = DoubleToFixed16(scale_x * cos(rotation));
-    shx = DoubleToFixed16(scale_x * sin(rotation)); 
-    shy = -DoubleToFixed16(scale_y * sin(rot_y - rot_x + rotation));
-    sy  =  DoubleToFixed16(scale_y * cos(rot_y - rot_x + rotation));
+    sx  = DoubleToFixed16(scale_x * std::cos(rotation));
+    shx = DoubleToFixed16(scale_x * std::sin(rotation)); 
+    shy = -DoubleToFixed16(scale_y * std::sin(rot_y - rot_x + rotation));
+    sy  =  DoubleToFixed16(scale_y * std::cos(rot_y - rot_x + rotation));
 }
 
 void
@@ -334,20 +334,20 @@
 double
 SWFMatrix::get_x_scale() const
 {
-    return sqrt(((double)sx * sx + (double)shx * shx)) / 65536.0;
+    return std::sqrt(((double)sx * sx + (double)shx * shx)) / 65536.0;
 }
 
 double
 SWFMatrix::get_y_scale() const
 {
-    return sqrt(((double)sy * sy + (double)shy * shy)) / 65536.0;
+    return std::sqrt(((double)sy * sy + (double)shy * shy)) / 65536.0;
 }
 
 double
 SWFMatrix::get_rotation() const
 {
     // more successes in misc-ming.all/SWFMatrix_test.c
-    return atan2(static_cast<double>(shx), sx); 
+    return std::atan2(static_cast<double>(shx), sx); 
 }
 
 // private
--- gnash-0.8.6.orig/gui/gnash.cpp	2009-09-13 19:22:16.000000000 -0400
+++ gnash-0.8.6/gui/gnash.cpp	2009-12-09 00:15:07.840459783 -0500
@@ -51,7 +51,7 @@
 #include <ios>
 
 #ifdef ENABLE_NLS
-# include <locale>
+# include <clocale>
 #endif
 
 #ifdef GUI_ALP
--- gnash-0.8.6.orig/libbase/log.cpp	2009-09-13 19:22:16.000000000 -0400
+++ gnash-0.8.6/libbase/log.cpp	2009-12-09 05:31:43.116958831 -0500
@@ -43,6 +43,10 @@
 #include "log.h"
 #include "utility.h"
 
+#ifndef USE_BOOST_FORMAT_TEMPLATES
+#include <cstdarg>
+#endif
+
 using std::cout;
 using std::endl;
 
@@ -116,6 +120,35 @@
 	LogFile& dbglogfile = LogFile::getDefaultInstance();
 }
 
+#ifndef USE_BOOST_FORMAT_TEMPLATES
+
+// Workspace for vsnprintf formatting.
+static const int BUFFER_SIZE = 2048;
+
+#define LOG_DEFUN(data) \
+void \
+log_##data(const char* fmt, ...) \
+{ \
+	if (LogFile::getDefaultInstance().getVerbosity() == 0) return; \
+	va_list ap; \
+	char tmp[BUFFER_SIZE]; \
+	va_start (ap, fmt); \
+	vsnprintf (tmp, BUFFER_SIZE-1, fmt, ap); \
+	tmp[BUFFER_SIZE-1] = '\0'; \
+	processLog_##data(boost::format(tmp)); \
+	va_end (ap); \
+}
+#define GENERATE_LOG_TYPES(r, _, t) \
+    LOG_DEFUN(t)
+
+/// Calls the template generator for each log type in the
+/// sequence LOG_TYPES.
+BOOST_PP_SEQ_FOR_EACH(GENERATE_LOG_TYPES, _, LOG_TYPES)
+
+#undef GENERATE_LOG_TYPES
+
+#endif
+
 // boost format functions to process the objects
 // created by our hundreds of templates 
 
--- gnash-0.8.6.orig/libbase/log.h	2009-09-13 19:22:16.000000000 -0400
+++ gnash-0.8.6/libbase/log.h	2009-12-09 05:29:03.116046676 -0500
@@ -30,6 +30,10 @@
 #include <boost/thread/mutex.hpp>
 #include <boost/format.hpp>
 
+#ifndef __SUNPRO_CC
+#define USE_BOOST_FORMAT_TEMPLATES 1
+#endif
+
 // the default name for the debug log
 #define DEFAULT_LOGFILE "gnash-dbg.log"
 
@@ -265,6 +269,8 @@
 #define LOG_TYPES (error) (debug) (unimpl) (aserror) (swferror) \
     (amferror) (security) (action) (parse) (trace) (abc) (network)
 
+#ifdef USE_BOOST_FORMAT_TEMPLATES
+
 /// This actually creates the template functions using the TOKENIZE
 /// functions above. The templates look like this:
 //
@@ -310,11 +316,27 @@
 #define GENERATE_LOG_TYPES(r, _, t) \
     BOOST_PP_REPEAT(ARG_NUMBER, LOG_TEMPLATES, t)
 
+#else
+
+#ifdef __GNUC__
+#define GNUC_LOG_ATTRS __attribute__((format (printf, 1, 2)))
+#else
+#define GNUC_LOG_ATTRS
+#endif
+
+#define LOG_DECLARE(data) \
+DSOEXPORT void log_##data(const char* fmt, ...) GNUC_LOG_ATTRS;
+#define GENERATE_LOG_TYPES(r, _, t) \
+    LOG_DECLARE(t)
+
+#endif // USE_BOOST_FORMAT_TEMPLATES
+
 /// Calls the template generator for each log type in the
 /// sequence LOG_TYPES.
 BOOST_PP_SEQ_FOR_EACH(GENERATE_LOG_TYPES, _, LOG_TYPES)
 
 #undef TOKENIZE_FORMAT
+#undef TOKENIZE_ARGS
 #undef GENERATE_LOG_TYPES
 #undef LOG_TEMPLATES
 #undef ARG_NUMBER
@@ -489,10 +489,10 @@
 #define GNASH_REPORT_RETURN
 #else
 #define GNASH_REPORT_FUNCTION \
-    log_debug("entering")
+    gnash::log_debug("entering")
 
 #define GNASH_REPORT_RETURN \
-    log_debug("returning")
+    gnash::log_debug("returning")
 #endif
 
 }
--- gnash-0.8.6.orig/libbase/GnashImageJpeg.h	2009-09-13 19:22:16.000000000 -0400
+++ gnash-0.8.6/libbase/GnashImageJpeg.h	2009-12-09 06:43:52.911549122 -0500
@@ -58,7 +58,7 @@
 
     const char* _errorOccurred;
 
-    jmp_buf _jmpBuf;
+    std::jmp_buf _jmpBuf;
 
     // State needed for input.
     jpeg::jpeg_decompress_struct m_cinfo;
--- gnash-0.8.6.orig/libbase/GnashNumeric.h	2009-09-13 19:22:16.000000000 -0400
+++ gnash-0.8.6/libbase/GnashNumeric.h	2009-12-09 05:40:05.041371947 -0500
@@ -43,7 +43,7 @@
 inline bool
 isFinite(double d)
 {
-#if defined(HAVE_FINITE) && !defined(HAVE_ISFINITE)
+#if defined(HAVE_FINITE) && (!defined(HAVE_ISFINITE) || defined(__SUNPRO_CC))
     return (finite(d));
 #else
     // Put using namespace std; here if you have to
--- gnash-0.8.6.orig/libmedia/gst/VideoInputGst.cpp	2009-09-13 19:22:17.000000000 -0400
+++ gnash-0.8.6/libmedia/gst/VideoInputGst.cpp	2009-12-07 16:28:59.164119222 -0500
@@ -948,9 +948,9 @@
 {
     
     for (int i = 0; i < webcam->_currentFormat->numFramerates; ++i) {
-        int val = std::ceil(
+        int val = std::ceil(static_cast<double>(
                 webcam->_currentFormat->framerates[i].numerator /
-               webcam->_currentFormat->framerates[i].denominator);
+               webcam->_currentFormat->framerates[i].denominator));
         if (val == fps) {
             return true;
         }
--- gnash-0.8.6.orig/libmedia/AudioResampler.cpp	2009-09-13 19:22:17.000000000 -0400
+++ gnash-0.8.6/libmedia/AudioResampler.cpp	2009-12-07 16:23:49.776539235 -0500
@@ -81,7 +81,7 @@
     if (inc == 1 && dup == 1)
     {
 	    // No tranformation required
-	    memcpy(out_data, data, output_sample_count * sizeof(boost::int16_t));
+	    std::memcpy(out_data, data, output_sample_count * sizeof(boost::int16_t));
     }
     else if (inc > 1)
     {
--- gnash-0.8.6.orig/libmedia/AudioDecoderNellymoser.cpp	2009-09-13 19:22:17.000000000 -0400
+++ gnash-0.8.6/libmedia/AudioDecoderNellymoser.cpp	2009-12-07 15:05:49.865940740 -0500
@@ -54,6 +54,10 @@
 #include <cmath>
 #include <boost/random.hpp>
 
+#ifndef M_SQRT1_2
+#define M_SQRT1_2 0.70710678118654752440
+#endif
+
 namespace gnash {
 namespace media {
 
@@ -674,7 +678,7 @@
 	for (i = 0; i < 23; i++) {
 		if (i > 0)
 			val += nelly_delta_table[get_bits(block, &bit_offset, 5)];
-		pval = pow(2, val/2048);
+		pval = std::pow(2, val/2048);
 		for (j = 0; j < nelly_copy_count[i]; j++) {
 			*bptr = val;
 			*pptr = pval;
--- gnash-0.8.6.orig/utilities/processor.cpp	2009-09-13 19:22:22.000000000 -0400
+++ gnash-0.8.6/utilities/processor.cpp	2009-12-08 22:44:01.081502556 -0500
@@ -35,7 +35,7 @@
 #include <ctime>
 
 #ifdef ENABLE_NLS
-#include <locale>
+#include <clocale>
 #endif
 
 #include "MovieFactory.h"
--- gnash-0.8.6.orig/utilities/dumpshm.cpp	2009-09-13 19:22:22.000000000 -0400
+++ gnash-0.8.6/utilities/dumpshm.cpp	2009-12-09 00:11:16.015435791 -0500
@@ -60,7 +60,7 @@
 #include <cerrno>
 
 #ifdef ENABLE_NLS
-# include <locale>
+# include <clocale>
 #endif
 
 #include "log.h"
--- gnash-0.8.6.orig/utilities/soldumper.cpp	2009-09-13 19:22:22.000000000 -0400
+++ gnash-0.8.6/utilities/soldumper.cpp	2009-12-08 22:42:33.201198924 -0500
@@ -25,7 +25,7 @@
 #include <cstring>
 
 #ifdef ENABLE_NLS
-# include <locale>
+# include <clocale>
 #endif
 
 extern "C"{
--- gnash-0.8.6.orig/utilities/flvdumper.cpp	2009-09-13 19:22:22.000000000 -0400
+++ gnash-0.8.6/utilities/flvdumper.cpp	2009-12-09 00:12:48.772507206 -0500
@@ -31,7 +31,7 @@
 #include <vector>
 
 #ifdef ENABLE_NLS
-# include <locale>
+# include <clocale>
 #endif
 
 #include "log.h"
--- gnash-0.8.6.orig/cygnal/cvm.cpp	2009-09-13 19:22:15.000000000 -0400
+++ gnash-0.8.6/cygnal/cvm.cpp	2009-12-09 05:43:27.186532583 -0500
@@ -34,7 +34,7 @@
 #include <ctime>
 
 #ifdef ENABLE_NLS
-#include <locale>
+#include <clocale>
 #endif
 
 #include "gettext.h"
--- gnash-0.8.6.orig/libbase/GnashImageJpeg.h	2009-09-13 19:22:16.000000000 -0400
+++ gnash-0.8.6/libbase/GnashImageJpeg.h	2009-12-09 06:43:52.911549122 -0500
@@ -58,7 +58,7 @@
 
     const char* _errorOccurred;
 
-    jmp_buf _jmpBuf;
+    std::jmp_buf _jmpBuf;
 
     // State needed for input.
     jpeg::jpeg_decompress_struct m_cinfo;
--- gnash-0.8.6.orig/libbase/URL.cpp	2009-09-13 19:22:16.000000000 -0400
+++ gnash-0.8.6/libbase/URL.cpp	2009-12-09 06:49:34.761880069 -0500
@@ -182,7 +182,7 @@
 
         if (!dir) {
             std::stringstream err;
-            err << "getcwd failed: " << strerror(errno);
+            err << "getcwd failed: " << std::strerror(errno);
             throw gnash::GnashException(err.str());
         }
 
