Backport a bunch of bug fixes from upstream, including fixing WAV

header writing on 64-bit archs.

From Brad (maintainer)
This commit is contained in:
dcoppa 2010-11-07 18:58:24 +00:00
parent c3677a7fb2
commit 075e993185
7 changed files with 260 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.34 2010/10/27 07:57:34 dcoppa Exp $
# $OpenBSD: Makefile,v 1.35 2010/11/07 18:58:24 dcoppa Exp $
SHARED_ONLY= Yes
@ -8,7 +8,7 @@ COMMENT= SWF player with Firefox browser plugin
VER= 0.8.8
DISTNAME= gnash-${VER}
REVISION= 1
REVISION= 2
CATEGORIES= www
MASTER_SITES= ${MASTER_SITE_GNU:=gnash/${VER}/}

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-gui_Player_cpp,v 1.1 2010/11/07 18:58:24 dcoppa Exp $
"base" parameter is always to be considered a directory.
--- gui/Player.cpp.orig Sat Aug 7 11:50:00 2010
+++ gui/Player.cpp Fri Nov 5 21:15:25 2010
@@ -314,9 +314,12 @@ Player::run(int argc, char* argv[], const std::string&
// Parse player parameters. These are not passed to the SWF, but rather
// control stage properties etc.
+ // NOTE: it is intentional to force a trailing slash to "base" argument
+ // as it was tested that the "base" argument is always considered
+ // a directory!
Params::const_iterator it = _params.find("base");
const URL baseURL = (it == _params.end()) ? _baseurl :
- URL(it->second, _baseurl);
+ URL(it->second+"/", _baseurl);
/// The RunResources should be populated before parsing.
_runResources.reset(new RunResources(baseURL.str()));

View File

@ -0,0 +1,71 @@
$OpenBSD: patch-libcore_DisplayList_cpp,v 1.1 2010/11/07 18:58:24 dcoppa Exp $
Drop assertion, handle the case instead.
--- libcore/DisplayList.cpp.orig Sat Aug 7 11:50:00 2010
+++ libcore/DisplayList.cpp Fri Nov 5 21:15:20 2010
@@ -45,15 +45,11 @@ namespace {
DisplayList::const_iterator beginNonRemoved(
const DisplayList::container_type& c);
- /// Return an iterator succeeding the last element in zone
- /// (-16384, 0xffff-16384)
+ /// Return the first element in the DisplayList whose depth exceeds
+ /// 65535 (-16384).
DisplayList::iterator dlistTagsEffectiveZoneEnd(
DisplayList::container_type& c);
- /// Return an constant iterator succeeding the last element
- /// in (-16384, 0xffff-16384)
- DisplayList::const_iterator dlistTagsEffectiveZoneEnd(
- const DisplayList::container_type& c);
}
/// Anonymous namespace for generic algorithm functors.
@@ -881,21 +877,27 @@ DisplayList::sort()
}
void
-DisplayList::mergeDisplayList(DisplayList & newList)
+DisplayList::mergeDisplayList(DisplayList& newList)
{
testInvariant();
+ log_debug("New list size: %s", newList.size());
+
iterator itOld = beginNonRemoved(_charsByDepth);
iterator itNew = beginNonRemoved(newList._charsByDepth);
iterator itOldEnd = dlistTagsEffectiveZoneEnd(_charsByDepth);
- iterator itNewEnd = newList._charsByDepth.end();
- assert(itNewEnd == dlistTagsEffectiveZoneEnd(newList._charsByDepth) );
+ // There used to be an assertion here that no character in the new list
+ // is at depth 65535 or higher. There's no reason why the tags executed
+ // on the new list shouldn't do this though. Bug #29282 does this.
+ // TODO: check whether we should be ignoring that character.
+ iterator itNewEnd = dlistTagsEffectiveZoneEnd(newList._charsByDepth);
+
// step1.
// starting scanning both lists.
- while (itOld != itOldEnd)
- {
+ while (itOld != itOldEnd) {
+
iterator itOldBackup = itOld;
DisplayObject* chOld = *itOldBackup;
@@ -1105,13 +1107,6 @@ beginNonRemoved(const DisplayList::container_type& c)
DisplayList::iterator
dlistTagsEffectiveZoneEnd(DisplayList::container_type& c)
-{
- return std::find_if(c.begin(), c.end(),
- DepthGreaterOrEqual(0xffff + DisplayObject::staticDepthOffset));
-}
-
-DisplayList::const_iterator
-dlistTagsEffectiveZoneEnd(const DisplayList::container_type& c)
{
return std::find_if(c.begin(), c.end(),
DepthGreaterOrEqual(0xffff + DisplayObject::staticDepthOffset));

View File

@ -0,0 +1,31 @@
$OpenBSD: patch-libcore_ExternalInterface_cpp,v 1.1 2010/11/07 18:58:24 dcoppa Exp $
Don't wait for data in ::readBrowser, read only if data is available..
--- libcore/ExternalInterface.cpp.orig Sat Aug 7 11:50:00 2010
+++ libcore/ExternalInterface.cpp Fri Nov 5 21:29:04 2010
@@ -663,21 +663,12 @@ ExternalInterface::readBrowser(int fd)
std::string empty;
// Wait for some data from the player
int bytes = 0;
- fd_set fdset;
- FD_ZERO(&fdset);
- FD_SET(fd, &fdset);
- struct timeval tval;
- tval.tv_sec = 10;
- tval.tv_usec = 0;
- // log_debug("Waiting for data... ");
- if (select(fd+1, &fdset, NULL, NULL, &tval)) {
- // log_debug("There is data in the network");
+
#ifndef _WIN32
- ioctl(fd, FIONREAD, &bytes);
+ ioctl(fd, FIONREAD, &bytes);
#else
- ioctlSocket(fd, FIONREAD, &bytes);
+ ioctlSocket(fd, FIONREAD, &bytes);
#endif
- }
// No data yet
if (bytes == 0) {

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-libcore_asobj_XMLNode_as_cpp,v 1.1 2010/11/07 18:58:24 dcoppa Exp $
Mark parent XMLNodes. Fixes bug #31044.
--- libcore/asobj/XMLNode_as.cpp.orig Sat Aug 7 11:50:00 2010
+++ libcore/asobj/XMLNode_as.cpp Fri Nov 5 21:15:00 2010
@@ -465,6 +465,11 @@ XMLNode_as::stringify(const XMLNode_as& xml, std::ostr
void
XMLNode_as::setReachable()
{
+ // If there is a parent, make sure its object is reachable. This goes
+ // up towards the root node of tree without marking the XMLNode
+ // resources (which would cause infinite recursion).
+ if (_parent && _parent->_object) _parent->_object->setReachable();
+
// Mark children
std::for_each(_children.begin(), _children.end(),
boost::mem_fn(&XMLNode_as::setReachable));

View File

@ -0,0 +1,47 @@
$OpenBSD: patch-libsound_sdl_sound_handler_sdl_cpp,v 1.1 2010/11/07 18:58:24 dcoppa Exp $
Use exact-size integers for WAV header (see bug #30993)
--- libsound/sdl/sound_handler_sdl.cpp.orig Sat Aug 7 11:50:00 2010
+++ libsound/sdl/sound_handler_sdl.cpp Fri Nov 5 21:15:15 2010
@@ -31,6 +31,7 @@
#include <vector>
#include <boost/scoped_array.hpp>
+#include <boost/cstdint.hpp>
#include <SDL.h>
// Define this to get debugging call about pausing/unpausing audio
@@ -45,23 +46,23 @@ namespace { // anonymous
// http://ftp.iptel.org/pub/sems/doc/full/current/wav__hdr_8c-source.html
typedef struct{
char rID[4]; // 'RIFF'
- long int rLen;
+ boost::uint32_t rLen;
char wID[4]; // 'WAVE'
char fId[4]; // 'fmt '
- long int pcm_header_len; // varies...
- short int wFormatTag;
- short int nChannels; // 1,2 for stereo data is (l,r) pairs
- long int nSamplesPerSec;
- long int nAvgBytesPerSec;
- short int nBlockAlign;
- short int nBitsPerSample;
+ boost::uint32_t pcm_header_len; // varies...
+ boost::int16_t wFormatTag;
+ boost::int16_t nChannels; // 1,2 for stereo data is (l,r) pairs
+ boost::uint32_t nSamplesPerSec;
+ boost::uint32_t nAvgBytesPerSec;
+ boost::int16_t nBlockAlign;
+ boost::int16_t nBitsPerSample;
} WAV_HDR;
// Chunk of wave file
// http://ftp.iptel.org/pub/sems/doc/full/current/wav__hdr_8c-source.html
typedef struct{
char dId[4]; // 'data' or 'fact'
- long int dLen;
+ boost::uint32_t dLen;
} CHUNK_HDR;
} // end of anonymous namespace

View File

@ -0,0 +1,71 @@
$OpenBSD: patch-plugin_npapi_plugin_cpp,v 1.3 2010/11/07 18:58:24 dcoppa Exp $
Use window.document.baseURI rather than
window.document.location.href. The former
honours <base> tags, fixing bug #31497
(aka easy come, easy go)
--- plugin/npapi/plugin.cpp.orig Mon Aug 16 11:46:55 2010
+++ plugin/npapi/plugin.cpp Fri Nov 5 21:15:29 2010
@@ -1218,6 +1218,13 @@ nsPluginInstance::startProc()
std::string
nsPluginInstance::getCurrentPageURL() const
{
+ // Return:
+ // window.document.baseURI
+ //
+ // Was (bogus):
+ // window.document.location.href
+ //
+
NPP npp = _instance;
NPIdentifier sDocument = NPN_GetStringIdentifier("document");
@@ -1230,20 +1237,21 @@ nsPluginInstance::getCurrentPageURL() const
NPN_ReleaseObject(window);
if (!NPVARIANT_IS_OBJECT(vDoc)) {
- gnash::log_error("Can't get window object");
- return NULL;
+ gnash::log_error("Can't get window.document object");
+ return std::string();
}
NPObject* npDoc = NPVARIANT_TO_OBJECT(vDoc);
+/*
NPIdentifier sLocation = NPN_GetStringIdentifier("location");
NPVariant vLoc;
NPN_GetProperty(npp, npDoc, sLocation, &vLoc);
NPN_ReleaseObject(npDoc);
if (!NPVARIANT_IS_OBJECT(vLoc)) {
- gnash::log_error("Can't get window.location object");
- return NULL;
+ gnash::log_error("Can't get window.document.location object");
+ return std::string();
}
NPObject* npLoc = NPVARIANT_TO_OBJECT(vLoc);
@@ -1254,8 +1262,19 @@ nsPluginInstance::getCurrentPageURL() const
NPN_ReleaseObject(npLoc);
if (!NPVARIANT_IS_STRING(vProp)) {
- gnash::log_error("Can't get window.location.href object");
- return NULL;
+ gnash::log_error("Can't get window.document.location.href string");
+ return std::string();
+ }
+*/
+
+ NPIdentifier sProperty = NPN_GetStringIdentifier("baseURI");
+ NPVariant vProp;
+ NPN_GetProperty(npp, npDoc, sProperty, &vProp);
+ NPN_ReleaseObject(npDoc);
+
+ if (!NPVARIANT_IS_STRING(vProp)) {
+ gnash::log_error("Can't get window.document.baseURI string");
+ return std::string();
}
const NPString& propValue = NPVARIANT_TO_STRING(vProp);