fix: support GDAL 3.13 (GDT_Byte to GDT_UInt8, bOperateInBufType)#714
fix: support GDAL 3.13 (GDT_Byte to GDT_UInt8, bOperateInBufType)#714AlexanderWillner wants to merge 2 commits into
Conversation
GDAL 3.13 renamed GDT_Byte to GDT_UInt8 and added bOperateInBufType to GDALRasterIOExtraArg. - Add cfg-gated GDT_UInt8 fallback for GDAL >= 3.13 in types.rs - Add bOperateInBufType field in rasterband.rs struct init - Add bindgen feature to gdal-sys (was missing) - Fix GDT_Byte reference in mdarray.rs test
|
Thanks. The |
| impl GdalType for u8 { | ||
| fn gdal_ordinal() -> GDALDataType::Type { | ||
| GDALDataType::GDT_Byte | ||
| #[cfg(not(all(major_ge_3, minor_ge_13)))] |
There was a problem hiding this comment.
Can you add some newlines here or run cargo fmt?
There was a problem hiding this comment.
Fixed in 2f7da56. Applied cargo fmt.
|
|
||
| [features] | ||
| default = [] | ||
| bindgen = ["dep:bindgen"] |
There was a problem hiding this comment.
I don't think this does anything? You can already run cargo check --features bindgen or cargo check -p gdal-sys --features bindgen.
There was a problem hiding this comment.
You're right, removed in 2f7da56. Cargo auto-creates the feature from the optional dep.
Remove redundant bindgen feature from gdal-sys/Cargo.toml (optional dep already auto-creates it). Apply cargo fmt to cfg-gated blocks. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Thanks @AlexanderWillner ! Im just getting into GDAL recently and ran into this issue. Pointing my project's dep at your branch and its working well. |
|
Upstream now released gdal 3.13.1. Anything I can do to help this PR? |
Summary
GDAL 3.13 renamed
GDT_BytetoGDT_UInt8in the C API enum and addedbOperateInBufTypetoGDALRasterIOExtraArg. This broke the Rust bindings at both compile and link time.Changes
gdal-sys/Cargo.toml: Add missingbindgenfeature (bindgen = ["dep:bindgen"]) so bindings can be generated at build timesrc/raster/types.rs: Gate allGDT_Bytereferences behind#[cfg(not(all(major_ge_3, minor_ge_13)))]withGDT_UInt8fallback for>= 3.13(enum discriminant, TryFrom, GdalType impl, test match arms)src/raster/rasterband.rs: AddbOperateInBufType: 0field toGDALRasterIOExtraArgstruct init for>= 3.13src/raster/mdarray.rs: GateGDT_Bytein test assertion withGDT_UInt8fallbackTesting
Built and tested against GDAL 3.13.0 on macOS aarch64 with
cargo test --features bindgen:test_slope: floating point precision difference in DEM slope calculationtest_make_valid_invalid:make_validno longer errors on that input