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

Fix bitness issues #40

Merged
merged 5 commits into from
Nov 11, 2024
Merged

Fix bitness issues #40

merged 5 commits into from
Nov 11, 2024

Conversation

panekj
Copy link

@panekj panekj commented Nov 11, 2024

Replaces i64 with isize for ffi functions that operate on time_t which is c_long that is either i32 or i64 based on the platform, this way it can cleanly cast between types

Example signature (copied from generated bindings):

pub type __time_t = ::std::os::raw::c_long;
pub type __suseconds_t = ::std::os::raw::c_long;
pub type __socklen_t = ::std::os::raw::c_uint;
pub type time_t = __time_t;
[...]
pub printf_datetime_tags: ::std::option::Option<
        unsafe extern "C" fn(
            buffer: *mut t_gui_buffer,
            date: time_t,
            date_usec: ::std::os::raw::c_int,
            tags: *const ::std::os::raw::c_char,
            message: *const ::std::os::raw::c_char,
            ...
        ),
    >,

Fixes poljar/weechat-matrix-rs#84
Fixes #34

cast return value from hdata_time that returns time_t which
is platform dependent to isize
fixes type incompatibility on architectures with different bitness
printf_datetime_tags uses time_t which is backed by c_long
that resolves to either i32 or i64 depending on a platform

make printf_date_tags accept an isize so it casts cleanly
to platform specific time_t
@panekj
Copy link
Author

panekj commented Nov 11, 2024

Updated header comes from weechat/weechat@80def4a

Copy link
Owner

@poljar poljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible.

@poljar poljar merged commit 5b4eb1c into poljar:main Nov 11, 2024
6 checks passed
@panekj panekj deleted the fix/bitness branch November 11, 2024 21:26
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 this pull request may close these issues.

Can't build on RPi - Debian 12 Not building on 32bit
2 participants