Re: [rust-dev] Casting *c_uchar to *c_char

2014-05-13 Thread Christophe Pedretti
So, if i understand correctly, using CString::new with 'false' as a second argument implies : - as you have no control on the lifetime underlying buffer, generally, you have to as_str() and clone() the CString (the exception is when you use immediately (right after creation) and only once the

[rust-dev] Casting *c_uchar to *c_char

2014-05-12 Thread Christophe Pedretti
Hi all, Vladimir suggested to use CString::new(sqlite3_errmsg(*ppDb), false) and then as_str() on the CString in order to obtain a Rust String from a *c_char. Another SQLite function, sqlite3_column_text, return a *c_uchar; so, tu use the CString new, which takes a *c_char as argument, i can

Re: [rust-dev] Casting *c_uchar to *c_char

2014-05-12 Thread comex
On Mon, May 12, 2014 at 6:41 PM, Christophe Pedretti christophe.pedre...@gmail.com wrote: Another SQLite function, sqlite3_column_text, return a *c_uchar; so, tu use the CString new, which takes a *c_char as argument, i can cast CString::new(sqlite3_column_text(pStmt, column_index) as *i8,