mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-21 20:27:46 +00:00
Fix even more Clippy and other compiler warnings
This commit is contained in:
parent
e1a9be2756
commit
6e6124a278
6 changed files with 11 additions and 19 deletions
|
@ -113,6 +113,7 @@ pub struct ExistingUserDirectory {
|
|||
/// Finds existing user folders on disk. Will only return locations that actually have files in them, and a really basic check to see if the data is valid.
|
||||
pub fn find_existing_user_dirs() -> Vec<ExistingUserDirectory> {
|
||||
let mut user_dirs = Vec::new();
|
||||
#[allow(deprecated)] // We still want std::env::home_dir
|
||||
let Some(_) = home_dir() else {
|
||||
return user_dirs;
|
||||
};
|
||||
|
@ -177,9 +178,10 @@ pub fn find_existing_user_dirs() -> Vec<ExistingUserDirectory> {
|
|||
}
|
||||
|
||||
fn from_home_dir(path: &'static str) -> String {
|
||||
#[allow(deprecated)] // We still want std::env::home_dir
|
||||
let mut new_path = home_dir().unwrap();
|
||||
new_path.push(path);
|
||||
return new_path.into_os_string().into_string().unwrap();
|
||||
new_path.into_os_string().into_string().unwrap()
|
||||
}
|
||||
|
||||
fn is_valid_game_dir(path: &String) -> bool {
|
||||
|
|
|
@ -187,7 +187,7 @@ impl GameData {
|
|||
Some((entry, chunk)) => {
|
||||
let mut dat_file = self.get_dat_file(path, chunk, entry.data_file_id.into())?;
|
||||
|
||||
dat_file.read_from_offset(entry.offset as u64)
|
||||
dat_file.read_from_offset(entry.offset)
|
||||
}
|
||||
None => None,
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ use crate::ByteBuffer;
|
|||
|
||||
use crate::common::{get_platform_string, Platform, Region};
|
||||
use crate::common_file_operations::{get_string_len, read_bool_from, read_string, write_bool_as, write_string};
|
||||
use crate::shpk::ShaderPackage;
|
||||
use crate::sqpack::{read_data_block_patch, write_data_block_patch};
|
||||
|
||||
#[binrw]
|
||||
|
@ -734,13 +733,13 @@ impl ZiPatch {
|
|||
add_file_chunk.write(&mut writer).ok()?;
|
||||
|
||||
// reverse reading crc32
|
||||
writer.seek(SeekFrom::Current(-4));
|
||||
writer.seek(SeekFrom::Current(-4)).ok()?;
|
||||
|
||||
// add file data, dummy ver for now
|
||||
write_data_block_patch(&mut writer, file_data);
|
||||
|
||||
// re-apply crc32
|
||||
writer.seek(SeekFrom::Current(4));
|
||||
writer.seek(SeekFrom::Current(4)).ok()?;
|
||||
}
|
||||
|
||||
// Process deleted files
|
||||
|
|
|
@ -96,7 +96,7 @@ impl PatchList {
|
|||
id: "".to_string(),
|
||||
content_location: "".to_string(),
|
||||
requested_version: "".to_string(),
|
||||
patch_length: patch_length,
|
||||
patch_length,
|
||||
patches,
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ impl PatchList {
|
|||
str.push_str(&patch.hashes[0]);
|
||||
for hash in &patch.hashes[1..] {
|
||||
str.push(',');
|
||||
str.push_str(&hash);
|
||||
str.push_str(hash);
|
||||
}
|
||||
str.push('\t');
|
||||
}
|
||||
|
|
|
@ -283,15 +283,6 @@ impl Sha1 {
|
|||
|
||||
Digest { data: state }
|
||||
}
|
||||
|
||||
/// Retrieve the digest result as hex string directly.
|
||||
///
|
||||
/// (The function is only available if the `std` feature is enabled)
|
||||
#[cfg(feature = "std")]
|
||||
pub fn hexdigest(&self) -> std::string::String {
|
||||
use std::string::ToString;
|
||||
self.digest().to_string()
|
||||
}
|
||||
}
|
||||
|
||||
impl Digest {
|
||||
|
|
|
@ -76,7 +76,7 @@ pub fn read_data_block_patch<T: Read + Seek>(mut buf: T) -> Option<Vec<u8>> {
|
|||
}
|
||||
|
||||
pub fn write_data_block_patch<T: Write + Seek>(mut writer: T, data: Vec<u8>) {
|
||||
let new_file_size: usize = (data.len() as usize + 143) & 0xFFFFFF80;
|
||||
let new_file_size: usize = (data.len() + 143) & 0xFFFFFF80;
|
||||
|
||||
// This only adds uncompressed data for now, to simplify implementation
|
||||
// TODO: write compressed blocks
|
||||
|
@ -86,8 +86,8 @@ pub fn write_data_block_patch<T: Write + Seek>(mut writer: T, data: Vec<u8>) {
|
|||
file_size: data.len() as i32,
|
||||
},
|
||||
};
|
||||
block_header.write(&mut writer);
|
||||
block_header.write(&mut writer).unwrap();
|
||||
|
||||
data.write(&mut writer);
|
||||
data.write(&mut writer).unwrap();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue