Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

More functions that probably shouldn't return an Option #161

Closed
sophie-h opened this issue Oct 18, 2018 · 10 comments
Closed

More functions that probably shouldn't return an Option #161

sophie-h opened this issue Oct 18, 2018 · 10 comments

Comments

@sophie-h
Copy link
Contributor

and

#define G_IS_FILE(obj)	       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_FILE))

If I am correct, there are probably many more functions, that shouldn't return an Option.

@EPashkin
Copy link
Member

@sophie-h
Copy link
Contributor Author

I think GFile has no concept/representation of relative paths. Relative arguments to g_file_new_for_path() lead to an absolute representation in g_file_get_uri(). Also, NULL is not documented as return value.

@EPashkin
Copy link
Member

You right, for relative paths GLocalFile doing canonicalize.
I found only one call in gio, that checks it result for NULL: https://gitlab.gnome.org/GNOME/glib/blob/master/gio/win32/gwinhttpfile.c#L243,
so maybe you right about get_uri

@sdroege
Copy link
Member

sdroege commented Oct 19, 2018

So anything that has to be done here?

@sophie-h
Copy link
Contributor Author

@sdroege it's probably more the question where to start? There is a lot of functions that don't need to return an Option. I don't know if it is really efficient if I am opening an issue for every singe function (#158, gtk-rs/gtk#709).

@sdroege
Copy link
Member

sdroege commented Oct 19, 2018

Well, it needs someone to systematically go over all these functions and check what would be correct, and then make a PR with the changes :) If you don't plan to do that, just doing an issue for every (group of) functions you find that look wrong is fine too.

The functions mentioned here seem to be correct though? Unlikely that they return None but unfortunately that can

@sdroege
Copy link
Member

sdroege commented Jun 19, 2019

Let's close this then. Please open new issues for everything you notice that shouldn't return an Option :)

@sdroege sdroege closed this as completed Jun 19, 2019
@sophie-h
Copy link
Contributor Author

The functions mentioned here seem to be correct though? Unlikely that they return None but unfortunately that can

I don't think so.

@sdroege
Copy link
Member

sdroege commented Jun 19, 2019

Checked again and you're right that these functions shouldn't return an Option. The discussion above confused me! Will fix :)

@sdroege
Copy link
Member

sdroege commented Jun 19, 2019

See #221

GuillaumeGomez pushed a commit to gtk-rs/gtk3-rs that referenced this issue Oct 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants