return 0;
};
- if match_opcode(detect, header_flags) {
- 1
- } else {
- 0
- }
+ match_opcode(detect, header_flags).into()
}
fn match_opcode(detect: &DetectDnsOpcode, flags: u16) -> bool {
}
impl FileContainer {
- pub fn default() -> FileContainer {
- FileContainer { head:ptr::null_mut(), tail:ptr::null_mut() }
- }
pub fn free(&mut self) {
SCLogDebug!("freeing self");
if let Some(c) = unsafe {SC} {
stream_slice,
offset as u32,
frame_len,
- if stream_slice.flags() & STREAM_TOSERVER != 0 { 0 } else { 1 },
+ (stream_slice.flags() & STREAM_TOSERVER == 0).into(),
frame_type,
)
};
fn parse_smb2_flags(i: &[u8]) -> IResult<&[u8], SmbFlags> {
let (i, val) = le_u32(i)?;
- let direction = if val & SMB2_FLAGS_SERVER_TO_REDIR != 0 { 1 } else { 0 };
- let async_command = if val & SMB2_FLAGS_ASYNC_COMMAND != 0 { 1 } else { 0 };
+ let direction = u8::from(val & SMB2_FLAGS_SERVER_TO_REDIR != 0);
+ let async_command = u8::from(val & SMB2_FLAGS_ASYNC_COMMAND != 0);
Ok((i, SmbFlags {
direction,
async_command,