diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2022-12-23 08:39:09 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2022-12-23 08:39:09 +0100 |
commit | 71d7f39706f0f5004820f8d1d36c87d5f9ec3e97 (patch) | |
tree | 1938481028914a91b4f98d95675360d695febec9 | |
parent | a970b2110488aeff5855743d1728ee83462e8306 (diff) | |
download | nihav-71d7f39706f0f5004820f8d1d36c87d5f9ec3e97.tar.gz |
make validate!() print message only in debug builds
24 files changed, 120 insertions, 0 deletions
diff --git a/nihav-commonfmt/src/codecs/mod.rs b/nihav-commonfmt/src/codecs/mod.rs index cf0c846..f69fc64 100644 --- a/nihav-commonfmt/src/codecs/mod.rs +++ b/nihav-commonfmt/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_cinepak")] mod cinepak; diff --git a/nihav-commonfmt/src/demuxers/mod.rs b/nihav-commonfmt/src/demuxers/mod.rs index d850e05..32fe113 100644 --- a/nihav-commonfmt/src/demuxers/mod.rs +++ b/nihav-commonfmt/src/demuxers/mod.rs @@ -2,9 +2,14 @@ use nihav_core::demuxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(feature="demuxer_avi")] #[allow(clippy::cast_lossless)] diff --git a/nihav-duck/src/codecs/mod.rs b/nihav-duck/src/codecs/mod.rs index 271dc57..e4f115b 100644 --- a/nihav-duck/src/codecs/mod.rs +++ b/nihav-duck/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_truemotion1")] mod truemotion1; diff --git a/nihav-duck/src/demuxers/mod.rs b/nihav-duck/src/demuxers/mod.rs index 3ac19a2..7a45b94 100644 --- a/nihav-duck/src/demuxers/mod.rs +++ b/nihav-duck/src/demuxers/mod.rs @@ -2,9 +2,14 @@ use nihav_core::demuxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(feature="demuxer_ivf")] mod ivf; diff --git a/nihav-flash/src/codecs/mod.rs b/nihav-flash/src/codecs/mod.rs index 906c3ec..74525fb 100644 --- a/nihav-flash/src/codecs/mod.rs +++ b/nihav-flash/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_flv263")] mod flv263; diff --git a/nihav-flash/src/demuxers/mod.rs b/nihav-flash/src/demuxers/mod.rs index a06fc48..fa46f34 100644 --- a/nihav-flash/src/demuxers/mod.rs +++ b/nihav-flash/src/demuxers/mod.rs @@ -2,9 +2,14 @@ use nihav_core::demuxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(feature="demuxer_flv")] mod flv; diff --git a/nihav-flash/src/muxers/mod.rs b/nihav-flash/src/muxers/mod.rs index 692c5ad..edb87e3 100644 --- a/nihav-flash/src/muxers/mod.rs +++ b/nihav-flash/src/muxers/mod.rs @@ -1,9 +1,14 @@ use nihav_core::muxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(MuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(MuxerError::InvalidData); } }; +} #[cfg(feature="muxer_flv")] mod flv; diff --git a/nihav-game/src/codecs/mod.rs b/nihav-game/src/codecs/mod.rs index c31c6a3..14c6c87 100644 --- a/nihav-game/src/codecs/mod.rs +++ b/nihav-game/src/codecs/mod.rs @@ -1,9 +1,14 @@ use nihav_core::codecs::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_arxel_vid")] pub mod arxel_vid; diff --git a/nihav-game/src/demuxers/mod.rs b/nihav-game/src/demuxers/mod.rs index f144965..8ee7a6c 100644 --- a/nihav-game/src/demuxers/mod.rs +++ b/nihav-game/src/demuxers/mod.rs @@ -1,9 +1,14 @@ use nihav_core::demuxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(any(feature="demuxer_bmv",feature="demuxer_bmv3"))] mod bmv; diff --git a/nihav-indeo/src/codecs/mod.rs b/nihav-indeo/src/codecs/mod.rs index 2352bf9..57f39a3 100644 --- a/nihav-indeo/src/codecs/mod.rs +++ b/nihav-indeo/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_intel263")] mod intel263; diff --git a/nihav-indeo/src/demuxers/mod.rs b/nihav-indeo/src/demuxers/mod.rs index db8046a..6e25fcc 100644 --- a/nihav-indeo/src/demuxers/mod.rs +++ b/nihav-indeo/src/demuxers/mod.rs @@ -2,9 +2,14 @@ use nihav_core::demuxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(feature="demuxer_ivf")] mod ivf; diff --git a/nihav-itu/src/codecs/mod.rs b/nihav-itu/src/codecs/mod.rs index ac1f7d6..f0ccc23 100644 --- a/nihav-itu/src/codecs/mod.rs +++ b/nihav-itu/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[allow(clippy::collapsible_else_if)] #[allow(clippy::too_many_arguments)] diff --git a/nihav-llaudio/src/codecs/mod.rs b/nihav-llaudio/src/codecs/mod.rs index a0e92bb..4f2a21a 100644 --- a/nihav-llaudio/src/codecs/mod.rs +++ b/nihav-llaudio/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_ape")] pub mod ape; diff --git a/nihav-llaudio/src/demuxers/mod.rs b/nihav-llaudio/src/demuxers/mod.rs index 41dd9fd..4ccb8f1 100644 --- a/nihav-llaudio/src/demuxers/mod.rs +++ b/nihav-llaudio/src/demuxers/mod.rs @@ -1,9 +1,14 @@ use nihav_core::demuxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(feature="demuxer_ape")] mod ape; diff --git a/nihav-misc/src/codecs/mod.rs b/nihav-misc/src/codecs/mod.rs index a41bd34..1723a4e 100644 --- a/nihav-misc/src/codecs/mod.rs +++ b/nihav-misc/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_mwv1")] mod mwv1; diff --git a/nihav-mpeg/src/codecs/mod.rs b/nihav-mpeg/src/codecs/mod.rs index fd05a3f..f6fb31c 100644 --- a/nihav-mpeg/src/codecs/mod.rs +++ b/nihav-mpeg/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_aac")] #[allow(clippy::comparison_chain)] diff --git a/nihav-ms/src/codecs/mod.rs b/nihav-ms/src/codecs/mod.rs index 1216205..739315b 100644 --- a/nihav-ms/src/codecs/mod.rs +++ b/nihav-ms/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_msrle")] pub mod msrle; diff --git a/nihav-qt/src/codecs/mod.rs b/nihav-qt/src/codecs/mod.rs index 326ea0c..d06c401 100644 --- a/nihav-qt/src/codecs/mod.rs +++ b/nihav-qt/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(feature="decoder_rle")] mod rle; diff --git a/nihav-rad/src/codecs/mod.rs b/nihav-rad/src/codecs/mod.rs index 6680c0f..61b2e8c 100644 --- a/nihav-rad/src/codecs/mod.rs +++ b/nihav-rad/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(any(feature="decoder_smkaud", feature="decoder_smkvid"))] mod smacker; diff --git a/nihav-rad/src/demuxers/mod.rs b/nihav-rad/src/demuxers/mod.rs index b196964..65ddf2c 100644 --- a/nihav-rad/src/demuxers/mod.rs +++ b/nihav-rad/src/demuxers/mod.rs @@ -1,9 +1,14 @@ use nihav_core::demuxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(feature="demuxer_smk")] mod smacker; diff --git a/nihav-realmedia/src/codecs/mod.rs b/nihav-realmedia/src/codecs/mod.rs index aea7a9e..6ca76ac 100644 --- a/nihav-realmedia/src/codecs/mod.rs +++ b/nihav-realmedia/src/codecs/mod.rs @@ -1,8 +1,13 @@ use nihav_core::codecs::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(any(feature="decoder_realvideo3", feature="decoder_realvideo4"))] mod rv3040; diff --git a/nihav-realmedia/src/demuxers/mod.rs b/nihav-realmedia/src/demuxers/mod.rs index 1b044a6..820dd2e 100644 --- a/nihav-realmedia/src/demuxers/mod.rs +++ b/nihav-realmedia/src/demuxers/mod.rs @@ -1,8 +1,13 @@ use nihav_core::demuxers::*; +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(feature="demuxer_real")] #[allow(clippy::identity_op)] diff --git a/nihav-vivo/src/codecs/mod.rs b/nihav-vivo/src/codecs/mod.rs index ea95f23..e869c8d 100644 --- a/nihav-vivo/src/codecs/mod.rs +++ b/nihav-vivo/src/codecs/mod.rs @@ -1,9 +1,14 @@ use nihav_core::codecs::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DecoderError::InvalidData); } }; +} #[cfg(any(feature="decoder_vivo1", feature="decoder_vivo2"))] #[allow(clippy::useless_let_if_seq)] diff --git a/nihav-vivo/src/demuxers/mod.rs b/nihav-vivo/src/demuxers/mod.rs index 2f4a94d..145dafc 100644 --- a/nihav-vivo/src/demuxers/mod.rs +++ b/nihav-vivo/src/demuxers/mod.rs @@ -2,9 +2,14 @@ use nihav_core::demuxers::*; #[allow(unused_macros)] +#[cfg(debug_assertions)] macro_rules! validate { ($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DemuxerError::InvalidData); } }; } +#[cfg(not(debug_assertions))] +macro_rules! validate { + ($a:expr) => { if !$a { return Err(DemuxerError::InvalidData); } }; +} #[cfg(feature="demuxer_vivo")] mod vivo; |