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

0.2.4 broke the C API on 32-bit unix #72

Closed
cuviper opened this issue Feb 19, 2020 · 2 comments
Closed

0.2.4 broke the C API on 32-bit unix #72

cuviper opened this issue Feb 19, 2020 · 2 comments

Comments

@cuviper
Copy link

cuviper commented Feb 19, 2020

On Fedora, we found that 0.2.4 broke for i686 and armv7hl, such as this build.

error[E0308]: mismatched types
   --> src/lib.rs:252:79
    |
252 |                 as_c_return_code(mz_compress2_oxide(&mut stream_oxide, level, dest_len))
    |                                                                               ^^^^^^^^ expected `u64`, found `u32`
    |
    = note: expected mutable reference `&mut u64`
               found mutable reference `&mut u32`
error[E0308]: mismatched types
   --> src/lib.rs:291:74
    |
291 |                 as_c_return_code(mz_uncompress2_oxide(&mut stream_oxide, dest_len))
    |                                                                          ^^^^^^^^ expected `u64`, found `u32`
    |
    = note: expected mutable reference `&mut u64`
               found mutable reference `&mut u32`
error[E0308]: mismatched types
   --> src/c_export.rs:150:23
    |
150 |             total_in: self.total_in,
    |                       ^^^^^^^^^^^^^ expected `u32`, found `u64`
error[E0308]: mismatched types
   --> src/c_export.rs:160:24
    |
160 |             total_out: self.total_out,
    |                        ^^^^^^^^^^^^^^ expected `u32`, found `u64`
error[E0308]: mismatched types
   --> src/c_export.rs:211:23
    |
211 |             total_in: stream.total_in,
    |                       ^^^^^^^^^^^^^^^ expected `u64`, found `u32`
error[E0308]: mismatched types
   --> src/c_export.rs:213:24
    |
213 |             total_out: stream.total_out,
    |                        ^^^^^^^^^^^^^^^^ expected `u64`, found `u32`
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0308`.
error: could not compile `miniz_oxide_c_api`.

I bisected the regression to commit 918aa73. For the mz_uncompress2_oxide errors, that parameter changed from &mut c_ulong to &mut u64. StreamOxide's total_in and total_out also changed from c_ulong to u64. Those are the same type on LP64 targets (most 64-bit Unix), but not on 32-bit targets, nor 64-bit Windows (LLP64).

See also #54.

@oyvindln
Copy link
Collaborator

Yeah that was a slip, need to make sure the data types line up. The C API is in bad shape in general.

@cuviper
Copy link
Author

cuviper commented Mar 2, 2020

Thank you, 0.2.5 built on all Fedora arches without trouble.

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

No branches or pull requests

2 participants