Skip to contentSkip to conversation

vnc: Fix compile error on x86_64 with -D_VNC_DEBUG=1

PATCH In review Corentin Chary 4 participants 6 messages May 3, 2010 – May 6, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 vnc: Fix compile error on x86_64 with -D_VNC_DEBUG=1

cc1: warnings being treated as errors
vnc-auth-sasl.c: In function ‘vnc_client_write_sasl’:
vnc-auth-sasl.c:50: error: format ‘%d’ expects type ‘int’, but argument 4 has type ‘size_t’ vnc-auth-sasl.c:50: error: format ‘%d’ expects type ‘int’, but argument 5 has type ‘size_t’
make: *** [vnc-auth-sasl.o] Error 1

---
 vnc-auth-sasl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
vnc-auth-sasl.c +2 -1
index acaac0c..a51ddc8 100644
@@ -47,7 +47,8 @@ long vnc_client_write_sasl(VncState *vs)
 {
     long ret;
 
-    VNC_DEBUG("Write SASL: Pending output %p size %d offset %d Encoded: %p size %d offset %d\n",
+    VNC_DEBUG("Write SASL: Pending output %p size %zd offset %zd "
+              "Encoded: %p size %d offset %d\n",
               vs->output.buffer, vs->output.capacity, vs->output.offset,
               vs->sasl.encoded, vs->sasl.encodedLength, vs->sasl.encodedOffset);
 
Signature · 1 line
1.7.0.2
#1 lore raw

PATCH 2/2 vnc: set the right prefered encoding

Quoted 1 line

From RFB specs: "The order of the encoding types given in this

message is a hint bby the client as to its preference (the first encoding specified being most preferred)"

---
 vnc.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
vnc.c +7 -4
index d332099..ad5b5af 100644
@@ -1767,7 +1767,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
 
     vnc_zlib_init(vs);
     vs->features = 0;
-    vs->vnc_encoding = 0;
+    vs->vnc_encoding = -1;
     vs->tight_compression = 9;
     vs->tight_quality = 9;
     vs->absolute = -1;
@@ -1776,18 +1776,21 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
         enc = encodings[i];
         switch (enc) {
         case VNC_ENCODING_RAW:
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1)
+                vs->vnc_encoding = enc;
             break;
         case VNC_ENCODING_COPYRECT:
             vs->features |= VNC_FEATURE_COPYRECT_MASK;
             break;
         case VNC_ENCODING_HEXTILE:
             vs->features |= VNC_FEATURE_HEXTILE_MASK;
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1)
+                vs->vnc_encoding = enc;
             break;
         case VNC_ENCODING_ZLIB:
             vs->features |= VNC_FEATURE_ZLIB_MASK;
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1)
+                vs->vnc_encoding = enc;
             break;
         case VNC_ENCODING_DESKTOPRESIZE:
             vs->features |= VNC_FEATURE_RESIZE_MASK;
Signature · 1 line
1.7.0.2
#2 lore raw

[Qemu-devel] Re: [PATCH 2/2] vnc: set the right prefered encoding

Quoted 23 lines · Corentin Chary
Quoted 1 line

From RFB specs: "The order of the encoding types given in this

message is a hint bby the client as to its preference (the first encoding specified being most preferred)"

---
  vnc.c |   11 +++++++----
  1 files changed, 7 insertions(+), 4 deletions(-)
vnc.c +1 -1
index d332099..ad5b5af 100644
@@ -1767,7 +1767,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
 
      vnc_zlib_init(vs);
      vs->features = 0;
-    vs->vnc_encoding = 0;
+    vs->vnc_encoding = -1;
      vs->tight_compression = 9;
      vs->tight_quality = 9;
      vs->absolute = -1;

vnc.c static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) · line 1781

Quoted 7 lines
vnc.c +2 -1
@@ -1776,18 +1776,21 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
          enc = encodings[i];
          switch (enc) {
          case VNC_ENCODING_RAW:
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1)
+                vs->vnc_encoding = enc;
 

Need braces on the if statement (see CODING_STYLE) but otherwise, this patch makes sense.

Regards,

Anthony Liguori

