Browse Source

Address cargo warnings

master
Drew Short 5 years ago
parent
commit
e3560fb7bf
  1. 2
      src/cache.rs
  2. 2
      src/hash/ahash.rs
  3. 2
      src/hash/dhash.rs
  4. 2
      src/hash/phash.rs
  5. 12
      src/lib.rs

2
src/cache.rs

@ -175,7 +175,7 @@ impl<'a> Cache<'a> {
Ok(_) => { Ok(_) => {
let file_path = Path::new(&cache_path_str); let file_path = Path::new(&cache_path_str);
match File::create(file_path) { match File::create(file_path) {
Ok(mut file) => {
Ok(_) => {
// Save the file into the cache // Save the file into the cache
match image.save(file_path) { match image.save(file_path) {
Ok(_) => {} Ok(_) => {}

2
src/hash/ahash.rs

@ -12,7 +12,7 @@ use cache::Cache;
use super::prepare_image; use super::prepare_image;
use super::{HashType, PerceptualHash, Precision, PreparedImage}; use super::{HashType, PerceptualHash, Precision, PreparedImage};
use self::image::{GenericImage, GenericImageView};
use self::image::GenericImageView;
pub struct AHash<'a> { pub struct AHash<'a> {
prepared_image: Box<PreparedImage<'a>>, prepared_image: Box<PreparedImage<'a>>,

2
src/hash/dhash.rs

@ -11,7 +11,7 @@ use cache::Cache;
use super::prepare_image; use super::prepare_image;
use super::{HashType, PerceptualHash, Precision, PreparedImage}; use super::{HashType, PerceptualHash, Precision, PreparedImage};
use self::image::{GenericImage, GenericImageView};
use self::image::GenericImageView;
pub struct DHash<'a> { pub struct DHash<'a> {
prepared_image: Box<PreparedImage<'a>>, prepared_image: Box<PreparedImage<'a>>,

2
src/hash/phash.rs

@ -14,7 +14,7 @@ use super::image::Pixel;
use super::prepare_image; use super::prepare_image;
use super::{HashType, PerceptualHash, Precision, PreparedImage}; use super::{HashType, PerceptualHash, Precision, PreparedImage};
use self::image::{DynamicImage, GenericImage, GenericImageView};
use self::image::{DynamicImage, GenericImageView};
pub struct PHash<'a> { pub struct PHash<'a> {
prepared_image: Box<PreparedImage<'a>>, prepared_image: Box<PreparedImage<'a>>,

12
src/lib.rs

@ -123,7 +123,7 @@ pub extern "C" fn ext_free(raw_lib: *const libc::c_void) {
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn ext_get_ahash(lib: &PIHash, path_char: *const libc::c_char) -> libc::uint64_t {
pub extern "C" fn ext_get_ahash(lib: &PIHash, path_char: *const libc::c_char) -> u64 {
unsafe { unsafe {
let path_str = CStr::from_ptr(path_char); let path_str = CStr::from_ptr(path_char);
let image_path = match path_str.to_str() { let image_path = match path_str.to_str() {
@ -143,7 +143,7 @@ pub extern "C" fn ext_get_ahash(lib: &PIHash, path_char: *const libc::c_char) ->
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn ext_get_dhash(lib: &PIHash, path_char: *const libc::c_char) -> libc::uint64_t {
pub extern "C" fn ext_get_dhash(lib: &PIHash, path_char: *const libc::c_char) -> u64 {
unsafe { unsafe {
let path_str = CStr::from_ptr(path_char); let path_str = CStr::from_ptr(path_char);
let image_path = match path_str.to_str() { let image_path = match path_str.to_str() {
@ -163,7 +163,7 @@ pub extern "C" fn ext_get_dhash(lib: &PIHash, path_char: *const libc::c_char) ->
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn ext_get_phash(lib: &PIHash, path_char: *const libc::c_char) -> libc::uint64_t {
pub extern "C" fn ext_get_phash(lib: &PIHash, path_char: *const libc::c_char) -> u64 {
unsafe { unsafe {
let path_str = CStr::from_ptr(path_char); let path_str = CStr::from_ptr(path_char);
let image_path = match path_str.to_str() { let image_path = match path_str.to_str() {
@ -184,9 +184,9 @@ pub extern "C" fn ext_get_phash(lib: &PIHash, path_char: *const libc::c_char) ->
#[repr(C)] #[repr(C)]
pub struct PIHashes { pub struct PIHashes {
ahash: libc::uint64_t,
dhash: libc::uint64_t,
phash: libc::uint64_t,
ahash: u64,
dhash: u64,
phash: u64,
} }
#[no_mangle] #[no_mangle]

Loading…
Cancel
Save