move consts to start of the function

This commit is contained in:
Alfredo Garcia 2021-03-22 12:53:17 -03:00 committed by Deirdre Connolly
parent 0eeb77a44c
commit c5b1d0deee
1 changed files with 3 additions and 3 deletions

View File

@ -588,15 +588,15 @@ impl Codec {
}
fn read_filterload<R: Read>(&self, mut reader: R, body_len: usize) -> Result<Message, Error> {
const MAX_FILTERLOAD_LENGTH: usize = 36000;
const FILTERLOAD_REMAINDER_LENGTH: usize = 4 + 4 + 1;
if !(FILTERLOAD_REMAINDER_LENGTH <= body_len
&& body_len <= FILTERLOAD_REMAINDER_LENGTH + MAX_FILTERLOAD_LENGTH)
{
return Err(Error::Parse("Invalid filterload message body length."));
}
const MAX_FILTERLOAD_LENGTH: usize = 36000;
const FILTERLOAD_REMAINDER_LENGTH: usize = 4 + 4 + 1;
let filter_length: usize = body_len - FILTERLOAD_REMAINDER_LENGTH;
let mut filter_bytes = vec![0; filter_length];