proper c_char usage #93

This commit is contained in:
Nikolay Kim 2017-11-27 10:59:45 -08:00
parent e7a7b3d5a0
commit d3832359a2
3 changed files with 12 additions and 8 deletions

View File

@ -1,11 +1,14 @@
Changes
-------
master
^^^^^^^^^^^^^^^^^
0.2.3 (11-27-2017)
^^^^^^^^^^^^^^^^^^
* Proper `c_char` usage #93
* Rustup to 1.23.0-nightly 2017-11-07, Remove use of now unneeded 'AsciiExt' trait
0.2.2 (09-26-2017)
^^^^^^^^^^^^^^^^^^

View File

@ -50,8 +50,8 @@ impl PyString {
src.py().from_owned_ptr_or_err::<PyString>(
ffi::PyUnicode_FromEncodedObject(
src.as_ptr(),
encoding.as_ptr() as *const i8,
errors.as_ptr() as *const i8))
encoding.as_ptr() as *const c_char,
errors.as_ptr() as *const c_char))
}
}

View File

@ -5,7 +5,6 @@
use std;
use std::str;
use std::borrow::Cow;
use std::ascii::AsciiExt;
use std::os::raw::c_char;
use ffi;
@ -55,7 +54,9 @@ impl PyString {
unsafe {
Ok(Py::from_owned_ptr_or_err(
src.py(), ffi::PyUnicode_FromEncodedObject(
src.as_ptr(), encoding.as_ptr() as *const i8, errors.as_ptr() as *const i8))?
src.as_ptr(),
encoding.as_ptr() as *const c_char,
errors.as_ptr() as *const c_char))?
)
}
}
@ -141,8 +142,8 @@ impl PyUnicode {
Ok(Py::from_owned_ptr_or_err(
src.py(), ffi::PyUnicode_FromEncodedObject(
src.as_ptr(),
encoding.as_ptr() as *const i8,
errors.as_ptr() as *const i8))?)
encoding.as_ptr() as *const c_char,
errors.as_ptr() as *const c_char))?)
}
}