gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-230-gf07c4e9
Date: Wed, 09 Mar 2011 17:36:11 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  f07c4e935aaf3d9e7d144f97c02fce92455c66fb (commit)
       via  56f97846eb23ec80eff45695d91f59d7d7487c24 (commit)
      from  4c1603484b6bbdcf14138be7d3e903b16edb0da7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=f07c4e935aaf3d9e7d144f97c02fce92455c66fb


commit f07c4e935aaf3d9e7d144f97c02fce92455c66fb
Author: Bastiaan Jacques <address@hidden>
Date:   Wed Mar 9 18:35:16 2011 +0100

    Document abuse of exceptions in FFMPEG callbacks.

diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.cpp 
b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
index daf225a..4afed1b 100644
--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
@@ -518,6 +518,11 @@ MediaParserFfmpeg::~MediaParserFfmpeg()
 
 }
 
+// NOTE: as this function is used as a callback from FFMPEG, it should not
+// throw any exceptions, because:
+// a) The behaviour of C++ exceptions passed into C code is undefined.
+// b) Even if we don't crash and burn, the FFMPEG parser is left in an
+//    undefined state.
 int 
 MediaParserFfmpeg::readPacket(boost::uint8_t* buf, int buf_size)
 {
@@ -530,6 +535,11 @@ MediaParserFfmpeg::readPacket(boost::uint8_t* buf, int 
buf_size)
 
 }
 
+// NOTE: as this function is used as a callback from FFMPEG, it should not
+// throw any exceptions, because:
+// a) The behaviour of C++ exceptions passed into C code is undefined.
+// b) Even if we don't crash and burn, the FFMPEG parser is left in an
+//    undefined state.
 boost::int64_t 
 MediaParserFfmpeg::seekMedia(boost::int64_t offset, int whence)
 {

http://git.savannah.gnu.org/cgit//commit/?id=56f97846eb23ec80eff45695d91f59d7d7487c24


commit 56f97846eb23ec80eff45695d91f59d7d7487c24
Author: Bastiaan Jacques <address@hidden>
Date:   Wed Mar 9 18:28:27 2011 +0100

    Minor cleanup.

diff --git a/plugin/npapi/GnashNPVariant.h b/plugin/npapi/GnashNPVariant.h
index 3524fef..3de7099 100644
--- a/plugin/npapi/GnashNPVariant.h
+++ b/plugin/npapi/GnashNPVariant.h
@@ -28,6 +28,26 @@
 
 namespace gnash {
 
+inline const uint32_t&
+GetNPStringLen(const NPString& str)
+{
+#if NPAPI_VERSION == 192
+     return str.UTF8Length;
+#else
+     return str.utf8length;
+#endif
+}
+
+inline const NPUTF8*
+GetNPStringChars(const NPString& str)
+{
+#if NPAPI_VERSION == 192
+    return str.UTF8Characters;
+#else
+    return str.utf8characters;
+#endif
+}
+
 /// Makes a deep copy of a NPVariant.
 /// @param from The source NPVariant to copy values from.
 /// @param to The destination NPVariant.
@@ -43,18 +63,11 @@ CopyVariantValue(const NPVariant& from, NPVariant& to)
         case NPVariantType_String:
         {
             const NPString& fromstr = NPVARIANT_TO_STRING(from);
-#if NPAPI_VERSION == 192
-            const uint32_t& len = fromstr.UTF8Length;
-#else
-            const uint32_t& len = fromstr.utf8length;
-#endif
+            const uint32_t& len = GetNPStringLen(fromstr);
 
             NPUTF8* tostr = static_cast<NPUTF8*>(NPN_MemAlloc(len));
-#if NPAPI_VERSION == 192
-            std::copy(fromstr.UTF8Characters, fromstr.UTF8Characters+len, 
tostr);
-#else
-            std::copy(fromstr.utf8characters, fromstr.utf8characters+len, 
tostr);
-#endif
+            std::copy(GetNPStringChars(fromstr),
+                      GetNPStringChars(fromstr)+ GetNPStringLen(fromstr), 
tostr);
 
             STRINGN_TO_NPVARIANT(tostr, len, to);
             break;
@@ -73,11 +86,7 @@ CopyVariantValue(const NPVariant& from, NPVariant& to)
 inline std::string
 NPStringToString(const NPString& str)
 {
-#if NPAPI_VERSION == 192
-    return std::string(str.UTF8Characters, str.UTF8Length);
-#else
-    return std::string(str.utf8characters, str.utf8length);
-#endif
+    return std::string(GetNPStringChars(str), GetNPStringLen(str));
 }
 
 
diff --git a/plugin/npapi/test.cpp b/plugin/npapi/test.cpp
index bbd2604..138ff04 100644
--- a/plugin/npapi/test.cpp
+++ b/plugin/npapi/test.cpp
@@ -40,6 +40,7 @@
 #include <regex.h>
 
 #include "external.h"
+#include "GnashNPVariant.h"
 
 TestState& runtest = _runtest;
 
@@ -456,11 +457,7 @@ NPN_ReleaseVariantValue(NPVariant *variant)
     switch(variant->type) {
         case NPVariantType_String:
         {
-#if NPAPI_VERSION == 192
-            
NPN_MemFree(const_cast<NPUTF8*>(NPVARIANT_TO_STRING(*variant).UTF8Characters));
-#else
-            
NPN_MemFree(const_cast<NPUTF8*>(NPVARIANT_TO_STRING(*variant).utf8characters));
-#endif
+            
NPN_MemFree(const_cast<NPUTF8*>(gnash::GetNPStringChars(NPVARIANT_TO_STRING(*variant))));
             break;
         }
         case NPVariantType_Object:

-----------------------------------------------------------------------

Summary of changes:
 libmedia/ffmpeg/MediaParserFfmpeg.cpp |   10 ++++++++
 plugin/npapi/GnashNPVariant.h         |   39 ++++++++++++++++++++------------
 plugin/npapi/test.cpp                 |    7 +----
 3 files changed, 36 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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