mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
binpac: Replace u_char usages with unsigned char
Improve Alpine (musl) support by not relying on the (technically) non-standard u_char typedef.
This commit is contained in:
parent
46e2490cb0
commit
1d750aa164
5 changed files with 15 additions and 15 deletions
|
@ -109,7 +109,7 @@ inline int64 pac_swap(const int64 x)
|
|||
#define FixByteOrder(byteorder, x) (byteorder == HOST_BYTEORDER ? (x) : pac_swap(x))
|
||||
|
||||
template <class T>
|
||||
inline T UnMarshall(const u_char *data, int byteorder)
|
||||
inline T UnMarshall(const unsigned char *data, int byteorder)
|
||||
{
|
||||
T result = 0;
|
||||
for ( int i = 0; i < (int) sizeof(T); ++i )
|
||||
|
|
|
@ -10,16 +10,16 @@ class ConnectionAnalyzer {
|
|||
public:
|
||||
virtual ~ConnectionAnalyzer() {}
|
||||
virtual void NewData(bool is_orig,
|
||||
const u_char *begin_of_data,
|
||||
const u_char *end_of_data) = 0;
|
||||
const unsigned char* begin_of_data,
|
||||
const unsigned char* end_of_data) = 0;
|
||||
};
|
||||
|
||||
// The interface for a flow analyzer
|
||||
class FlowAnalyzer {
|
||||
public:
|
||||
virtual ~FlowAnalyzer() {}
|
||||
virtual void NewData(const u_char *begin_of_data,
|
||||
const u_char *end_of_data) = 0;
|
||||
virtual void NewData(const unsigned char* begin_of_data,
|
||||
const unsigned char* end_of_data) = 0;
|
||||
};
|
||||
|
||||
} // namespace binpac
|
||||
|
|
|
@ -12,8 +12,8 @@ namespace binpac {
|
|||
extern double network_time();
|
||||
|
||||
namespace {
|
||||
const u_char CR = '\r';
|
||||
const u_char LF = '\n';
|
||||
const unsigned char CR = '\r';
|
||||
const unsigned char LF = '\n';
|
||||
}
|
||||
|
||||
FlowBuffer::FlowBuffer(LineBreakStyle linebreak_style)
|
||||
|
@ -108,10 +108,10 @@ void FlowBuffer::ExpandBuffer(int length)
|
|||
|
||||
// Allocate a new buffer and copy the existing contents
|
||||
buffer_length_ = length;
|
||||
u_char *new_buf = (u_char *) realloc(buffer_, buffer_length_);
|
||||
unsigned char* new_buf = (unsigned char *) realloc(buffer_, buffer_length_);
|
||||
BINPAC_ASSERT(new_buf);
|
||||
#if 0
|
||||
u_char* new_buf = new u_char[buffer_length_];
|
||||
unsigned char* new_buf = new unsigned char[buffer_length_];
|
||||
if ( buffer_ && buffer_n_ > 0 )
|
||||
memcpy(new_buf, buffer_, buffer_n_);
|
||||
delete [] buffer_;
|
||||
|
@ -119,7 +119,7 @@ void FlowBuffer::ExpandBuffer(int length)
|
|||
buffer_ = new_buf;
|
||||
}
|
||||
|
||||
void FlowBuffer::SetLineBreaker(u_char *lbreaker)
|
||||
void FlowBuffer::SetLineBreaker(unsigned char* lbreaker)
|
||||
{
|
||||
linebreaker_ = *lbreaker;
|
||||
linebreak_style_default = linebreak_style_;
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
return buffer_n_ > 0 || orig_data_end_ > orig_data_begin_;
|
||||
}
|
||||
|
||||
void SetLineBreaker(u_char *lbreaker);
|
||||
void SetLineBreaker(unsigned char* lbreaker);
|
||||
void UnsetLineBreaker();
|
||||
void NewLine();
|
||||
// A negative frame_length represents a frame till EOF
|
||||
|
@ -126,7 +126,7 @@ protected:
|
|||
|
||||
int buffer_n_; // number of bytes in the buffer
|
||||
int buffer_length_; // size of the buffer
|
||||
u_char *buffer_;
|
||||
unsigned char* buffer_;
|
||||
bool message_complete_;
|
||||
int frame_length_;
|
||||
bool chunked_;
|
||||
|
@ -134,7 +134,7 @@ protected:
|
|||
|
||||
LineBreakStyle linebreak_style_;
|
||||
LineBreakStyle linebreak_style_default;
|
||||
u_char linebreaker_;
|
||||
unsigned char linebreaker_;
|
||||
|
||||
enum {
|
||||
UNKNOWN_MODE,
|
||||
|
|
|
@ -454,8 +454,8 @@ void Type::GenBufferConfiguration(Output *out_cc, Env *env)
|
|||
env->RValue(buffering_state_id));
|
||||
out_cc->inc_indent();
|
||||
out_cc->println("{");
|
||||
if(BufferableWithLineBreaker())
|
||||
out_cc->println("%s->SetLineBreaker((u_char*)%s);",
|
||||
if ( BufferableWithLineBreaker() )
|
||||
out_cc->println("%s->SetLineBreaker((unsigned char*)%s);",
|
||||
env->LValue(flow_buffer_id), LineBreaker()->orig());
|
||||
else
|
||||
out_cc->println("%s->UnsetLineBreaker();",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue