Browse Source

[php] fixed extern for fseek

Aleksandr Kuzmenko 5 years ago
parent
commit
b31f77aa6d
4 changed files with 4 additions and 3 deletions
  1. 1 0
      extra/CHANGES.txt
  2. 1 1
      std/php/Global.hx
  3. 1 1
      std/php/_std/sys/io/FileInput.hx
  4. 1 1
      std/php/_std/sys/io/FileOutput.hx

+ 1 - 0
extra/CHANGES.txt

@@ -3,6 +3,7 @@
 	Bugfixes:
 
 	php : fixed false detection of `catch` vars in anonymous functions as captured from outer scope
+	php : fixed return type of extern definition for `fseek` function
 
 2020-07-22 4.1.3
 

+ 1 - 1
std/php/Global.hx

@@ -638,7 +638,7 @@ extern class Global {
 	/**
 		@see http://php.net/manual/en/function.fseek.php
 	**/
-	static function fseek(handle:Resource, offset:Int, ?whence:Int):EitherType<Int, Bool>;
+	static function fseek(handle:Resource, offset:Int, ?whence:Int):Int;
 
 	/**
 		@see http://php.net/manual/en/function.ftell.php

+ 1 - 1
std/php/_std/sys/io/FileInput.hx

@@ -76,7 +76,7 @@ class FileInput extends haxe.io.Input {
 				w = SEEK_END;
 		}
 		var r = fseek(__f, p, w);
-		if (r == false)
+		if (r == -1)
 			throw Custom('An error occurred');
 	}
 

+ 1 - 1
std/php/_std/sys/io/FileOutput.hx

@@ -73,7 +73,7 @@ class FileOutput extends haxe.io.Output {
 				w = SEEK_END;
 		}
 		var r = fseek(__f, p, w);
-		if (r == false)
+		if (r == -1)
 			throw haxe.io.Error.Custom('An error occurred');
 	}