Fix minor format string issues

pull/1619/head
Victor Julien 10 years ago
parent ba81c4d290
commit 6b2fb3fd5d

@ -645,7 +645,7 @@ void AppLayerProtoDetectPrintProbingParsers(AppLayerProtoDetectProbingParser *pp
else if (pp->ipproto == IPPROTO_UDP)
printf("IPProto: UDP\n");
else
printf("IPProto: %"PRIu16"\n", pp->ipproto);
printf("IPProto: %"PRIu8"\n", pp->ipproto);
pp_port = pp->port;
for ( ; pp_port != NULL; pp_port = pp_port->next) {
@ -934,7 +934,7 @@ static void AppLayerProtoDetectInsertNewProbingParser(AppLayerProtoDetectProbing
while (curr_pe != NULL) {
if (curr_pe->alproto == alproto) {
SCLogError(SC_ERR_ALPARSER, "Duplicate pp registered - "
"ipproto - %"PRIu16" Port - %"PRIu16" "
"ipproto - %"PRIu8" Port - %"PRIu16" "
"App Protocol - NULL, App Protocol(ID) - "
"%"PRIu16" min_depth - %"PRIu16" "
"max_dept - %"PRIu16".",

@ -66,7 +66,7 @@
#define TCP_OPTS_CNT tcpvars.tcp_opt_cnt
#define TCP_GET_RAW_OFFSET(tcph) (((tcph)->th_offx2 & 0xf0) >> 4)
#define TCP_GET_RAW_X2(tcph) ((tcph)->th_offx2 & 0x0f)
#define TCP_GET_RAW_X2(tcph) (unsigned char)((tcph)->th_offx2 & 0x0f)
#define TCP_GET_RAW_SRC_PORT(tcph) ntohs((tcph)->th_sport)
#define TCP_GET_RAW_DST_PORT(tcph) ntohs((tcph)->th_dport)

@ -484,7 +484,7 @@ static void SigNumArrayPrint(void *tmp)
for (; i < 8; i++) {
if (bitarray & 0x01)
printf(", %"PRIu16"", u * 8 + i);
printf(", %"PRIu32"", u * 8 + i);
else
printf(", ");

@ -1225,7 +1225,7 @@ void SigGroupHeadPrintSigs(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
for (u = 0; u < (sgh->init->sig_size * 8); u++) {
if (sgh->init->sig_array[u / 8] & (1 << (u % 8))) {
SCLogDebug("%" PRIu32, u);
printf("s->num %"PRIu16" ", u);
printf("s->num %"PRIu32" ", u);
}
}

@ -244,11 +244,11 @@ static int LogDropLogNetFilter (ThreadVars *tv, const Packet *p, void *data)
break;
case IPPROTO_ICMP:
if (PKT_IS_ICMPV4(p)) {
fprintf(dlt->file_ctx->fp, " TYPE=%"PRIu16" CODE=%"PRIu16""
fprintf(dlt->file_ctx->fp, " TYPE=%"PRIu8" CODE=%"PRIu8""
" ID=%"PRIu16" SEQ=%"PRIu16"", ICMPV4_GET_TYPE(p),
ICMPV4_GET_CODE(p), ICMPV4_GET_ID(p), ICMPV4_GET_SEQ(p));
} else if(PKT_IS_ICMPV6(p)) {
fprintf(dlt->file_ctx->fp, " TYPE=%"PRIu16" CODE=%"PRIu16""
fprintf(dlt->file_ctx->fp, " TYPE=%"PRIu8" CODE=%"PRIu8""
" ID=%"PRIu16" SEQ=%"PRIu16"", ICMPV6_GET_TYPE(p),
ICMPV6_GET_CODE(p), ICMPV6_GET_ID(p), ICMPV6_GET_SEQ(p));
}

@ -202,8 +202,8 @@ int RunModeErfFileAutoFp(void)
}
for (thread = 0; thread < thread_max; thread++) {
snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
snprintf(tname, sizeof(tname), "Detect%d", thread+1);
snprintf(qname, sizeof(qname), "pickup%d", thread+1);
SCLogDebug("tname %s, qname %s", tname, qname);

@ -217,8 +217,8 @@ int RunModeFilePcapAutoFp(void)
}
for (thread = 0; thread < thread_max; thread++) {
snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
snprintf(tname, sizeof(tname), "Detect%d", thread+1);
snprintf(qname, sizeof(qname), "pickup%d", thread+1);
SCLogDebug("tname %s, qname %s", tname, qname);

@ -991,7 +991,7 @@ TmEcode TmThreadSetupOptions(ThreadVars *tv)
tv->thread_priority = taf->prio;
}
SCLogInfo("Setting prio %d for \"%s\" Module to cpu/core "
"%"PRIu16", thread id %lu", tv->thread_priority,
"%d, thread id %lu", tv->thread_priority,
tv->name, cpu, SCGetThreadIdLong());
} else {
SetCPUAffinitySet(&taf->cpu_set);

@ -207,7 +207,7 @@ int ByteExtractStringUint32(uint32_t *res, int base, uint16_t len, const char *s
if ((uint64_t)(*res) != i64) {
SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
"(%" PRIu64 " > %" PRIu32 ")", i64, UINT_MAX);
"(%" PRIu64 " > %" PRIuMAX ")", i64, (uintmax_t)UINT_MAX);
return -1;
}
@ -228,7 +228,7 @@ int ByteExtractStringUint16(uint16_t *res, int base, uint16_t len, const char *s
if ((uint64_t)(*res) != i64) {
SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
"(%" PRIu64 " > %" PRIu16 ")", i64, USHRT_MAX);
"(%" PRIu64 " > %" PRIuMAX ")", i64, (uintmax_t)USHRT_MAX);
return -1;
}
@ -249,7 +249,7 @@ int ByteExtractStringUint8(uint8_t *res, int base, uint16_t len, const char *str
if ((uint64_t)(*res) != i64) {
SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
"(%" PRIu64 " > %" PRIu8 ")", i64, UCHAR_MAX);
"(%" PRIu64 " > %" PRIuMAX ")", i64, (uintmax_t)UCHAR_MAX);
return -1;
}
@ -326,7 +326,7 @@ int ByteExtractStringInt32(int32_t *res, int base, uint16_t len, const char *str
if ((int64_t)(*res) != i64) {
SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
"(%" PRIi64 " > %" PRIi32 ")\n", i64, INT_MAX);
"(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)INT_MAX);
return -1;
}
@ -347,7 +347,7 @@ int ByteExtractStringInt16(int16_t *res, int base, uint16_t len, const char *str
if ((int64_t)(*res) != i64) {
SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
"(%" PRIi64 " > %" PRIi16 ")\n", i64, SHRT_MAX);
"(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)SHRT_MAX);
return -1;
}
@ -368,7 +368,7 @@ int ByteExtractStringInt8(int8_t *res, int base, uint16_t len, const char *str)
if ((int64_t)(*res) != i64) {
SCLogError(SC_ERR_NUMERIC_VALUE_ERANGE, "Numeric value out of range "
"(%" PRIi64 " > %" PRIi8 ")\n", i64, CHAR_MAX);
"(%" PRIi64 " > %" PRIiMAX ")\n", i64, (intmax_t)CHAR_MAX);
return -1;
}

@ -319,7 +319,7 @@ void SCPrintByteBin(uint8_t byte)
{
uint8_t i = 0;
for (i = 8; i > 0; i--) {
printf("%"PRIu8, ((byte >> (i - 1)) & 0x01));
printf("%"PRIu8, (uint8_t)((byte >> (i - 1)) & 0x01));
if (i == 5)
printf(" ");
}

@ -90,7 +90,7 @@ char *RunmodeAutoFpCreatePickupQueuesString(int n)
if (strlen(queues) > 0)
strlcat(queues, ",", queues_size);
snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
snprintf(qname, sizeof(qname), "pickup%d", thread+1);
strlcat(queues, qname, queues_size);
}
@ -147,7 +147,7 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
/* create the threads */
for (thread = 0; thread < threads_count; thread++) {
snprintf(tname, sizeof(tname), "%s%"PRIu16, thread_name, thread+1);
snprintf(tname, sizeof(tname), "%s%d", thread_name, thread+1);
char *thread_name = SCStrdup(tname);
if (unlikely(thread_name == NULL)) {
SCLogError(SC_ERR_MEM_ALLOC, "Can't allocate thread name");
@ -209,7 +209,7 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
threads_count = ModThreadsCount(aconf);
for (thread = 0; thread < threads_count; thread++) {
snprintf(tname, sizeof(tname), "%s%s%"PRIu16, thread_name,
snprintf(tname, sizeof(tname), "%s%s%d", thread_name,
live_dev, thread+1);
char *thread_name = SCStrdup(tname);
if (unlikely(thread_name == NULL)) {
@ -249,8 +249,8 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
}
for (thread = 0; thread < thread_max; thread++) {
snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
snprintf(tname, sizeof(tname), "Detect%d", thread+1);
snprintf(qname, sizeof(qname), "pickup%d", thread+1);
SCLogDebug("tname %s, qname %s", tname, qname);
@ -341,7 +341,7 @@ static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc Mod
if (single_mode) {
snprintf(tname, sizeof(tname), "%s", thread_name);
} else {
snprintf(tname, sizeof(tname), "%s%s%"PRIu16,
snprintf(tname, sizeof(tname), "%s%s%d",
thread_name, live_dev, thread+1);
}
n_thread_name = SCStrdup(tname);
@ -557,8 +557,8 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
}
for (thread = 0; thread < thread_max; thread++) {
snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
snprintf(tname, sizeof(tname), "Detect%d", thread+1);
snprintf(qname, sizeof(qname), "pickup%d", thread+1);
SCLogDebug("tname %s, qname %s", tname, qname);
@ -612,7 +612,7 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
/* create the threads */
for (int i = 0; i < nqueue; i++) {
memset(tname, 0, sizeof(tname));
snprintf(tname, sizeof(tname), "Verdict%"PRIu16, i);
snprintf(tname, sizeof(tname), "Verdict%d", i);
char *thread_name = SCStrdup(tname);
if (unlikely(thread_name == NULL)) {

Loading…
Cancel
Save