2
0
Эх сурвалжийг харах

Fix issue with `os.file_size` on *nix

Ginger Bill 8 жил өмнө
parent
commit
ded99a2cab
2 өөрчлөгдсөн 4 нэмэгдсэн , 4 устгасан
  1. 2 2
      core/os_linux.odin
  2. 2 2
      core/os_x.odin

+ 2 - 2
core/os_linux.odin

@@ -179,11 +179,11 @@ seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) {
 	return res, 0;
 }
 
-file_size :: proc(fd: Handle) -> (i64, bool) {
+file_size :: proc(fd: Handle) -> (i64, Errno) {
 	prev, _ := seek(fd, 0, SEEK_CUR);
 	size, err := seek(fd, 0, SEEK_END);
 	seek(fd, prev, SEEK_SET);
-	return size, err != 0;
+	return size, err;
 }
 
 

+ 2 - 2
core/os_x.odin

@@ -196,11 +196,11 @@ seek :: proc(fd: Handle, offset: AddressSize, whence: int) -> (AddressSize, Errn
 	return final_offset, 0;
 }
 
-file_size :: proc(fd: Handle) -> (i64, bool) {
+file_size :: proc(fd: Handle) -> (i64, Errno) {
 	prev, _ := seek(fd, 0, SEEK_CUR);
 	size, err := seek(fd, 0, SEEK_END);
 	seek(fd, prev, SEEK_SET);
-	return size, err != 0;
+	return size, err;
 }