[Swfdec] 9 commits - libswfdec/swfdec_as_string.c libswfdec/swfdec_color_as.c libswfdec/swfdec_interval.c test/image test/trace

Pekka Lampila medar at kemper.freedesktop.org
Wed Nov 14 06:06:22 PST 2007


 libswfdec/swfdec_as_string.c                 |   31 +++---
 libswfdec/swfdec_color_as.c                  |    9 -
 libswfdec/swfdec_interval.c                  |    2 
 test/image/.gitignore                        |    2 
 test/trace/Makefile.am                       |   27 +++++
 test/trace/array2-8.swf                      |binary
 test/trace/array2-8.swf.trace                |   40 ++++++++
 test/trace/fromcharcode-other-5.swf          |binary
 test/trace/fromcharcode-other-5.swf.trace    |  124 ++++++++++++++++++++++++++
 test/trace/fromcharcode-other-6.swf          |binary
 test/trace/fromcharcode-other-6.swf.trace    |  125 +++++++++++++++++++++++++++
 test/trace/fromcharcode-other-7.swf          |binary
 test/trace/fromcharcode-other-7.swf.trace    |  125 +++++++++++++++++++++++++++
 test/trace/fromcharcode-other-8.swf          |binary
 test/trace/fromcharcode-other-8.swf.trace    |  125 +++++++++++++++++++++++++++
 test/trace/fromcharcode-other.as             |   11 ++
 test/trace/native-run-5.swf                  |binary
 test/trace/native-run-5.swf.trace            |    3 
 test/trace/native-run-6.swf                  |binary
 test/trace/native-run-6.swf.trace            |    3 
 test/trace/native-run-7.swf                  |binary
 test/trace/native-run-7.swf.trace            |    3 
 test/trace/native-run-8.swf                  |binary
 test/trace/native-run-8.swf.trace            |    3 
 test/trace/native-run.as                     |   69 ++++++++++++++
 test/trace/settimeout-clear-self-5.swf       |binary
 test/trace/settimeout-clear-self-5.swf.trace |    2 
 test/trace/settimeout-clear-self-6.swf       |binary
 test/trace/settimeout-clear-self-6.swf.trace |    2 
 test/trace/settimeout-clear-self-7.swf       |binary
 test/trace/settimeout-clear-self-7.swf.trace |    2 
 test/trace/settimeout-clear-self-8.swf       |binary
 test/trace/settimeout-clear-self-8.swf.trace |    2 
 test/trace/settimeout-clear-self.as          |   11 ++
 34 files changed, 702 insertions(+), 19 deletions(-)

New commits:
commit 41178928861567a0918949825b975f3658a4b6a8
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Nov 14 15:31:34 2007 +0200

    Add *.dump.png and *.diff.png to test/image/'s .gitignore

diff --git a/test/image/.gitignore b/test/image/.gitignore
index 5cb64c3..a26d58e 100644
--- a/test/image/.gitignore
+++ b/test/image/.gitignore
@@ -9,3 +9,5 @@ Makefile.in
 *.o
 
 image
+*.dump.png
+*.diff.png
commit 6c994e5fe15290542983d67fa2770aea590e49e5
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Nov 14 15:28:04 2007 +0200

    Recompile array2 test for version 8, since apparently it had been forgotten

diff --git a/test/trace/array2-8.swf b/test/trace/array2-8.swf
index de31d1f..4b6910f 100644
Binary files a/test/trace/array2-8.swf and b/test/trace/array2-8.swf differ
diff --git a/test/trace/array2-8.swf.trace b/test/trace/array2-8.swf.trace
index 51ea2a3..1ebe055 100644
--- a/test/trace/array2-8.swf.trace
+++ b/test/trace/array2-8.swf.trace
@@ -40,6 +40,10 @@
 [undefined, undefined, undefined, undefined, undefined]
 undefined
 [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined]
+[]
+-4
+[]
+-1
 [1, b, c, undefined, ]
 3.4
 [1, b, c, undefined, ]
@@ -91,9 +95,18 @@ undefined:undefined:undefined:undefined:undefined:undefined:undefined:undefined:
 6
 [1, 2, 3, 4, 5, [a, b, c]]
 1
+undefined
+[weirder]
+0
+undefined
+[]
+1
 [6]
 6
 [undefined, undefined, undefined, undefined, undefined, 6]
+-2
+x
+-2
 ## Pop
 # Normal usage
 4
@@ -103,6 +116,8 @@ c
 # Special cases
 undefined
 []
+undefined
+[]
 4
 [1, b, c]
 c
@@ -548,4 +563,29 @@ sort customfunc 30 [[1, 2, 3], [1, 2, 3, 4], [], [1, 2], [1]]
 sort customfunc 31 [[1, 2, 3], [1, 2, 3, 4], [], [1, 2], [1]]
 [1, 0, 3, 4, 2]
 [[1, 2, 3], [1, 2, 3, 4], [], [1, 2], [1]]
