*: use is_null instead of == ptr::null()
This commit is contained in:
parent
ff1b880be6
commit
d56ac34413
@ -74,7 +74,7 @@ impl Context {
|
||||
|
||||
pub fn codec(&self) -> Option<Codec> {
|
||||
unsafe {
|
||||
if (*self.as_ptr()).codec == ptr::null() {
|
||||
if (*self.as_ptr()).codec.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
|
@ -16,7 +16,6 @@ pub mod check;
|
||||
pub use self::check::Check;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::ptr;
|
||||
use std::slice::from_raw_parts;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
@ -136,7 +135,7 @@ pub fn find(id: Id) -> Option<Codec<'static>> {
|
||||
unsafe {
|
||||
let ptr = avcodec_find_decoder(id.into());
|
||||
|
||||
if ptr == ptr::null_mut() {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
@ -149,7 +148,7 @@ pub fn find_by_name(name: &str) -> Option<Codec<'static>> {
|
||||
unsafe {
|
||||
let ptr = avcodec_find_decoder_by_name(CString::new(name).unwrap().as_ptr());
|
||||
|
||||
if ptr == ptr::null_mut() {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
|
@ -20,7 +20,6 @@ pub mod decision;
|
||||
pub use self::decision::Decision;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::ptr;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use libc::c_int;
|
||||
@ -126,7 +125,7 @@ pub fn find(id: Id) -> Option<Codec<'static>> {
|
||||
unsafe {
|
||||
let ptr = avcodec_find_encoder(id.into());
|
||||
|
||||
if ptr == ptr::null_mut() {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
@ -139,7 +138,7 @@ pub fn find_by_name(name: &str) -> Option<Codec<'static>> {
|
||||
unsafe {
|
||||
let ptr = avcodec_find_encoder_by_name(CString::new(name).unwrap().as_ptr());
|
||||
|
||||
if ptr == ptr::null_mut() {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
|
@ -13,7 +13,7 @@ impl Iterator for AudioIter {
|
||||
unsafe {
|
||||
let ptr = av_input_audio_device_next(self.0);
|
||||
|
||||
if ptr == ptr::null_mut() && self.0 != ptr::null_mut() {
|
||||
if ptr.is_null() && !self.0.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
@ -38,7 +38,7 @@ impl Iterator for VideoIter {
|
||||
unsafe {
|
||||
let ptr = av_input_video_device_next(self.0);
|
||||
|
||||
if ptr == ptr::null_mut() && self.0 != ptr::null_mut() {
|
||||
if ptr.is_null() && !self.0.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
|
@ -13,7 +13,7 @@ impl Iterator for AudioIter {
|
||||
unsafe {
|
||||
let ptr = av_output_audio_device_next(self.0);
|
||||
|
||||
if ptr == ptr::null_mut() && self.0 != ptr::null_mut() {
|
||||
if ptr.is_null() && !self.0.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
@ -36,7 +36,7 @@ impl Iterator for VideoIter {
|
||||
unsafe {
|
||||
let ptr = av_output_video_device_next(self.0);
|
||||
|
||||
if ptr == ptr::null_mut() && self.0 != ptr::null_mut() {
|
||||
if ptr.is_null() && !self.0.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
|
@ -59,7 +59,7 @@ impl Context {
|
||||
unsafe {
|
||||
let ptr = av_format_get_video_codec(self.as_ptr());
|
||||
|
||||
if ptr == ptr::null_mut() {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
@ -78,7 +78,7 @@ impl Context {
|
||||
unsafe {
|
||||
let ptr = av_format_get_audio_codec(self.as_ptr());
|
||||
|
||||
if ptr == ptr::null_mut() {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
@ -97,7 +97,7 @@ impl Context {
|
||||
unsafe {
|
||||
let ptr = av_format_get_subtitle_codec(self.as_ptr());
|
||||
|
||||
if ptr == ptr::null_mut() {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
@ -116,7 +116,7 @@ impl Context {
|
||||
unsafe {
|
||||
let ptr = av_format_get_data_codec(self.as_ptr());
|
||||
|
||||
if ptr == ptr::null_mut() {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
}
|
||||
else {
|
||||
|
@ -74,8 +74,8 @@ impl Input {
|
||||
unsafe {
|
||||
let ptr = (*self.as_ptr()).extensions;
|
||||
|
||||
if ptr == ptr::null() {
|
||||
vec!()
|
||||
if ptr.is_null() {
|
||||
Vec::new()
|
||||
}
|
||||
else {
|
||||
from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()).split(',').collect()
|
||||
@ -87,8 +87,8 @@ impl Input {
|
||||
unsafe {
|
||||
let ptr = (*self.as_ptr()).mime_type;
|
||||
|
||||
if ptr == ptr::null() {
|
||||
vec!()
|
||||
if ptr.is_null() {
|
||||
Vec::new()
|
||||
}
|
||||
else {
|
||||
from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()).split(',').collect()
|
||||
@ -132,8 +132,8 @@ impl Output {
|
||||
unsafe {
|
||||
let ptr = (*self.as_ptr()).extensions;
|
||||
|
||||
if ptr == ptr::null() {
|
||||
vec!()
|
||||
if ptr.is_null() {
|
||||
Vec::new()
|
||||
}
|
||||
else {
|
||||
from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()).split(',').collect()
|
||||
@ -145,8 +145,8 @@ impl Output {
|
||||
unsafe {
|
||||
let ptr = (*self.as_ptr()).mime_type;
|
||||
|
||||
if ptr == ptr::null() {
|
||||
vec!()
|
||||
if ptr.is_null() {
|
||||
Vec::new()
|
||||
}
|
||||
else {
|
||||
from_utf8_unchecked(CStr::from_ptr(ptr).to_bytes()).split(',').collect()
|
||||
@ -180,7 +180,7 @@ impl Iterator for FormatIter {
|
||||
0 => {
|
||||
let ptr = av_iformat_next(self.input);
|
||||
|
||||
if ptr == ptr::null_mut() && self.input != ptr::null_mut() {
|
||||
if ptr.is_null() && !self.input.is_null() {
|
||||
self.step = 1;
|
||||
|
||||
self.next()
|
||||
@ -195,7 +195,7 @@ impl Iterator for FormatIter {
|
||||
1 => {
|
||||
let ptr = av_oformat_next(self.output);
|
||||
|
||||
if ptr == ptr::null_mut() && self.output != ptr::null_mut() {
|
||||
if ptr.is_null() && !self.output.is_null() {
|
||||
self.step = 2;
|
||||
|
||||
self.next()
|
||||
|
Loading…
x
Reference in New Issue
Block a user