diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 559bcc1d..2d6ac64b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ jobs: - 3.4 - 3.3 - 3.2 + - 3.1 runs-on: ubuntu-latest container: diff --git a/CHANGES.md b/CHANGES.md index d8bad4f4..e42dd5da 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,9 @@ # Changes ## Unreleased +- Fixed build error with GDAL 3.1 + + - ## 0.15 - **Breaking**: `RasterBand::actual_block_size` now takes two `usize` offsets instead of `(isize, isize)` diff --git a/src/raster/mdarray.rs b/src/raster/mdarray.rs index 18d07485..46c3c80b 100644 --- a/src/raster/mdarray.rs +++ b/src/raster/mdarray.rs @@ -15,9 +15,8 @@ use gdal_sys::{ GDALGroupGetGroupNames, GDALGroupGetMDArrayNames, GDALGroupGetName, GDALGroupH, GDALGroupOpenGroup, GDALGroupOpenMDArray, GDALGroupRelease, GDALMDArrayGetAttribute, GDALMDArrayGetDataType, GDALMDArrayGetDimensionCount, GDALMDArrayGetDimensions, - GDALMDArrayGetNoDataValueAsDouble, GDALMDArrayGetSpatialRef, GDALMDArrayGetStatistics, - GDALMDArrayGetTotalElementsCount, GDALMDArrayGetUnit, GDALMDArrayH, GDALMDArrayRelease, - OSRDestroySpatialReference, VSIFree, + GDALMDArrayGetNoDataValueAsDouble, GDALMDArrayGetSpatialRef, GDALMDArrayGetTotalElementsCount, + GDALMDArrayGetUnit, GDALMDArrayH, GDALMDArrayRelease, OSRDestroySpatialReference, VSIFree, }; use libc::c_void; use std::ffi::CString; @@ -387,6 +386,7 @@ impl<'a> MDArray<'a> { /// /// TODO: add option to pass progress callback (`pfnProgress`) /// + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] pub fn get_statistics( &self, force: bool, @@ -401,7 +401,7 @@ impl<'a> MDArray<'a> { }; let rv = unsafe { - GDALMDArrayGetStatistics( + gdal_sys::GDALMDArrayGetStatistics( self.c_mdarray, self.c_dataset, libc::c_int::from(is_approx_ok), @@ -805,6 +805,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_root_group_name() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -822,6 +823,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_array_names() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -843,6 +845,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_n_dimension() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -863,6 +866,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_n_elements() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -883,6 +887,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_dimension_name() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -918,6 +923,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_dimension_size() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -942,6 +948,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_read_data() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -968,6 +975,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_1), major_ge_4))] fn test_read_string_array() { // Beware https://github.com/georust/gdal/issues/299 if you want to reuse this // This can't be Zarr because it doesn't support string arrays @@ -1001,6 +1009,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_datatype() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -1027,6 +1036,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_spatial_ref() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -1052,6 +1062,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_no_data_value() { let fixture = "/vsizip/fixtures/byte_no_cf.zarr.zip"; @@ -1073,6 +1084,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_attributes() { let fixture = "/vsizip/fixtures/cf_nasa_4326.zarr.zip"; @@ -1124,6 +1136,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_unit() { let fixture = "/vsizip/fixtures/cf_nasa_4326.zarr.zip"; @@ -1164,6 +1177,7 @@ mod tests { #[test] #[cfg_attr(not(all(major_ge_3, minor_ge_4)), ignore)] + #[cfg(any(all(major_is_3, minor_ge_2), major_ge_4))] fn test_stats() { // make a copy to avoid writing the statistics into the original file let fixture = TempFixture::fixture("byte_no_cf.zarr.zip");