+## Fake Array (Object with Array's methods)
+[type Function]
+5
+5: a:b:c:x:z
+z
+5: a:b:c:x:undefined
+5
+5: y:a:b:c:x
+5
+5: z:y:a:b:c
+6: z:y:a:b:c:x
+z
+6: y:a:b:c:x:x
+x,x,c,b,a,y
+6: x:x:c:b:a:y
+x:x:c:b:a:y:a:x,x,c,b,a,y
+6: x:x:c:b:a:y
+x,c
+6: x:x:c:b:a:y
+c,b,a
+5: x:x:i:j:y
+i,j,x,x,y
+5: i:j:x:x:y
+[object Object]
+4, 3
 ## Done
commit d59ccd4d0bdd5fb1cd8004474ccb44a9258786d6
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Nov 14 15:26:17 2007 +0200

    Add a test that runs all native functions with various objects/arguments
    
    The goal of the test is to spot crashes
    It's list of native functions is not complete, but should include all the
    functions that have ASnative number in Swfdec at the moment

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 023d72e..4650b7b 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -1096,6 +1096,15 @@ EXTRA_DIST = \
 	name2.swf.trace \
 	names.swf \
 	names.swf.trace \
+	native-run.as \
+	native-run-5.swf \
+	native-run-5.swf.trace \
+	native-run-6.swf \
+	native-run-6.swf.trace \
+	native-run-7.swf \
+	native-run-7.swf.trace \
+	native-run-8.swf \
+	native-run-8.swf.trace \
 	netconnection.swf \
 	netconnection.swf.trace \
 	netstream-fscommand.as \
diff --git a/test/trace/native-run-5.swf b/test/trace/native-run-5.swf
new file mode 100644
index 0000000..f6a4d92
Binary files /dev/null and b/test/trace/native-run-5.swf differ
diff --git a/test/trace/native-run-5.swf.trace b/test/trace/native-run-5.swf.trace
new file mode 100644
index 0000000..2e23c21
--- /dev/null
+++ b/test/trace/native-run-5.swf.trace
@@ -0,0 +1,3 @@
+Running all native functions to find crashes
+Using undefined, movieclip, object and number as this
+Done
diff --git a/test/trace/native-run-6.swf b/test/trace/native-run-6.swf
new file mode 100644
index 0000000..0b6574b
Binary files /dev/null and b/test/trace/native-run-6.swf differ
diff --git a/test/trace/native-run-6.swf.trace b/test/trace/native-run-6.swf.trace
new file mode 100644
index 0000000..2e23c21
--- /dev/null
+++ b/test/trace/native-run-6.swf.trace
@@ -0,0 +1,3 @@
+Running all native functions to find crashes
+Using undefined, movieclip, object and number as this
+Done
diff --git a/test/trace/native-run-7.swf b/test/trace/native-run-7.swf
new file mode 100644
index 0000000..9d77f7d
Binary files /dev/null and b/test/trace/native-run-7.swf differ
diff --git a/test/trace/native-run-7.swf.trace b/test/trace/native-run-7.swf.trace
new file mode 100644
index 0000000..2e23c21
--- /dev/null
+++ b/test/trace/native-run-7.swf.trace
@@ -0,0 +1,3 @@
+Running all native functions to find crashes
+Using undefined, movieclip, object and number as this
+Done
diff --git a/test/trace/native-run-8.swf b/test/trace/native-run-8.swf
new file mode 100644
index 0000000..809aad3
Binary files /dev/null and b/test/trace/native-run-8.swf differ
diff --git a/test/trace/native-run-8.swf.trace b/test/trace/native-run-8.swf.trace
new file mode 100644
index 0000000..2e23c21
--- /dev/null
+++ b/test/trace/native-run-8.swf.trace
@@ -0,0 +1,3 @@
+Running all native functions to find crashes
+Using undefined, movieclip, object and number as this
+Done
diff --git a/test/trace/native-run.as b/test/trace/native-run.as
new file mode 100644
index 0000000..773a58d
--- /dev/null
+++ b/test/trace/native-run.as
@@ -0,0 +1,69 @@
+// makeswf -v 7 -r 1 -o native-run-7.swf native-run.as
+
+trace ("Running all native functions to find crashes");
+trace ("Using undefined, movieclip, object and number as this");
+
+// FIXME: List is not complete, check when implemting new native functions
+var native_functions = [
+  [4,0], [4,1], [5,0], [5,1], [11,0], [100,0], [100,1], [100,2], [100,3],
+  [100,5], [101,0], [101,1], [101,10], [101,11], [101,12], [101,2], [101,3],
+  [101,4], [101,5], [101,6], [101,7], [101,8], [103,0], [103,1], [103,10],
+  [103,11], [103,12], [103,128], [103,13], [103,14], [103,15], [103,16],
+  [103,17], [103,18], [103,19], [103,2], [103,20], [103,257], [103,3], [103,4],
+  [103,5], [103,6], [103,7], [103,8], [103,9], [104,0], [104,101], [104,102],
+  [104,103], [104,104], [104,105], [104,106], [104,107], [104,200], [104,201],
+  [106,0], [106,1], [107,0], [107,1], [111,0], [111,100], [111,101], [111,102],
+  [112,100], [112,101], [112,102], [113,100], [113,101], [113,102], [113,103],
+  [200,0], [200,1], [200,10], [200,11], [200,12], [200,13], [200,14], [200,15],
+  [200,16], [200,17], [200,18], [200,19], [200,2], [200,3], [200,4], [200,5],
+  [200,6], [200,7], [200,8], [200,9], [250,0], [250,1], [250,2], [251,1],
+  [251,10], [251,11], [251,12], [251,13], [251,14], [251,2], [251,3], [251,4],
+  [251,5], [251,6], [251,7], [251,8], [251,9], [252,1], [252,10], [252,11],
+  [252,12], [252,2], [252,3], [252,4], [252,5], [252,6], [252,7], [252,8],
+  [252,9], [253,1], [253,10], [253,11], [253,12], [253,2], [253,3], [253,4],
+  [253,5], [253,6], [253,7], [253,8], [301,0], [301,2], [301,3], [400,0],
+  [400,1], [400,2], [500,6], [500,7], [500,8], [600,0], [600,1], [600,2],
+  [600,3], [600,4], [600,5], [666,1], [666,2], [666,3], [666,4], [666,5],
+  [666,6], [666,7], [666,8], [700,0], [700,1], [700,2], [700,3], [800,0],
+  [800,1], [800,2], [900,0],
+  /* swapDepths: [900,1], */
+  [900,10], [900,12], [900,13], [900,14], [900,15], [900,16], [900,17],
+  [900,18], [900,19], [900,20], [900,21], [900,4], [900,5], [900,6], [900,7],
+  [901,0], [901,1], [901,2], [901,3], [901,4], [901,5], [901,6], [901,7],
+  [901,8], [1067,0], [1067,1], [1067,2], [1067,3], [1067,4], [1067,5],
+  [1067,6], [1067,7], [1067,8], [1067,9], [1112,1], [1999,0], [1999,1],
+  [1999,2], [2102,0], [2102,1], [2102,2],
+  /* Camera: */ [2102,200], [2102,201],
+  [2102,3], [2102,4], [2102,5], [2104,0], [2104,1], [2104,2], [2104,200],
+  [2104,201], [2104,3], [2150,0], [2150,1], [2150,10], [2150,11], [2150,2],
+  [2150,3], [2150,4], [2150,5], [2200,0], [2200,1], [2200,2], [2200,3],
+  [2204,0], [2204,1], [2204,2], [2204,200], [2204,3], [2205,0]
+];
+
+for (var i = 0; i < native_functions.length; i++) {
+  var o = new Object ();
+  var n = new Number ();
+  var func = ASnative (native_functions[i][0], native_functions[i][1]);
+  o.func = func;
+  n.func = func;
+
+  var args = [];
+  for (var j = 0; j < 10; j++) {
+    args.push (j);
+    func.apply (this, args);
+    o.func.apply (this, args);
+    n.func.apply (this, args);
+  }
+
+  // this way the function is called with this being undefined
+  setTimeout (func, 0);
+  setTimeout (func, 0, 1);
+  setTimeout (func, 0, 1, 2);
+  setTimeout (func, 0, 1, 2, 3);
+  setTimeout (func, 0, 1, 2, 3, 4);
+  setTimeout (func, 0, 1, 2, 3, 4, 5);
+}
+
+trace ("Done");
+
+loadMovie ("FSCommand:quit", "");
commit 155b0c503d0c1f8652652f371cc8c80c3e686b8d
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Nov 14 14:46:18 2007 +0200

    Add a test for String.fromCharCode with some extra values

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index ba2eede..023d72e 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -617,6 +617,15 @@ EXTRA_DIST = \
 	fromcharcode-6.swf.trace \
 	fromcharcode-7.swf \
 	fromcharcode-7.swf.trace \
