cleanup: remove all uint use

pull/2850/head
Victor Julien 7 years ago
parent 90e612d3e4
commit afed6fe4a2

@ -499,8 +499,8 @@ static int TCPProtoDetect(ThreadVars *tv,
AppLayerParserGetStreamDepth(f));
*alproto = *alproto_otherdir;
SCLogDebug("packet %u: pd done(us %u them %u), parser called (r==%d), APPLAYER_DETECT_PROTOCOL_ONLY_ONE_DIRECTION set",
(uint)p->pcap_cnt, *alproto, *alproto_otherdir, r);
SCLogDebug("packet %"PRIu64": pd done(us %u them %u), parser called (r==%d), APPLAYER_DETECT_PROTOCOL_ONLY_ONE_DIRECTION set",
p->pcap_cnt, *alproto, *alproto_otherdir, r);
if (r < 0)
goto failure;
}

@ -77,7 +77,8 @@ int DecoderParseDataFromFile(char *filename, DecoderFunc Decoder) {
size_t size = fread(&buffer, 1, sizeof(buffer), fp);
char outfilename[256];
snprintf(outfilename, sizeof(outfilename), "dump/%u-%u.%u", (uint)ts.tv_sec, (uint)ts.tv_usec, cnt);
snprintf(outfilename, sizeof(outfilename), "dump/%u-%u.%u",
(unsigned int)ts.tv_sec, (unsigned int)ts.tv_usec, cnt);
FILE *out_fp = fopen(outfilename, "w");
BUG_ON(out_fp == NULL);
(void)fwrite(buffer, size, 1, out_fp);
@ -106,7 +107,8 @@ int DecoderParseDataFromFile(char *filename, DecoderFunc Decoder) {
uint32_t x = 0;
for (x = 0; x < cnt; x++) {
char rmfilename[256];
snprintf(rmfilename, sizeof(rmfilename), "dump/%u-%u.%u", (uint)ts.tv_sec, (uint)ts.tv_usec, x);
snprintf(rmfilename, sizeof(rmfilename), "dump/%u-%u.%u",
(unsigned int)ts.tv_sec, (unsigned int)ts.tv_usec, x);
unlink(rmfilename);
}

@ -163,7 +163,8 @@ static const uint8_t *DetectEngineSMTPGetBufferForTX(uint64_t tx_id,
/* updat inspected tracker */
curr_file->content_inspected = FileDataSize(curr_file);
SCLogDebug("content_inspected %u, offset %u", (uint)curr_file->content_inspected, (uint)det_ctx->smtp[index].offset);
SCLogDebug("content_inspected %"PRIu64", offset %"PRIu64,
curr_file->content_inspected, det_ctx->smtp[index].offset);
buffer = det_ctx->smtp[index].buffer;
*buffer_len = det_ctx->smtp[index].buffer_len;

@ -185,7 +185,7 @@ static const uint8_t *DetectEngineHCBDGetBufferForTX(htp_tx_t *tx, uint64_t tx_i
if (htud->request_body.body_inspected > htp_state->cfg->request.inspect_min_size) {
BUG_ON(htud->request_body.content_len_so_far < htud->request_body.body_inspected);
uint64_t inspect_win = htud->request_body.content_len_so_far - htud->request_body.body_inspected;
SCLogDebug("inspect_win %u", (uint)inspect_win);
SCLogDebug("inspect_win %"PRIu64, inspect_win);
if (inspect_win < htp_state->cfg->request.inspect_window) {
uint64_t inspect_short = htp_state->cfg->request.inspect_window - inspect_win;
if (htud->request_body.body_inspected < inspect_short)
@ -210,7 +210,7 @@ static const uint8_t *DetectEngineHCBDGetBufferForTX(htp_tx_t *tx, uint64_t tx_i
*buffer_len = det_ctx->hcbd[index].buffer_len;
*stream_start_offset = det_ctx->hcbd[index].offset;
SCLogDebug("buffer_len %u (%u)", *buffer_len, (uint)htud->request_body.content_len_so_far);
SCLogDebug("buffer_len %u (%"PRIu64")", *buffer_len, htud->request_body.content_len_so_far);
end:
return buffer;
}

@ -190,7 +190,7 @@ static const uint8_t *DetectEngineHSBDGetBufferForTX(htp_tx_t *tx, uint64_t tx_i
if (htud->response_body.body_inspected > htp_state->cfg->response.inspect_min_size) {
BUG_ON(htud->response_body.content_len_so_far < htud->response_body.body_inspected);
uint64_t inspect_win = htud->response_body.content_len_so_far - htud->response_body.body_inspected;
SCLogDebug("inspect_win %u", (uint)inspect_win);
SCLogDebug("inspect_win %"PRIu64, inspect_win);
if (inspect_win < htp_state->cfg->response.inspect_window) {
uint64_t inspect_short = htp_state->cfg->response.inspect_window - inspect_win;
if (htud->response_body.body_inspected < inspect_short)

@ -265,7 +265,7 @@ static int HasStoredSigs(const Flow *f, const uint8_t flags)
continue;
}
if (tx_de_state->dir_state[flags & STREAM_TOSERVER ? 0 : 1].cnt != 0) {
SCLogDebug("tx %u has sigs present", (uint)inspect_tx_id);
SCLogDebug("tx %"PRIu64" has sigs present", inspect_tx_id);
return 1;
}
}
@ -298,7 +298,7 @@ static void StoreStateTxHandleFiles(DetectEngineThreadCtx *det_ctx, Flow *f,
DetectEngineState *destate, const uint8_t flags,
const uint64_t tx_id, const uint16_t file_no_match)
{
SCLogDebug("tx %u, file_no_match %u", (uint)tx_id, file_no_match);
SCLogDebug("tx %"PRIu64", file_no_match %u", tx_id, file_no_match);
DeStateStoreFileNoMatchCnt(destate, file_no_match, flags);
if (DeStateStoreFilestoreSigsCantMatch(det_ctx->sgh, destate, flags) == 1) {
FileDisableStoringForTransaction(f, flags & (STREAM_TOCLIENT | STREAM_TOSERVER), tx_id);
@ -378,7 +378,7 @@ int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
uint8_t offset = det_ctx->de_state_sig_array[s->num] & 0xef;
uint64_t tx_id = AppLayerParserGetTransactionInspectId(f->alparser, flags);
if (offset > 0) {
SCLogDebug("using stored_tx_id %u instead of %u", (uint)tx_id+offset, (uint)tx_id);
SCLogDebug("using stored_tx_id %"PRIu64" instead of %"PRIu64, tx_id+offset, tx_id);
tx_id += offset;
}
if (offset == MAX_STORED_TXID_OFFSET) {
@ -388,7 +388,7 @@ int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate);
SCLogDebug("total_txs %"PRIu64, total_txs);
SCLogDebug("starting: start tx %u, packet %u", (uint)tx_id, (uint)p->pcap_cnt);
SCLogDebug("starting: start tx %"PRIu64", packet %"PRIu64, tx_id, p->pcap_cnt);
det_ctx->stream_already_inspected = false;
for (; tx_id < total_txs; tx_id++) {
@ -475,7 +475,7 @@ int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
PACKET_ALERT_FLAG_STATE_MATCH|PACKET_ALERT_FLAG_TX);
}
alert_cnt = 1;
SCLogDebug("MATCH: tx %u packet %u", (uint)tx_id, (uint)p->pcap_cnt);
SCLogDebug("MATCH: tx %"PRIu64" packet %"PRIu64, tx_id, p->pcap_cnt);
}
/* if this is the last tx in our list, and it's incomplete: then
@ -483,8 +483,8 @@ int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
int tx_is_done = (tx_progress >=
AppLayerParserGetStateProgressCompletionStatus(alproto, flags));
SCLogDebug("tx %u, packet %u, rule %u, alert_cnt %u, last tx %d, tx_is_done %d, next_tx_no_progress %d",
(uint)tx_id, (uint)p->pcap_cnt, s->num, alert_cnt,
SCLogDebug("tx %"PRIu64", packet %"PRIu64", rule %u, alert_cnt %u, last tx %d, tx_is_done %d, next_tx_no_progress %d",
tx_id, p->pcap_cnt, s->num, alert_cnt,
TxIsLast(tx_id, total_txs), tx_is_done, next_tx_no_progress);
/* store our state */

@ -119,7 +119,7 @@ static inline int CreateSpace(HttpHeaderThreadData *td, uint64_t size)
while (td->buffers_size + extra < size) {
extra += td->tx_step;
}
SCLogDebug("adding %u to the buffer", (uint)extra);
SCLogDebug("adding %u to the buffer", extra);
void *ptmp = SCRealloc(td->buffers,
(td->buffers_size + extra) * sizeof(HttpHeaderBuffer));
@ -144,7 +144,7 @@ int HttpHeaderExpandBuffer(HttpHeaderThreadData *td,
while ((buf->size + extra) < (size + buf->len)) {
extra += td->size_step;
}
SCLogDebug("adding %u to the buffer", (uint)extra);
SCLogDebug("adding %"PRIuMAX" to the buffer", (uintmax_t)extra);
uint8_t *new_buffer = SCRealloc(buf->buffer, buf->size + extra);
if (unlikely(new_buffer == NULL)) {

@ -120,7 +120,8 @@ static uint8_t *GetBufferForTX(htp_tx_t *tx, uint64_t tx_id,
if (i + 1 == no_of_headers)
size += 2;
SCLogDebug("size %u + buf->len %u vs buf->size %u", (uint)size, buf->len, buf->size);
SCLogDebug("size %"PRIuMAX" + buf->len %u vs buf->size %u",
(uintmax_t)size, buf->len, buf->size);
if (size + buf->len > buf->size) {
if (HttpHeaderExpandBuffer(hdr_td, buf, size) != 0) {
return NULL;

@ -89,8 +89,8 @@ static inline int InsertSegmentDataCustom(TcpStream *stream, TcpSegment *seg, ui
uint64_t mydata_offset;
StreamingBufferGetData(&stream->sb, &mydata, &mydata_len, &mydata_offset);
SCLogDebug("stream %p seg %p data in buffer %p of len %u and offset %u",
stream, seg, &stream->sb, mydata_len, (uint)mydata_offset);
SCLogDebug("stream %p seg %p data in buffer %p of len %u and offset %"PRIu64,
stream, seg, &stream->sb, mydata_len, mydata_offset);
//PrintRawDataFp(stdout, mydata, mydata_len);
}
#endif

@ -1274,9 +1274,9 @@ void StreamReassembleRawUpdateProgress(TcpSession *ssn, Packet *p, uint64_t prog
stream->flags &= ~STREAMTCP_STREAM_FLAG_TRIGGER_RAW;
} else {
SCLogDebug("p->pcap_cnt %u: progress %u app %u raw %u tcp win %u",
(uint)p->pcap_cnt, (uint)progress, (uint)STREAM_APP_PROGRESS(stream),
(uint)STREAM_RAW_PROGRESS(stream), (uint)stream->window);
SCLogDebug("p->pcap_cnt %"PRIu64": progress %"PRIu64" app %"PRIu64" raw %"PRIu64" tcp win %"PRIu32,
p->pcap_cnt, progress, STREAM_APP_PROGRESS(stream),
STREAM_RAW_PROGRESS(stream), stream->window);
}
/* if we were told to accept no more raw data, we can mark raw as
@ -1534,8 +1534,8 @@ static int StreamReassembleRawDo(TcpSession *ssn, TcpStream *stream,
//PrintRawDataFp(stdout, mydata, mydata_len);
SCLogDebug("raw progress %"PRIu64, progress);
SCLogDebug("stream %p data in buffer %p of len %u and offset %u",
stream, &stream->sb, mydata_len, (uint)progress);
SCLogDebug("stream %p data in buffer %p of len %u and offset %"PRIu64,
stream, &stream->sb, mydata_len, progress);
if (eof) {
// inspect all remaining data, ack'd or not

@ -2391,7 +2391,7 @@ void TmreadsGetMinimalTimestamp(struct timeval *ts)
}
SCMutexUnlock(&thread_store_lock);
COPY_TIMESTAMP(&local, ts);
SCLogDebug("ts->tv_sec %u", (uint)ts->tv_sec);
SCLogDebug("ts->tv_sec %"PRIuMAX, (uintmax_t)ts->tv_sec);
}
#undef COPY_TIMESTAMP

@ -589,5 +589,5 @@ void PacketPoolPostRunmodes(void)
max_pending_return_packets = packets;
SCLogDebug("detect threads %u, max packets %u, max_pending_return_packets %u",
threads, (uint)threads, max_pending_return_packets);
threads, threads, max_pending_return_packets);
}

@ -231,12 +231,12 @@ static int SBBUpdateLookForward(StreamingBuffer *sb,
while (sbb->offset + sbb->len == sbb->next->offset)
{
SCLogDebug("EndsAfter: gobble up next: %u/%u", (uint)sbb->next->offset, sbb->next->len);
SCLogDebug("EndsAfter: gobble up next: %"PRIu64"/%u", sbb->next->offset, sbb->next->len);
uint64_t right_edge = sbb->next->offset + sbb->next->len;
uint32_t expand_by = right_edge - (sbb->offset + sbb->len);
sbb->len += expand_by;
SCLogDebug("EndsAfter: expand_by %u (part 2)", expand_by);
SCLogDebug("EndsAfter: (loop) sbb now %u/%u", (uint)sbb->offset, sbb->len);
SCLogDebug("EndsAfter: (loop) sbb now %"PRIu64"/%u", sbb->offset, sbb->len);
/* we can gobble up next */
StreamingBufferBlock *to_free = sbb->next;
@ -265,7 +265,7 @@ static int SBBUpdateLookForward(StreamingBuffer *sb,
/* if next is not directly connected and we have some
* block len left, expand sbb further */
uint32_t gap = sbb->next->offset - (sbb->offset + sbb->len);
SCLogDebug("EndsAfter: we now have a gap of %u and a block of %u/%u", gap, (uint)my_block->offset, my_block->len);
SCLogDebug("EndsAfter: we now have a gap of %u and a block of %"PRIu64"/%u", gap, my_block->offset, my_block->len);
if (my_block->len < gap) {
sbb->len += my_block->len;
@ -276,8 +276,8 @@ static int SBBUpdateLookForward(StreamingBuffer *sb,
sbb->len += gap;
my_block->offset += gap;
my_block->len -= gap;
SCLogDebug("EndsAfter: (loop) block at %u/%u, sbb %u/%u", (uint)my_block->offset, my_block->len, (uint)sbb->offset, sbb->len);
SCLogDebug("EndsAfter: (loop) sbb->next %u/%u", (uint)sbb->next->offset, sbb->next->len);
SCLogDebug("EndsAfter: (loop) block at %"PRIu64"/%u, sbb %"PRIu64"/%u", my_block->offset, my_block->len, sbb->offset, sbb->len);
SCLogDebug("EndsAfter: (loop) sbb->next %"PRIu64"/%u", sbb->next->offset, sbb->next->len);
}
}
}
@ -304,7 +304,7 @@ static void SBBUpdate(StreamingBuffer *sb,
else if (tail && IsAfter(&my_block, tail)) {
StreamingBufferBlock *new_sbb = GetNew(sb, my_block.offset, my_block.len, NULL);
sb->block_list_tail = tail->next = new_sbb;
SCLogDebug("tail: new block at %u/%u", (uint)my_block.offset, my_block.len);
SCLogDebug("tail: new block at %"PRIu64"/%u", my_block.offset, my_block.len);
goto done;
}
@ -312,7 +312,7 @@ static void SBBUpdate(StreamingBuffer *sb,
#ifdef DEBUG
SBBPrintList(sb);
#endif
SCLogDebug("PreInsert: block at %u/%u", (uint)my_block.offset, my_block.len);
SCLogDebug("PreInsert: block at %"PRIu64"/%u", my_block.offset, my_block.len);
StreamingBufferBlock *sbb = sb->block_list, *prev = NULL;
while (sbb) {
SCLogDebug("sbb %"PRIu64"/%u data %"PRIu64"/%u. Next %s", sbb->offset, sbb->len,
@ -327,12 +327,12 @@ static void SBBUpdate(StreamingBuffer *sb,
} else {
prev->next = new_sbb;
}
SCLogDebug("IsBefore: new block at %u/%u", (uint)my_block.offset, my_block.len);
SCLogDebug("IsBefore: new block at %"PRIu64"/%u", my_block.offset, my_block.len);
break;
} else if (IsOverlappedBy(&my_block, sbb)) {
/* nothing to do */
SCLogDebug("IsOverlappedBy: overlapped block at %u/%u", (uint)my_block.offset, my_block.len);
SCLogDebug("IsOverlappedBy: overlapped block at %"PRIu64"/%u", my_block.offset, my_block.len);
break;
} else if (IsAfter(&my_block, sbb)) {
@ -342,10 +342,10 @@ static void SBBUpdate(StreamingBuffer *sb,
StreamingBufferBlock *new_sbb = GetNew(sb, my_block.offset, my_block.len, NULL);
sbb->next = new_sbb;
sb->block_list_tail = new_sbb;
SCLogDebug("new block at %u/%u", (uint)my_block.offset, my_block.len);
SCLogDebug("new block at %"PRIu64"/%u", my_block.offset, my_block.len);
break;
}
SCLogDebug("IsAfter: block at %u/%u, is after sbb", (uint)my_block.offset, my_block.len);
SCLogDebug("IsAfter: block at %"PRIu64"/%u, is after sbb", my_block.offset, my_block.len);
} else {
@ -364,7 +364,7 @@ static void SBBUpdate(StreamingBuffer *sb,
my_block.offset = sbb->offset + sbb->len;
my_block.len = my_block_right_edge - my_block.offset;
SCLogDebug("StartsBefore: block now %u/%u", (uint)my_block.offset, my_block.len);
SCLogDebug("StartsBefore: block now %"PRIu64"/%u", my_block.offset, my_block.len);
if (sbb->next == NULL) {
sbb->len += my_block.len;
@ -379,11 +379,11 @@ static void SBBUpdate(StreamingBuffer *sb,
expand_by = right_edge - (sbb->offset + sbb->len);
SCLogDebug("EndsAfter: expand_by %u", expand_by);
sbb->len += expand_by;
SCLogDebug("EndsAfter: sbb now %u/%u", (uint)sbb->offset, sbb->len);
SCLogDebug("EndsAfter: sbb now %"PRIu64"/%u", sbb->offset, sbb->len);
my_block.offset = sbb->offset + sbb->len;
my_block.len = my_block_right_edge - my_block.offset;
SCLogDebug("StartsBefore: sbb now %u/%u", (uint)sbb->offset, sbb->len);
SCLogDebug("StartsBefore: sbb now %"PRIu64"/%u", sbb->offset, sbb->len);
} else if (EndsAfter(&my_block, sbb)) {
/* expand sbb, but we need to mind "next" */
@ -403,7 +403,7 @@ static void SBBUpdate(StreamingBuffer *sb,
uint32_t expand_by = right_edge - (sbb->offset + sbb->len);
SCLogDebug("EndsAfter: expand_by %u", expand_by);
sbb->len += expand_by;
SCLogDebug("EndsAfter: sbb now %u/%u", (uint)sbb->offset, sbb->len);
SCLogDebug("EndsAfter: sbb now %"PRIu64"/%u", sbb->offset, sbb->len);
my_block.offset = sbb->offset + sbb->len;
my_block.len = my_block_right_edge - my_block.offset;
@ -416,7 +416,7 @@ static void SBBUpdate(StreamingBuffer *sb,
goto done;
}
SCLogDebug("EndsAfter: block at %u/%u, is after sbb", (uint)my_block.offset, my_block.len);
SCLogDebug("EndsAfter: block at %"PRIu64"/%u, is after sbb", my_block.offset, my_block.len);
if (my_block.len == 0)
break;
@ -425,7 +425,7 @@ static void SBBUpdate(StreamingBuffer *sb,
sbb = sbb->next;
}
done:
SCLogDebug("PostInsert: block at %u/%u", (uint)my_block.offset, my_block.len);
SCLogDebug("PostInsert: block at %"PRIu64"/%u", my_block.offset, my_block.len);
SCLogDebug("PostInsert");
#ifdef DEBUG
SBBPrintList(sb);
@ -945,7 +945,7 @@ int StreamingBufferCompareRawData(const StreamingBuffer *sb,
{
return 1;
}
SCLogDebug("sbdata_len %u, offset %u", sbdata_len, (uint)offset);
SCLogDebug("sbdata_len %u, offset %"PRIu64, sbdata_len, offset);
printf("got:\n");
PrintRawDataFp(stdout, sbdata,sbdata_len);
printf("wanted:\n");

Loading…
Cancel
Save