Skip to content

Commit

Permalink
Fix build error on GDAL 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola committed Jun 3, 2023
1 parent fdbb4f5 commit ee8bb2d
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/raster/mdarray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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),
Expand Down Expand Up @@ -804,7 +804,7 @@ mod tests {
use crate::{test_utils::TempFixture, Dataset, DatasetOptions, GdalOpenFlags};

#[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";

Expand All @@ -821,7 +821,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";

Expand All @@ -842,7 +842,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";

Expand All @@ -862,7 +862,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";

Expand All @@ -882,7 +882,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";

Expand Down Expand Up @@ -917,7 +917,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";

Expand All @@ -941,7 +941,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";

Expand All @@ -967,7 +967,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
Expand Down Expand Up @@ -1000,7 +1000,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";

Expand All @@ -1026,7 +1026,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";

Expand All @@ -1051,7 +1051,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";

Expand All @@ -1072,7 +1072,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";

Expand Down Expand Up @@ -1123,7 +1123,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";

Expand Down Expand Up @@ -1163,7 +1163,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");
Expand Down

0 comments on commit ee8bb2d

Please sign in to comment.