honzasp / rust-turbojpeg

Rust bindings for TurboJPEG library
MIT License
16 stars 12 forks source link

change enum #[repr(u32)] to #[repr(i32)] for binding to libjpeg-turbo latest version 3.0.1 #14

Closed c5soft closed 8 months ago

c5soft commented 11 months ago

This fixing following compiling error while doing bindgen to libjpeg-turbo 3.0.1:

error[E0308]: mismatched types
   --> src\common.rs:141:12
    |
141 |     None = raw::TJSAMP_TJSAMP_444,
    |            ^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:148:14
    |
148 |     Sub2x1 = raw::TJSAMP_TJSAMP_422,
    |              ^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:155:14
    |
155 |     Sub2x2 = raw::TJSAMP_TJSAMP_420,
    |              ^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:161:12
    |
161 |     Gray = raw::TJSAMP_TJSAMP_GRAY,
    |            ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:172:14
    |
172 |     Sub1x2 = raw::TJSAMP_TJSAMP_440,
    |              ^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:186:14
    |
186 |     Sub4x1 = raw::TJSAMP_TJSAMP_411,
    |              ^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:298:11
    |
298 |     RGB = raw::TJCS_TJCS_RGB,
    |           ^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:314:13
    |
314 |     YCbCr = raw::TJCS_TJCS_YCbCr,
    |             ^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:323:12
    |
323 |     Gray = raw::TJCS_TJCS_GRAY,
    |            ^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:331:12
    |
331 |     CMYK = raw::TJCS_TJCS_CMYK,
    |            ^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\common.rs:341:12
    |
341 |     YCCK = raw::TJCS_TJCS_YCCK,
    |            ^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\transform.rs:111:12
    |
111 |     None = raw::TJXOP_TJXOP_NONE,
    |            ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\transform.rs:118:13
    |
118 |     Hflip = raw::TJXOP_TJXOP_HFLIP,
    |             ^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\transform.rs:125:13
    |
125 |     Vflip = raw::TJXOP_TJXOP_VFLIP,
    |             ^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\transform.rs:131:17
    |
131 |     Transpose = raw::TJXOP_TJXOP_TRANSPOSE,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\transform.rs:138:18
    |
138 |     Transverse = raw::TJXOP_TJXOP_TRANSVERSE,
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\transform.rs:145:13
    |
145 |     Rot90 = raw::TJXOP_TJXOP_ROT90,
    |             ^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\transform.rs:152:14
    |
152 |     Rot180 = raw::TJXOP_TJXOP_ROT180,
    |              ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

error[E0308]: mismatched types
   --> src\transform.rs:158:14
    |
158 |     Rot270 = raw::TJXOP_TJXOP_ROT270,
    |              ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `turbojpeg` (lib) due to 19 previous errors
tvh commented 8 months ago

https://github.com/honzasp/rust-turbojpeg/pull/15 has been merged. Does that solve this issue?

honzasp commented 8 months ago

Uh oh, @c5soft, I apologize for ghosting your PR! I completely missed it :(

This issue should be solved by the PR from @tvh. I'm working on version 1.0.0 of this crate that uses the APIs from TurboJPEG 3, I should finish and release it over the weekend.