mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote branch 'origin/topic/seth/fix-compiler-warnings'
* origin/topic/seth/fix-compiler-warnings: Fixed problem with PRI macros. PRI macros are currently not working for some reason. Two more small compile time error fixes. Cleaned up the output from running binpac. Added line to expect shift/reduce errors in parse.in Cleaned up g++ warnings. Addition: I fixed a few more warnings I was getting, and tweaked some of the existing changes slightly.
This commit is contained in:
commit
2f7fa3470b
16 changed files with 58 additions and 44 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
|||
1.6-dev.45 Tue Feb 8 21:28:01 PST 2011
|
||||
|
||||
- Fixing a number of compiler warnings. (Seth Hall and Robin Sommer)
|
||||
|
||||
1.6-dev.44 Tue Feb 8 20:11:44 PST 2011
|
||||
|
||||
- A number of updates to the SSL analyzer, including support for new
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.6-dev.44
|
||||
1.6-dev.45
|
||||
|
|
|
@ -160,7 +160,7 @@ macro(BINPAC_TARGET pacFile)
|
|||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${basename}_pac.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${basename}_pac.cc
|
||||
COMMAND ${BinPAC_EXE}
|
||||
ARGS -d ${CMAKE_CURRENT_BINARY_DIR}
|
||||
ARGS -q -d ${CMAKE_CURRENT_BINARY_DIR}
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${pacFile}
|
||||
DEPENDS ${BinPAC_EXE} ${pacFile}
|
||||
|
@ -177,9 +177,9 @@ binpac_target(binpac_bro-lib.pac)
|
|||
binpac_target(bittorrent.pac
|
||||
bittorrent-protocol.pac bittorrent-analyzer.pac)
|
||||
binpac_target(dce_rpc.pac
|
||||
dce_rpc-protocol.pac dce_rpc-analyzer.pac)
|
||||
dce_rpc-protocol.pac dce_rpc-analyzer.pac epmapper.pac)
|
||||
binpac_target(dce_rpc_simple.pac
|
||||
dce_rpc-protocol.pac)
|
||||
dce_rpc-protocol.pac epmapper.pac)
|
||||
binpac_target(dhcp.pac
|
||||
dhcp-protocol.pac dhcp-analyzer.pac)
|
||||
binpac_target(dns.pac
|
||||
|
@ -217,6 +217,8 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h
|
|||
)
|
||||
|
||||
set(dns_SRCS nb_dns.c nb_dns.h)
|
||||
set_source_files_properties(nb_dns.c PROPERTIES COMPILE_FLAGS
|
||||
-fno-strict-aliasing)
|
||||
|
||||
set(openssl_SRCS X509.cc SSLCiphers.cc SSLInterpreter.cc SSLProxy.cc
|
||||
SSLv2.cc SSLv3.cc SSLv3Automaton.cc)
|
||||
|
|
|
@ -82,7 +82,7 @@ UUID::UUID(const char* str)
|
|||
}
|
||||
|
||||
if ( i != 16 )
|
||||
internal_error(fmt("invalid UUID string: %s", str));
|
||||
internal_error("invalid UUID string: %s", str);
|
||||
}
|
||||
|
||||
typedef map<UUID, BroEnum::dce_rpc_if_id> uuid_map_t;
|
||||
|
|
|
@ -99,8 +99,8 @@ void* PrefixTable::Lookup(const Val* value, bool exact) const
|
|||
break;
|
||||
|
||||
default:
|
||||
internal_error(fmt("Wrong index type %d for PrefixTable",
|
||||
value->Type()->Tag()));
|
||||
internal_error("Wrong index type %d for PrefixTable",
|
||||
value->Type()->Tag());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1516,13 +1516,13 @@ bool RemoteSerializer::DoMessage()
|
|||
{
|
||||
// We shut the connection to this peer down,
|
||||
// so we ignore all further messages.
|
||||
DEBUG_COMM(fmt("parent: ignoring %s due to shutdown of peer #%d",
|
||||
DEBUG_COMM(fmt("parent: ignoring %s due to shutdown of peer #%" PRI_SOURCE_ID,
|
||||
msgToStr(current_msgtype),
|
||||
current_peer ? current_peer->id : 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
DEBUG_COMM(fmt("parent: %s from child; peer is #%d",
|
||||
DEBUG_COMM(fmt("parent: %s from child; peer is #%" PRI_SOURCE_ID,
|
||||
msgToStr(current_msgtype),
|
||||
current_peer ? current_peer->id : 0));
|
||||
|
||||
|
@ -2619,7 +2619,7 @@ bool RemoteSerializer::SendCMsgToChild(char msg_type, Peer* peer)
|
|||
|
||||
bool RemoteSerializer::SendToChild(char type, Peer* peer, char* str, int len)
|
||||
{
|
||||
DEBUG_COMM(fmt("parent: (->child) %s (#%d, %s)", msgToStr(type), peer ? peer->id : PEER_NONE, str));
|
||||
DEBUG_COMM(fmt("parent: (->child) %s (#%" PRI_SOURCE_ID ", %s)", msgToStr(type), peer ? peer->id : PEER_NONE, str));
|
||||
|
||||
if ( ! child_pid )
|
||||
return false;
|
||||
|
@ -2643,7 +2643,7 @@ bool RemoteSerializer::SendToChild(char type, Peer* peer, int nargs, ...)
|
|||
|
||||
#ifdef DEBUG
|
||||
va_start(ap, nargs);
|
||||
DEBUG_COMM(fmt("parent: (->child) %s (#%d,%s)",
|
||||
DEBUG_COMM(fmt("parent: (->child) %s (#%" PRI_SOURCE_ID ",%s)",
|
||||
msgToStr(type), peer ? peer->id : PEER_NONE, fmt_uint32s(nargs, ap)));
|
||||
va_end(ap);
|
||||
#endif
|
||||
|
@ -3074,7 +3074,7 @@ bool SocketComm::ProcessParentMessage()
|
|||
}
|
||||
|
||||
default:
|
||||
internal_error(fmt("unknown msg type %d", parent_msgtype));
|
||||
internal_error("unknown msg type %d", parent_msgtype);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3244,7 +3244,7 @@ bool SocketComm::ForwardChunkToPeer()
|
|||
{
|
||||
#ifdef DEBUG
|
||||
if ( parent_peer )
|
||||
DEBUG_COMM(fmt("child: not connected to #%d", parent_id));
|
||||
DEBUG_COMM(fmt("child: not connected to #%" PRI_SOURCE_ID, parent_id));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3327,7 +3327,7 @@ bool SocketComm::ProcessRemoteMessage(SocketComm::Peer* peer)
|
|||
|
||||
CMsg* msg = (CMsg*) c->data;
|
||||
|
||||
DEBUG_COMM(fmt("child: %s from peer #%d",
|
||||
DEBUG_COMM(fmt("child: %s from peer #%" PRI_SOURCE_ID,
|
||||
msgToStr(msg->Type()), peer->id));
|
||||
|
||||
switch ( msg->Type() ) {
|
||||
|
@ -3804,7 +3804,7 @@ bool SocketComm::SendToParent(char type, Peer* peer, const char* str, int len)
|
|||
#ifdef DEBUG
|
||||
// str may already by constructed with fmt()
|
||||
const char* tmp = copy_string(str);
|
||||
DEBUG_COMM(fmt("child: (->parent) %s (#%d, %s)", msgToStr(type), peer ? peer->id : RemoteSerializer::PEER_NONE, tmp));
|
||||
DEBUG_COMM(fmt("child: (->parent) %s (#%" PRI_SOURCE_ID ", %s)", msgToStr(type), peer ? peer->id : RemoteSerializer::PEER_NONE, tmp));
|
||||
delete [] tmp;
|
||||
#endif
|
||||
if ( sendToIO(io, type, peer ? peer->id : RemoteSerializer::PEER_NONE,
|
||||
|
@ -3823,7 +3823,7 @@ bool SocketComm::SendToParent(char type, Peer* peer, int nargs, ...)
|
|||
|
||||
#ifdef DEBUG
|
||||
va_start(ap,nargs);
|
||||
DEBUG_COMM(fmt("child: (->parent) %s (#%d,%s)", msgToStr(type), peer ? peer->id : RemoteSerializer::PEER_NONE, fmt_uint32s(nargs, ap)));
|
||||
DEBUG_COMM(fmt("child: (->parent) %s (#%" PRI_SOURCE_ID ",%s)", msgToStr(type), peer ? peer->id : RemoteSerializer::PEER_NONE, fmt_uint32s(nargs, ap)));
|
||||
va_end(ap);
|
||||
#endif
|
||||
|
||||
|
@ -3859,7 +3859,7 @@ bool SocketComm::SendToPeer(Peer* peer, char type, const char* str, int len)
|
|||
#ifdef DEBUG
|
||||
// str may already by constructed with fmt()
|
||||
const char* tmp = copy_string(str);
|
||||
DEBUG_COMM(fmt("child: (->peer) %s to #%d (%s)", msgToStr(type), peer->id, tmp));
|
||||
DEBUG_COMM(fmt("child: (->peer) %s to #%" PRI_SOURCE_ID " (%s)", msgToStr(type), peer->id, tmp));
|
||||
delete [] tmp;
|
||||
#endif
|
||||
|
||||
|
@ -3878,7 +3878,7 @@ bool SocketComm::SendToPeer(Peer* peer, char type, int nargs, ...)
|
|||
|
||||
#ifdef DEBUG
|
||||
va_start(ap,nargs);
|
||||
DEBUG_COMM(fmt("child: (->peer) %s to #%d (%s)",
|
||||
DEBUG_COMM(fmt("child: (->peer) %s to #%" PRI_SOURCE_ID " (%s)",
|
||||
msgToStr(type), peer->id, fmt_uint32s(nargs, ap)));
|
||||
va_end(ap);
|
||||
#endif
|
||||
|
@ -3899,7 +3899,7 @@ bool SocketComm::SendToPeer(Peer* peer, char type, int nargs, ...)
|
|||
|
||||
bool SocketComm::SendToPeer(Peer* peer, ChunkedIO::Chunk* c)
|
||||
{
|
||||
DEBUG_COMM(fmt("child: (->peer) chunk of size %d to #%d", c->len, peer->id));
|
||||
DEBUG_COMM(fmt("child: (->peer) chunk of size %d to #%" PRI_SOURCE_ID, c->len, peer->id));
|
||||
if ( ! sendToIO(peer->io, c) )
|
||||
{
|
||||
Error(fmt("child: write error %s", io->Error()), peer);
|
||||
|
|
|
@ -166,7 +166,7 @@ void SMB_Session::Deliver(int is_orig, int len, const u_char* data)
|
|||
const u_char* tmp = data_start + next;
|
||||
if ( data_start + next < data + body.length() )
|
||||
{
|
||||
Weird(fmt("ANDX buffer overlapping: next = %d, buffer_end = %d", next, data + body.length() - data_start));
|
||||
Weird(fmt("ANDX buffer overlapping: next = %d, buffer_end = %" PRIuPTR, next, data + body.length() - data_start));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
static scope_list scopes;
|
||||
static Scope* top_scope;
|
||||
|
||||
extern const char* GLOBAL_MODULE_NAME = "GLOBAL";
|
||||
|
||||
|
||||
// Returns it without trailing "::".
|
||||
string extract_module_name(const char* name)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ protected:
|
|||
id_list* inits;
|
||||
};
|
||||
|
||||
extern const char* GLOBAL_MODULE_NAME;
|
||||
static const char* GLOBAL_MODULE_NAME = "GLOBAL";
|
||||
|
||||
extern string extract_module_name(const char* name);
|
||||
extern string normalized_module_name(const char* module_name); // w/o ::
|
||||
|
|
4
src/cq.c
4
src/cq.c
|
@ -570,8 +570,8 @@ cq_debugbucket(register struct cq_handle *hp,
|
|||
bp2 = hp->buckets + PRI2BUCKET(hp, bp->pri);
|
||||
if (bp2 != buckets) {
|
||||
fprintf(stderr,
|
||||
"%f in wrong bucket! (off by %d)\n",
|
||||
bp->pri, bp2 - buckets);
|
||||
"%f in wrong bucket! (off by %ld)\n",
|
||||
bp->pri, (long)(bp2 - buckets));
|
||||
cq_dump(hp);
|
||||
abort();
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ analyzer DCE_RPC withcontext {
|
|||
flow: DCE_RPC_Flow;
|
||||
};
|
||||
|
||||
%include "dce_rpc-protocol.pac"
|
||||
%include "dce_rpc-analyzer.pac"
|
||||
%include dce_rpc-protocol.pac
|
||||
%include dce_rpc-analyzer.pac
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
@ -421,7 +422,7 @@ int main(int argc, char** argv)
|
|||
|
||||
prog = argv[0];
|
||||
|
||||
prefixes.append(""); // "" = "no prefix"
|
||||
prefixes.append(strdup("")); // "" = "no prefix"
|
||||
|
||||
char* p = getenv("BRO_PREFIXES");
|
||||
if ( p )
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
%}
|
||||
|
||||
%expect 71
|
||||
|
||||
%token TOK_ADD TOK_ADD_TO TOK_ADDR TOK_ALARM TOK_ANY
|
||||
%token TOK_ATENDIF TOK_ATELSE TOK_ATIF TOK_ATIFDEF TOK_ATIFNDEF
|
||||
%token TOK_BOOL TOK_BREAK TOK_CASE TOK_CONST
|
||||
|
|
|
@ -1027,7 +1027,7 @@ lookup_then_remove (patricia_tree_t *tree, char *string)
|
|||
{
|
||||
patricia_node_t *node;
|
||||
|
||||
if (node = try_search_exact (tree, string))
|
||||
if ( (node = try_search_exact(tree, string)) )
|
||||
patricia_remove (tree, node);
|
||||
}
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ Val* do_split(StringVal* str_val, RE_Matcher* re, TableVal* other_sep,
|
|||
{
|
||||
offset = 0;
|
||||
// Find next match offset.
|
||||
int end_of_match;
|
||||
int end_of_match = 0;
|
||||
while ( n > 0 &&
|
||||
(end_of_match = re->MatchPrefix(s + offset, n)) <= 0 )
|
||||
{
|
||||
|
|
34
src/util.h
34
src/util.h
|
@ -11,6 +11,11 @@
|
|||
#include <stdarg.h>
|
||||
#include "config.h"
|
||||
|
||||
// Expose C99 functionality from inttypes.h, which would otherwise not be
|
||||
// available in C++.
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#if __STDC__
|
||||
#define myattribute __attribute__
|
||||
#else
|
||||
|
@ -39,19 +44,17 @@
|
|||
extern HeapLeakChecker* heap_checker;
|
||||
#endif
|
||||
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned char uint8;
|
||||
#include <stdint.h>
|
||||
|
||||
#if SIZEOF_LONG_LONG == 8
|
||||
typedef unsigned long long uint64;
|
||||
typedef long long int64;
|
||||
#elif SIZEOF_LONG_INT == 8
|
||||
typedef unsigned long int uint64;
|
||||
typedef long int int64;
|
||||
#else
|
||||
# error "Couldn't reliably identify 64-bit type. Please report to bro@bro-ids.org."
|
||||
#endif
|
||||
typedef uint64_t uint64;
|
||||
typedef uint32_t uint32;
|
||||
typedef uint16_t uint16;
|
||||
typedef uint8_t uint8;
|
||||
|
||||
typedef int64_t int64;
|
||||
typedef int32_t int32;
|
||||
typedef int16_t int16;
|
||||
typedef int8_t int8;
|
||||
|
||||
typedef int64 bro_int_t;
|
||||
typedef uint64 bro_uint_t;
|
||||
|
@ -63,9 +66,13 @@ typedef uint64 bro_uint_t;
|
|||
#if SIZEOF_VOID_P == 8
|
||||
typedef uint64 ptr_compat_uint;
|
||||
typedef int64 ptr_compat_int;
|
||||
#define PRI_PTR_COMPAT_INT PRId64 // Format to use with printf.
|
||||
#define PRI_PTR_COMPAT_UINT PRIu64
|
||||
#elif SIZEOF_VOID_P == 4
|
||||
typedef uint32 ptr_compat_uint;
|
||||
typedef int ptr_compat_int;
|
||||
typedef int32 ptr_compat_int;
|
||||
#define PRI_PTR_COMPAT_INT PRId32
|
||||
#define PRI_PTR_COMPAT_UINT PRIu32
|
||||
#else
|
||||
# error "Unusual pointer size. Please report to bro@bro-ids.org."
|
||||
#endif
|
||||
|
@ -156,6 +163,7 @@ extern uint8 uhash_key[UHASH_KEY_SIZE];
|
|||
// the obvious places (like Event.h or RemoteSerializer.h)
|
||||
|
||||
typedef ptr_compat_uint SourceID;
|
||||
#define PRI_SOURCE_ID PRI_PTR_COMPAT_UINT
|
||||
static const SourceID SOURCE_LOCAL = 0;
|
||||
|
||||
class BroObj;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue