mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix for Val constructor with new int64 typedefs.
Val::Val had prototypes for int, long, int64, etc. But depending on the architecture some of those might be the same (int64 and long) thus yielding a compile error. Fix: only use int32, int64, etc. for prototype. ints and longs can still be passed, since they will match one of these fixed-width types regardless of platform. Also fix some more compiler warnings with format strings.
This commit is contained in:
parent
2aae4eaf91
commit
2ced4839e9
2 changed files with 6 additions and 26 deletions
|
@ -369,25 +369,25 @@ bool XMLSerializationFormat::Write(char v, const char* tag)
|
|||
|
||||
bool XMLSerializationFormat::Write(uint16 v, const char* tag)
|
||||
{
|
||||
const char* tmp = fmt("%u", v);
|
||||
const char* tmp = fmt("%"PRIu16, v);
|
||||
return WriteElem(tag, "uint16", tmp, strlen(tmp));
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Write(uint32 v, const char* tag)
|
||||
{
|
||||
const char* tmp = fmt("%u", v);
|
||||
const char* tmp = fmt("%"PRIu32, v);
|
||||
return WriteElem(tag, "uint32", tmp, strlen(tmp));
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Write(uint64 v, const char* tag)
|
||||
{
|
||||
const char* tmp = fmt("%llu", v);
|
||||
const char* tmp = fmt("%"PRIu64, v);
|
||||
return WriteElem(tag, "uint64", tmp, strlen(tmp));
|
||||
}
|
||||
|
||||
bool XMLSerializationFormat::Write(int64 v, const char* tag)
|
||||
{
|
||||
const char* tmp = fmt("%lld", v);
|
||||
const char* tmp = fmt("%"PRId64, v);
|
||||
return WriteElem(tag, "int64", tmp, strlen(tmp));
|
||||
}
|
||||
|
||||
|
|
24
src/Val.h
24
src/Val.h
|
@ -87,7 +87,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
Val(int i, TypeTag t)
|
||||
Val(int32 i, TypeTag t)
|
||||
{
|
||||
val.int_val = bro_int_t(i);
|
||||
type = base_type(t);
|
||||
|
@ -97,27 +97,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
Val(long i, TypeTag t)
|
||||
{
|
||||
val.int_val = bro_int_t(i);
|
||||
type = base_type(t);
|
||||
attribs = 0;
|
||||
#ifdef DEBUG
|
||||
bound_id = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
Val(unsigned int u, TypeTag t)
|
||||
{
|
||||
val.uint_val = bro_uint_t(u);
|
||||
type = base_type(t);
|
||||
attribs = 0;
|
||||
#ifdef DEBUG
|
||||
bound_id = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
Val(unsigned long u, TypeTag t)
|
||||
Val(uint32 u, TypeTag t)
|
||||
{
|
||||
val.uint_val = bro_uint_t(u);
|
||||
type = base_type(t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue