Skip to content
This repository was archived by the owner on Apr 9, 2023. It is now read-only.

Commit f84785e

Browse files
committed
Remove system magic file usage, as it's redundant and problematic
1 parent 9bc1f46 commit f84785e

File tree

3 files changed

+0
-229
lines changed

3 files changed

+0
-229
lines changed

src/fdo_magic/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ extern crate petgraph;
55
extern crate fnv;
66

77
pub mod builtin;
8-
#[cfg(not(feature="staticmime"))]
9-
pub mod sys;
108

119
// We can't have staticmime and sys_fdo_magic enabled
1210
// because we can't statically refer to a file on disk.

src/fdo_magic/sys.rs

-214
This file was deleted.

src/lib.rs

-13
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
//! between 5,000ns and 100,000ns to find a MIME type.)
1414
//! - Check if a file *is* a certain type.
1515
//! - Handles aliases (ex: `application/zip` vs `application/x-zip-compressed`)
16-
//! - Uses system [FreeDesktop.org magic files](https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html)
17-
//! on Linux systems, and built-in magic file on Windows and macOS.
1816
//! - Can delegate different file types to different "checkers", reducing false positives
1917
//! by choosing a different method of attack.
2018
//!
@@ -85,22 +83,12 @@ struct CheckerStruct {
8583

8684
/// Maximum number of checkers supported with build config.
8785
/// TODO: Find any better way to do this!
88-
#[cfg(not(feature="staticmime"))]
89-
const CHECKERCOUNT: usize = 3;
90-
#[cfg(feature="staticmime")]
9186
const CHECKERCOUNT: usize = 2;
9287

9388
/// List of checker functions
9489
const CHECKERS: [CheckerStruct; CHECKERCOUNT] =
9590
[
9691
// Disable sys checker when using staticmime
97-
#[cfg(not(feature="staticmime"))] CheckerStruct{
98-
from_u8: fdo_magic::sys::check::from_u8,
99-
from_filepath: fdo_magic::sys::check::from_filepath,
100-
get_supported: fdo_magic::sys::init::get_supported,
101-
get_subclasses: fdo_magic::sys::init::get_subclasses,
102-
get_aliaslist: fdo_magic::sys::init::get_aliaslist
103-
},
10492
CheckerStruct{
10593
from_u8: fdo_magic::builtin::check::from_u8,
10694
from_filepath: fdo_magic::builtin::check::from_filepath,
@@ -152,7 +140,6 @@ lazy_static! {
152140
#[derive(Clone)]
153141
pub enum Cache {
154142
FileCache(Vec<u8>),
155-
#[cfg(not(feature="staticmime"))] FdoMagicSys(fdo_magic::sys::Cache),
156143
FdoMagicBuiltin(fdo_magic::builtin::Cache),
157144
Basetype(basetype::Cache)
158145
}

0 commit comments

Comments
 (0)