move consts to start of the function
This commit is contained in:
parent
0eeb77a44c
commit
c5b1d0deee
|
@ -588,15 +588,15 @@ impl Codec {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_filterload<R: Read>(&self, mut reader: R, body_len: usize) -> Result<Message, Error> {
|
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
|
if !(FILTERLOAD_REMAINDER_LENGTH <= body_len
|
||||||
&& body_len <= FILTERLOAD_REMAINDER_LENGTH + MAX_FILTERLOAD_LENGTH)
|
&& body_len <= FILTERLOAD_REMAINDER_LENGTH + MAX_FILTERLOAD_LENGTH)
|
||||||
{
|
{
|
||||||
return Err(Error::Parse("Invalid filterload message body 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 filter_length: usize = body_len - FILTERLOAD_REMAINDER_LENGTH;
|
||||||
|
|
||||||
let mut filter_bytes = vec![0; filter_length];
|
let mut filter_bytes = vec![0; filter_length];
|
||||||
|
|
Loading…
Reference in New Issue