Fix compiler warnings

These changes eliminate 405 of 571 warnings seen on OS X 10.7.4 with clang.
This commit is contained in:
Daniel Thayer 2012-07-10 15:39:05 -05:00
parent c0bbd78ee1
commit 7f4b0b52f8
11 changed files with 15 additions and 15 deletions

View file

@ -96,7 +96,7 @@ EventHandler* EventHandler::Unserialize(UnserialInfo* info)
{ {
char* name; char* name;
if ( ! UNSERIALIZE_STR(&name, 0) ) if ( ! UNSERIALIZE_STR(&name, 0) )
return false; return 0;
EventHandler* h = event_registry->Lookup(name); EventHandler* h = event_registry->Lookup(name);
if ( ! h ) if ( ! h )

View file

@ -100,7 +100,7 @@ Func* Func::Unserialize(UnserialInfo* info)
if ( ! (id->HasVal() && id->ID_Val()->Type()->Tag() == TYPE_FUNC) ) if ( ! (id->HasVal() && id->ID_Val()->Type()->Tag() == TYPE_FUNC) )
{ {
info->s->Error(fmt("ID %s is not a built-in", name)); info->s->Error(fmt("ID %s is not a built-in", name));
return false; return 0;
} }
Unref(f); Unref(f);

View file

@ -17,8 +17,8 @@
class IncrementalSendTimer; class IncrementalSendTimer;
namespace threading { namespace threading {
class Field; struct Field;
class Value; struct Value;
} }
// This class handles the communication done in Bro's main loop. // This class handles the communication done in Bro's main loop.

View file

@ -368,7 +368,7 @@ int SMB_Session::ParseSetupAndx(int is_orig, binpac::SMB::SMB_header const& hdr,
// The binpac type depends on the negotiated server settings - // The binpac type depends on the negotiated server settings -
// possibly we can just pick the "right" format here, and use that? // possibly we can just pick the "right" format here, and use that?
if ( hdr.flags2() && 0x0800 ) if ( hdr.flags2() & 0x0800 )
{ {
binpac::SMB::SMB_setup_andx_ext msg(hdr.unicode()); binpac::SMB::SMB_setup_andx_ext msg(hdr.unicode());
msg.Parse(body.data(), body.data() + body.length()); msg.Parse(body.data(), body.data() + body.length());

View file

@ -163,7 +163,7 @@ SerialObj* SerialObj::Unserialize(UnserialInfo* info, SerialType type)
if ( ! result ) if ( ! result )
{ {
DBG_POP(DBG_SERIAL); DBG_POP(DBG_SERIAL);
return false; return 0;
} }
DBG_POP(DBG_SERIAL); DBG_POP(DBG_SERIAL);

View file

@ -18,7 +18,7 @@ struct pcap_pkthdr;
class EncapsulationStack; class EncapsulationStack;
class Connection; class Connection;
class ConnID; struct ConnID;
class OSFingerprint; class OSFingerprint;
class ConnCompressor; class ConnCompressor;

View file

@ -910,7 +910,7 @@ Val* RecordType::FieldDefault(int field) const
const TypeDecl* td = FieldDecl(field); const TypeDecl* td = FieldDecl(field);
if ( ! td->attrs ) if ( ! td->attrs )
return false; return 0;
const Attr* def_attr = td->attrs->FindAttr(ATTR_DEFAULT); const Attr* def_attr = td->attrs->FindAttr(ATTR_DEFAULT);

View file

@ -232,7 +232,7 @@ Value* Ascii::EntryToVal(string s, FieldMapping field)
{ {
Error(Fmt("Field: %s Invalid value for boolean: %s", Error(Fmt("Field: %s Invalid value for boolean: %s",
field.name.c_str(), s.c_str())); field.name.c_str(), s.c_str()));
return false; return 0;
} }
break; break;
@ -262,7 +262,7 @@ Value* Ascii::EntryToVal(string s, FieldMapping field)
if ( pos == s.npos ) if ( pos == s.npos )
{ {
Error(Fmt("Invalid value for subnet: %s", s.c_str())); Error(Fmt("Invalid value for subnet: %s", s.c_str()));
return false; return 0;
} }
int width = atoi(s.substr(pos+1).c_str()); int width = atoi(s.substr(pos+1).c_str());

View file

@ -983,7 +983,7 @@ WriterFrontend* Manager::CreateWriter(EnumVal* id, EnumVal* writer, const Writer
if ( ! stream ) if ( ! stream )
// Don't know this stream. // Don't know this stream.
return false; return 0;
Stream::WriterMap::iterator w = Stream::WriterMap::iterator w =
stream->writers.find(Stream::WriterPathPair(writer->AsEnum(), info.path)); stream->writers.find(Stream::WriterPathPair(writer->AsEnum(), info.path));

View file

@ -295,7 +295,7 @@ refine connection SSL_Conn += {
for ( int k = 0; k < num_ext; ++k ) for ( int k = 0; k < num_ext; ++k )
{ {
unsigned char *pBuffer = 0; unsigned char *pBuffer = 0;
uint length = 0; int length = 0;
X509_EXTENSION* ex = X509_get_ext(pTemp, k); X509_EXTENSION* ex = X509_get_ext(pTemp, k);
if (ex) if (ex)
@ -303,7 +303,7 @@ refine connection SSL_Conn += {
ASN1_STRING *pString = X509_EXTENSION_get_data(ex); ASN1_STRING *pString = X509_EXTENSION_get_data(ex);
length = ASN1_STRING_to_UTF8(&pBuffer, pString); length = ASN1_STRING_to_UTF8(&pBuffer, pString);
//i2t_ASN1_OBJECT(&pBuffer, length, obj) //i2t_ASN1_OBJECT(&pBuffer, length, obj)
// printf("extension length: %u\n", length); // printf("extension length: %d\n", length);
// -1 indicates an error. // -1 indicates an error.
if ( length < 0 ) if ( length < 0 )
continue; continue;

View file

@ -2,8 +2,6 @@
#ifndef THREADING_SERIALIZATIONTYPES_H #ifndef THREADING_SERIALIZATIONTYPES_H
#define THREADING_SERIALIZATIONTYPES_H #define THREADING_SERIALIZATIONTYPES_H
using namespace std;
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
@ -11,6 +9,8 @@ using namespace std;
#include "Type.h" #include "Type.h"
#include "net_util.h" #include "net_util.h"
using namespace std;
class SerializationFormat; class SerializationFormat;
namespace threading { namespace threading {