Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 2a1d0875 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

BUILD: Try to fix the -Werror=conversion returned from gcc (see CI)

parent 0bb3bfc2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!172Update the validate script to use the new cmake thing
Pipeline #2401 en échec
......@@ -194,7 +194,7 @@ LKT_IGNORE_WARN_FMT_SECURITY
int
json_parse(const char *str, int asked_level, json_parse_callback call, void *user)
{
int level = 0;
int64_t level = 0;
char key[LKT_LINE_MAX];
char val[LKT_LINE_MAX];
char tmp[LKT_LINE_MAX];
......@@ -205,7 +205,9 @@ json_parse(const char *str, int asked_level, json_parse_callback call, void *use
/* Begin of a block */
if ((len = strspn(str, __JSON_BEGIN))) {
level += len;
if (len >= INT64_MAX)
return 1; /* Json error */
level += (int64_t)len;
str += len;
}
......@@ -213,8 +215,10 @@ json_parse(const char *str, int asked_level, json_parse_callback call, void *use
else if ((len = strspn(str, __JSON_END))) {
if ((level == asked_level) && call(NULL, NULL, 1, user) != 0)
return 2;
if (len >= INT64_MAX)
return 1; /* Json error */
str += len;
level -= len;
level -= (int64_t)len;
}
/* Key Value */
......@@ -241,7 +245,7 @@ LKT_POP
int
json_parse_get_count(const char *str, int asked_level)
{
int level = 0;
int64_t level = 0;
int ret_len = 0;
for (;;) {
......@@ -250,15 +254,19 @@ json_parse_get_count(const char *str, int asked_level)
/* Begin of a block */
if ((len = strspn(str, __JSON_BEGIN))) {
level += len;
if (len >= INT64_MAX)
return 1; /* Json error */
level += (int64_t)len;
str += len;
}
/* End of a block */
else if ((len = strspn(str, __JSON_END))) {
if (len >= INT64_MAX)
return 1; /* Json error */
ret_len += (level == asked_level);
str += len;
level -= len;
level -= (int64_t)len;
}
/* Key Value */
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter