When munging enum values, the fact that we were passing the entire prefix + value through camel_to_upper() meant that enum values spelled with CamelCase could be turned into CAMEL_CASE. However, this provides a potential collision (both OneTwo and One-Two would munge into ONE_TWO). By changing the generation of enum constants to always be prefix + '_' + c_name(value).upper(), we can avoid any risk of collisions (if we can also ensure no case collisions, in the next patch) without having to think about what the heuristics in camel_to_upper() will actually do to the value.
Thankfully, only two enums are affected: ErrorClass and InputButton. Suggested by: Markus Armbruster <arm...@redhat.com> Signed-off-by: Eric Blake <ebl...@redhat.com> --- v11: new patch --- backends/rng-egd.c | 2 +- balloon.c | 4 ++-- block.c | 2 +- blockdev-nbd.c | 2 +- blockdev.c | 24 ++++++++++++------------ docs/writing-qmp-commands.txt | 2 +- hmp.c | 6 +++--- hw/input/hid.c | 4 ++-- hw/input/ps2.c | 4 ++-- hw/input/virtio-input-hid.c | 4 ++-- include/qapi/error.h | 6 +++--- include/ui/qemu-spice.h | 2 +- monitor.c | 8 ++++---- net/net.c | 4 ++-- qapi/qmp-dispatch.c | 2 +- qdev-monitor.c | 4 ++-- qmp.c | 8 ++++---- qom/object.c | 4 ++-- scripts/qapi.py | 2 +- ui/cocoa.m | 4 ++-- ui/gtk.c | 4 ++-- ui/input-legacy.c | 4 ++-- ui/input.c | 2 +- ui/sdl.c | 4 ++-- ui/sdl2.c | 4 ++-- ui/spice-input.c | 4 ++-- ui/vnc.c | 4 ++-- util/error.c | 6 +++--- 28 files changed, 65 insertions(+), 65 deletions(-) diff --git a/backends/rng-egd.c b/backends/rng-egd.c index 6c13409..d92af31 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -147,7 +147,7 @@ static void rng_egd_opened(RngBackend *b, Error **errp) s->chr = qemu_chr_find(s->chr_name); if (s->chr == NULL) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", s->chr_name); return; } diff --git a/balloon.c b/balloon.c index 0f45d1b..8aab0b8 100644 --- a/balloon.c +++ b/balloon.c @@ -51,12 +51,12 @@ void qemu_balloon_inhibit(bool state) static bool have_balloon(Error **errp) { if (kvm_enabled() && !kvm_has_sync_mmu()) { - error_set(errp, ERROR_CLASS_KVM_MISSING_CAP, + error_set(errp, ERROR_CLASS_KVMMISSINGCAP, "Using KVM without synchronous MMU, balloon unavailable"); return false; } if (!balloon_event_fn) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_ACTIVE, + error_set(errp, ERROR_CLASS_DEVICENOTACTIVE, "No balloon device has been activated"); return false; } diff --git a/block.c b/block.c index 53a978a..0e0058d 100644 --- a/block.c +++ b/block.c @@ -2584,7 +2584,7 @@ void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp) } } else { if (bdrv_key_required(bs)) { - error_set(errp, ERROR_CLASS_DEVICE_ENCRYPTED, + error_set(errp, ERROR_CLASS_DEVICEENCRYPTED, "'%s' (%s) is encrypted", bdrv_get_device_or_node_name(bs), bdrv_get_encrypted_filename(bs)); diff --git a/blockdev-nbd.c b/blockdev-nbd.c index bcdd18b..6184eef 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -90,7 +90,7 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable, blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } diff --git a/blockdev.c b/blockdev.c index 97be42f..115f46e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1215,7 +1215,7 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device, blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return NULL; } @@ -1411,7 +1411,7 @@ static void internal_snapshot_prepare(BlkTransactionState *common, /* 2. check for validation */ blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } @@ -1697,7 +1697,7 @@ static void drive_backup_prepare(BlkTransactionState *common, Error **errp) blk = blk_by_name(backup->device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", backup->device); return; } @@ -1984,7 +1984,7 @@ void qmp_eject(const char *device, bool has_force, bool force, Error **errp) blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } @@ -2052,7 +2052,7 @@ void qmp_change_blockdev(const char *device, const char *filename, blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } @@ -2118,7 +2118,7 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } @@ -2444,7 +2444,7 @@ void qmp_block_stream(const char *device, blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } @@ -2524,7 +2524,7 @@ void qmp_block_commit(const char *device, * scenario in which all optional arguments are omitted. */ blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } @@ -2639,7 +2639,7 @@ void qmp_drive_backup(const char *device, const char *target, blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } @@ -2864,7 +2864,7 @@ void qmp_drive_mirror(const char *device, const char *target, blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } @@ -3028,7 +3028,7 @@ static BlockJob *find_block_job(const char *device, AioContext **aio_context, return bs->job; notfound: - error_set(errp, ERROR_CLASS_DEVICE_NOT_ACTIVE, + error_set(errp, ERROR_CLASS_DEVICENOTACTIVE, "No active block job on device '%s'", device); if (*aio_context) { aio_context_release(*aio_context); @@ -3136,7 +3136,7 @@ void qmp_change_backing_file(const char *device, blk = blk_by_name(device); if (!blk) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); return; } diff --git a/docs/writing-qmp-commands.txt b/docs/writing-qmp-commands.txt index 59aa77a..21b8686 100644 --- a/docs/writing-qmp-commands.txt +++ b/docs/writing-qmp-commands.txt @@ -246,7 +246,7 @@ The QMP server's response should be: } } -As a general rule, all QMP errors should use ERROR_CLASS_GENERIC_ERROR +As a general rule, all QMP errors should use ERROR_CLASS_GENERICERROR (done by default when using error_setg()). There are two exceptions to this rule: diff --git a/hmp.c b/hmp.c index b992a29..ad3eb44 100644 --- a/hmp.c +++ b/hmp.c @@ -1364,7 +1364,7 @@ void hmp_change(Monitor *mon, const QDict *qdict) qmp_change(device, target, !!arg, arg, &err); if (err && - error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) { + error_get_class(err) == ERROR_CLASS_DEVICEENCRYPTED) { error_free(err); monitor_read_block_device_key(mon, device, NULL, NULL); return; @@ -1907,7 +1907,7 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict) if (blk) { qemuio_command(blk, command); } else { - error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(&err, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device); } @@ -2049,7 +2049,7 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict) obj = object_resolve_path(path, &ambiguous); if (obj == NULL) { - error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(&err, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", path); } else { if (ambiguous) { diff --git a/hw/input/hid.c b/hw/input/hid.c index e39269f..e68c3b1 100644 --- a/hw/input/hid.c +++ b/hw/input/hid.c @@ -139,9 +139,9 @@ static void hid_pointer_event(DeviceState *dev, QemuConsole *src, case INPUT_EVENT_KIND_BTN: if (evt->u.btn->down) { e->buttons_state |= bmap[evt->u.btn->button]; - if (evt->u.btn->button == INPUT_BUTTON_WHEEL_UP) { + if (evt->u.btn->button == INPUT_BUTTON_WHEELUP) { e->dz--; - } else if (evt->u.btn->button == INPUT_BUTTON_WHEEL_DOWN) { + } else if (evt->u.btn->button == INPUT_BUTTON_WHEELDOWN) { e->dz++; } } else { diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 3d6d496..aaa4479 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -405,9 +405,9 @@ static void ps2_mouse_event(DeviceState *dev, QemuConsole *src, case INPUT_EVENT_KIND_BTN: if (evt->u.btn->down) { s->mouse_buttons |= bmap[evt->u.btn->button]; - if (evt->u.btn->button == INPUT_BUTTON_WHEEL_UP) { + if (evt->u.btn->button == INPUT_BUTTON_WHEELUP) { s->mouse_dz--; - } else if (evt->u.btn->button == INPUT_BUTTON_WHEEL_DOWN) { + } else if (evt->u.btn->button == INPUT_BUTTON_WHEELDOWN) { s->mouse_dz++; } } else { diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c index bdd479c..8838ea5 100644 --- a/hw/input/virtio-input-hid.c +++ b/hw/input/virtio-input-hid.c @@ -142,8 +142,8 @@ static const unsigned int keymap_button[INPUT_BUTTON_MAX] = { [INPUT_BUTTON_LEFT] = BTN_LEFT, [INPUT_BUTTON_RIGHT] = BTN_RIGHT, [INPUT_BUTTON_MIDDLE] = BTN_MIDDLE, - [INPUT_BUTTON_WHEEL_UP] = BTN_GEAR_UP, - [INPUT_BUTTON_WHEEL_DOWN] = BTN_GEAR_DOWN, + [INPUT_BUTTON_WHEELUP] = BTN_GEAR_UP, + [INPUT_BUTTON_WHEELDOWN] = BTN_GEAR_DOWN, }; static const unsigned int axismap_rel[INPUT_AXIS_MAX] = { diff --git a/include/qapi/error.h b/include/qapi/error.h index 4d42cdc..30b6634 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -97,7 +97,7 @@ const char *error_get_pretty(Error *err); /* * Get @err's error class. - * Note: use of error classes other than ERROR_CLASS_GENERIC_ERROR is + * Note: use of error classes other than ERROR_CLASS_GENERICERROR is * strongly discouraged. */ ErrorClass error_get_class(const Error *err); @@ -109,7 +109,7 @@ ErrorClass error_get_class(const Error *err); * If @errp is &error_abort, print a suitable message and abort(). * If @errp is &error_fatal, print a suitable message and exit(1). * If @errp is anything else, *@errp must be NULL. - * The new error's class is ERROR_CLASS_GENERIC_ERROR, and its + * The new error's class is ERROR_CLASS_GENERICERROR, and its * human-readable error message is made from printf-style @fmt, ... */ #define error_setg(errp, fmt, ...) \ @@ -205,7 +205,7 @@ void error_report_err(Error *); /* * Just like error_setg(), except you get to specify the error class. - * Note: use of error classes other than ERROR_CLASS_GENERIC_ERROR is + * Note: use of error classes other than ERROR_CLASS_GENERICERROR is * strongly discouraged. */ #define error_set(errp, err_class, fmt, ...) \ diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h index f9ce357..02847c8 100644 --- a/include/ui/qemu-spice.h +++ b/include/ui/qemu-spice.h @@ -81,7 +81,7 @@ static inline int qemu_spice_display_add_client(int csock, int skipauth, static inline bool qemu_using_spice(Error **errp) { if (!using_spice) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_ACTIVE, + error_set(errp, ERROR_CLASS_DEVICENOTACTIVE, "SPICE is not in use"); return false; } diff --git a/monitor.c b/monitor.c index 3295840..bd1e194 100644 --- a/monitor.c +++ b/monitor.c @@ -1375,7 +1375,7 @@ static void hmp_mouse_move(Monitor *mon, const QDict *qdict) if (dz_str) { dz = strtol(dz_str, NULL, 0); if (dz != 0) { - button = (dz > 0) ? INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN; + button = (dz > 0) ? INPUT_BUTTON_WHEELUP : INPUT_BUTTON_WHEELDOWN; qemu_input_queue_btn(NULL, button, true); qemu_input_event_sync(); qemu_input_queue_btn(NULL, button, false); @@ -3578,13 +3578,13 @@ static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd, bool is_cap = cmd->mhandler.cmd_new == qmp_capabilities; if (is_cap && mon->qmp.in_command_mode) { - error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND, + error_set(errp, ERROR_CLASS_COMMANDNOTFOUND, "Capabilities negotiation is already complete, command " "'%s' ignored", cmd->name); return true; } if (!is_cap && !mon->qmp.in_command_mode) { - error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND, + error_set(errp, ERROR_CLASS_COMMANDNOTFOUND, "Expecting capabilities negotiation with " "'qmp_capabilities' before command '%s'", cmd->name); return true; @@ -3873,7 +3873,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) trace_handle_qmp_command(mon, cmd_name); cmd = qmp_find_cmd(cmd_name); if (!cmd) { - error_set(&local_err, ERROR_CLASS_COMMAND_NOT_FOUND, + error_set(&local_err, ERROR_CLASS_COMMANDNOTFOUND, "The command %s has not been found", cmd_name); goto err_out; } diff --git a/net/net.c b/net/net.c index ade6051..0d2a8b2 100644 --- a/net/net.c +++ b/net/net.c @@ -1170,7 +1170,7 @@ void qmp_netdev_del(const char *id, Error **errp) nc = qemu_find_netdev(id); if (!nc) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", id); return; } @@ -1300,7 +1300,7 @@ void qmp_set_link(const char *name, bool up, Error **errp) MAX_QUEUE_NUM); if (queues == 0) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", name); return; } diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 7bcc860..e969bc2 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -76,7 +76,7 @@ static QObject *do_qmp_dispatch(QObject *request, Error **errp) command = qdict_get_str(dict, "execute"); cmd = qmp_find_command(command); if (cmd == NULL) { - error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND, + error_set(errp, ERROR_CLASS_COMMANDNOTFOUND, "The command %s has not been found", command); return NULL; } diff --git a/qdev-monitor.c b/qdev-monitor.c index a35098f..1c39432 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -461,7 +461,7 @@ static BusState *qbus_find(const char *path, Error **errp) pos += len; dev = qbus_find_dev(bus, elem); if (!dev) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", elem); qbus_list_dev(bus, errp); return NULL; @@ -788,7 +788,7 @@ void qmp_device_del(const char *id, Error **errp) } if (!obj) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", id); return; } diff --git a/qmp.c b/qmp.c index ff54e5a..2e39e04 100644 --- a/qmp.c +++ b/qmp.c @@ -216,7 +216,7 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp) if (ambiguous) { error_setg(errp, "Path '%s' is ambiguous", path); } else { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", path); } return NULL; @@ -243,7 +243,7 @@ void qmp_qom_set(const char *path, const char *property, QObject *value, obj = object_resolve_path(path, NULL); if (!obj) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", path); return; } @@ -257,7 +257,7 @@ QObject *qmp_qom_get(const char *path, const char *property, Error **errp) obj = object_resolve_path(path, NULL); if (!obj) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", path); return NULL; } @@ -506,7 +506,7 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename, klass = object_class_by_name(typename); if (klass == NULL) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", typename); return NULL; } diff --git a/qom/object.c b/qom/object.c index c0decb6..425b7c3 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1018,7 +1018,7 @@ Object *object_property_get_link(Object *obj, const char *name, if (str && *str) { target = object_resolve_path(str, NULL); if (!target) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", str); } } @@ -1337,7 +1337,7 @@ static Object *object_resolve_link(Object *obj, const char *name, if (target || ambiguous) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type); } else { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", path); } target = NULL; diff --git a/scripts/qapi.py b/scripts/qapi.py index b068141..d0f2308 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1439,7 +1439,7 @@ def camel_to_upper(value): def c_enum_const(type_name, const_name, prefix=None): if prefix is not None: type_name = prefix - return camel_to_upper(type_name + '_' + const_name) + return camel_to_upper(type_name) + '_' + c_name(const_name, False).upper() c_name_trans = string.maketrans('.-', '__') diff --git a/ui/cocoa.m b/ui/cocoa.m index c0d6bb2..e7964ae 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -729,8 +729,8 @@ QemuCocoaView *cocoaView; [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON, [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON, [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON, - [INPUT_BUTTON_WHEEL_UP] = MOUSE_EVENT_WHEELUP, - [INPUT_BUTTON_WHEEL_DOWN] = MOUSE_EVENT_WHEELDN, + [INPUT_BUTTON_WHEELUP] = MOUSE_EVENT_WHEELUP, + [INPUT_BUTTON_WHEELDOWN] = MOUSE_EVENT_WHEELDN, }; qemu_input_update_buttons(dcl->con, bmap, last_buttons, buttons); last_buttons = buttons; diff --git a/ui/gtk.c b/ui/gtk.c index 47b37e1..40e78c5 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -965,9 +965,9 @@ static gboolean gd_scroll_event(GtkWidget *widget, GdkEventScroll *scroll, InputButton btn; if (scroll->direction == GDK_SCROLL_UP) { - btn = INPUT_BUTTON_WHEEL_UP; + btn = INPUT_BUTTON_WHEELUP; } else if (scroll->direction == GDK_SCROLL_DOWN) { - btn = INPUT_BUTTON_WHEEL_DOWN; + btn = INPUT_BUTTON_WHEELDOWN; } else { return TRUE; } diff --git a/ui/input-legacy.c b/ui/input-legacy.c index e0a39f0..ec851d0 100644 --- a/ui/input-legacy.c +++ b/ui/input-legacy.c @@ -157,7 +157,7 @@ static void legacy_mouse_event(DeviceState *dev, QemuConsole *src, } else { s->buttons &= ~bmap[evt->u.btn->button]; } - if (evt->u.btn->down && evt->u.btn->button == INPUT_BUTTON_WHEEL_UP) { + if (evt->u.btn->down && evt->u.btn->button == INPUT_BUTTON_WHEELUP) { s->qemu_put_mouse_event(s->qemu_put_mouse_event_opaque, s->axis[INPUT_AXIS_X], s->axis[INPUT_AXIS_Y], @@ -165,7 +165,7 @@ static void legacy_mouse_event(DeviceState *dev, QemuConsole *src, s->buttons); } if (evt->u.btn->down && - evt->u.btn->button == INPUT_BUTTON_WHEEL_DOWN) { + evt->u.btn->button == INPUT_BUTTON_WHEELDOWN) { s->qemu_put_mouse_event(s->qemu_put_mouse_event_opaque, s->axis[INPUT_AXIS_X], s->axis[INPUT_AXIS_Y], diff --git a/ui/input.c b/ui/input.c index a0f9873..ebe8532 100644 --- a/ui/input.c +++ b/ui/input.c @@ -86,7 +86,7 @@ void qemu_input_handler_bind(QemuInputHandlerState *s, dev = qdev_find_recursive(sysbus_get_default(), device_id); if (dev == NULL) { - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, "Device '%s' not found", device_id); return; } diff --git a/ui/sdl.c b/ui/sdl.c index 570cb99..2678611 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -469,8 +469,8 @@ static void sdl_send_mouse_event(int dx, int dy, int x, int y, int state) [INPUT_BUTTON_LEFT] = SDL_BUTTON(SDL_BUTTON_LEFT), [INPUT_BUTTON_MIDDLE] = SDL_BUTTON(SDL_BUTTON_MIDDLE), [INPUT_BUTTON_RIGHT] = SDL_BUTTON(SDL_BUTTON_RIGHT), - [INPUT_BUTTON_WHEEL_UP] = SDL_BUTTON(SDL_BUTTON_WHEELUP), - [INPUT_BUTTON_WHEEL_DOWN] = SDL_BUTTON(SDL_BUTTON_WHEELDOWN), + [INPUT_BUTTON_WHEELUP] = SDL_BUTTON(SDL_BUTTON_WHEELUP), + [INPUT_BUTTON_WHEELDOWN] = SDL_BUTTON(SDL_BUTTON_WHEELDOWN), }; static uint32_t prev_state; diff --git a/ui/sdl2.c b/ui/sdl2.c index 5cb75aa..ce19e54 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -504,9 +504,9 @@ static void handle_mousewheel(SDL_Event *ev) InputButton btn; if (wev->y > 0) { - btn = INPUT_BUTTON_WHEEL_UP; + btn = INPUT_BUTTON_WHEELUP; } else if (wev->y < 0) { - btn = INPUT_BUTTON_WHEEL_DOWN; + btn = INPUT_BUTTON_WHEELDOWN; } else { return; } diff --git a/ui/spice-input.c b/ui/spice-input.c index c342e0d..e76c3e3 100644 --- a/ui/spice-input.c +++ b/ui/spice-input.c @@ -111,8 +111,8 @@ static void spice_update_buttons(QemuSpicePointer *pointer, [INPUT_BUTTON_LEFT] = 0x01, [INPUT_BUTTON_MIDDLE] = 0x04, [INPUT_BUTTON_RIGHT] = 0x02, - [INPUT_BUTTON_WHEEL_UP] = 0x10, - [INPUT_BUTTON_WHEEL_DOWN] = 0x20, + [INPUT_BUTTON_WHEELUP] = 0x10, + [INPUT_BUTTON_WHEELDOWN] = 0x20, }; if (wheel < 0) { diff --git a/ui/vnc.c b/ui/vnc.c index f20c08d..363a8ab 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1650,8 +1650,8 @@ static void pointer_event(VncState *vs, int button_mask, int x, int y) [INPUT_BUTTON_LEFT] = 0x01, [INPUT_BUTTON_MIDDLE] = 0x02, [INPUT_BUTTON_RIGHT] = 0x04, - [INPUT_BUTTON_WHEEL_UP] = 0x08, - [INPUT_BUTTON_WHEEL_DOWN] = 0x10, + [INPUT_BUTTON_WHEELUP] = 0x08, + [INPUT_BUTTON_WHEELDOWN] = 0x10, }; QemuConsole *con = vs->vd->dcl.con; int width = pixman_image_get_width(vs->vd->server); diff --git a/util/error.c b/util/error.c index 80c89a2..2730106 100644 --- a/util/error.c +++ b/util/error.c @@ -85,7 +85,7 @@ void error_setg_internal(Error **errp, va_list ap; va_start(ap, fmt); - error_setv(errp, src, line, func, ERROR_CLASS_GENERIC_ERROR, fmt, ap); + error_setv(errp, src, line, func, ERROR_CLASS_GENERICERROR, fmt, ap); va_end(ap); } @@ -102,7 +102,7 @@ void error_setg_errno_internal(Error **errp, } va_start(ap, fmt); - error_setv(errp, src, line, func, ERROR_CLASS_GENERIC_ERROR, fmt, ap); + error_setv(errp, src, line, func, ERROR_CLASS_GENERICERROR, fmt, ap); va_end(ap); if (os_errno != 0) { @@ -158,7 +158,7 @@ void error_setg_win32_internal(Error **errp, } va_start(ap, fmt); - error_setv(errp, src, line, func, ERROR_CLASS_GENERIC_ERROR, fmt, ap); + error_setv(errp, src, line, func, ERROR_CLASS_GENERICERROR, fmt, ap); va_end(ap); if (win32_err != 0) { -- 2.4.3