- qint = qobject_to_qint(qobj);
- if (!qint) {
- error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
- full_name(qiv, name), "integer");
+ qnum = qobject_to(QNum, qobj);
+ if (!qnum) {
+ goto err;
+ }
+
+ if (qnum_get_try_uint(qnum, obj)) {
+ return;
+ }
+
+ /* Need to accept negative values for backward compatibility */
+ if (qnum_get_try_int(qnum, &val)) {
+ *obj = val;