Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade bindgen. #53

Merged
merged 3 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion proj-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions src/proj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -792,16 +793,17 @@ impl Proj {
.collect::<Result<Vec<_>, 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());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@michaelkirk michaelkirk Dec 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this break against our prebuilt bindings which expect a usize?

I admit - I'm kind of surprised by the changes made to bindgen.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we can just re-generate all the prebuilt bindings with the new bindgen.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 Oh yeah, I never did #44, so we don't have any prebuilt bindings. 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit - I'm kind of surprised by the changes made to bindgen.

there appears to be an ongoing discussions about that change rust-lang/rust-bindgen#1901

err = proj_errno(self.c_proj);
},
}
Expand Down