Fix clang-tidy performance-enum-size warnings in headers

This commit is contained in:
Tim Wojtulewicz 2025-06-09 17:06:52 -07:00
parent 89ac0cb418
commit f386deba94
76 changed files with 184 additions and 136 deletions

View file

@ -53,7 +53,7 @@ public:
/**
* Type of input a packet source supports.
*/
enum InputType {
enum InputType : uint8_t {
LIVE, ///< Live input.
TRACE, ///< Offline input from trace file.
BOTH ///< Live input as well as offline.

View file

@ -2,6 +2,8 @@
#pragma once
#include <cstdint>
namespace zeek::iosource {
/**
@ -10,7 +12,7 @@ namespace zeek::iosource {
*/
class IOSource {
public:
enum ProcessFlags { READ = 0x01, WRITE = 0x02 };
enum ProcessFlags : uint8_t { READ = 0x01, WRITE = 0x02 };
/**
* Constructor.

View file

@ -38,7 +38,7 @@ using RecordValPtr = IntrusivePtr<RecordVal>;
* This enum is sized as an int32_t to make the Packet structure align
* correctly.
*/
enum Layer3Proto : int32_t {
enum Layer3Proto : int8_t {
L3_UNKNOWN = -1, /// Layer 3 type could not be determined.
L3_IPV4 = 1, /// Layer 3 is IPv4.
L3_IPV6 = 2, /// Layer 3 is IPv6.
@ -148,11 +148,6 @@ public:
uint32_t cap_len; /// Captured packet length
uint32_t link_type; /// pcap link_type (DLT_EN10MB, DLT_RAW, etc)
/**
* Layer 3 protocol identified (if any).
*/
Layer3Proto l3_proto;
/**
* If layer 2 is Ethernet, innermost ethertype field.
*/
@ -168,6 +163,11 @@ public:
*/
uint32_t inner_vlan = 0;
/**
* Layer 3 protocol identified (if any).
*/
Layer3Proto l3_proto;
/**
* If this packet is related to a connection, this flag denotes whether
* this packet is from the originator of the connection.