Difference between g_file_info_get_size() and G_FILE_ATTRIBUTE_STANDARD_SIZE

Hi,

I am wondering what the difference between the result of g_file_info_get_size(GFileInfo *info) (with result type goffset, where typedef gint64 goffset;, see link) and retrieving the file size with the help of G_FILE_ATTRIBUTE_STANDARD_SIZE (type of uint64, see link) is.

Can somebody explain me if there is a difference? In which cases should I use which approach to get the size of a file?

Thank you
Uwe

Use the source, Luke!

https://gitlab.gnome.org/GNOME/glib/-/blob/49d5c4f85910ab80db6cdfd6c4761ef5406df220/gio/gfileinfo.c#L1732-1753

g_file_info_get_size() returns the same number but cast to a goffset.

1 Like

Wow :laughing:, thanks, Philip. :+1:

That should probably be added to the documentation to prevent this confusion in the future. Someone wants to create an issue or directly send an MR?

1 Like

I have opened an issue.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.