Browse Source

fixed api (changed in cpp .this_run by .execute)

Nicolas Cannasse 12 years ago
parent
commit
2222e3996c

+ 4 - 4
std/cpp/_std/zip/Compress.hx → std/cpp/_std/haxe/zip/Compress.hx

@@ -26,7 +26,7 @@ class Compress {
 
 
 	var s : Dynamic;
 	var s : Dynamic;
 
 
-	public function new( level : Int ) {
+	public function new( level : Int ) : Void {
 		s = _deflate_init(level);
 		s = _deflate_init(level);
 	}
 	}
 
 
@@ -34,17 +34,17 @@ class Compress {
 		return _deflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
 		return _deflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
 	}
 	}
 
 
-	public function setFlushMode( f : FlushMode ) {
+	public function setFlushMode( f : FlushMode ) : Void {
 		_set_flush_mode(s,Std.string(f));
 		_set_flush_mode(s,Std.string(f));
 	}
 	}
 
 
-	public function close() {
+	public function close() : Void {
 		_deflate_end(s);
 		_deflate_end(s);
 	}
 	}
 
 
 	public static function run( s : haxe.io.Bytes, level : Int ) : haxe.io.Bytes {
 	public static function run( s : haxe.io.Bytes, level : Int ) : haxe.io.Bytes {
 		var c = new Compress(level);
 		var c = new Compress(level);
-		c.setFlushMode(Flush.FINISH);
+		c.setFlushMode(FlushMode.FINISH);
 		var out = haxe.io.Bytes.alloc(_deflate_bound(c.s,s.length));
 		var out = haxe.io.Bytes.alloc(_deflate_bound(c.s,s.length));
 		var r = c.execute(s,0,out,0);
 		var r = c.execute(s,0,out,0);
 		c.close();
 		c.close();

+ 7 - 7
std/cpp/_std/zip/Uncompress.hx → std/cpp/_std/haxe/zip/Uncompress.hx

@@ -25,31 +25,31 @@ package haxe.zip;
 class Uncompress {
 class Uncompress {
 	var s : Dynamic;
 	var s : Dynamic;
 
 
-	public function new( windowBits : Null<Int> ) {
+	public function new( ?windowBits : Int ) : Void {
 		s = _inflate_init(windowBits);
 		s = _inflate_init(windowBits);
 	}
 	}
 
 
-	public function this_run( src : haxe.io.Bytes, srcPos : Int, dst : haxe.io.Bytes, dstPos : Int ) : { done : Bool, read : Int, write : Int } {
+	public function execute( src : haxe.io.Bytes, srcPos : Int, dst : haxe.io.Bytes, dstPos : Int ) : { done : Bool, read : Int, write : Int } {
 		return _inflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
 		return _inflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
 	}
 	}
 
 
-	public function setFlushMode( f : FlushMode ) {
+	public function setFlushMode( f : FlushMode ) : Void {
 		_set_flush_mode(s,untyped f.__Tag());
 		_set_flush_mode(s,untyped f.__Tag());
 	}
 	}
 
 
-	public function close() {
+	public function close() : Void {
 		_inflate_end(s);
 		_inflate_end(s);
 	}
 	}
 
 
-	public static function run( src : haxe.io.Bytes, ?bufsize ) : haxe.io.Bytes {
+	public static function run( src : haxe.io.Bytes, ?bufsize : Int ) : haxe.io.Bytes {
 		var u = new Uncompress(null);
 		var u = new Uncompress(null);
 		if( bufsize == null ) bufsize = 1 << 16; // 64K
 		if( bufsize == null ) bufsize = 1 << 16; // 64K
 		var tmp = haxe.io.Bytes.alloc(bufsize);
 		var tmp = haxe.io.Bytes.alloc(bufsize);
 		var b = new haxe.io.BytesBuffer();
 		var b = new haxe.io.BytesBuffer();
 		var pos = 0;
 		var pos = 0;
-		u.setFlushMode(Flush.SYNC);
+		u.setFlushMode(FlushMode.SYNC);
 		while( true ) {
 		while( true ) {
-			var r = u.this_run(src,pos,tmp,0);
+			var r = u.execute(src,pos,tmp,0);
 			b.addBytes(tmp,0,r.write);
 			b.addBytes(tmp,0,r.write);
 			pos += r.read;
 			pos += r.read;
 			if( r.done )
 			if( r.done )

+ 3 - 3
std/haxe/zip/Uncompress.hx

@@ -23,7 +23,7 @@ package haxe.zip;
 
 
 class Uncompress {
 class Uncompress {
 
 
-	public function new( windowBits : Int ) {
+	public function new( ?windowBits : Int ) {
 		throw "Not implemented for this platform";
 		throw "Not implemented for this platform";
 	}
 	}
 
 
@@ -37,8 +37,8 @@ class Uncompress {
 	public function close() {
 	public function close() {
 	}
 	}
 
 
-	public static function run( src : haxe.io.Bytes, ?bufsize ) : haxe.io.Bytes {
-		return InflateImpl.run(src,bufsize);
+	public static function run( src : haxe.io.Bytes, ?bufsize : Int ) : haxe.io.Bytes {
+		return InflateImpl.run(new haxe.io.BytesInput(src),bufsize);
 	}
 	}
 
 
 }
 }

+ 4 - 4
std/neko/_std/zip/Compress.hx → std/neko/_std/haxe/zip/Compress.hx

@@ -26,7 +26,7 @@ class Compress {
 
 
 	var s : Dynamic;
 	var s : Dynamic;
 
 
-	public function new( level : Int ) {
+	public function new( level : Int ) : Void {
 		s = _deflate_init(level);
 		s = _deflate_init(level);
 	}
 	}
 
 
@@ -34,17 +34,17 @@ class Compress {
 		return _deflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
 		return _deflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
 	}
 	}
 
 
-	public function setFlushMode( f : FlushMode ) {
+	public function setFlushMode( f : FlushMode ) : Void {
 		_set_flush_mode(s,untyped Std.string(f).__s);
 		_set_flush_mode(s,untyped Std.string(f).__s);
 	}
 	}
 
 
-	public function close() {
+	public function close() : Void {
 		_deflate_end(s);
 		_deflate_end(s);
 	}
 	}
 
 
 	public static function run( s : haxe.io.Bytes, level : Int ) : haxe.io.Bytes {
 	public static function run( s : haxe.io.Bytes, level : Int ) : haxe.io.Bytes {
 		var c = new Compress(level);
 		var c = new Compress(level);
-		c.setFlushMode(Flush.FINISH);
+		c.setFlushMode(FlushMode.FINISH);
 		var out = haxe.io.Bytes.alloc(_deflate_bound(c.s,s.length));
 		var out = haxe.io.Bytes.alloc(_deflate_bound(c.s,s.length));
 		var r = c.execute(s,0,out,0);
 		var r = c.execute(s,0,out,0);
 		c.close();
 		c.close();

+ 5 - 5
std/neko/_std/zip/Uncompress.hx → std/neko/_std/haxe/zip/Uncompress.hx

@@ -26,7 +26,7 @@ class Uncompress {
 
 
 	var s : Dynamic;
 	var s : Dynamic;
 
 
-	public function new( windowBits : Int ) {
+	public function new( ?windowBits : Int ) : Void {
 		s = _inflate_init(windowBits);
 		s = _inflate_init(windowBits);
 	}
 	}
 
 
@@ -34,21 +34,21 @@ class Uncompress {
 		return _inflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
 		return _inflate_buffer(s,src.getData(),srcPos,dst.getData(),dstPos);
 	}
 	}
 
 
-	public function setFlushMode( f : FlushMode ) {
+	public function setFlushMode( f : FlushMode ) : Void {
 		_set_flush_mode(s,untyped Std.string(f).__s);
 		_set_flush_mode(s,untyped Std.string(f).__s);
 	}
 	}
 
 
-	public function close() {
+	public function close() : Void {
 		_inflate_end(s);
 		_inflate_end(s);
 	}
 	}
 
 
-	public static function run( src : haxe.io.Bytes, ?bufsize ) : haxe.io.Bytes {
+	public static function run( src : haxe.io.Bytes, ?bufsize : Int ) : haxe.io.Bytes {
 		var u = new Uncompress(null);
 		var u = new Uncompress(null);
 		if( bufsize == null ) bufsize = 1 << 16; // 64K
 		if( bufsize == null ) bufsize = 1 << 16; // 64K
 		var tmp = haxe.io.Bytes.alloc(bufsize);
 		var tmp = haxe.io.Bytes.alloc(bufsize);
 		var b = new haxe.io.BytesBuffer();
 		var b = new haxe.io.BytesBuffer();
 		var pos = 0;
 		var pos = 0;
-		u.setFlushMode(Flush.SYNC);
+		u.setFlushMode(FlushMode.SYNC);
 		while( true ) {
 		while( true ) {
 			var r = u.execute(src,pos,tmp,0);
 			var r = u.execute(src,pos,tmp,0);
 			b.addBytes(tmp,0,r.write);
 			b.addBytes(tmp,0,r.write);