aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2010-05-19 09:24:02 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-06-01 12:53:09 -0500
commit8a0f0d0ca343e406aab7161c883187f1d2b85d89 (patch)
tree862d586623312e6a0dbd559c3af211d137041c0a
parenta9f20d31a8332ea4d6a0c90b9731f11a51cff6db (diff)
downloadqemu-8a0f0d0ca343e406aab7161c883187f1d2b85d89.zip
qemu-8a0f0d0ca343e406aab7161c883187f1d2b85d89.tar.gz
qemu-8a0f0d0ca343e406aab7161c883187f1d2b85d89.tar.bz2
vnc: explain why set_encodings loop is reversed
Add a small comment to explain why we need to start from the end of the array to set the right prefered encoding. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--vnc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/vnc.c b/vnc.c
index 1fb46bd..774a0b3 100644
--- a/vnc.c
+++ b/vnc.c
@@ -1649,6 +1649,11 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
vs->tight_quality = 9;
vs->absolute = -1;
+ /*
+ * Start from the end because the encodings are sent in order of preference.
+ * This way the prefered encoding (first encoding defined in the array)
+ * will be set at the end of the loop.
+ */
for (i = n_encodings - 1; i >= 0; i--) {
enc = encodings[i];
switch (enc) {