[virt-tools-list] [virt-viewer][PATCH] Remove deprecated call to g_value_array_get_nth and substitute it by g_array_index.
lagarcia at linux.vnet.ibm.com
lagarcia at linux.vnet.ibm.com
Thu Jan 3 16:54:36 UTC 2013
From: Leonardo Garcia <lagarcia at br.ibm.com>
This avoids warning messages during the build process which were causing the
build to fail with enforcement of errors when warnings happen. Notice that this
is necessary because the corresponding event from gtk-vnc is still passing a
GValueArray as its parameter. As soon as gtk-vnc also removes the use of
GValueArray and start using the preferable GArray, this will need to be changed
again.
---
src/virt-viewer-auth.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/virt-viewer-auth.c b/src/virt-viewer-auth.c
index 487e67c..5a46226 100644
--- a/src/virt-viewer-auth.c
+++ b/src/virt-viewer-auth.c
@@ -105,10 +105,15 @@ virt_viewer_auth_vnc_credentials(GtkWindow *window,
gboolean wantPassword = FALSE, wantUsername = FALSE;
int i;
- DEBUG_LOG("Got VNC credential request for %d credential(s)", credList->n_values);
+ GArray *credArray = g_array_sized_new(FALSE, TRUE, sizeof(GValue),
+ credList->n_values);
+ g_array_set_clear_func(credArray, (GDestroyNotify) g_value_unset);
+ g_array_append_vals(credArray, credList->values, credList->n_values);
- for (i = 0 ; i < credList->n_values ; i++) {
- GValue *cred = g_value_array_get_nth(credList, i);
+ DEBUG_LOG("Got VNC credential request for %d credential(s)", credArray->len);
+
+ for (i = 0 ; i < credArray->len ; i++) {
+ GValue *cred = &g_array_index(credArray, GValue, i);
switch (g_value_get_enum(cred)) {
case VNC_DISPLAY_CREDENTIAL_USERNAME:
wantUsername = TRUE;
@@ -137,8 +142,8 @@ virt_viewer_auth_vnc_credentials(GtkWindow *window,
}
}
- for (i = 0 ; i < credList->n_values ; i++) {
- GValue *cred = g_value_array_get_nth(credList, i);
+ for (i = 0 ; i < credArray->len ; i++) {
+ GValue *cred = &g_array_index(credArray, GValue, i);
switch (g_value_get_enum(cred)) {
case VNC_DISPLAY_CREDENTIAL_USERNAME:
if (!username ||
--
1.7.1
More information about the virt-tools-list
mailing list