Quoted 19 lines
vnc.c +4 -2
              break;
          case VNC_ENCODING_COPYRECT:
              vs->features |= VNC_FEATURE_COPYRECT_MASK;
              break;
          case VNC_ENCODING_HEXTILE:
              vs->features |= VNC_FEATURE_HEXTILE_MASK;
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1)
+                vs->vnc_encoding = enc;
              break;
          case VNC_ENCODING_ZLIB:
              vs->features |= VNC_FEATURE_ZLIB_MASK;
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1)
+                vs->vnc_encoding = enc;
              break;
          case VNC_ENCODING_DESKTOPRESIZE:
              vs->features |= VNC_FEATURE_RESIZE_MASK;
#3 lore raw

PATCH 1/1 vnc: set the right prefered encoding

Quoted 1 line

From RFB specs: "The order of the encoding types given in this

message is a hint by the client as to its preference (the first encoding specified being most preferred)"

---
 vnc.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
vnc.c +10 -4
index 5241a6a..2d05d8f 100644
@@ -1594,7 +1594,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
 
     vnc_zlib_init(vs);
     vs->features = 0;
-    vs->vnc_encoding = 0;
+    vs->vnc_encoding = -1;
     vs->tight_compression = 9;
     vs->tight_quality = 9;
     vs->absolute = -1;
@@ -1603,18 +1603,24 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
         enc = encodings[i];
         switch (enc) {
         case VNC_ENCODING_RAW:
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1) {
+                vs->vnc_encoding = enc;
+            }
             break;
         case VNC_ENCODING_COPYRECT:
             vs->features |= VNC_FEATURE_COPYRECT_MASK;
             break;
         case VNC_ENCODING_HEXTILE:
             vs->features |= VNC_FEATURE_HEXTILE_MASK;
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1) {
+                vs->vnc_encoding = enc;
+            }
             break;
         case VNC_ENCODING_ZLIB:
             vs->features |= VNC_FEATURE_ZLIB_MASK;
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1) {
+                vs->vnc_encoding = enc;
+            }
             break;
         case VNC_ENCODING_DESKTOPRESIZE:
             vs->features |= VNC_FEATURE_RESIZE_MASK;
Signature · 1 line
1.7.0.2
#4 lore raw

Re: [Qemu-devel] [PATCH] vnc: set the right prefered encoding

Quoted 25 lines · Corentin Chary

From RFB specs: "The order of the encoding types given in this message is a hint by the client as to its preference (the first encoding specified being most preferred)"

---
 vnc.c |   14 ++++++++++----

 1 files changed, 10 insertions(+), 4 deletions(-)
vnc.c +1 -1
index 5241a6a..2d05d8f 100644
@@ -1594,7 +1594,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
 
     vnc_zlib_init(vs);
     vs->features = 0;
-    vs->vnc_encoding = 0;
+    vs->vnc_encoding = -1;
     vs->tight_compression = 9;
     vs->tight_quality = 9;
     vs->absolute = -1;
@@ -1603,18 +1603,24 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
         enc = encodings[i];
         switch (enc) {
Quoted 5 lines

        case VNC_ENCODING_RAW:
-            vs->vnc_encoding = enc;
+            if (vs->vnc_encoding != -1) {
+                vs->vnc_encoding = enc;
+            }

hum patch is broken, sending a fixed patch today, sorry

should be if (vs->vnc_encoding == -1)

Signature · 2 lines
Corentin Chary
http://xf.iksaif.net
#5 lore raw
In reply to Corentin Chary
Quoted 8 lines · Corentin Chary

cc1: warnings being treated as errors
vnc-auth-sasl.c: In function ‘vnc_client_write_sasl’:
vnc-auth-sasl.c:50: error: format ‘%d’ expects type ‘int’, but argument 4 has type ‘size_t’ vnc-auth-sasl.c:50: error: format ‘%d’ expects type ‘int’, but argument 5 has type ‘size_t’
make: *** [vnc-auth-sasl.o] Error 1

Applied 1/2. Thanks.

Regards,

Anthony Liguori

Quoted 19 lines
---
  vnc-auth-sasl.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
vnc-auth-sasl.c +2 -1
index acaac0c..a51ddc8 100644
@@ -47,7 +47,8 @@ long vnc_client_write_sasl(VncState *vs)
  {
      long ret;
 
-    VNC_DEBUG("Write SASL: Pending output %p size %d offset %d Encoded: %p size %d offset %d\n",
+    VNC_DEBUG("Write SASL: Pending output %p size %zd offset %zd "
+              "Encoded: %p size %d offset %d\n",
                vs->output.buffer, vs->output.capacity, vs->output.offset,
                vs->sasl.encoded, vs->sasl.encodedLength, vs->sasl.encodedOffset);