From ba0feea1942c61c6f308fe1fa9b7a65bd2ff6fa4 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Wed, 9 Dec 2020 17:53:32 -0500 Subject: [PATCH 1/3] Upgrade bindgen. This was needed to get things compiling on Apple Silicon. --- proj-sys/Cargo.toml | 2 +- src/proj.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/proj-sys/Cargo.toml b/proj-sys/Cargo.toml index 659ff499..facc61f4 100644 --- a/proj-sys/Cargo.toml +++ b/proj-sys/Cargo.toml @@ -13,7 +13,7 @@ links = "proj" [dependencies] [build-dependencies] -bindgen = "0.52.0" +bindgen = "0.56.0" pkg-config = "0.3.17" cmake = "0.1" flate2 = "1.0.14" diff --git a/src/proj.rs b/src/proj.rs index 16453bea..72d4fdd4 100644 --- a/src/proj.rs +++ b/src/proj.rs @@ -16,6 +16,7 @@ use proj_sys::proj_context_set_enable_network; use proj_sys::{proj_errno, proj_errno_reset}; +use std::convert::TryFrom; use std::ffi::CStr; use std::ffi::CString; use std::mem::MaybeUninit; @@ -792,16 +793,17 @@ impl Proj { .collect::, ProjError>>()?; pj.shrink_to_fit(); // Transformation operations are slightly different + let pj_len = u64::try_from(pj.len()).unwrap(); match op { Transformation::Conversion => unsafe { proj_errno_reset(self.c_proj); trans = - proj_trans_array(self.c_proj, PJ_DIRECTION_PJ_FWD, pj.len(), pj.as_mut_ptr()); + proj_trans_array(self.c_proj, PJ_DIRECTION_PJ_FWD, pj_len, pj.as_mut_ptr()); err = proj_errno(self.c_proj); }, Transformation::Projection => unsafe { proj_errno_reset(self.c_proj); - trans = proj_trans_array(self.c_proj, inv, pj.len(), pj.as_mut_ptr()); + trans = proj_trans_array(self.c_proj, inv, pj_len, pj.as_mut_ptr()); err = proj_errno(self.c_proj); }, } From dcf327f8680c10357978248a5258fd3febf2ebaf Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Wed, 9 Dec 2020 21:48:38 -0500 Subject: [PATCH 2/3] Restore the existing size_t as usize behavior --- proj-sys/build.rs | 1 + src/proj.rs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proj-sys/build.rs b/proj-sys/build.rs index efef0524..d8953785 100644 --- a/proj-sys/build.rs +++ b/proj-sys/build.rs @@ -49,6 +49,7 @@ fn main() -> Result<(), Box> { let bindings = bindgen::Builder::default() .clang_arg(format!("-I{}", include_path.to_string_lossy())) .trust_clang_mangling(false) + .size_t_is_usize(true) .blacklist_type("max_align_t") // The input header we would like to generate // bindings for. diff --git a/src/proj.rs b/src/proj.rs index 72d4fdd4..7d22c301 100644 --- a/src/proj.rs +++ b/src/proj.rs @@ -793,17 +793,16 @@ impl Proj { .collect::, ProjError>>()?; pj.shrink_to_fit(); // Transformation operations are slightly different - let pj_len = u64::try_from(pj.len()).unwrap(); match op { Transformation::Conversion => unsafe { proj_errno_reset(self.c_proj); trans = - proj_trans_array(self.c_proj, PJ_DIRECTION_PJ_FWD, pj_len, pj.as_mut_ptr()); + proj_trans_array(self.c_proj, PJ_DIRECTION_PJ_FWD, pj.len(), pj.as_mut_ptr()); err = proj_errno(self.c_proj); }, Transformation::Projection => unsafe { proj_errno_reset(self.c_proj); - trans = proj_trans_array(self.c_proj, inv, pj_len, pj.as_mut_ptr()); + trans = proj_trans_array(self.c_proj, inv, pj.len(), pj.as_mut_ptr()); err = proj_errno(self.c_proj); }, } From 91ad652efc4a6698c238c4977c8b7327c8106956 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sun, 13 Dec 2020 10:22:32 -0500 Subject: [PATCH 3/3] Remove unneeded import --- src/proj.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/proj.rs b/src/proj.rs index 7d22c301..16453bea 100644 --- a/src/proj.rs +++ b/src/proj.rs @@ -16,7 +16,6 @@ use proj_sys::proj_context_set_enable_network; use proj_sys::{proj_errno, proj_errno_reset}; -use std::convert::TryFrom; use std::ffi::CStr; use std::ffi::CString; use std::mem::MaybeUninit;