mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
Silent properly GCC format-truncation warnings in jansson
This commit is contained in:
parent
e53ac8b715
commit
73bbb2e9e8
2 changed files with 10 additions and 5 deletions
|
@ -40,9 +40,6 @@ platform = $(shell uname)
|
||||||
|
|
||||||
CC= gcc
|
CC= gcc
|
||||||
CFLAGS= -O2 -Wall -Wno-unused-variable -Wno-unused-function
|
CFLAGS= -O2 -Wall -Wno-unused-variable -Wno-unused-function
|
||||||
ifneq ($(platform),Darwin)
|
|
||||||
CFLAGS += -Wno-format-truncation
|
|
||||||
endif
|
|
||||||
|
|
||||||
LDFLAGS= $(SYSLDFLAGS) $(libjansson_la_LDFLAGS)
|
LDFLAGS= $(SYSLDFLAGS) $(libjansson_la_LDFLAGS)
|
||||||
LIBS= $(SYSLIBS) $(MYLIBS)
|
LIBS= $(SYSLIBS) $(MYLIBS)
|
||||||
|
|
|
@ -111,7 +111,11 @@ static void error_set(json_error_t *error, const lex_t *lex,
|
||||||
|
|
||||||
if (saved_text && saved_text[0]) {
|
if (saved_text && saved_text[0]) {
|
||||||
if (lex->saved_text.length <= 20) {
|
if (lex->saved_text.length <= 20) {
|
||||||
snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, "%s near '%s'", msg_text, saved_text);
|
int ret = snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, "%s near '%s'", msg_text, saved_text);
|
||||||
|
if (ret < 0) {
|
||||||
|
jsonp_error_set(error, line, col, pos, code, "%s", "internal snprint error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
|
msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
|
||||||
result = msg_with_context;
|
result = msg_with_context;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +128,11 @@ static void error_set(json_error_t *error, const lex_t *lex,
|
||||||
/* No context for UTF-8 decoding errors */
|
/* No context for UTF-8 decoding errors */
|
||||||
result = msg_text;
|
result = msg_text;
|
||||||
} else {
|
} else {
|
||||||
snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, "%s near end of file", msg_text);
|
int ret = snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, "%s near end of file", msg_text);
|
||||||
|
if (ret < 0) {
|
||||||
|
jsonp_error_set(error, line, col, pos, code, "%s", "internal snprint error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
|
msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
|
||||||
result = msg_with_context;
|
result = msg_with_context;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue