Fix/suppress a couple of harmless compiler warnings.

pull/133/merge
Victor Julien 13 years ago
parent 870a98b528
commit d68fd54a76

@ -342,7 +342,7 @@ TmEcode AlertDebugLogger(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
}
SCMutexLock(&aft->file_ctx->fp_mutex);
MemBufferPrintToFPAsString(aft->buffer, aft->file_ctx->fp);
(void)MemBufferPrintToFPAsString(aft->buffer, aft->file_ctx->fp);
fflush(aft->file_ctx->fp);
aft->file_ctx->alerts += p->alerts.cnt;
SCMutexUnlock(&aft->file_ctx->fp_mutex);
@ -402,7 +402,7 @@ TmEcode AlertDebugLogDecoderEvent(ThreadVars *tv, Packet *p, void *data, PacketQ
GET_PKT_DATA(p), GET_PKT_LEN(p));
SCMutexLock(&aft->file_ctx->fp_mutex);
MemBufferPrintToFPAsString(aft->buffer, aft->file_ctx->fp);
(void)MemBufferPrintToFPAsString(aft->buffer, aft->file_ctx->fp);
fflush(aft->file_ctx->fp);
aft->file_ctx->alerts += p->alerts.cnt;
SCMutexUnlock(&aft->file_ctx->fp_mutex);

@ -142,18 +142,6 @@ static int MD5MatchLookupBuffer(ROHashTable *hash, uint8_t *buf, size_t buflen)
return 1;
}
static int MD5MatchLookupString(ROHashTable *hash, char *string) {
uint8_t md5[16];
if (Md5ReadString(md5, string) == 1) {
void *ptr = ROHashLookup(hash, &md5, (uint16_t)sizeof(md5));
if (ptr == NULL)
return 0;
else
return 1;
}
return 0;
}
/**
* \brief match the specified filemd5
*
@ -352,6 +340,18 @@ static void DetectFileMd5Free(void *ptr) {
}
#ifdef UNITTESTS
static int MD5MatchLookupString(ROHashTable *hash, char *string) {
uint8_t md5[16];
if (Md5ReadString(md5, string) == 1) {
void *ptr = ROHashLookup(hash, &md5, (uint16_t)sizeof(md5));
if (ptr == NULL)
return 0;
else
return 1;
}
return 0;
}
static int MD5MatchTest01(void) {
ROHashTable *hash = ROHashInit(4, 16);
if (hash == NULL) {

@ -523,7 +523,7 @@ static TmEcode LogHttpLogIPWrapper(ThreadVars *tv, Packet *p, void *data, Packet
aft->uri_cnt ++;
SCMutexLock(&hlog->file_ctx->fp_mutex);
MemBufferPrintToFPAsString(aft->buffer, hlog->file_ctx->fp);
(void)MemBufferPrintToFPAsString(aft->buffer, hlog->file_ctx->fp);
fflush(hlog->file_ctx->fp);
SCMutexUnlock(&hlog->file_ctx->fp_mutex);

@ -74,9 +74,9 @@ void MemBufferFree(MemBuffer *buffer);
* \param buffer Pointer to the src MemBuffer instance to write.
* \param fp Pointer to the file file instance to write to.
*/
#define MemBufferPrintToFPAsString(mem_buffer, fp) do { \
fwrite((mem_buffer)->buffer, sizeof(uint8_t), (mem_buffer)->offset, fp); \
} while (0)
#define MemBufferPrintToFPAsString(mem_buffer, fp) ({ \
fwrite((mem_buffer)->buffer, sizeof(uint8_t), (mem_buffer)->offset, fp); \
})
/**
* \brief Write a buffer in hex format.

@ -60,22 +60,6 @@ SCEnumCharMap sc_hinfo_os_policy_map[ ] = {
static SCRadixTree *sc_hinfo_tree = NULL;
static SCRadixTree *sc_hinfo_tree_backup = NULL;
static void SCHInfoCreateContextBackup(void)
{
sc_hinfo_tree_backup = sc_hinfo_tree;
sc_hinfo_tree = NULL;
return;
}
static void SCHInfoRestoreContextBackup(void)
{
sc_hinfo_tree = sc_hinfo_tree_backup;
sc_hinfo_tree_backup = NULL;
return;
}
/**
* \brief Validates an IPV4 address and returns the network endian arranged
* version of the IPV4 address
@ -448,6 +432,22 @@ void SCHInfoLoadFromConfig(void)
#ifdef UNITTESTS
static void SCHInfoCreateContextBackup(void)
{
sc_hinfo_tree_backup = sc_hinfo_tree;
sc_hinfo_tree = NULL;
return;
}
static void SCHInfoRestoreContextBackup(void)
{
sc_hinfo_tree = sc_hinfo_tree_backup;
sc_hinfo_tree_backup = NULL;
return;
}
/**
* \test Check if we the IPs with the right OS flavours are added to the host OS
* radix tree, and the IPS with invalid flavours returns an error(-1)

Loading…
Cancel
Save