Closed ricotz closed 1 year ago
This is still open. Could this be merged soon?
fwrite and fread take 4 arguments - https://linux.die.net/man/3/fwrite
are we sure the vala binding is right?
fwrite and fread take 4 arguments - https://linux.die.net/man/3/fwrite
are we sure the vala binding is right?
The binding itself is correct, the object (FileStream) is the last FILE pointer, nmemb
is calculated by vala's compiler, and the size
is provided by the default argument, and the buf
is the ptr
.
Actually the size
in the API is useless, vala always casts the array into uint8 array, so it should always be 1.
If you are still not sure, check https://gitlab.gnome.org/GNOME/vala/-/issues/1410. You may also try compile the code and debug it, you'll find if you pass array length as current doc, you'll write length * length
bytes instead of length * size
bytes.
See https://gitlab.gnome.org/GNOME/vala/-/issues/1410