[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9555: SimpleBuffer and cross-blocks
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9555: SimpleBuffer and cross-blocks branching |
Date: |
Mon, 04 Aug 2008 10:31:39 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9555
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Mon 2008-08-04 10:31:39 +0200
message:
SimpleBuffer and cross-blocks branching
added:
testsuite/misc-swfmill.all/jump_to_prev_block.xml
modified:
libamf/amf.cpp
libamf/amf.h
libbase/SimpleBuffer.h
testsuite/misc-swfmill.all/Makefile.am
------------------------------------------------------------
revno: 9554.1.1
committer: Sandro Santilli <address@hidden>
branch nick: mybranch
timestamp: Mon 2008-08-04 10:27:46 +0200
message:
Test that ActionScript branch opcode do can cross action blocks.
added:
testsuite/misc-swfmill.all/jump_to_prev_block.xml
modified:
testsuite/misc-swfmill.all/Makefile.am
------------------------------------------------------------
revno: 9554.1.2
author: Jason Woofenden <address@hidden>
committer: Sandro Santilli <address@hidden>
branch nick: mybranch
timestamp: Mon 2008-08-04 10:29:21 +0200
message:
Change SimpleBuffer::append to take a void*, add methods to append
bytes and shorts and longs in network byte order.
modified:
libamf/amf.cpp
libamf/amf.h
libbase/SimpleBuffer.h
=== modified file 'libamf/amf.cpp'
--- a/libamf/amf.cpp 2008-06-17 13:55:12 +0000
+++ b/libamf/amf.cpp 2008-08-04 08:29:21 +0000
@@ -706,7 +706,7 @@
switch (type) {
case Element::NUMBER_AMF0:
el->makeNumber(tmpptr);
- tmpptr += AMF0_NUMBER_SIZE; // all numbers are 8 bit big endian
+ tmpptr += AMF0_NUMBER_SIZE; // all numbers are 8 byte big endian
break;
case Element::BOOLEAN_AMF0:
el->makeBoolean(tmpptr);
=== modified file 'libamf/amf.h'
--- a/libamf/amf.h 2008-05-16 02:46:11 +0000
+++ b/libamf/amf.h 2008-08-04 08:29:21 +0000
@@ -49,7 +49,7 @@
// All numbers in AMF format are 8 byte doubles.
const size_t AMF0_NUMBER_SIZE = 0x08;
-// The header of an AMF object is a type filed (1 byte), followed by a
+// The header of an AMF object is a type field (1 byte), followed by a
// length field. (short)
const gnash::Network::byte_t AMF_HEADER_SIZE = 3;
=== modified file 'libbase/SimpleBuffer.h'
--- a/libbase/SimpleBuffer.h 2008-06-12 18:49:35 +0000
+++ b/libbase/SimpleBuffer.h 2008-08-04 08:29:21 +0000
@@ -146,14 +146,60 @@
/// @param size
/// Size of data to append
///
- void append(const boost::uint8_t* newData, size_t size)
+ void append(const void* inData, size_t size)
{
+ const boost::uint8_t* newData = reinterpret_cast<const
uint8_t*>(inData);
size_t curSize = _size;
resize(curSize+size);
std::copy(newData, newData+size, _data+curSize);
assert(_size == curSize+size);
}
+ /// Append a byte to the buffer
+ //
+ /// The buffer will be appropriately resized to have space.
+ ///
+ /// @param b
+ /// Byte to append.
+ ///
+ void appendByte(const boost::uint8_t b)
+ {
+ resize(_size + 1);
+ _data[_size - 1] = b;
+ }
+
+ /// Append 2 bytes to the buffer
+ //
+ /// The buffer will be appropriately resized to have space.
+ ///
+ /// @param s
+ /// Short to append. Will be appended in network order. ie
+ /// with high order byte first.
+ ///
+ void appendNetworkShort(const boost::uint16_t s)
+ {
+ resize(_size + 2);
+ _data[_size - 2] = s >> 8;
+ _data[_size - 1] = s & 0xff;
+ }
+
+ /// Append 4 bytes to the buffer
+ //
+ /// The buffer will be appropriately resized to have space.
+ ///
+ /// @param l
+ /// Long to append. Will be appended in network order. ie
+ /// with high order bytes first.
+ ///
+ void appendNetworkLong(const boost::uint32_t l)
+ {
+ resize(_size + 4);
+ _data[_size - 4] = l >> 24;
+ _data[_size - 3] = (l >> 16) & 0xff;
+ _data[_size - 2] = (l >> 8) & 0xff;
+ _data[_size - 1] = l & 0xff;
+ }
+
/// Append data to the buffer
//
/// The buffer will be appropriately resized to have space for
=== modified file 'testsuite/misc-swfmill.all/Makefile.am'
--- a/testsuite/misc-swfmill.all/Makefile.am 2008-07-22 21:24:49 +0000
+++ b/testsuite/misc-swfmill.all/Makefile.am 2008-08-04 08:27:46 +0000
@@ -25,6 +25,7 @@
SC_XMLTESTS = \
hello.xml \
jump_after_end.xml \
+ jump_to_prev_block.xml \
dict_override.xml \
initaction_in_definesprite.xml \
zeroframe_definesprite.xml \
@@ -53,6 +54,7 @@
check_SCRIPTS = \
jump_after_end-runner \
+ jump_to_prev_block-runner \
dict_override-runner \
initaction_in_definesprite-runner \
zeroframe_definesprite-runner \
@@ -67,6 +69,10 @@
sh $< -r 50 -c "END OF TEST" $(top_builddir) jump_after_end.swf > $@
chmod 755 $@
+jump_to_prev_block-runner: $(srcdir)/../generic-testrunner.sh
jump_to_prev_block.swf Makefile
+ sh $< -r 50 -C "ABA" $(top_builddir) jump_to_prev_block.swf > $@
+ chmod 755 $@
+
dict_override-runner: $(srcdir)/../generic-testrunner.sh dict_override.swf
Makefile
sh $< -r 50 -c "END OF TEST" $(top_builddir) dict_override.swf > $@
chmod 755 $@
=== added file 'testsuite/misc-swfmill.all/jump_to_prev_block.xml'
--- a/testsuite/misc-swfmill.all/jump_to_prev_block.xml 1970-01-01 00:00:00
+0000
+++ b/testsuite/misc-swfmill.all/jump_to_prev_block.xml 2008-08-04 08:27:46
+0000
@@ -0,0 +1,102 @@
+<?xml version="1.0"?>
+<swf version="6" compressed="1">
+
+<!--
+
+ This file wants to test if branch to a previous block is allowed.
+
+ It is hard to make it self-contained as if the branch fails
+ we'll loose control over the execution so nothing will be
+ traced. Tracing successes is fine.
+
+ The only solution I found was making the test *runner*
+ aware of what signals end of test, and verify the end of test
+ is reached. The expected final pattern (ABA) is set in the
+ Makefile.am so if you change last trace from this test please
+ update that as well.
+
+ A good way to find jump offset after editing is using 'listswf'
+ from a fairly recent Ming version, in that you can read absolute
+ offsets and computed targets from it.
+
+-->
+
+ <Header framerate="12" frames="1">
+ <size>
+ <Rectangle left="0" right="12800" top="0" bottom="9600"/>
+ </size>
+ <tags>
+
+ <DoAction>
+ <actions>
+ <PushData>
+ <items>
+ <StackString value="jumpval"/>
+ <StackString value=""/>
+ </items>
+ </PushData>
+ <SetVariable/>
+ <EndAction/>
+ </actions>
+ </DoAction>
+
+ <DoAction>
+ <actions>
+ <PushData>
+ <items>
+ <StackString value="jumpval"/>
+ </items>
+ </PushData>
+ <Duplicate/>
+ <GetVariable/>
+ <PushData>
+ <items>
+ <StackString value="A"/>
+ </items>
+ </PushData>
+ <AddTyped/>
+ <SetVariable/>
+ <EndAction/>
+ </actions>
+ </DoAction>
+
+ <DoAction>
+ <actions>
+ <PushData>
+ <items>
+ <StackString value="jumpval"/>
+ </items>
+ </PushData>
+ <Duplicate/>
+ <GetVariable/>
+ <PushData>
+ <items>
+ <StackString value="B"/>
+ </items>
+ </PushData>
+ <AddTyped/>
+ <SetVariable/>
+ <BranchAlways byteOffset="-56"/>
+ <EndAction/>
+ </actions>
+ </DoAction>
+
+ <DoAction>
+ <actions>
+ <PushData>
+ <items>
+ <StackString value="jumpval"/>
+ </items>
+ </PushData>
+ <GetVariable/>
+ <Trace/> <!-- EXPECT: ABA -->
+ <EndAction/>
+ </actions>
+ </DoAction>
+
+
+ <ShowFrame/>
+ <End/>
+ </tags>
+ </Header>
+</swf>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9555: SimpleBuffer and cross-blocks branching,
Sandro Santilli <=