+	fromcharcode-other.as \
+	fromcharcode-other-5.swf \
+	fromcharcode-other-5.swf.trace \
+	fromcharcode-other-6.swf \
+	fromcharcode-other-6.swf.trace \
+	fromcharcode-other-7.swf \
+	fromcharcode-other-7.swf.trace \
+	fromcharcode-other-8.swf \
+	fromcharcode-other-8.swf.trace \
 	fscommand.as \
 	fscommand-5.swf \
 	fscommand-5.swf.trace \
diff --git a/test/trace/fromcharcode-other-5.swf b/test/trace/fromcharcode-other-5.swf
new file mode 100644
index 0000000..2122b80
Binary files /dev/null and b/test/trace/fromcharcode-other-5.swf differ
diff --git a/test/trace/fromcharcode-other-5.swf.trace b/test/trace/fromcharcode-other-5.swf.trace
new file mode 100644
index 0000000..8cb67e9
--- /dev/null
+++ b/test/trace/fromcharcode-other-5.swf.trace
@@ -0,0 +1,124 @@
+valueOf called
+toString called
+toString called with 
+valueOf called with 
+0: valueOf!
+1: valueOf!
+2: valueOf!
+3: valueOf!
+4: valueOf!
+5: valueOf!
+6: valueOf!
+7: valueOf!
+8: valueOf!
+9: valueOf!
+10: valueOf!
+11: valueOf!
+12: valueOf!
+13: valueOf!
+14: valueOf!
+15: valueOf!
+16: valueOf!
+17: valueOf!
+18: valueOf!
+19: valueOf!
+20: valueOf!
+21: valueOf!
+22: valueOf!
+22: toString!
+23: valueOf!
+24: valueOf!
+24: toString!
+25: valueOf!
+25: toString!
+26: valueOf!
+26: toString!
+27: valueOf!
+27: toString!
+(no params) = 
+(0)  (undefined) = 
+(1) null (null) = 
+(2) true (boolean) = 
+(3) false (boolean) = 
+(4) 0 (number) = 
+(5) 1 (number) = 
+(6) 0.5 (number) = 
+(7) -1 (number) = ÿÿ
+(8) -0.5 (number) = 
+(9) Infinity (number) = 
+(10) -Infinity (number) = 
+(11) NaN (number) = 
+(12)  (string) = 
+(13) 0 (string) = 
+(14) -0 (string) = 
+(15) 0.0 (string) = 
+(16) 1 (string) = 
+(17) Hello World! (string) = 
+(18) true (string) = 
+(19) _level0 (string) = 
+(20) äöü (string) = 
+(21) _level0 (movieclip) = 
+(22) [object Object] (object) = 
+(23)  (undefined) = 
+valueOf called
+(24) [type Object] (object) = 
+(25) [type Object] (object) = 
+valueOf called with 
+(26) [object Object] (object) = 
+(27)  (object) = 
+0: valueOf!
+(28)  (object) = 
+1: valueOf!
+(29) null (object) = 
+2: valueOf!
+(30) true (object) = 
+3: valueOf!
+(31) false (object) = 
+4: valueOf!
+(32) 0 (object) = 
+5: valueOf!
+(33) 1 (object) = 
+6: valueOf!
+(34) 0.5 (object) = 
+7: valueOf!
+(35) -1 (object) = ÿÿ
+8: valueOf!
+(36) -0.5 (object) = 
+9: valueOf!
+(37) Infinity (object) = 
+10: valueOf!
+(38) -Infinity (object) = 
+11: valueOf!
+(39) NaN (object) = 
+12: valueOf!
+(40)  (object) = 
+13: valueOf!
+(41) 0 (object) = 
+14: valueOf!
+(42) -0 (object) = 
+15: valueOf!
+(43) 0.0 (object) = 
+16: valueOf!
+(44) 1 (object) = 
+17: valueOf!
+(45) Hello World! (object) = 
+18: valueOf!
+(46) true (object) = 
+19: valueOf!
+(47) _level0 (object) = 
+20: valueOf!
+(48) äöü (object) = 
+21: valueOf!
+(49) _level0 (object) = 
+22: valueOf!
+(50) [type Object] (object) = 
+23: valueOf!
+(51)  (object) = 
+24: valueOf!
+(52) [type Object] (object) = 
+25: valueOf!
+(53) [type Object] (object) = 
+26: valueOf!
+(54) [type Object] (object) = 
+27: valueOf!
+(55) [type Object] (object) = 
diff --git a/test/trace/fromcharcode-other-6.swf b/test/trace/fromcharcode-other-6.swf
new file mode 100644
index 0000000..19bb17d
Binary files /dev/null and b/test/trace/fromcharcode-other-6.swf differ
diff --git a/test/trace/fromcharcode-other-6.swf.trace b/test/trace/fromcharcode-other-6.swf.trace
new file mode 100644
index 0000000..5afde21
--- /dev/null
+++ b/test/trace/fromcharcode-other-6.swf.trace
@@ -0,0 +1,125 @@
+valueOf called
+toString called
+toString called with 
+valueOf called with 
+0: valueOf!
+1: valueOf!
+2: valueOf!
+3: valueOf!
+4: valueOf!
+5: valueOf!
+6: valueOf!
+7: valueOf!
+8: valueOf!
+9: valueOf!
+10: valueOf!
+11: valueOf!
+12: valueOf!
+13: valueOf!
+14: valueOf!
+15: valueOf!
+16: valueOf!
+17: valueOf!
+18: valueOf!
+19: valueOf!
+20: valueOf!
+21: valueOf!
+22: valueOf!
+22: toString!
+23: valueOf!
+23: toString!
+24: valueOf!
+24: toString!
+25: valueOf!
+25: toString!
+26: valueOf!
+26: toString!
+27: valueOf!
+27: toString!
+(no params) = 
+(0)  (undefined) = 
+(1) null (null) = 
+(2) true (boolean) = 
+(3) false (boolean) = 
+(4) 0 (number) = 
+(5) 1 (number) = 
+(6) 0.5 (number) = 
+(7) -1 (number) = ï¿¿
+(8) -0.5 (number) = 
+(9) Infinity (number) = 
+(10) -Infinity (number) = 
+(11) NaN (number) = 
+(12)  (string) = 
+(13) 0 (string) = 
+(14) -0 (string) = 
+(15) 0.0 (string) = 
+(16) 1 (string) = 
+(17) Hello World! (string) = 
+(18) true (string) = 
+(19) _level0 (string) = 
+(20) äöü (string) = 
+(21) _level0 (movieclip) = 
+(22) [object Object] (object) = 
+(23) [type Function] (function) = 
+valueOf called
+(24) [type Object] (object) = 
+(25) [type Object] (object) = 
+valueOf called with 
+(26) [object Object] (object) = 
+(27)  (object) = 
+0: valueOf!
+(28)  (object) = 
+1: valueOf!
+(29) null (object) = 
+2: valueOf!
+(30) true (object) = 
+3: valueOf!
+(31) false (object) = 
+4: valueOf!
+(32) 0 (object) = 
+5: valueOf!
+(33) 1 (object) = 
+6: valueOf!
+(34) 0.5 (object) = 
+7: valueOf!
+(35) -1 (object) = ï¿¿
+8: valueOf!
+(36) -0.5 (object) = 
+9: valueOf!
+(37) Infinity (object) = 
+10: valueOf!
+(38) -Infinity (object) = 
+11: valueOf!
+(39) NaN (object) = 
+12: valueOf!
+(40)  (object) = 
+13: valueOf!
+(41) 0 (object) = 
+14: valueOf!
+(42) -0 (object) = 
+15: valueOf!
+(43) 0.0 (object) = 
+16: valueOf!
+(44) 1 (object) = 
+17: valueOf!
+(45) Hello World! (object) = 
+18: valueOf!
+(46) true (object) = 
+19: valueOf!
+(47) _level0 (object) = 
+20: valueOf!
+(48) äöü (object) = 
+21: valueOf!
+(49) _level0 (object) = 
+22: valueOf!
+(50) [type Object] (object) = 
+23: valueOf!
+(51) [type Object] (object) = 
+24: valueOf!
+(52) [type Object] (object) = 
+25: valueOf!
+(53) [type Object] (object) = 
+26: valueOf!
+(54) [type Object] (object) = 
+27: valueOf!
+(55) [type Object] (object) = 
diff --git a/test/trace/fromcharcode-other-7.swf b/test/trace/fromcharcode-other-7.swf
new file mode 100644
index 0000000..c809db0
Binary files /dev/null and b/test/trace/fromcharcode-other-7.swf differ
diff --git a/test/trace/fromcharcode-other-7.swf.trace b/test/trace/fromcharcode-other-7.swf.trace
new file mode 100644
index 0000000..c867cfc
--- /dev/null
+++ b/test/trace/fromcharcode-other-7.swf.trace
@@ -0,0 +1,125 @@
+valueOf called
+toString called
+toString called with 
+valueOf called with 
+0: valueOf!
+1: valueOf!
+2: valueOf!
+3: valueOf!
+4: valueOf!
+5: valueOf!
+6: valueOf!
+7: valueOf!
+8: valueOf!
+9: valueOf!
+10: valueOf!
+11: valueOf!
+12: valueOf!
+13: valueOf!
+14: valueOf!
+15: valueOf!
+16: valueOf!
+17: valueOf!
+18: valueOf!
+19: valueOf!
+20: valueOf!
+21: valueOf!
+22: valueOf!
+22: toString!
+23: valueOf!
+23: toString!
+24: valueOf!
+24: toString!
+25: valueOf!
+25: toString!
+26: valueOf!
+26: toString!
+27: valueOf!
+27: toString!
+(no params) = 
+(0) undefined (undefined) = 
+(1) null (null) = 
+(2) true (boolean) = 
+(3) false (boolean) = 
+(4) 0 (number) = 
+(5) 1 (number) = 
+(6) 0.5 (number) = 
+(7) -1 (number) = ï¿¿
+(8) -0.5 (number) = 
+(9) Infinity (number) = 
+(10) -Infinity (number) = 
+(11) NaN (number) = 
+(12)  (string) = 
+(13) 0 (string) = 
+(14) -0 (string) = 
+(15) 0.0 (string) = 
+(16) 1 (string) = 
+(17) Hello World! (string) = 
+(18) true (string) = 
+(19) _level0 (string) = 
+(20) äöü (string) = 
+(21) _level0 (movieclip) = 
+(22) [object Object] (object) = 
+(23) [type Function] (function) = 
+valueOf called
+(24) [type Object] (object) = 
+(25) [type Object] (object) = 
+valueOf called with 
+(26) [object Object] (object) = 
+(27) undefined (object) = 
+0: valueOf!
+(28) undefined (object) = 
+1: valueOf!
+(29) null (object) = 
+2: valueOf!
+(30) true (object) = 
+3: valueOf!
+(31) false (object) = 
+4: valueOf!
+(32) 0 (object) = 
+5: valueOf!
+(33) 1 (object) = 
+6: valueOf!
+(34) 0.5 (object) = 
+7: valueOf!
+(35) -1 (object) = ï¿¿
+8: valueOf!
+(36) -0.5 (object) = 
+9: valueOf!
+(37) Infinity (object) = 
+10: valueOf!
+(38) -Infinity (object) = 
+11: valueOf!
+(39) NaN (object) = 
+12: valueOf!
+(40)  (object) = 
+13: valueOf!
+(41) 0 (object) = 
+14: valueOf!
+(42) -0 (object) = 
+15: valueOf!
+(43) 0.0 (object) = 
+16: valueOf!
+(44) 1 (object) = 
+17: valueOf!
+(45) Hello World! (object) = 
+18: valueOf!
+(46) true (object) = 
+19: valueOf!
+(47) _level0 (object) = 
+20: valueOf!
+(48) äöü (object) = 
+21: valueOf!
+(49) _level0 (object) = 
+22: valueOf!
+(50) [type Object] (object) = 
+23: valueOf!
+(51) [type Object] (object) = 
+24: valueOf!
+(52) [type Object] (object) = 
+25: valueOf!
+(53) [type Object] (object) = 
+26: valueOf!
+(54) [type Object] (object) = 
+27: valueOf!
+(55) [type Object] (object) = 
diff --git a/test/trace/fromcharcode-other-8.swf b/test/trace/fromcharcode-other-8.swf
new file mode 100644
index 0000000..c17d62e
Binary files /dev/null and b/test/trace/fromcharcode-other-8.swf differ
diff --git a/test/trace/fromcharcode-other-8.swf.trace b/test/trace/fromcharcode-other-8.swf.trace
new file mode 100644
index 0000000..c867cfc
--- /dev/null
+++ b/test/trace/fromcharcode-other-8.swf.trace
@@ -0,0 +1,125 @@
+valueOf called
+toString called
+toString called with 
+valueOf called with 
+0: valueOf!
+1: valueOf!
+2: valueOf!
+3: valueOf!
+4: valueOf!
+5: valueOf!
+6: valueOf!
+7: valueOf!
+8: valueOf!
+9: valueOf!
+10: valueOf!
+11: valueOf!
+12: valueOf!
+13: valueOf!
+14: valueOf!
+15: valueOf!
+16: valueOf!
+17: valueOf!
+18: valueOf!
+19: valueOf!
+20: valueOf!
+21: valueOf!
+22: valueOf!
+22: toString!
+23: valueOf!
+23: toString!
+24: valueOf!
+24: toString!
+25: valueOf!
+25: toString!
+26: valueOf!
+26: toString!
+27: valueOf!
+27: toString!
+(no params) = 
+(0) undefined (undefined) = 
+(1) null (null) = 
+(2) true (boolean) = 
+(3) false (boolean) = 
+(4) 0 (number) = 
+(5) 1 (number) = 
+(6) 0.5 (number) = 
+(7) -1 (number) = ï¿¿
+(8) -0.5 (number) = 
+(9) Infinity (number) = 
+(10) -Infinity (number) = 
+(11) NaN (number) = 
+(12)  (string) = 
+(13) 0 (string) = 
+(14) -0 (string) = 
+(15) 0.0 (string) = 
+(16) 1 (string) = 
+(17) Hello World! (string) = 
+(18) true (string) = 
+(19) _level0 (string) = 
+(20) äöü (string) = 
+(21) _level0 (movieclip) = 
+(22) [object Object] (object) = 
+(23) [type Function] (function) = 
+valueOf called
+(24) [type Object] (object) = 
+(25) [type Object] (object) = 
+valueOf called with 
+(26) [object Object] (object) = 
+(27) undefined (object) = 
+0: valueOf!
+(28) undefined (object) = 
+1: valueOf!
+(29) null (object) = 
+2: valueOf!
+(30) true (object) = 
+3: valueOf!
+(31) false (object) = 
+4: valueOf!
+(32) 0 (object) = 
+5: valueOf!
+(33) 1 (object) = 
+6: valueOf!
+(34) 0.5 (object) = 
+7: valueOf!
+(35) -1 (object) = ï¿¿
+8: valueOf!
+(36) -0.5 (object) = 
+9: valueOf!
+(37) Infinity (object) = 
+10: valueOf!
+(38) -Infinity (object) = 
+11: valueOf!
+(39) NaN (object) = 
+12: valueOf!
+(40)  (object) = 
+13: valueOf!
+(41) 0 (object) = 
+14: valueOf!
+(42) -0 (object) = 
+15: valueOf!
+(43) 0.0 (object) = 
+16: valueOf!
+(44) 1 (object) = 
+17: valueOf!
+(45) Hello World! (object) = 
+18: valueOf!
+(46) true (object) = 
+19: valueOf!
+(47) _level0 (object) = 
+20: valueOf!
+(48) äöü (object) = 
+21: valueOf!
+(49) _level0 (object) = 
+22: valueOf!
+(50) [type Object] (object) = 
+23: valueOf!
+(51) [type Object] (object) = 
+24: valueOf!
+(52) [type Object] (object) = 
+25: valueOf!
+(53) [type Object] (object) = 
+26: valueOf!
+(54) [type Object] (object) = 
+27: valueOf!
+(55) [type Object] (object) = 
diff --git a/test/trace/fromcharcode-other.as b/test/trace/fromcharcode-other.as
new file mode 100644
index 0000000..7e67fc3
--- /dev/null
+++ b/test/trace/fromcharcode-other.as
@@ -0,0 +1,11 @@
+// makeswf -v 7 -r 1 -o fromcharcode-other-7.swf fromcharcode-other.as
+
+#include "values.as"
+
+trace ("(no params) = " + String.fromCharCode ());
+
+for (var i = 0; i < values.length; i++) {
+  trace (names[i] + " = " + String.fromCharCode (values[i]));
+}
+
+loadMovie ("FSCommand:quit", "");
commit 70924d3f7e56012a590d8bb678c99715ca4c0a86
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Nov 14 14:44:45 2007 +0200

    Fix an assert in String.fromCharCode in version 5 when called with no args

diff --git a/libswfdec/swfdec_as_string.c b/libswfdec/swfdec_as_string.c
index 3a642c7..2fad7cf 100644
--- a/libswfdec/swfdec_as_string.c
+++ b/libswfdec/swfdec_as_string.c
@@ -223,18 +223,23 @@ swfdec_as_string_fromCharCode_5 (SwfdecAsContext *cx, SwfdecAsObject *object,
   char *s;
   GByteArray *array = g_byte_array_new ();
 
-  for (i = 0; i < argc; i++) {
-    c = ((guint) swfdec_as_value_to_integer (cx, &argv[i])) % 65536;
-    if (c > 255) {
-      append = c / 256;
+  if (argc > 0) {
+    for (i = 0; i < argc; i++) {
+      c = ((guint) swfdec_as_value_to_integer (cx, &argv[i])) % 65536;
+      if (c > 255) {
+	append = c / 256;
+	g_byte_array_append (array, &append, 1);
+      }
+      append = c;
       g_byte_array_append (array, &append, 1);
     }
-    append = c;
-    g_byte_array_append (array, &append, 1);
+
+    /* FIXME: are these the correct charset names? */
+    s = g_convert ((char *) array->data, array->len, "UTF-8", "LATIN1", NULL, NULL, &error);
+  } else{
+    s = g_strdup ("");
   }
 
-  /* FIXME: are these the correct charset names? */
-  s = g_convert ((char *) array->data, array->len, "UTF-8", "LATIN1", NULL, NULL, &error);
   if (s) {
     SWFDEC_AS_VALUE_SET_STRING (ret, swfdec_as_context_get_string (cx, s));
     g_free (s);
commit fcb45ff8220c95899a1e4108b79f1ac21861d398
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Nov 14 14:28:06 2007 +0200

    Fix some crashes in string functions when this is null

diff --git a/libswfdec/swfdec_as_string.c b/libswfdec/swfdec_as_string.c
index d15c81b..3a642c7 100644
--- a/libswfdec/swfdec_as_string.c
+++ b/libswfdec/swfdec_as_string.c
@@ -108,9 +108,9 @@ swfdec_as_string_lastIndexOf (SwfdecAsContext *cx, SwfdecAsObject *object,
   if (argc < 1)
     return;
 
-  s = swfdec_as_value_to_string (object->context, &argv[0]);
+  s = swfdec_as_value_to_string (cx, &argv[0]);
   if (argc == 2) {
-    int offset = swfdec_as_value_to_integer (object->context, &argv[1]);
+    int offset = swfdec_as_value_to_integer (cx, &argv[1]);
     if (offset < 0) {
       SWFDEC_AS_VALUE_SET_INT (ret, -1);
       return;
@@ -139,9 +139,9 @@ swfdec_as_string_indexOf (SwfdecAsContext *cx, SwfdecAsObject *object,
   if (argc < 1)
     return;
 
-  s = swfdec_as_value_to_string (object->context, &argv[0]);
+  s = swfdec_as_value_to_string (cx, &argv[0]);
   if (argc == 2)
-    offset = swfdec_as_value_to_integer (object->context, &argv[1]);
+    offset = swfdec_as_value_to_integer (cx, &argv[1]);
   if (offset < 0)
     offset = 0;
   len = g_utf8_strlen (string, -1);
@@ -167,7 +167,7 @@ swfdec_as_string_charAt (SwfdecAsContext *cx, SwfdecAsObject *object,
   if (argc < 1)
     return;
 
-  i = swfdec_as_value_to_integer (object->context, &argv[0]);
+  i = swfdec_as_value_to_integer (cx, &argv[0]);
   if (i < 0) {
     SWFDEC_AS_VALUE_SET_STRING (ret, SWFDEC_AS_STR_EMPTY);
     return;
commit f95f7054827397fc579398d604f820847beeae0f
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Nov 14 14:25:51 2007 +0200

    Add a test for clearing timeout in it's own callback function

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 584e7be..ba2eede 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -1773,6 +1773,15 @@ EXTRA_DIST = \
 	settimeout-6.swf.trace \
 	settimeout-7.swf \
 	settimeout-7.swf.trace \
+	settimeout-clear-self.as \
+	settimeout-clear-self-5.swf \
+	settimeout-clear-self-5.swf.trace \
+	settimeout-clear-self-6.swf \
+	settimeout-clear-self-6.swf.trace \
+	settimeout-clear-self-7.swf \
+	settimeout-clear-self-7.swf.trace \
+	settimeout-clear-self-8.swf \
+	settimeout-clear-self-8.swf.trace \
 	setvariable.swf \
 	setvariable.swf.trace \
 	setvariable-callback.as \
diff --git a/test/trace/settimeout-clear-self-5.swf b/test/trace/settimeout-clear-self-5.swf
new file mode 100644
index 0000000..bcb741c
Binary files /dev/null and b/test/trace/settimeout-clear-self-5.swf differ
diff --git a/test/trace/settimeout-clear-self-5.swf.trace b/test/trace/settimeout-clear-self-5.swf.trace
new file mode 100644
index 0000000..25583ff
--- /dev/null
+++ b/test/trace/settimeout-clear-self-5.swf.trace
@@ -0,0 +1,2 @@
+Test clearing timeout in it's own callback function
+clearing timeout
diff --git a/test/trace/settimeout-clear-self-6.swf b/test/trace/settimeout-clear-self-6.swf
new file mode 100644
index 0000000..d2f3c18
Binary files /dev/null and b/test/trace/settimeout-clear-self-6.swf differ
diff --git a/test/trace/settimeout-clear-self-6.swf.trace b/test/trace/settimeout-clear-self-6.swf.trace
new file mode 100644
index 0000000..25583ff
--- /dev/null
+++ b/test/trace/settimeout-clear-self-6.swf.trace
@@ -0,0 +1,2 @@
+Test clearing timeout in it's own callback function
+clearing timeout
diff --git a/test/trace/settimeout-clear-self-7.swf b/test/trace/settimeout-clear-self-7.swf
new file mode 100644
index 0000000..8cc06f3
Binary files /dev/null and b/test/trace/settimeout-clear-self-7.swf differ
diff --git a/test/trace/settimeout-clear-self-7.swf.trace b/test/trace/settimeout-clear-self-7.swf.trace
new file mode 100644
index 0000000..25583ff
--- /dev/null
+++ b/test/trace/settimeout-clear-self-7.swf.trace
@@ -0,0 +1,2 @@
+Test clearing timeout in it's own callback function
+clearing timeout
diff --git a/test/trace/settimeout-clear-self-8.swf b/test/trace/settimeout-clear-self-8.swf
new file mode 100644
index 0000000..c9104d7
Binary files /dev/null and b/test/trace/settimeout-clear-self-8.swf differ
diff --git a/test/trace/settimeout-clear-self-8.swf.trace b/test/trace/settimeout-clear-self-8.swf.trace
new file mode 100644
index 0000000..25583ff
--- /dev/null
+++ b/test/trace/settimeout-clear-self-8.swf.trace
@@ -0,0 +1,2 @@
+Test clearing timeout in it's own callback function
+clearing timeout
diff --git a/test/trace/settimeout-clear-self.as b/test/trace/settimeout-clear-self.as
new file mode 100644
index 0000000..80a05c0
--- /dev/null
+++ b/test/trace/settimeout-clear-self.as
@@ -0,0 +1,11 @@
+// makeswf -v 7 -r 1 -o settimeout-clear-self-7.swf settimeout-clear-self.as
+
+trace ("Test clearing timeout in it's own callback function");
+
+function clear_self () {
+  trace ("clearing timeout");
+  clearTimeout (timeout);
+  loadMovie ("FSCommand:quit", "");
+}
+
+timeout = setTimeout (clear_self, 50);
commit 6b8e7e49facb8026dcc5836a45a0ad3b8d1e065c
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Nov 14 14:23:37 2007 +0200

    Remove timeouts from intervals list once they have been triggered

diff --git a/libswfdec/swfdec_interval.c b/libswfdec/swfdec_interval.c
index f8fcc85..1199290 100644
--- a/libswfdec/swfdec_interval.c
+++ b/libswfdec/swfdec_interval.c
@@ -87,11 +87,13 @@ swfdec_interval_trigger (SwfdecTimeout *timeout)
   SwfdecInterval *interval = SWFDEC_INTERVAL (((guchar *) timeout) 
       - G_STRUCT_OFFSET (SwfdecInterval, timeout));
   SwfdecAsContext *context = SWFDEC_AS_OBJECT (interval)->context;
+  SwfdecPlayer *player = SWFDEC_PLAYER (context);
 
   if (interval->repeat) {
     timeout->timestamp += SWFDEC_MSECS_TO_TICKS (interval->msecs);
     swfdec_player_add_timeout (SWFDEC_PLAYER (context), timeout);
   } else {
+    player->intervals = g_list_remove (player->intervals, interval);
     interval->timeout.callback = NULL;
   }
   if (interval->fun_name) {
commit f22f7bef8ab822c14a653c04680840150a97b4d0
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Nov 14 14:10:26 2007 +0200

    Make swfdec_movie_color_get_movie return null if object is null

diff --git a/libswfdec/swfdec_color_as.c b/libswfdec/swfdec_color_as.c
index 6bd1878..aece489 100644
--- a/libswfdec/swfdec_color_as.c
+++ b/libswfdec/swfdec_color_as.c
@@ -37,6 +37,9 @@ swfdec_movie_color_get_movie (SwfdecAsObject *object)
   SwfdecAsValue val;
   SwfdecAsObject *target;
 
+  if (object == NULL)
+    return NULL;
+
   swfdec_as_object_get_variable (object, SWFDEC_AS_STR_target, &val);
   if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
     return NULL;
@@ -56,9 +59,6 @@ swfdec_movie_color_getRGB (SwfdecAsContext *cx, SwfdecAsObject *obj,
   int result;
   SwfdecMovie *movie;
 
-  if (obj == NULL)
-    return;
-
   movie = swfdec_movie_color_get_movie (obj);
   
   if (movie == NULL)
@@ -87,9 +87,6 @@ swfdec_movie_color_getTransform (SwfdecAsContext *cx, SwfdecAsObject *obj,
   SwfdecAsObject *ret;
   SwfdecMovie *movie;
 
-  if (obj == NULL)
-    return;
-
   movie = swfdec_movie_color_get_movie (obj);
   
   if (movie == NULL)


More information about the Swfdec mailing list