Skip to content

Commit

Permalink
Fix a few size_t diag printf
Browse files Browse the repository at this point in the history
  • Loading branch information
phaag committed Nov 10, 2024
1 parent 8a11e1a commit b845a53
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/libnffile/nffile.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ static int ReadAppendix(nffile_t *nffile) {

// seek back to currentPos
off_t backPosition = lseek(nffile->fd, currentPos, SEEK_SET);
dbg_printf("Reset position to %lld -> %lld\n", currentPos, backPosition);
dbg_printf("Reset position to %lld -> %lld\n", (long long)currentPos, (long long)backPosition);
if (backPosition < 0) {
LogError("lseek() error in %s line %d: %s", __FILE__, __LINE__, strerror(errno));
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/libnffile/nfxV3.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ uint16_t *SetupSequencer(sequencer_t *sequencer, sequence_t *sequenceTable, uint
}
if (!hasVarInLength && !hasVarOutLength) {
dbg_printf("SetupSequencer() Fixed length fields, found %u elements in %u sequences\n", sequencer->numElements, sequencer->numSequences);
dbg_printf("SetupSequencer() Calculated input length: %lu, output length: %lu\n", sequencer->inLength, sequencer->outLength);
dbg_printf("SetupSequencer() Calculated input length: %zu, output length: %zu\n", sequencer->inLength, sequencer->outLength);
}

// dynamically create extension list
Expand Down Expand Up @@ -463,7 +463,7 @@ int SequencerRun(sequencer_t *sequencer, const void *inBuff, size_t inSize, void

nestLevel--;
#ifdef DEVEL
printf("[%u] End sequencer ID: %u, inputLength: %lu, processed: %u, outputLength: %u header size: %u\n", nestLevel, sequencer->templateID, inSize,
printf("[%u] End sequencer ID: %u, inputLength: %zu, processed: %u, outputLength: %u header size: %u\n", nestLevel, sequencer->templateID, inSize,
totalInLength, totalOutLength, recordHeaderV3->size);
#endif

Expand Down
6 changes: 2 additions & 4 deletions src/netflow/ipfix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,10 +1335,8 @@ static void Process_ipfix_data(exporterDomain_t *exporter, uint32_t ExportTime,
break;
}

dbg_printf(
"New record added with %u elements and size: %u, sequencer inLength: %lu, outLength: "
"%lu\n",
recordHeaderV3->numElements, recordHeaderV3->size, sequencer->inLength, sequencer->outLength);
dbg_printf("New record added with %u elements and size: %u, sequencer inLength: %zu, outLength: %zu\n", recordHeaderV3->numElements,
recordHeaderV3->size, sequencer->inLength, sequencer->outLength);

recordHeaderV3->engineType = stack[STACK_ENGINETYPE];
recordHeaderV3->engineID = stack[STACK_ENGINEID];
Expand Down
4 changes: 2 additions & 2 deletions src/netflow/netflow_v9.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ static inline void Process_v9_data(exporterDomain_t *exporter, void *data_flowse
break;
}

dbg_printf("New record added with %u elements and size: %u, sequencer inLength: %lu, outLength: %lu\n", recordHeaderV3->numElements,
dbg_printf("New record added with %u elements and size: %u, sequencer inLength: %zu, outLength: %zu\n", recordHeaderV3->numElements,
recordHeaderV3->size, sequencer->inLength, sequencer->outLength);

// add router IP
Expand Down Expand Up @@ -1712,7 +1712,7 @@ void Process_v9(void *in_buff, ssize_t in_buff_cnt, FlowSource_t *fs) {

#ifdef DEVEL
uint32_t expected_records = ntohs(v9_header->count);
printf("[%u] records: %u, buffer: %li \n", exporter_id, expected_records, size_left);
printf("[%u] records: %u, buffer: %zd \n", exporter_id, expected_records, size_left);
printf("SourceID: %u, Sysuptime: %u.%u\n", v9_header->source_id, v9_header->SysUptime, v9_header->unix_secs);
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/nfreplay/send_v9.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ static void CloseDataFlowset(send_peer_t *peer) {
} // End of CloseDataFlowset

static int CheckSendBufferSpace(size_t size, send_peer_t *peer) {
dbg_printf("CheckSendBufferSpace for %lu bytes: ", size);
dbg_printf("CheckSendBufferSpace for %zu bytes: ", size);
if ((peer->buff_ptr + size) > peer->endp) {
// request buffer flush
dbg_printf("Check for %zu bytes in send buffer. Flush first.\n", size);
Expand Down

0 comments on commit b845a53

Please sign in to comment.