Fix sys_stat size integer overflow
This pull request fixes the file size integer overflow issue for sys_stat.
CI failure is related:
Error: /Users/runner/work/hxcpp/hxcpp/src/hx/libs/std/Sys.cpp:479:4: error: conversion from 'long' to 'const Dynamic' is ambiguous
STATF64(size);
CI failure is related:
Error: /Users/runner/work/hxcpp/hxcpp/src/hx/libs/std/Sys.cpp:479:4: error: conversion from 'long' to 'const Dynamic' is ambiguous STATF64(size);
I think Apple is a bit more strict with the type casting, the compile problem was solved.
https://github.com/barisyild/hxcpp/actions/runs/11325731311
Note that long is 32-bit on certain platforms, it would be better to use int64_t.
Can't we just always use the __APPLE__ version?
Obviously nothing has changed on the apple side, but the error occurred, does anyone have any idea?
Old Commit: https://github.com/HaxeFoundation/hxcpp/pull/1157/commits/a427d1f4c5b78d35f65a21de31950f11d3aeb95f
New Commit: https://github.com/HaxeFoundation/hxcpp/pull/1157/commits/193b3d1632b72c9ba2832f51b6839a5e0d0a6c92
Probably a bug, because the same code works fine in my ci.
https://github.com/barisyild/hxcpp/actions/runs/11331298885
Doesn't this require a change on the haxe side to work properly? Since the FileStat typedef only has size as an Int.
Changes like this should also probably be guarded with a HXCPP_API_LEVEL check so new hxcpp versions can be used with older haxe without anything changing.
Doesn't this require a change on the haxe side to work properly? Since the
FileStattypedef only has size as an Int.Changes like this should also probably be guarded with a
HXCPP_API_LEVELcheck so new hxcpp versions can be used with older haxe without anything changing.
Even if there is no api change on the Haxe side, it looks fine, because haxe int actually works with float double-precision.
https://github.com/HaxeFoundation/haxe/blob/94bde7d3c00b0d1d5eabf0bbde93533c4a44b065/std/StdTypes.hx#L61
Doesn't this require a change on the haxe side to work properly? Since the
FileStattypedef only has size as an Int.Changes like this should also probably be guarded with a
HXCPP_API_LEVELcheck so new hxcpp versions can be used with older haxe without anything changing.
I tried and you are right, I think it needs a haxe api change.
https://github.com/HaxeFoundation/haxe/pull/11791
I just tried it and it doesn't work. FileStat.size just returns 0.