Skip to content

Commit d257371

Browse files
committed
Resolved some of the review comments
1 parent 583845e commit d257371

4 files changed

Lines changed: 7 additions & 11 deletions

File tree

c/sedona-gdal/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ readme.workspace = true
2929
edition.workspace = true
3030
rust-version.workspace = true
3131

32-
[lib]
33-
crate-type = ["staticlib", "cdylib", "lib"]
34-
3532
[dependencies]
3633
gdal-sys = { version = "0.12.0", optional = true }
3734
libloading = { workspace = true }

c/sedona-gdal/src/dyn_load.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ macro_rules! load_fn_any {
7979
}};
8080
}
8181

82-
/// Populate all 64 function-pointer fields of [`SedonaGdalApi`] from the given
82+
/// Populate all function-pointer fields of [`SedonaGdalApi`] from the given
8383
/// [`Library`] handle.
8484
fn load_all_symbols(lib: &Library, api: &mut SedonaGdalApi) -> Result<(), GdalInitLibraryError> {
8585
// --- Dataset ---

c/sedona-gdal/src/gdal_api.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ use crate::gdal_dyn_bindgen::SedonaGdalApi;
3030
///
3131
/// Panics if the function pointer is `None`. This is unreachable in correct usage
3232
/// because all function pointers are guaranteed to be `Some` after successful
33-
/// `sedona_gdal_dyn_api_init` (the C loader fails if any symbol is missing),
34-
/// and you cannot obtain a `&GdalApi` without successful initialization
35-
/// (it's behind `OnceLock`).
33+
/// initialization of [`GdalApi`] via [`GdalApi::try_from_shared_library`] or
34+
/// [`GdalApi::try_from_current_process`], and you cannot obtain a `&GdalApi`
35+
/// without successful initialization.
3636
macro_rules! call_gdal_api {
3737
($api:expr, $func:ident $(, $arg:expr)*) => {
3838
if let Some(func) = $api.inner.$func {
@@ -80,7 +80,8 @@ impl GdalApi {
8080
&self.name
8181
}
8282

83-
/// Check the last CPL error and return a `GdalError` if there was one.
83+
/// Check the last CPL error and return a `GdalError`, it always returns an error struct
84+
/// (even when the error number is 0).
8485
pub fn last_cpl_err(&self, default_err_class: u32) -> GdalError {
8586
let err_no = unsafe { call_gdal_api!(self, CPLGetLastErrorNo) };
8687
let err_msg = unsafe {

c/sedona-gdal/src/gdal_dyn_bindgen.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ pub enum GDALDataType {
6666
GDT_CFloat16 = 16,
6767
GDT_CFloat32 = 10,
6868
GDT_CFloat64 = 11,
69-
GDT_TypeCount = 17,
7069
}
7170

7271
impl GDALDataType {
@@ -90,7 +89,6 @@ impl GDALDataType {
9089
14 => Ok(GDALDataType::GDT_Int8),
9190
15 => Ok(GDALDataType::GDT_Float16),
9291
16 => Ok(GDALDataType::GDT_CFloat16),
93-
17 => Ok(GDALDataType::GDT_TypeCount),
9492
_ => Err(()),
9593
}
9694
}
@@ -239,7 +237,7 @@ pub const wkbNDR: OGRwkbByteOrder = 1; // Little endian
239237

240238
#[repr(C)]
241239
#[derive(Debug, Copy, Clone, Default)]
242-
pub struct SedonaGdalApi {
240+
pub(crate) struct SedonaGdalApi {
243241
// --- Dataset ---
244242
pub GDALOpenEx: Option<
245243
unsafe extern "C" fn(

0 commit comments

Comments
 (0)