func_attr.h: FUNC_ATTR_PRINTF

This commit is contained in:
Michael Hoffmann
2018-09-23 10:49:20 +02:00
committed by Justin M. Keyes
parent 2b06c32a23
commit 197d907e09
4 changed files with 15 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name,
if (!rv.fn) {
api_set_error(error, kErrorTypeException, "Invalid method: %.*s",
m.size > 0 ? m.size : sizeof("<empty>"),
m.size > 0 ? (int)m.size : (int)sizeof("<empty>"),
m.size > 0 ? m.data : "<empty>");
}
return rv;

View File

@@ -1157,7 +1157,7 @@ static void set_option_value_err(char *key,
}
void api_set_error(Error *err, ErrorType errType, const char *format, ...)
FUNC_ATTR_NONNULL_ALL
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PRINTF(3, 4)
{
assert(kErrorTypeNone != errType);
va_list args1;

View File

@@ -222,9 +222,8 @@ static void ui_set_option(UI *ui, bool init, String name, Object value,
if (strequal(name.data, ui_ext_names[i])
|| (i == kUIPopupmenu && is_popupmenu)) {
if (value.type != kObjectTypeBoolean) {
snprintf((char *)IObuff, IOSIZE, "%s must be a Boolean",
name.data);
api_set_error(error, kErrorTypeValidation, (char *)IObuff);
api_set_error(error, kErrorTypeValidation, "%s must be a Boolean",
name.data);
return;
}
bool boolval = value.data.boolean;