提交 1d575629 编写于 作者: E Eric Blake

sendkey: use consistent API convention

Even though rpc uses 'unsigned int' for the _len parameter that
passes the length of item<length>, the public libvirt APIs all
use 'int' and filter out lengths < 0, except for virDomainSendKey.

* include/libvirt/libvirt.h.in (virDomainSendKey): All other APIs
use int for array length.
* src/libvirt.c (virDomainSendKey): Adjust.
* src/driver.h (virDrvDomainSendKey): Likewise.
* daemon/remote_generator.pl: Likewise.
上级 b33cd5e3
......@@ -1007,7 +1007,7 @@ elsif ($opt_k) {
my $limit = $3;
push(@args_list, "${type_name} *$arg_name");
push(@args_list, "unsigned int ${arg_name}len");
push(@args_list, "int ${arg_name}len");
push(@setters_list, "args.$arg_name.${arg_name}_val = $arg_name;");
push(@setters_list, "args.$arg_name.${arg_name}_len = ${arg_name}len;");
push(@args_check_list, { name => "\"$arg_name\"", arg => "${arg_name}len", limit => $limit });
......
......@@ -1788,7 +1788,7 @@ int virDomainSendKey(virDomainPtr domain,
unsigned int codeset,
unsigned int holdtime,
unsigned int *keycodes,
unsigned int nkeycodes,
int nkeycodes,
unsigned int flags);
/*
......
......@@ -568,7 +568,7 @@ typedef int
(*virDrvDomainSendKey)(virDomainPtr dom, unsigned int codeset,
unsigned int holdtime,
unsigned int *keycodes,
unsigned int nkeycodes,
int nkeycodes,
unsigned int flags);
typedef char *
......
......@@ -6653,7 +6653,7 @@ int virDomainSendKey(virDomainPtr domain,
unsigned int codeset,
unsigned int holdtime,
unsigned int *keycodes,
unsigned int nkeycodes,
int nkeycodes,
unsigned int flags)
{
virConnectPtr conn;
......@@ -6663,7 +6663,7 @@ int virDomainSendKey(virDomainPtr domain,
virResetLastError();
if (keycodes == NULL ||
nkeycodes == 0 || nkeycodes > VIR_DOMAIN_SEND_KEY_MAX_KEYS) {
nkeycodes <= 0 || nkeycodes > VIR_DOMAIN_SEND_KEY_MAX_KEYS) {
virLibDomainError(VIR_ERR_OPERATION_INVALID, __FUNCTION__);
virDispatchError(NULL);
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册