Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug : wrong type conversions making compilation on poppler-rs fail on windows #1605

Closed
Doublonmousse opened this issue Oct 12, 2024 · 3 comments · Fixed by #1612
Closed

Bug : wrong type conversions making compilation on poppler-rs fail on windows #1605

Doublonmousse opened this issue Oct 12, 2024 · 3 comments · Fixed by #1612

Comments

@Doublonmousse
Copy link

Copy of https://gitlab.gnome.org/World/Rust/poppler-rs/-/issues/1

Downstream poppler_rs cannot compile because of a type mismatch on windows (on one side a libc::clong that is i32 on windows and on the other side the type of time_t that is seen as i64).

According to bilelmoussaoui the type issue comes from this repo and types conversions : https://gitlab.gnome.org/World/Rust/poppler-rs/-/issues/1#note_2242804

The issue comes from the conversion from time_t which is platform dependent (can be i32 or i64) and the code generator always generates it as c_long which is wrong.

@sdroege
Copy link
Member

sdroege commented Oct 12, 2024

The code generator is generating it as libc::time_t nowadays. See #1562. Sounds like you'll have to update gir :) If it shows up as ulong in the .gir file, you probably have to update gobject-introspection and get a new .gir file.

@sdroege sdroege closed this as completed Oct 12, 2024
@bilelmoussaoui
Copy link
Member

No, this is a gir bug. The gir was updated to contain the commit you mentioned and if you check the ffi function below

    pub fn poppler_document_set_modification_date(
        document: *mut PopplerDocument,
        modification_date: time_t,
    );

it is generated correctly. Although, the safe wrapper is generated using

    #[doc(alias = "poppler_document_set_modification_date")]
    pub fn set_modification_date(&self, modification_date: libc::c_long) {
        unsafe {
            ffi::poppler_document_set_modification_date(self.to_glib_none().0, modification_date);
        }
    }

@bilelmoussaoui
Copy link
Member

never mind, it was actually the gir file that was outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants