Browse Source

fixed ByteArray serialization

Nicolas Cannasse 18 years ago
parent
commit
f85cc58aa0
2 changed files with 7 additions and 2 deletions
  1. 1 0
      doc/CHANGES.txt
  2. 6 2
      std/haxe/Serializer.hx

+ 1 - 0
doc/CHANGES.txt

@@ -2,6 +2,7 @@
 	added flash lite support with -D flash_lite
 	bugfix for Unknown<X> should Unknown<X>
 	prevent some exceptions in neko.net.ProxyDetect
+	fixed ByteArray serialization
 
 2007-01-28: 1.11
 	changed StringBuf.add implementation

+ 6 - 2
std/haxe/Serializer.hx

@@ -238,15 +238,19 @@ class Serializer {
 			#if flash9
 			case cast flash.utils.ByteArray:
 				buf.add("y");
+				var s = "";
 				var b : flash.utils.ByteArray = v;
 				for( p in 0...b.length ) {
 					var c = b[p];
 					// 0-9a-zA-Z
 					if( (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122) )
-						buf.add(String.fromCharCode(c));
+						s += String.fromCharCode(c);
 					else
-						buf.add("%"+(c>>4)+(c&15));
+						s += "%"+(c>>4)+(c&15);
 				}
+				buf.add(s.length);
+				buf.add(":");
+				buf.add(s);
 			#end
 			default:
 				cache.pop();