Skip to content

Fix colormaps#92

Merged
9prady9 merged 3 commits intoarrayfire:develfrom
kryptan:devel
Nov 17, 2016
Merged

Fix colormaps#92
9prady9 merged 3 commits intoarrayfire:develfrom
kryptan:devel

Conversation

@kryptan
Copy link
Copy Markdown
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
Copy Markdown
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!

src/graphics.rs Outdated
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
Copy Markdown
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