-eliminate more format-string packs

This commit is contained in:
Christian Grothoff 2021-07-31 08:16:59 +02:00
parent e92588a0ef
commit 7d323303b6
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -204,14 +204,18 @@ TALER_MHD_parse_json_data (struct MHD_Connection *connection,
if (NULL == error_json_name) if (NULL == error_json_name)
error_json_name = "<no field>"; error_json_name = "<no field>";
ret = (MHD_YES == ret = (MHD_YES ==
TALER_MHD_reply_json_pack ( TALER_MHD_REPLY_JSON_PACK (
connection, connection,
MHD_HTTP_BAD_REQUEST, MHD_HTTP_BAD_REQUEST,
"{s:s, s:I, s:s, s:I}", GNUNET_JSON_pack_string ("hint",
"hint", TALER_ErrorCode_get_hint (TALER_EC_GENERIC_JSON_INVALID), TALER_ErrorCode_get_hint (
"code", (json_int_t) TALER_EC_GENERIC_JSON_INVALID, TALER_EC_GENERIC_JSON_INVALID)),
"field", error_json_name, GNUNET_JSON_pack_uint64 ("code",
"line", (json_int_t) error_line)) TALER_EC_GENERIC_JSON_INVALID),
GNUNET_JSON_pack_string ("field",
error_json_name),
GNUNET_JSON_pack_uint64 ("line",
error_line)))
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
return ret; return ret;
} }
@ -255,15 +259,18 @@ TALER_MHD_parse_internal_json_data (struct MHD_Connection *connection,
if (NULL == error_json_name) if (NULL == error_json_name)
error_json_name = "<no field>"; error_json_name = "<no field>";
ret = (MHD_YES == ret = (MHD_YES ==
TALER_MHD_reply_json_pack ( TALER_MHD_REPLY_JSON_PACK (
connection, connection,
MHD_HTTP_INTERNAL_SERVER_ERROR, MHD_HTTP_INTERNAL_SERVER_ERROR,
"{s:s, s:I, s:s, s:I}", GNUNET_JSON_pack_string ("hint",
"hint", TALER_ErrorCode_get_hint ( TALER_ErrorCode_get_hint (
TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE), TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE)),
"code", (json_int_t) TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, GNUNET_JSON_pack_uint64 ("code",
"field", error_json_name, TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE),
"line", (json_int_t) error_line)) GNUNET_JSON_pack_string ("field",
error_json_name),
GNUNET_JSON_pack_uint64 ("line",
error_line)))
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
return ret; return ret;
} }
@ -310,14 +317,18 @@ TALER_MHD_parse_json_array (struct MHD_Connection *connection,
if (NULL == root) if (NULL == root)
{ {
ret = (MHD_YES == ret = (MHD_YES ==
TALER_MHD_reply_json_pack ( TALER_MHD_REPLY_JSON_PACK (
connection, connection,
MHD_HTTP_BAD_REQUEST, MHD_HTTP_BAD_REQUEST,
"{s:s, s:I, s:s, s:I}", GNUNET_JSON_pack_string ("hint",
"hint", TALER_ErrorCode_get_hint (TALER_EC_GENERIC_JSON_INVALID), TALER_ErrorCode_get_hint (
"code", (json_int_t) TALER_EC_GENERIC_JSON_INVALID, TALER_EC_GENERIC_JSON_INVALID)),
"detail", "expected array", GNUNET_JSON_pack_uint64 ("code",
"dimension", dim)) TALER_EC_GENERIC_JSON_INVALID),
GNUNET_JSON_pack_string ("detail",
"expected array"),
GNUNET_JSON_pack_uint64 ("dimension",
dim)))
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
return ret; return ret;
} }
@ -330,14 +341,18 @@ TALER_MHD_parse_json_array (struct MHD_Connection *connection,
if (NULL == error_json_name) if (NULL == error_json_name)
error_json_name = "<no field>"; error_json_name = "<no field>";
ret = (MHD_YES == ret = (MHD_YES ==
TALER_MHD_reply_json_pack ( TALER_MHD_REPLY_JSON_PACK (
connection, connection,
MHD_HTTP_BAD_REQUEST, MHD_HTTP_BAD_REQUEST,
"{s:s, s:s, s:I, s:I}", GNUNET_JSON_pack_string ("detail",
"detail", error_json_name, error_json_name),
"hint", TALER_ErrorCode_get_hint (TALER_EC_GENERIC_JSON_INVALID), GNUNET_JSON_pack_string ("hint",
"code", (json_int_t) TALER_EC_GENERIC_JSON_INVALID, TALER_ErrorCode_get_hint (
"line", (json_int_t) error_line)) TALER_EC_GENERIC_JSON_INVALID)),
GNUNET_JSON_pack_uint64 ("code",
TALER_EC_GENERIC_JSON_INVALID),
GNUNET_JSON_pack_uint64 ("line",
error_line)))
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
return ret; return ret;
} }