Skip to content

Fix colormaps #92

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

Merged
merged 3 commits into from
Nov 17, 2016
Merged

Fix colormaps #92

merged 3 commits into from
Nov 17, 2016

Conversation

kryptan
Copy link
Contributor

@kryptan kryptan commented Nov 15, 2016

Colormaps are not currently working because layout of the Cell structure doesn't match its version in arrayfire. Also there are some potential bugs because Rust's non null-terminated strings were passed to C.

This pull request fixes this. I also simplified code in graphics.rs where other strings were passed to C.

Copy link
Member

@9prady9 9prady9 left a comment

Choose a reason for hiding this comment

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

Except the change i requested in a separate comment, everything else looks good. Thank you for the contributions!

let xstr = CString::new(xlabel.as_bytes()).unwrap();
let ystr = CString::new(ylabel.as_bytes()).unwrap();
let zstr = CString::new(zlabel.as_bytes()).unwrap();
let cprops = &Cell {row: self.row, col: self.col, title: [0].as_ptr(), cmap: self.cmap};
Copy link
Member

Choose a reason for hiding this comment

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

Can you please use std::ptr::null instead of an static single element slice to get a invalid pointer. Please do similar change in all other places where [0].as_ptr() is being used.

@9prady9 9prady9 merged commit babec9d into arrayfire:devel Nov 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants