[Qemu-devel] [PATCH] ui: vnc: finish removing TABs

Paolo Bonzini posted 1 patch 5 years, 4 months ago
Test asan passed
Test checkpatch failed
Test docker-clang@ubuntu passed
Test docker-mingw@fedora passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181217231629.24147-1-pbonzini@redhat.com
Maintainers: Gerd Hoffmann <kraxel@redhat.com>
ui/vnc-enc-hextile-template.h | 268 +++++++++++------------
ui/vnc-enc-zywrle.h           | 394 +++++++++++++++++-----------------
2 files changed, 331 insertions(+), 331 deletions(-)
[Qemu-devel] [PATCH] ui: vnc: finish removing TABs
Posted by Paolo Bonzini 5 years, 4 months ago
Suggested-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 ui/vnc-enc-hextile-template.h | 268 +++++++++++------------
 ui/vnc-enc-zywrle.h           | 394 +++++++++++++++++-----------------
 2 files changed, 331 insertions(+), 331 deletions(-)

diff --git a/ui/vnc-enc-hextile-template.h b/ui/vnc-enc-hextile-template.h
index d868d75720..0c56262aff 100644
--- a/ui/vnc-enc-hextile-template.h
+++ b/ui/vnc-enc-hextile-template.h
@@ -30,127 +30,127 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
     int n_subtiles = 0;
 
     for (j = 0; j < h; j++) {
-	for (i = 0; i < w; i++) {
-	    switch (n_colors) {
-	    case 0:
-		bg = irow[i];
-		n_colors = 1;
-		break;
-	    case 1:
-		if (irow[i] != bg) {
-		    fg = irow[i];
-		    n_colors = 2;
-		}
-		break;
-	    case 2:
-		if (irow[i] != bg && irow[i] != fg) {
-		    n_colors = 3;
-		} else {
-		    if (irow[i] == bg)
-			bg_count++;
-		    else if (irow[i] == fg)
-			fg_count++;
-		}
-		break;
-	    default:
-		break;
-	    }
-	}
-	if (n_colors > 2)
-	    break;
-	irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
+        for (i = 0; i < w; i++) {
+            switch (n_colors) {
+            case 0:
+                bg = irow[i];
+                n_colors = 1;
+                break;
+            case 1:
+                if (irow[i] != bg) {
+                    fg = irow[i];
+                    n_colors = 2;
+                }
+                break;
+            case 2:
+                if (irow[i] != bg && irow[i] != fg) {
+                    n_colors = 3;
+                } else {
+                    if (irow[i] == bg)
+                        bg_count++;
+                    else if (irow[i] == fg)
+                        fg_count++;
+                }
+                break;
+            default:
+                break;
+            }
+        }
+        if (n_colors > 2)
+            break;
+        irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
     }
 
     if (n_colors > 1 && fg_count > bg_count) {
-	pixel_t tmp = fg;
-	fg = bg;
-	bg = tmp;
+        pixel_t tmp = fg;
+        fg = bg;
+        bg = tmp;
     }
 
     if (!*has_bg || *last_bg != bg) {
-	flags |= 0x02;
-	*has_bg = 1;
-	*last_bg = bg;
+        flags |= 0x02;
+        *has_bg = 1;
+        *last_bg = bg;
     }
 
     if (n_colors < 3 && (!*has_fg || *last_fg != fg)) {
-	flags |= 0x04;
-	*has_fg = 1;
-	*last_fg = fg;
+        flags |= 0x04;
+        *has_fg = 1;
+        *last_fg = fg;
     }
 
     switch (n_colors) {
     case 1:
-	n_data = 0;
-	break;
+        n_data = 0;
+        break;
     case 2:
-	flags |= 0x08;
-
-	irow = (pixel_t *)row;
-
-	for (j = 0; j < h; j++) {
-	    int min_x = -1;
-	    for (i = 0; i < w; i++) {
-		if (irow[i] == fg) {
-		    if (min_x == -1)
-			min_x = i;
-		} else if (min_x != -1) {
-		    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
-		    n_data += 2;
-		    n_subtiles++;
-		    min_x = -1;
-		}
-	    }
-	    if (min_x != -1) {
-		hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
-		n_data += 2;
-		n_subtiles++;
-	    }
-	    irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
-	}
-	break;
+        flags |= 0x08;
+
+        irow = (pixel_t *)row;
+
+        for (j = 0; j < h; j++) {
+            int min_x = -1;
+            for (i = 0; i < w; i++) {
+                if (irow[i] == fg) {
+                    if (min_x == -1)
+                        min_x = i;
+                } else if (min_x != -1) {
+                    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
+                    n_data += 2;
+                    n_subtiles++;
+                    min_x = -1;
+                }
+            }
+            if (min_x != -1) {
+                hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
+                n_data += 2;
+                n_subtiles++;
+            }
+            irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
+        }
+        break;
     case 3:
-	flags |= 0x18;
-
-	irow = (pixel_t *)row;
-
-	if (!*has_bg || *last_bg != bg)
-	    flags |= 0x02;
-
-	for (j = 0; j < h; j++) {
-	    int has_color = 0;
-	    int min_x = -1;
-	    pixel_t color = 0; /* shut up gcc */
-
-	    for (i = 0; i < w; i++) {
-		if (!has_color) {
-		    if (irow[i] == bg)
-			continue;
-		    color = irow[i];
-		    min_x = i;
-		    has_color = 1;
-		} else if (irow[i] != color) {
-		    has_color = 0;
+        flags |= 0x18;
+
+        irow = (pixel_t *)row;
+
+        if (!*has_bg || *last_bg != bg)
+            flags |= 0x02;
+
+        for (j = 0; j < h; j++) {
+            int has_color = 0;
+            int min_x = -1;
+            pixel_t color = 0; /* shut up gcc */
+
+            for (i = 0; i < w; i++) {
+                if (!has_color) {
+                    if (irow[i] == bg)
+                        continue;
+                    color = irow[i];
+                    min_x = i;
+                    has_color = 1;
+                } else if (irow[i] != color) {
+                    has_color = 0;
 #ifdef GENERIC
                     vnc_convert_pixel(vs, data + n_data, color);
                     n_data += vs->client_pf.bytes_per_pixel;
 #else
-		    memcpy(data + n_data, &color, sizeof(color));
+                    memcpy(data + n_data, &color, sizeof(color));
                     n_data += sizeof(pixel_t);
 #endif
-		    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
-		    n_data += 2;
-		    n_subtiles++;
-
-		    min_x = -1;
-		    if (irow[i] != bg) {
-			color = irow[i];
-			min_x = i;
-			has_color = 1;
-		    }
-		}
-	    }
-	    if (has_color) {
+                    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
+                    n_data += 2;
+                    n_subtiles++;
+
+                    min_x = -1;
+                    if (irow[i] != bg) {
+                        color = irow[i];
+                        min_x = i;
+                        has_color = 1;
+                    }
+                }
+            }
+            if (has_color) {
 #ifdef GENERIC
                 vnc_convert_pixel(vs, data + n_data, color);
                 n_data += vs->client_pf.bytes_per_pixel;
@@ -158,50 +158,50 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
                 memcpy(data + n_data, &color, sizeof(color));
                 n_data += sizeof(pixel_t);
 #endif
-		hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
-		n_data += 2;
-		n_subtiles++;
-	    }
-	    irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
-	}
-
-	/* A SubrectsColoured subtile invalidates the foreground color */
-	*has_fg = 0;
-	if (n_data > (w * h * sizeof(pixel_t))) {
-	    n_colors = 4;
-	    flags = 0x01;
-	    *has_bg = 0;
-
-	    /* we really don't have to invalidate either the bg or fg
-	       but we've lost the old values.  oh well. */
-	}
+                hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
+                n_data += 2;
+                n_subtiles++;
+            }
+            irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
+        }
+
+        /* A SubrectsColoured subtile invalidates the foreground color */
+        *has_fg = 0;
+        if (n_data > (w * h * sizeof(pixel_t))) {
+            n_colors = 4;
+            flags = 0x01;
+            *has_bg = 0;
+
+            /* we really don't have to invalidate either the bg or fg
+               but we've lost the old values.  oh well. */
+        }
         break;
     default:
-	break;
+        break;
     }
 
     if (n_colors > 3) {
-	flags = 0x01;
-	*has_fg = 0;
-	*has_bg = 0;
-	n_colors = 4;
+        flags = 0x01;
+        *has_fg = 0;
+        *has_bg = 0;
+        n_colors = 4;
     }
 
     vnc_write_u8(vs, flags);
     if (n_colors < 4) {
-	if (flags & 0x02)
-	    vs->write_pixels(vs, last_bg, sizeof(pixel_t));
-	if (flags & 0x04)
-	    vs->write_pixels(vs, last_fg, sizeof(pixel_t));
-	if (n_subtiles) {
-	    vnc_write_u8(vs, n_subtiles);
-	    vnc_write(vs, data, n_data);
-	}
+        if (flags & 0x02)
+            vs->write_pixels(vs, last_bg, sizeof(pixel_t));
+        if (flags & 0x04)
+            vs->write_pixels(vs, last_fg, sizeof(pixel_t));
+        if (n_subtiles) {
+            vnc_write_u8(vs, n_subtiles);
+            vnc_write(vs, data, n_data);
+        }
     } else {
-	for (j = 0; j < h; j++) {
-	    vs->write_pixels(vs, row, w * 4);
-	    row += vnc_server_fb_stride(vd);
-	}
+        for (j = 0; j < h; j++) {
+            vs->write_pixels(vs, row, w * 4);
+            row += vnc_server_fb_stride(vd);
+        }
     }
 }
 
diff --git a/ui/vnc-enc-zywrle.h b/ui/vnc-enc-zywrle.h
index 610bd79d1a..9b7f698975 100644
--- a/ui/vnc-enc-zywrle.h
+++ b/ui/vnc-enc-zywrle.h
@@ -48,162 +48,162 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef ZYWRLE_QUANTIZE
 /* Type A:lower bit omitting of EZW style. */
 static const unsigned int zywrle_param[3][3]={
-	{0x0000F000, 0x00000000, 0x00000000},
-	{0x0000C000, 0x00F0F0F0, 0x00000000},
-	{0x0000C000, 0x00C0C0C0, 0x00F0F0F0},
+        {0x0000F000, 0x00000000, 0x00000000},
+        {0x0000C000, 0x00F0F0F0, 0x00000000},
+        {0x0000C000, 0x00C0C0C0, 0x00F0F0F0},
 /*	{0x0000FF00, 0x00000000, 0x00000000},
-	{0x0000FF00, 0x00FFFFFF, 0x00000000},
-	{0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */
+        {0x0000FF00, 0x00FFFFFF, 0x00000000},
+        {0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */
 };
 #else
 /* Type B:Non liner quantization filter. */
 static const int8_t zywrle_conv[4][256]={
 {	/* bi=5, bo=5 r=0.0:PSNR=24.849 */
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
 },
 {	/* bi=5, bo=5 r=2.0:PSNR=74.031 */
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 32,
-	32, 32, 32, 32, 32, 32, 32, 32,
-	32, 32, 32, 32, 32, 32, 32, 32,
-	48, 48, 48, 48, 48, 48, 48, 48,
-	48, 48, 48, 56, 56, 56, 56, 56,
-	56, 56, 56, 56, 64, 64, 64, 64,
-	64, 64, 64, 64, 72, 72, 72, 72,
-	72, 72, 72, 72, 80, 80, 80, 80,
-	80, 80, 88, 88, 88, 88, 88, 88,
-	88, 88, 88, 88, 88, 88, 96, 96,
-	96, 96, 96, 104, 104, 104, 104, 104,
-	104, 104, 104, 104, 104, 112, 112, 112,
-	112, 112, 112, 112, 112, 112, 120, 120,
-	120, 120, 120, 120, 120, 120, 120, 120,
-	0, -120, -120, -120, -120, -120, -120, -120,
-	-120, -120, -120, -112, -112, -112, -112, -112,
-	-112, -112, -112, -112, -104, -104, -104, -104,
-	-104, -104, -104, -104, -104, -104, -96, -96,
-	-96, -96, -96, -88, -88, -88, -88, -88,
-	-88, -88, -88, -88, -88, -88, -88, -80,
-	-80, -80, -80, -80, -80, -72, -72, -72,
-	-72, -72, -72, -72, -72, -64, -64, -64,
-	-64, -64, -64, -64, -64, -56, -56, -56,
-	-56, -56, -56, -56, -56, -56, -48, -48,
-	-48, -48, -48, -48, -48, -48, -48, -48,
-	-48, -32, -32, -32, -32, -32, -32, -32,
-	-32, -32, -32, -32, -32, -32, -32, -32,
-	-32, -32, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 32,
+        32, 32, 32, 32, 32, 32, 32, 32,
+        32, 32, 32, 32, 32, 32, 32, 32,
+        48, 48, 48, 48, 48, 48, 48, 48,
+        48, 48, 48, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 64, 64, 64, 64,
+        64, 64, 64, 64, 72, 72, 72, 72,
+        72, 72, 72, 72, 80, 80, 80, 80,
+        80, 80, 88, 88, 88, 88, 88, 88,
+        88, 88, 88, 88, 88, 88, 96, 96,
+        96, 96, 96, 104, 104, 104, 104, 104,
+        104, 104, 104, 104, 104, 112, 112, 112,
+        112, 112, 112, 112, 112, 112, 120, 120,
+        120, 120, 120, 120, 120, 120, 120, 120,
+        0, -120, -120, -120, -120, -120, -120, -120,
+        -120, -120, -120, -112, -112, -112, -112, -112,
+        -112, -112, -112, -112, -104, -104, -104, -104,
+        -104, -104, -104, -104, -104, -104, -96, -96,
+        -96, -96, -96, -88, -88, -88, -88, -88,
+        -88, -88, -88, -88, -88, -88, -88, -80,
+        -80, -80, -80, -80, -80, -72, -72, -72,
+        -72, -72, -72, -72, -72, -64, -64, -64,
+        -64, -64, -64, -64, -64, -56, -56, -56,
+        -56, -56, -56, -56, -56, -56, -48, -48,
+        -48, -48, -48, -48, -48, -48, -48, -48,
+        -48, -32, -32, -32, -32, -32, -32, -32,
+        -32, -32, -32, -32, -32, -32, -32, -32,
+        -32, -32, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
 },
 {	/* bi=5, bo=4 r=2.0:PSNR=64.441 */
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	48, 48, 48, 48, 48, 48, 48, 48,
-	48, 48, 48, 48, 48, 48, 48, 48,
-	48, 48, 48, 48, 48, 48, 48, 48,
-	64, 64, 64, 64, 64, 64, 64, 64,
-	64, 64, 64, 64, 64, 64, 64, 64,
-	80, 80, 80, 80, 80, 80, 80, 80,
-	80, 80, 80, 80, 80, 88, 88, 88,
-	88, 88, 88, 88, 88, 88, 88, 88,
-	104, 104, 104, 104, 104, 104, 104, 104,
-	104, 104, 104, 112, 112, 112, 112, 112,
-	112, 112, 112, 112, 120, 120, 120, 120,
-	120, 120, 120, 120, 120, 120, 120, 120,
-	0, -120, -120, -120, -120, -120, -120, -120,
-	-120, -120, -120, -120, -120, -112, -112, -112,
-	-112, -112, -112, -112, -112, -112, -104, -104,
-	-104, -104, -104, -104, -104, -104, -104, -104,
-	-104, -88, -88, -88, -88, -88, -88, -88,
-	-88, -88, -88, -88, -80, -80, -80, -80,
-	-80, -80, -80, -80, -80, -80, -80, -80,
-	-80, -64, -64, -64, -64, -64, -64, -64,
-	-64, -64, -64, -64, -64, -64, -64, -64,
-	-64, -48, -48, -48, -48, -48, -48, -48,
-	-48, -48, -48, -48, -48, -48, -48, -48,
-	-48, -48, -48, -48, -48, -48, -48, -48,
-	-48, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        48, 48, 48, 48, 48, 48, 48, 48,
+        48, 48, 48, 48, 48, 48, 48, 48,
+        48, 48, 48, 48, 48, 48, 48, 48,
+        64, 64, 64, 64, 64, 64, 64, 64,
+        64, 64, 64, 64, 64, 64, 64, 64,
+        80, 80, 80, 80, 80, 80, 80, 80,
+        80, 80, 80, 80, 80, 88, 88, 88,
+        88, 88, 88, 88, 88, 88, 88, 88,
+        104, 104, 104, 104, 104, 104, 104, 104,
+        104, 104, 104, 112, 112, 112, 112, 112,
+        112, 112, 112, 112, 120, 120, 120, 120,
+        120, 120, 120, 120, 120, 120, 120, 120,
+        0, -120, -120, -120, -120, -120, -120, -120,
+        -120, -120, -120, -120, -120, -112, -112, -112,
+        -112, -112, -112, -112, -112, -112, -104, -104,
+        -104, -104, -104, -104, -104, -104, -104, -104,
+        -104, -88, -88, -88, -88, -88, -88, -88,
+        -88, -88, -88, -88, -80, -80, -80, -80,
+        -80, -80, -80, -80, -80, -80, -80, -80,
+        -80, -64, -64, -64, -64, -64, -64, -64,
+        -64, -64, -64, -64, -64, -64, -64, -64,
+        -64, -48, -48, -48, -48, -48, -48, -48,
+        -48, -48, -48, -48, -48, -48, -48, -48,
+        -48, -48, -48, -48, -48, -48, -48, -48,
+        -48, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
 },
 {	/* bi=5, bo=2 r=2.0:PSNR=43.175 */
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	88, 88, 88, 88, 88, 88, 88, 88,
-	88, 88, 88, 88, 88, 88, 88, 88,
-	88, 88, 88, 88, 88, 88, 88, 88,
-	88, 88, 88, 88, 88, 88, 88, 88,
-	88, 88, 88, 88, 88, 88, 88, 88,
-	88, 88, 88, 88, 88, 88, 88, 88,
-	88, 88, 88, 88, 88, 88, 88, 88,
-	88, 88, 88, 88, 88, 88, 88, 88,
-	0, -88, -88, -88, -88, -88, -88, -88,
-	-88, -88, -88, -88, -88, -88, -88, -88,
-	-88, -88, -88, -88, -88, -88, -88, -88,
-	-88, -88, -88, -88, -88, -88, -88, -88,
-	-88, -88, -88, -88, -88, -88, -88, -88,
-	-88, -88, -88, -88, -88, -88, -88, -88,
-	-88, -88, -88, -88, -88, -88, -88, -88,
-	-88, -88, -88, -88, -88, -88, -88, -88,
-	-88, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        88, 88, 88, 88, 88, 88, 88, 88,
+        88, 88, 88, 88, 88, 88, 88, 88,
+        88, 88, 88, 88, 88, 88, 88, 88,
+        88, 88, 88, 88, 88, 88, 88, 88,
+        88, 88, 88, 88, 88, 88, 88, 88,
+        88, 88, 88, 88, 88, 88, 88, 88,
+        88, 88, 88, 88, 88, 88, 88, 88,
+        88, 88, 88, 88, 88, 88, 88, 88,
+        0, -88, -88, -88, -88, -88, -88, -88,
+        -88, -88, -88, -88, -88, -88, -88, -88,
+        -88, -88, -88, -88, -88, -88, -88, -88,
+        -88, -88, -88, -88, -88, -88, -88, -88,
+        -88, -88, -88, -88, -88, -88, -88, -88,
+        -88, -88, -88, -88, -88, -88, -88, -88,
+        -88, -88, -88, -88, -88, -88, -88, -88,
+        -88, -88, -88, -88, -88, -88, -88, -88,
+        -88, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
 }
 };
 
 static const int8_t *zywrle_param[3][3][3]={
-	{{zywrle_conv[0], zywrle_conv[2], zywrle_conv[0]},
+        {{zywrle_conv[0], zywrle_conv[2], zywrle_conv[0]},
          {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]},
          {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}},
-	{{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
+        {{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
          {zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]},
          {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}},
-	{{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
+        {{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
          {zywrle_conv[2], zywrle_conv[2], zywrle_conv[2]},
          {zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]}},
 };
@@ -214,53 +214,53 @@ static const int8_t *zywrle_param[3][3][3]={
 #define ZYWRLE_UVMASK15 0xFFFFFFF8
 #define ZYWRLE_LOAD_PIXEL15(src, r, g, b)                               \
     do {                                                                \
-	r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
-	g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
+        r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
+        g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
         g &= 0xF8;                                                      \
-	b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
+        b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
     } while (0)
 
 #define ZYWRLE_SAVE_PIXEL15(dst, r, g, b)                               \
     do {                                                                \
-	r &= 0xF8;                                                      \
-	g &= 0xF8;                                                      \
-	b &= 0xF8;                                                      \
-	((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \
-	((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
+        r &= 0xF8;                                                      \
+        g &= 0xF8;                                                      \
+        b &= 0xF8;                                                      \
+        ((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
     } while (0)
 
 #define ZYWRLE_YMASK16  0xFFFFFFFC
 #define ZYWRLE_UVMASK16 0xFFFFFFF8
 #define ZYWRLE_LOAD_PIXEL16(src, r, g, b)                               \
     do {                                                                \
-	r = ((uint8_t*)src)[S_1] & 0xF8;                                \
-	g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \
+        r = ((uint8_t*)src)[S_1] & 0xF8;                                \
+        g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \
         g &= 0xFC;                                                      \
-	b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \
+        b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \
     } while (0)
 
 #define ZYWRLE_SAVE_PIXEL16(dst, r, g,b)                                \
     do {                                                                \
-	r &= 0xF8;                                                      \
-	g &= 0xFC;                                                      \
-	b &= 0xF8;                                                      \
-	((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5));                 \
-	((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \
+        r &= 0xF8;                                                      \
+        g &= 0xFC;                                                      \
+        b &= 0xF8;                                                      \
+        ((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5));                 \
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \
     } while (0)
 
 #define ZYWRLE_YMASK32  0xFFFFFFFF
 #define ZYWRLE_UVMASK32 0xFFFFFFFF
 #define ZYWRLE_LOAD_PIXEL32(src, r, g, b)     \
     do {                                      \
-	r = ((uint8_t*)src)[L_2];             \
-	g = ((uint8_t*)src)[L_1];             \
-	b = ((uint8_t*)src)[L_0];             \
+        r = ((uint8_t*)src)[L_2];             \
+        g = ((uint8_t*)src)[L_1];             \
+        b = ((uint8_t*)src)[L_0];             \
     } while (0)
 #define ZYWRLE_SAVE_PIXEL32(dst, r, g, b)             \
     do {                                              \
-	((uint8_t*)dst)[L_2] = (uint8_t)r;            \
-	((uint8_t*)dst)[L_1] = (uint8_t)g;            \
-	((uint8_t*)dst)[L_0] = (uint8_t)b;            \
+        ((uint8_t*)dst)[L_2] = (uint8_t)r;            \
+        ((uint8_t*)dst)[L_1] = (uint8_t)g;            \
+        ((uint8_t*)dst)[L_0] = (uint8_t)b;            \
     } while (0)
 
 static inline void harr(int8_t *px0, int8_t *px1)
@@ -443,27 +443,27 @@ static inline void filter_wavelet_square(int *buf, int width, int height,
 
 static inline void wavelet(int *buf, int width, int height, int level)
 {
-	int l, s;
-	int *top;
-	int *end;
-
-	for (l = 0; l < level; l++) {
-		top = buf;
-		end = buf + height * width;
-		s = width << l;
-		while (top < end) {
-			wavelet_level(top, width, l, 1);
-			top += s;
-		}
-		top = buf;
-		end = buf + width;
-		s = 1<<l;
-		while (top < end) {
-			wavelet_level(top, height, l, width);
-			top += s;
-		}
-		filter_wavelet_square(buf, width, height, level, l);
-	}
+        int l, s;
+        int *top;
+        int *end;
+
+        for (l = 0; l < level; l++) {
+                top = buf;
+                end = buf + height * width;
+                s = width << l;
+                while (top < end) {
+                        wavelet_level(top, width, l, 1);
+                        top += s;
+                }
+                top = buf;
+                end = buf + width;
+                s = 1<<l;
+                while (top < end) {
+                        wavelet_level(top, height, l, width);
+                        top += s;
+                }
+                filter_wavelet_square(buf, width, height, level, l);
+        }
 }
 
 
@@ -471,16 +471,16 @@ static inline void wavelet(int *buf, int width, int height, int level)
  Coefficients manages as 24 bits little-endian pixel. */
 #define ZYWRLE_LOAD_COEFF(src, r, g, b)         \
     do {                                        \
-	r = ((int8_t*)src)[2];                  \
-	g = ((int8_t*)src)[1];                  \
-	b = ((int8_t*)src)[0];                  \
+        r = ((int8_t*)src)[2];                  \
+        g = ((int8_t*)src)[1];                  \
+        b = ((int8_t*)src)[0];                  \
     } while (0)
 
 #define ZYWRLE_SAVE_COEFF(dst, r, g, b)       \
     do {                                      \
-	((int8_t*)dst)[2] = (int8_t)r;        \
-	((int8_t*)dst)[1] = (int8_t)g;        \
-	((int8_t*)dst)[0] = (int8_t)b;        \
+        ((int8_t*)dst)[2] = (int8_t)r;        \
+        ((int8_t*)dst)[1] = (int8_t)g;        \
+        ((int8_t*)dst)[0] = (int8_t)b;        \
     } while (0)
 
 /*
@@ -502,22 +502,22 @@ static inline void wavelet(int *buf, int width, int height, int level)
    More exact PLHarr, we reduce to odd range(-127<=x<=127). */
 #define ZYWRLE_RGBYUV_(r, g, b, y, u, v, ymask, uvmask)          \
     do {                                                         \
-	y = (r + (g << 1) + b) >> 2;                             \
-	u =  b - g;                                              \
-	v =  r - g;                                              \
-	y -= 128;                                                \
-	u >>= 1;                                                 \
-	v >>= 1;                                                 \
-	y &= ymask;                                              \
-	u &= uvmask;                                             \
-	v &= uvmask;                                             \
-	if (y == -128) {                                         \
+        y = (r + (g << 1) + b) >> 2;                             \
+        u =  b - g;                                              \
+        v =  r - g;                                              \
+        y -= 128;                                                \
+        u >>= 1;                                                 \
+        v >>= 1;                                                 \
+        y &= ymask;                                              \
+        u &= uvmask;                                             \
+        v &= uvmask;                                             \
+        if (y == -128) {                                         \
             y += (0xFFFFFFFF - ymask + 1);                       \
         }                                                        \
-	if (u == -128) {                                         \
+        if (u == -128) {                                         \
             u += (0xFFFFFFFF - uvmask + 1);                      \
         }                                                        \
-	if (v == -128) {                                         \
+        if (v == -128) {                                         \
             v += (0xFFFFFFFF - uvmask + 1);                      \
         }                                                        \
     } while (0)
-- 
2.20.1


Re: [Qemu-devel] [PATCH] ui: vnc: finish removing TABs
Posted by Philippe Mathieu-Daudé 5 years, 4 months ago
Hi Paolo,

On 12/18/18 12:16 AM, Paolo Bonzini wrote:
> Suggested-by: Daniel P. Berrange <berrange@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  ui/vnc-enc-hextile-template.h | 268 +++++++++++------------
>  ui/vnc-enc-zywrle.h           | 394 +++++++++++++++++-----------------
>  2 files changed, 331 insertions(+), 331 deletions(-)
> 
> diff --git a/ui/vnc-enc-hextile-template.h b/ui/vnc-enc-hextile-template.h
> index d868d75720..0c56262aff 100644
> --- a/ui/vnc-enc-hextile-template.h
> +++ b/ui/vnc-enc-hextile-template.h
> @@ -30,127 +30,127 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
>      int n_subtiles = 0;
>  
>      for (j = 0; j < h; j++) {
> -	for (i = 0; i < w; i++) {
> -	    switch (n_colors) {
> -	    case 0:
> -		bg = irow[i];
> -		n_colors = 1;
> -		break;
> -	    case 1:
> -		if (irow[i] != bg) {
> -		    fg = irow[i];
> -		    n_colors = 2;
> -		}
> -		break;
> -	    case 2:
> -		if (irow[i] != bg && irow[i] != fg) {
> -		    n_colors = 3;
> -		} else {
> -		    if (irow[i] == bg)

If we want to respect the QEMU CODYING_STYLE, we should respect:
"Every indented statement is braced; even if the block contains
just one statement."

Anyway this is another improvement, this patch already does a lot.

{

> -			bg_count++;

}

> -		    else if (irow[i] == fg)

{

> -			fg_count++;

}

> -		}
> -		break;
> -	    default:
> -		break;
> -	    }
> -	}
> -	if (n_colors > 2)
> -	    break;
> -	irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> +        for (i = 0; i < w; i++) {
> +            switch (n_colors) {
> +            case 0:
> +                bg = irow[i];
> +                n_colors = 1;
> +                break;
> +            case 1:
> +                if (irow[i] != bg) {
> +                    fg = irow[i];
> +                    n_colors = 2;
> +                }
> +                break;
> +            case 2:
> +                if (irow[i] != bg && irow[i] != fg) {
> +                    n_colors = 3;
> +                } else {
> +                    if (irow[i] == bg)

Ditto.

> +                        bg_count++;
> +                    else if (irow[i] == fg)
> +                        fg_count++;
> +                }
> +                break;
> +            default:
> +                break;
> +            }
> +        }
> +        if (n_colors > 2)

{

> +            break;

}

> +        irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
>      }
>  
>      if (n_colors > 1 && fg_count > bg_count) {
> -	pixel_t tmp = fg;
> -	fg = bg;
> -	bg = tmp;
> +        pixel_t tmp = fg;
> +        fg = bg;
> +        bg = tmp;
>      }
>  
>      if (!*has_bg || *last_bg != bg) {
> -	flags |= 0x02;
> -	*has_bg = 1;
> -	*last_bg = bg;
> +        flags |= 0x02;
> +        *has_bg = 1;
> +        *last_bg = bg;
>      }
>  
>      if (n_colors < 3 && (!*has_fg || *last_fg != fg)) {
> -	flags |= 0x04;
> -	*has_fg = 1;
> -	*last_fg = fg;
> +        flags |= 0x04;
> +        *has_fg = 1;
> +        *last_fg = fg;
>      }
>  
>      switch (n_colors) {
>      case 1:
> -	n_data = 0;
> -	break;
> +        n_data = 0;
> +        break;
>      case 2:
> -	flags |= 0x08;
> -
> -	irow = (pixel_t *)row;
> -
> -	for (j = 0; j < h; j++) {
> -	    int min_x = -1;
> -	    for (i = 0; i < w; i++) {
> -		if (irow[i] == fg) {
> -		    if (min_x == -1)
> -			min_x = i;
> -		} else if (min_x != -1) {
> -		    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> -		    n_data += 2;
> -		    n_subtiles++;
> -		    min_x = -1;
> -		}
> -	    }
> -	    if (min_x != -1) {
> -		hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> -		n_data += 2;
> -		n_subtiles++;
> -	    }
> -	    irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> -	}
> -	break;
> +        flags |= 0x08;
> +
> +        irow = (pixel_t *)row;
> +
> +        for (j = 0; j < h; j++) {
> +            int min_x = -1;
> +            for (i = 0; i < w; i++) {
> +                if (irow[i] == fg) {
> +                    if (min_x == -1)
> +                        min_x = i;
> +                } else if (min_x != -1) {
> +                    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> +                    n_data += 2;
> +                    n_subtiles++;
> +                    min_x = -1;
> +                }
> +            }
> +            if (min_x != -1) {
> +                hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> +                n_data += 2;
> +                n_subtiles++;
> +            }
> +            irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> +        }
> +        break;
>      case 3:
> -	flags |= 0x18;
> -
> -	irow = (pixel_t *)row;
> -
> -	if (!*has_bg || *last_bg != bg)
> -	    flags |= 0x02;
> -
> -	for (j = 0; j < h; j++) {
> -	    int has_color = 0;
> -	    int min_x = -1;
> -	    pixel_t color = 0; /* shut up gcc */
> -
> -	    for (i = 0; i < w; i++) {
> -		if (!has_color) {
> -		    if (irow[i] == bg)
> -			continue;
> -		    color = irow[i];
> -		    min_x = i;
> -		    has_color = 1;
> -		} else if (irow[i] != color) {
> -		    has_color = 0;
> +        flags |= 0x18;
> +
> +        irow = (pixel_t *)row;
> +
> +        if (!*has_bg || *last_bg != bg)

{

> +            flags |= 0x02;

}

> +
> +        for (j = 0; j < h; j++) {
> +            int has_color = 0;
> +            int min_x = -1;
> +            pixel_t color = 0; /* shut up gcc */
> +
> +            for (i = 0; i < w; i++) {
> +                if (!has_color) {
> +                    if (irow[i] == bg)
> +                        continue;
> +                    color = irow[i];
> +                    min_x = i;
> +                    has_color = 1;
> +                } else if (irow[i] != color) {
> +                    has_color = 0;
>  #ifdef GENERIC
>                      vnc_convert_pixel(vs, data + n_data, color);
>                      n_data += vs->client_pf.bytes_per_pixel;
>  #else
> -		    memcpy(data + n_data, &color, sizeof(color));
> +                    memcpy(data + n_data, &color, sizeof(color));
>                      n_data += sizeof(pixel_t);
>  #endif
> -		    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> -		    n_data += 2;
> -		    n_subtiles++;
> -
> -		    min_x = -1;
> -		    if (irow[i] != bg) {
> -			color = irow[i];
> -			min_x = i;
> -			has_color = 1;
> -		    }
> -		}
> -	    }
> -	    if (has_color) {
> +                    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> +                    n_data += 2;
> +                    n_subtiles++;
> +
> +                    min_x = -1;
> +                    if (irow[i] != bg) {
> +                        color = irow[i];
> +                        min_x = i;
> +                        has_color = 1;
> +                    }
> +                }
> +            }
> +            if (has_color) {
>  #ifdef GENERIC
>                  vnc_convert_pixel(vs, data + n_data, color);
>                  n_data += vs->client_pf.bytes_per_pixel;
> @@ -158,50 +158,50 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
>                  memcpy(data + n_data, &color, sizeof(color));
>                  n_data += sizeof(pixel_t);
>  #endif
> -		hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> -		n_data += 2;
> -		n_subtiles++;
> -	    }
> -	    irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> -	}
> -
> -	/* A SubrectsColoured subtile invalidates the foreground color */
> -	*has_fg = 0;
> -	if (n_data > (w * h * sizeof(pixel_t))) {
> -	    n_colors = 4;
> -	    flags = 0x01;
> -	    *has_bg = 0;
> -
> -	    /* we really don't have to invalidate either the bg or fg
> -	       but we've lost the old values.  oh well. */
> -	}
> +                hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> +                n_data += 2;
> +                n_subtiles++;
> +            }
> +            irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> +        }
> +
> +        /* A SubrectsColoured subtile invalidates the foreground color */
> +        *has_fg = 0;
> +        if (n_data > (w * h * sizeof(pixel_t))) {
> +            n_colors = 4;
> +            flags = 0x01;
> +            *has_bg = 0;
> +
> +            /* we really don't have to invalidate either the bg or fg
> +               but we've lost the old values.  oh well. */
> +        }
>          break;
>      default:
> -	break;
> +        break;
>      }
>  
>      if (n_colors > 3) {
> -	flags = 0x01;
> -	*has_fg = 0;
> -	*has_bg = 0;
> -	n_colors = 4;
> +        flags = 0x01;
> +        *has_fg = 0;
> +        *has_bg = 0;
> +        n_colors = 4;
>      }
>  
>      vnc_write_u8(vs, flags);
>      if (n_colors < 4) {
> -	if (flags & 0x02)
> -	    vs->write_pixels(vs, last_bg, sizeof(pixel_t));
> -	if (flags & 0x04)
> -	    vs->write_pixels(vs, last_fg, sizeof(pixel_t));
> -	if (n_subtiles) {
> -	    vnc_write_u8(vs, n_subtiles);
> -	    vnc_write(vs, data, n_data);
> -	}
> +        if (flags & 0x02)
> +            vs->write_pixels(vs, last_bg, sizeof(pixel_t));
> +        if (flags & 0x04)
> +            vs->write_pixels(vs, last_fg, sizeof(pixel_t));
> +        if (n_subtiles) {
> +            vnc_write_u8(vs, n_subtiles);
> +            vnc_write(vs, data, n_data);
> +        }
>      } else {
> -	for (j = 0; j < h; j++) {
> -	    vs->write_pixels(vs, row, w * 4);
> -	    row += vnc_server_fb_stride(vd);
> -	}
> +        for (j = 0; j < h; j++) {
> +            vs->write_pixels(vs, row, w * 4);
> +            row += vnc_server_fb_stride(vd);
> +        }
>      }
>  }
>  
> diff --git a/ui/vnc-enc-zywrle.h b/ui/vnc-enc-zywrle.h
> index 610bd79d1a..9b7f698975 100644
> --- a/ui/vnc-enc-zywrle.h
> +++ b/ui/vnc-enc-zywrle.h
> @@ -48,162 +48,162 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  #ifndef ZYWRLE_QUANTIZE
>  /* Type A:lower bit omitting of EZW style. */
>  static const unsigned int zywrle_param[3][3]={
> -	{0x0000F000, 0x00000000, 0x00000000},
> -	{0x0000C000, 0x00F0F0F0, 0x00000000},
> -	{0x0000C000, 0x00C0C0C0, 0x00F0F0F0},
> +        {0x0000F000, 0x00000000, 0x00000000},
> +        {0x0000C000, 0x00F0F0F0, 0x00000000},
> +        {0x0000C000, 0x00C0C0C0, 0x00F0F0F0},
>  /*	{0x0000FF00, 0x00000000, 0x00000000},
> -	{0x0000FF00, 0x00FFFFFF, 0x00000000},
> -	{0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */
> +        {0x0000FF00, 0x00FFFFFF, 0x00000000},
> +        {0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */
>  };
>  #else
>  /* Type B:Non liner quantization filter. */
>  static const int8_t zywrle_conv[4][256]={
>  {	/* bi=5, bo=5 r=0.0:PSNR=24.849 */
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
>  },
>  {	/* bi=5, bo=5 r=2.0:PSNR=74.031 */
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 32,
> -	32, 32, 32, 32, 32, 32, 32, 32,
> -	32, 32, 32, 32, 32, 32, 32, 32,
> -	48, 48, 48, 48, 48, 48, 48, 48,
> -	48, 48, 48, 56, 56, 56, 56, 56,
> -	56, 56, 56, 56, 64, 64, 64, 64,
> -	64, 64, 64, 64, 72, 72, 72, 72,
> -	72, 72, 72, 72, 80, 80, 80, 80,
> -	80, 80, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 96, 96,
> -	96, 96, 96, 104, 104, 104, 104, 104,
> -	104, 104, 104, 104, 104, 112, 112, 112,
> -	112, 112, 112, 112, 112, 112, 120, 120,
> -	120, 120, 120, 120, 120, 120, 120, 120,
> -	0, -120, -120, -120, -120, -120, -120, -120,
> -	-120, -120, -120, -112, -112, -112, -112, -112,
> -	-112, -112, -112, -112, -104, -104, -104, -104,
> -	-104, -104, -104, -104, -104, -104, -96, -96,
> -	-96, -96, -96, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -80,
> -	-80, -80, -80, -80, -80, -72, -72, -72,
> -	-72, -72, -72, -72, -72, -64, -64, -64,
> -	-64, -64, -64, -64, -64, -56, -56, -56,
> -	-56, -56, -56, -56, -56, -56, -48, -48,
> -	-48, -48, -48, -48, -48, -48, -48, -48,
> -	-48, -32, -32, -32, -32, -32, -32, -32,
> -	-32, -32, -32, -32, -32, -32, -32, -32,
> -	-32, -32, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 32,
> +        32, 32, 32, 32, 32, 32, 32, 32,
> +        32, 32, 32, 32, 32, 32, 32, 32,
> +        48, 48, 48, 48, 48, 48, 48, 48,
> +        48, 48, 48, 56, 56, 56, 56, 56,
> +        56, 56, 56, 56, 64, 64, 64, 64,
> +        64, 64, 64, 64, 72, 72, 72, 72,
> +        72, 72, 72, 72, 80, 80, 80, 80,
> +        80, 80, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 96, 96,
> +        96, 96, 96, 104, 104, 104, 104, 104,
> +        104, 104, 104, 104, 104, 112, 112, 112,
> +        112, 112, 112, 112, 112, 112, 120, 120,
> +        120, 120, 120, 120, 120, 120, 120, 120,
> +        0, -120, -120, -120, -120, -120, -120, -120,
> +        -120, -120, -120, -112, -112, -112, -112, -112,
> +        -112, -112, -112, -112, -104, -104, -104, -104,
> +        -104, -104, -104, -104, -104, -104, -96, -96,
> +        -96, -96, -96, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -80,
> +        -80, -80, -80, -80, -80, -72, -72, -72,
> +        -72, -72, -72, -72, -72, -64, -64, -64,
> +        -64, -64, -64, -64, -64, -56, -56, -56,
> +        -56, -56, -56, -56, -56, -56, -48, -48,
> +        -48, -48, -48, -48, -48, -48, -48, -48,
> +        -48, -32, -32, -32, -32, -32, -32, -32,
> +        -32, -32, -32, -32, -32, -32, -32, -32,
> +        -32, -32, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
>  },
>  {	/* bi=5, bo=4 r=2.0:PSNR=64.441 */
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	48, 48, 48, 48, 48, 48, 48, 48,
> -	48, 48, 48, 48, 48, 48, 48, 48,
> -	48, 48, 48, 48, 48, 48, 48, 48,
> -	64, 64, 64, 64, 64, 64, 64, 64,
> -	64, 64, 64, 64, 64, 64, 64, 64,
> -	80, 80, 80, 80, 80, 80, 80, 80,
> -	80, 80, 80, 80, 80, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	104, 104, 104, 104, 104, 104, 104, 104,
> -	104, 104, 104, 112, 112, 112, 112, 112,
> -	112, 112, 112, 112, 120, 120, 120, 120,
> -	120, 120, 120, 120, 120, 120, 120, 120,
> -	0, -120, -120, -120, -120, -120, -120, -120,
> -	-120, -120, -120, -120, -120, -112, -112, -112,
> -	-112, -112, -112, -112, -112, -112, -104, -104,
> -	-104, -104, -104, -104, -104, -104, -104, -104,
> -	-104, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -80, -80, -80, -80,
> -	-80, -80, -80, -80, -80, -80, -80, -80,
> -	-80, -64, -64, -64, -64, -64, -64, -64,
> -	-64, -64, -64, -64, -64, -64, -64, -64,
> -	-64, -48, -48, -48, -48, -48, -48, -48,
> -	-48, -48, -48, -48, -48, -48, -48, -48,
> -	-48, -48, -48, -48, -48, -48, -48, -48,
> -	-48, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        48, 48, 48, 48, 48, 48, 48, 48,
> +        48, 48, 48, 48, 48, 48, 48, 48,
> +        48, 48, 48, 48, 48, 48, 48, 48,
> +        64, 64, 64, 64, 64, 64, 64, 64,
> +        64, 64, 64, 64, 64, 64, 64, 64,
> +        80, 80, 80, 80, 80, 80, 80, 80,
> +        80, 80, 80, 80, 80, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        104, 104, 104, 104, 104, 104, 104, 104,
> +        104, 104, 104, 112, 112, 112, 112, 112,
> +        112, 112, 112, 112, 120, 120, 120, 120,
> +        120, 120, 120, 120, 120, 120, 120, 120,
> +        0, -120, -120, -120, -120, -120, -120, -120,
> +        -120, -120, -120, -120, -120, -112, -112, -112,
> +        -112, -112, -112, -112, -112, -112, -104, -104,
> +        -104, -104, -104, -104, -104, -104, -104, -104,
> +        -104, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -80, -80, -80, -80,
> +        -80, -80, -80, -80, -80, -80, -80, -80,
> +        -80, -64, -64, -64, -64, -64, -64, -64,
> +        -64, -64, -64, -64, -64, -64, -64, -64,
> +        -64, -48, -48, -48, -48, -48, -48, -48,
> +        -48, -48, -48, -48, -48, -48, -48, -48,
> +        -48, -48, -48, -48, -48, -48, -48, -48,
> +        -48, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
>  },
>  {	/* bi=5, bo=2 r=2.0:PSNR=43.175 */
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	0, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        0, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
>  }
>  };
>  
>  static const int8_t *zywrle_param[3][3][3]={
> -	{{zywrle_conv[0], zywrle_conv[2], zywrle_conv[0]},
> +        {{zywrle_conv[0], zywrle_conv[2], zywrle_conv[0]},
>           {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]},
>           {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}},
> -	{{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
> +        {{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
>           {zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]},
>           {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}},
> -	{{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
> +        {{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
>           {zywrle_conv[2], zywrle_conv[2], zywrle_conv[2]},
>           {zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]}},
>  };
> @@ -214,53 +214,53 @@ static const int8_t *zywrle_param[3][3][3]={
>  #define ZYWRLE_UVMASK15 0xFFFFFFF8
>  #define ZYWRLE_LOAD_PIXEL15(src, r, g, b)                               \
>      do {                                                                \
> -	r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
> -	g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
> +        r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
> +        g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
>          g &= 0xF8;                                                      \
> -	b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
> +        b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
>      } while (0)
>  
>  #define ZYWRLE_SAVE_PIXEL15(dst, r, g, b)                               \
>      do {                                                                \
> -	r &= 0xF8;                                                      \
> -	g &= 0xF8;                                                      \
> -	b &= 0xF8;                                                      \
> -	((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \
> -	((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
> +        r &= 0xF8;                                                      \
> +        g &= 0xF8;                                                      \
> +        b &= 0xF8;                                                      \
> +        ((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \
> +        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
>      } while (0)
>  
>  #define ZYWRLE_YMASK16  0xFFFFFFFC
>  #define ZYWRLE_UVMASK16 0xFFFFFFF8
>  #define ZYWRLE_LOAD_PIXEL16(src, r, g, b)                               \
>      do {                                                                \
> -	r = ((uint8_t*)src)[S_1] & 0xF8;                                \
> -	g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \
> +        r = ((uint8_t*)src)[S_1] & 0xF8;                                \
> +        g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \
>          g &= 0xFC;                                                      \
> -	b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \
> +        b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \
>      } while (0)
>  
>  #define ZYWRLE_SAVE_PIXEL16(dst, r, g,b)                                \
>      do {                                                                \
> -	r &= 0xF8;                                                      \
> -	g &= 0xFC;                                                      \
> -	b &= 0xF8;                                                      \
> -	((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5));                 \
> -	((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \
> +        r &= 0xF8;                                                      \
> +        g &= 0xFC;                                                      \
> +        b &= 0xF8;                                                      \
> +        ((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5));                 \
> +        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \
>      } while (0)
>  
>  #define ZYWRLE_YMASK32  0xFFFFFFFF
>  #define ZYWRLE_UVMASK32 0xFFFFFFFF
>  #define ZYWRLE_LOAD_PIXEL32(src, r, g, b)     \
>      do {                                      \
> -	r = ((uint8_t*)src)[L_2];             \
> -	g = ((uint8_t*)src)[L_1];             \
> -	b = ((uint8_t*)src)[L_0];             \
> +        r = ((uint8_t*)src)[L_2];             \
> +        g = ((uint8_t*)src)[L_1];             \
> +        b = ((uint8_t*)src)[L_0];             \
>      } while (0)
>  #define ZYWRLE_SAVE_PIXEL32(dst, r, g, b)             \
>      do {                                              \
> -	((uint8_t*)dst)[L_2] = (uint8_t)r;            \
> -	((uint8_t*)dst)[L_1] = (uint8_t)g;            \
> -	((uint8_t*)dst)[L_0] = (uint8_t)b;            \
> +        ((uint8_t*)dst)[L_2] = (uint8_t)r;            \
> +        ((uint8_t*)dst)[L_1] = (uint8_t)g;            \
> +        ((uint8_t*)dst)[L_0] = (uint8_t)b;            \
>      } while (0)
>  
>  static inline void harr(int8_t *px0, int8_t *px1)
> @@ -443,27 +443,27 @@ static inline void filter_wavelet_square(int *buf, int width, int height,
>  
>  static inline void wavelet(int *buf, int width, int height, int level)
>  {
> -	int l, s;
> -	int *top;
> -	int *end;
> -
> -	for (l = 0; l < level; l++) {
> -		top = buf;
> -		end = buf + height * width;
> -		s = width << l;
> -		while (top < end) {
> -			wavelet_level(top, width, l, 1);
> -			top += s;
> -		}
> -		top = buf;
> -		end = buf + width;
> -		s = 1<<l;
> -		while (top < end) {
> -			wavelet_level(top, height, l, width);
> -			top += s;
> -		}
> -		filter_wavelet_square(buf, width, height, level, l);
> -	}
> +        int l, s;
> +        int *top;
> +        int *end;
> +
> +        for (l = 0; l < level; l++) {
> +                top = buf;
> +                end = buf + height * width;
> +                s = width << l;
> +                while (top < end) {
> +                        wavelet_level(top, width, l, 1);
> +                        top += s;
> +                }
> +                top = buf;
> +                end = buf + width;
> +                s = 1<<l;
> +                while (top < end) {
> +                        wavelet_level(top, height, l, width);
> +                        top += s;
> +                }
> +                filter_wavelet_square(buf, width, height, level, l);
> +        }
>  }
>  
>  
> @@ -471,16 +471,16 @@ static inline void wavelet(int *buf, int width, int height, int level)
>   Coefficients manages as 24 bits little-endian pixel. */
>  #define ZYWRLE_LOAD_COEFF(src, r, g, b)         \
>      do {                                        \
> -	r = ((int8_t*)src)[2];                  \
> -	g = ((int8_t*)src)[1];                  \
> -	b = ((int8_t*)src)[0];                  \
> +        r = ((int8_t*)src)[2];                  \
> +        g = ((int8_t*)src)[1];                  \
> +        b = ((int8_t*)src)[0];                  \
>      } while (0)
>  
>  #define ZYWRLE_SAVE_COEFF(dst, r, g, b)       \
>      do {                                      \
> -	((int8_t*)dst)[2] = (int8_t)r;        \
> -	((int8_t*)dst)[1] = (int8_t)g;        \
> -	((int8_t*)dst)[0] = (int8_t)b;        \
> +        ((int8_t*)dst)[2] = (int8_t)r;        \
> +        ((int8_t*)dst)[1] = (int8_t)g;        \
> +        ((int8_t*)dst)[0] = (int8_t)b;        \
>      } while (0)
>  
>  /*
> @@ -502,22 +502,22 @@ static inline void wavelet(int *buf, int width, int height, int level)
>     More exact PLHarr, we reduce to odd range(-127<=x<=127). */
>  #define ZYWRLE_RGBYUV_(r, g, b, y, u, v, ymask, uvmask)          \
>      do {                                                         \
> -	y = (r + (g << 1) + b) >> 2;                             \
> -	u =  b - g;                                              \
> -	v =  r - g;                                              \
> -	y -= 128;                                                \
> -	u >>= 1;                                                 \
> -	v >>= 1;                                                 \
> -	y &= ymask;                                              \
> -	u &= uvmask;                                             \
> -	v &= uvmask;                                             \
> -	if (y == -128) {                                         \
> +        y = (r + (g << 1) + b) >> 2;                             \
> +        u =  b - g;                                              \
> +        v =  r - g;                                              \
> +        y -= 128;                                                \
> +        u >>= 1;                                                 \
> +        v >>= 1;                                                 \
> +        y &= ymask;                                              \
> +        u &= uvmask;                                             \
> +        v &= uvmask;                                             \
> +        if (y == -128) {                                         \
>              y += (0xFFFFFFFF - ymask + 1);                       \
>          }                                                        \
> -	if (u == -128) {                                         \
> +        if (u == -128) {                                         \
>              u += (0xFFFFFFFF - uvmask + 1);                      \
>          }                                                        \
> -	if (v == -128) {                                         \
> +        if (v == -128) {                                         \
>              v += (0xFFFFFFFF - uvmask + 1);                      \
>          }                                                        \
>      } while (0)
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Re: [Qemu-devel] [PATCH] ui: vnc: finish removing TABs
Posted by no-reply@patchew.org 5 years, 4 months ago
Patchew URL: https://patchew.org/QEMU/20181217231629.24147-1-pbonzini@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20181217231629.24147-1-pbonzini@redhat.com
Type: series
Subject: [Qemu-devel] [PATCH] ui: vnc: finish removing TABs

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
df43c3d ui: vnc: finish removing TABs

=== OUTPUT BEGIN ===
Checking PATCH 1/1: ui: vnc: finish removing TABs...
ERROR: braces {} are necessary for all arms of this statement
#63: FILE: ui/vnc-enc-hextile-template.h:49:
+                    if (irow[i] == bg)
[...]
+                    else if (irow[i] == fg)
[...]

ERROR: braces {} are necessary for all arms of this statement
#65: FILE: ui/vnc-enc-hextile-template.h:51:
+                    else if (irow[i] == fg)
[...]

ERROR: braces {} are necessary for all arms of this statement
#73: FILE: ui/vnc-enc-hextile-template.h:59:
+        if (n_colors > 2)
[...]

ERROR: braces {} are necessary for all arms of this statement
#143: FILE: ui/vnc-enc-hextile-template.h:95:
+                    if (min_x == -1)
[...]

ERROR: braces {} are necessary for all arms of this statement
#169: FILE: ui/vnc-enc-hextile-template.h:117:
+        if (!*has_bg || *last_bg != bg)
[...]

ERROR: braces {} are necessary for all arms of this statement
#192: FILE: ui/vnc-enc-hextile-template.h:127:
+                    if (irow[i] == bg)
[...]

WARNING: Block comments use a leading /* on a separate line
#268: FILE: ui/vnc-enc-hextile-template.h:175:
+            /* we really don't have to invalidate either the bg or fg

WARNING: Block comments use * on subsequent lines
#269: FILE: ui/vnc-enc-hextile-template.h:176:
+            /* we really don't have to invalidate either the bg or fg
+               but we've lost the old values.  oh well. */

WARNING: Block comments use a trailing */ on a separate line
#269: FILE: ui/vnc-enc-hextile-template.h:176:
+               but we've lost the old values.  oh well. */

ERROR: braces {} are necessary for all arms of this statement
#298: FILE: ui/vnc-enc-hextile-template.h:192:
+        if (flags & 0x02)
[...]

ERROR: braces {} are necessary for all arms of this statement
#300: FILE: ui/vnc-enc-hextile-template.h:194:
+        if (flags & 0x04)
[...]

WARNING: Block comments use a trailing */ on a separate line
#336: FILE: ui/vnc-enc-zywrle.h:56:
+        {0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */

ERROR: "(foo*)" should be "(foo *)"
#627: FILE: ui/vnc-enc-zywrle.h:217:
+        r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \

ERROR: spaces required around that '<<' (ctx:VxW)
#627: FILE: ui/vnc-enc-zywrle.h:217:
+        r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
                                  ^

ERROR: spaces required around that '&' (ctx:VxW)
#627: FILE: ui/vnc-enc-zywrle.h:217:
+        r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
                                       ^

ERROR: "(foo*)" should be "(foo *)"
#628: FILE: ui/vnc-enc-zywrle.h:218:
+        g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \

ERROR: spaces required around that '<<' (ctx:VxW)
#628: FILE: ui/vnc-enc-zywrle.h:218:
+        g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
                                  ^

ERROR: spaces required around that '>>' (ctx:VxW)
#628: FILE: ui/vnc-enc-zywrle.h:218:
+        g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
                                                               ^

ERROR: "(foo*)" should be "(foo *)"
#631: FILE: ui/vnc-enc-zywrle.h:220:
+        b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \

ERROR: spaces required around that '<<' (ctx:VxW)
#631: FILE: ui/vnc-enc-zywrle.h:220:
+        b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
                                   ^

ERROR: spaces required around that '&' (ctx:VxW)
#631: FILE: ui/vnc-enc-zywrle.h:220:
+        b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
                                        ^

ERROR: "(foo*)" should be "(foo *)"
#644: FILE: ui/vnc-enc-zywrle.h:228:
+        ((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \

ERROR: spaces required around that '|' (ctx:VxV)
#644: FILE: ui/vnc-enc-zywrle.h:228:
+        ((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \
                                                  ^

ERROR: "(foo*)" should be "(foo *)"
#645: FILE: ui/vnc-enc-zywrle.h:229:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \

ERROR: spaces required around that '|' (ctx:VxV)
#645: FILE: ui/vnc-enc-zywrle.h:229:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
                                                   ^

ERROR: spaces required around that '&' (ctx:VxW)
#645: FILE: ui/vnc-enc-zywrle.h:229:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
                                                             ^

ERROR: "(foo*)" should be "(foo *)"
#654: FILE: ui/vnc-enc-zywrle.h:236:
+        r = ((uint8_t*)src)[S_1] & 0xF8;                                \

ERROR: "(foo*)" should be "(foo *)"
#655: FILE: ui/vnc-enc-zywrle.h:237:
+        g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \

ERROR: spaces required around that '<<' (ctx:VxW)
#655: FILE: ui/vnc-enc-zywrle.h:237:
+        g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \
                                  ^

ERROR: "(foo*)" should be "(foo *)"
#658: FILE: ui/vnc-enc-zywrle.h:239:
+        b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \

ERROR: spaces required around that '<<' (ctx:VxW)
#658: FILE: ui/vnc-enc-zywrle.h:239:
+        b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \
                                  ^

ERROR: "(foo*)" should be "(foo *)"
#671: FILE: ui/vnc-enc-zywrle.h:247:
+        ((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5));                 \

ERROR: "(foo*)" should be "(foo *)"
#672: FILE: ui/vnc-enc-zywrle.h:248:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \

ERROR: spaces required around that '|' (ctx:VxV)
#672: FILE: ui/vnc-enc-zywrle.h:248:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \
                                                   ^

ERROR: "(foo*)" should be "(foo *)"
#682: FILE: ui/vnc-enc-zywrle.h:255:
+        r = ((uint8_t*)src)[L_2];             \

ERROR: "(foo*)" should be "(foo *)"
#683: FILE: ui/vnc-enc-zywrle.h:256:
+        g = ((uint8_t*)src)[L_1];             \

ERROR: "(foo*)" should be "(foo *)"
#684: FILE: ui/vnc-enc-zywrle.h:257:
+        b = ((uint8_t*)src)[L_0];             \

ERROR: "(foo*)" should be "(foo *)"
#691: FILE: ui/vnc-enc-zywrle.h:261:
+        ((uint8_t*)dst)[L_2] = (uint8_t)r;            \

ERROR: "(foo*)" should be "(foo *)"
#692: FILE: ui/vnc-enc-zywrle.h:262:
+        ((uint8_t*)dst)[L_1] = (uint8_t)g;            \

ERROR: "(foo*)" should be "(foo *)"
#693: FILE: ui/vnc-enc-zywrle.h:263:
+        ((uint8_t*)dst)[L_0] = (uint8_t)b;            \

ERROR: spaces required around that '<<' (ctx:VxV)
#735: FILE: ui/vnc-enc-zywrle.h:460:
+                s = 1<<l;
                      ^

ERROR: "(foo*)" should be "(foo *)"
#752: FILE: ui/vnc-enc-zywrle.h:474:
+        r = ((int8_t*)src)[2];                  \

ERROR: "(foo*)" should be "(foo *)"
#753: FILE: ui/vnc-enc-zywrle.h:475:
+        g = ((int8_t*)src)[1];                  \

ERROR: "(foo*)" should be "(foo *)"
#754: FILE: ui/vnc-enc-zywrle.h:476:
+        b = ((int8_t*)src)[0];                  \

ERROR: "(foo*)" should be "(foo *)"
#762: FILE: ui/vnc-enc-zywrle.h:481:
+        ((int8_t*)dst)[2] = (int8_t)r;        \

ERROR: "(foo*)" should be "(foo *)"
#763: FILE: ui/vnc-enc-zywrle.h:482:
+        ((int8_t*)dst)[1] = (int8_t)g;        \

ERROR: "(foo*)" should be "(foo *)"
#764: FILE: ui/vnc-enc-zywrle.h:483:
+        ((int8_t*)dst)[0] = (int8_t)b;        \

total: 43 errors, 4 warnings, 778 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20181217231629.24147-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [Qemu-devel] [PATCH] ui: vnc: finish removing TABs
Posted by Paolo Bonzini 5 years, 3 months ago
On 18/12/18 00:16, Paolo Bonzini wrote:
> Suggested-by: Daniel P. Berrange <berrange@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  ui/vnc-enc-hextile-template.h | 268 +++++++++++------------
>  ui/vnc-enc-zywrle.h           | 394 +++++++++++++++++-----------------
>  2 files changed, 331 insertions(+), 331 deletions(-)
> 
> diff --git a/ui/vnc-enc-hextile-template.h b/ui/vnc-enc-hextile-template.h
> index d868d75720..0c56262aff 100644
> --- a/ui/vnc-enc-hextile-template.h
> +++ b/ui/vnc-enc-hextile-template.h
> @@ -30,127 +30,127 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
>      int n_subtiles = 0;
>  
>      for (j = 0; j < h; j++) {
> -	for (i = 0; i < w; i++) {
> -	    switch (n_colors) {
> -	    case 0:
> -		bg = irow[i];
> -		n_colors = 1;
> -		break;
> -	    case 1:
> -		if (irow[i] != bg) {
> -		    fg = irow[i];
> -		    n_colors = 2;
> -		}
> -		break;
> -	    case 2:
> -		if (irow[i] != bg && irow[i] != fg) {
> -		    n_colors = 3;
> -		} else {
> -		    if (irow[i] == bg)
> -			bg_count++;
> -		    else if (irow[i] == fg)
> -			fg_count++;
> -		}
> -		break;
> -	    default:
> -		break;
> -	    }
> -	}
> -	if (n_colors > 2)
> -	    break;
> -	irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> +        for (i = 0; i < w; i++) {
> +            switch (n_colors) {
> +            case 0:
> +                bg = irow[i];
> +                n_colors = 1;
> +                break;
> +            case 1:
> +                if (irow[i] != bg) {
> +                    fg = irow[i];
> +                    n_colors = 2;
> +                }
> +                break;
> +            case 2:
> +                if (irow[i] != bg && irow[i] != fg) {
> +                    n_colors = 3;
> +                } else {
> +                    if (irow[i] == bg)
> +                        bg_count++;
> +                    else if (irow[i] == fg)
> +                        fg_count++;
> +                }
> +                break;
> +            default:
> +                break;
> +            }
> +        }
> +        if (n_colors > 2)
> +            break;
> +        irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
>      }
>  
>      if (n_colors > 1 && fg_count > bg_count) {
> -	pixel_t tmp = fg;
> -	fg = bg;
> -	bg = tmp;
> +        pixel_t tmp = fg;
> +        fg = bg;
> +        bg = tmp;
>      }
>  
>      if (!*has_bg || *last_bg != bg) {
> -	flags |= 0x02;
> -	*has_bg = 1;
> -	*last_bg = bg;
> +        flags |= 0x02;
> +        *has_bg = 1;
> +        *last_bg = bg;
>      }
>  
>      if (n_colors < 3 && (!*has_fg || *last_fg != fg)) {
> -	flags |= 0x04;
> -	*has_fg = 1;
> -	*last_fg = fg;
> +        flags |= 0x04;
> +        *has_fg = 1;
> +        *last_fg = fg;
>      }
>  
>      switch (n_colors) {
>      case 1:
> -	n_data = 0;
> -	break;
> +        n_data = 0;
> +        break;
>      case 2:
> -	flags |= 0x08;
> -
> -	irow = (pixel_t *)row;
> -
> -	for (j = 0; j < h; j++) {
> -	    int min_x = -1;
> -	    for (i = 0; i < w; i++) {
> -		if (irow[i] == fg) {
> -		    if (min_x == -1)
> -			min_x = i;
> -		} else if (min_x != -1) {
> -		    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> -		    n_data += 2;
> -		    n_subtiles++;
> -		    min_x = -1;
> -		}
> -	    }
> -	    if (min_x != -1) {
> -		hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> -		n_data += 2;
> -		n_subtiles++;
> -	    }
> -	    irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> -	}
> -	break;
> +        flags |= 0x08;
> +
> +        irow = (pixel_t *)row;
> +
> +        for (j = 0; j < h; j++) {
> +            int min_x = -1;
> +            for (i = 0; i < w; i++) {
> +                if (irow[i] == fg) {
> +                    if (min_x == -1)
> +                        min_x = i;
> +                } else if (min_x != -1) {
> +                    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> +                    n_data += 2;
> +                    n_subtiles++;
> +                    min_x = -1;
> +                }
> +            }
> +            if (min_x != -1) {
> +                hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> +                n_data += 2;
> +                n_subtiles++;
> +            }
> +            irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> +        }
> +        break;
>      case 3:
> -	flags |= 0x18;
> -
> -	irow = (pixel_t *)row;
> -
> -	if (!*has_bg || *last_bg != bg)
> -	    flags |= 0x02;
> -
> -	for (j = 0; j < h; j++) {
> -	    int has_color = 0;
> -	    int min_x = -1;
> -	    pixel_t color = 0; /* shut up gcc */
> -
> -	    for (i = 0; i < w; i++) {
> -		if (!has_color) {
> -		    if (irow[i] == bg)
> -			continue;
> -		    color = irow[i];
> -		    min_x = i;
> -		    has_color = 1;
> -		} else if (irow[i] != color) {
> -		    has_color = 0;
> +        flags |= 0x18;
> +
> +        irow = (pixel_t *)row;
> +
> +        if (!*has_bg || *last_bg != bg)
> +            flags |= 0x02;
> +
> +        for (j = 0; j < h; j++) {
> +            int has_color = 0;
> +            int min_x = -1;
> +            pixel_t color = 0; /* shut up gcc */
> +
> +            for (i = 0; i < w; i++) {
> +                if (!has_color) {
> +                    if (irow[i] == bg)
> +                        continue;
> +                    color = irow[i];
> +                    min_x = i;
> +                    has_color = 1;
> +                } else if (irow[i] != color) {
> +                    has_color = 0;
>  #ifdef GENERIC
>                      vnc_convert_pixel(vs, data + n_data, color);
>                      n_data += vs->client_pf.bytes_per_pixel;
>  #else
> -		    memcpy(data + n_data, &color, sizeof(color));
> +                    memcpy(data + n_data, &color, sizeof(color));
>                      n_data += sizeof(pixel_t);
>  #endif
> -		    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> -		    n_data += 2;
> -		    n_subtiles++;
> -
> -		    min_x = -1;
> -		    if (irow[i] != bg) {
> -			color = irow[i];
> -			min_x = i;
> -			has_color = 1;
> -		    }
> -		}
> -	    }
> -	    if (has_color) {
> +                    hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> +                    n_data += 2;
> +                    n_subtiles++;
> +
> +                    min_x = -1;
> +                    if (irow[i] != bg) {
> +                        color = irow[i];
> +                        min_x = i;
> +                        has_color = 1;
> +                    }
> +                }
> +            }
> +            if (has_color) {
>  #ifdef GENERIC
>                  vnc_convert_pixel(vs, data + n_data, color);
>                  n_data += vs->client_pf.bytes_per_pixel;
> @@ -158,50 +158,50 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
>                  memcpy(data + n_data, &color, sizeof(color));
>                  n_data += sizeof(pixel_t);
>  #endif
> -		hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> -		n_data += 2;
> -		n_subtiles++;
> -	    }
> -	    irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> -	}
> -
> -	/* A SubrectsColoured subtile invalidates the foreground color */
> -	*has_fg = 0;
> -	if (n_data > (w * h * sizeof(pixel_t))) {
> -	    n_colors = 4;
> -	    flags = 0x01;
> -	    *has_bg = 0;
> -
> -	    /* we really don't have to invalidate either the bg or fg
> -	       but we've lost the old values.  oh well. */
> -	}
> +                hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1);
> +                n_data += 2;
> +                n_subtiles++;
> +            }
> +            irow += vnc_server_fb_stride(vd) / sizeof(pixel_t);
> +        }
> +
> +        /* A SubrectsColoured subtile invalidates the foreground color */
> +        *has_fg = 0;
> +        if (n_data > (w * h * sizeof(pixel_t))) {
> +            n_colors = 4;
> +            flags = 0x01;
> +            *has_bg = 0;
> +
> +            /* we really don't have to invalidate either the bg or fg
> +               but we've lost the old values.  oh well. */
> +        }
>          break;
>      default:
> -	break;
> +        break;
>      }
>  
>      if (n_colors > 3) {
> -	flags = 0x01;
> -	*has_fg = 0;
> -	*has_bg = 0;
> -	n_colors = 4;
> +        flags = 0x01;
> +        *has_fg = 0;
> +        *has_bg = 0;
> +        n_colors = 4;
>      }
>  
>      vnc_write_u8(vs, flags);
>      if (n_colors < 4) {
> -	if (flags & 0x02)
> -	    vs->write_pixels(vs, last_bg, sizeof(pixel_t));
> -	if (flags & 0x04)
> -	    vs->write_pixels(vs, last_fg, sizeof(pixel_t));
> -	if (n_subtiles) {
> -	    vnc_write_u8(vs, n_subtiles);
> -	    vnc_write(vs, data, n_data);
> -	}
> +        if (flags & 0x02)
> +            vs->write_pixels(vs, last_bg, sizeof(pixel_t));
> +        if (flags & 0x04)
> +            vs->write_pixels(vs, last_fg, sizeof(pixel_t));
> +        if (n_subtiles) {
> +            vnc_write_u8(vs, n_subtiles);
> +            vnc_write(vs, data, n_data);
> +        }
>      } else {
> -	for (j = 0; j < h; j++) {
> -	    vs->write_pixels(vs, row, w * 4);
> -	    row += vnc_server_fb_stride(vd);
> -	}
> +        for (j = 0; j < h; j++) {
> +            vs->write_pixels(vs, row, w * 4);
> +            row += vnc_server_fb_stride(vd);
> +        }
>      }
>  }
>  
> diff --git a/ui/vnc-enc-zywrle.h b/ui/vnc-enc-zywrle.h
> index 610bd79d1a..9b7f698975 100644
> --- a/ui/vnc-enc-zywrle.h
> +++ b/ui/vnc-enc-zywrle.h
> @@ -48,162 +48,162 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  #ifndef ZYWRLE_QUANTIZE
>  /* Type A:lower bit omitting of EZW style. */
>  static const unsigned int zywrle_param[3][3]={
> -	{0x0000F000, 0x00000000, 0x00000000},
> -	{0x0000C000, 0x00F0F0F0, 0x00000000},
> -	{0x0000C000, 0x00C0C0C0, 0x00F0F0F0},
> +        {0x0000F000, 0x00000000, 0x00000000},
> +        {0x0000C000, 0x00F0F0F0, 0x00000000},
> +        {0x0000C000, 0x00C0C0C0, 0x00F0F0F0},
>  /*	{0x0000FF00, 0x00000000, 0x00000000},
> -	{0x0000FF00, 0x00FFFFFF, 0x00000000},
> -	{0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */
> +        {0x0000FF00, 0x00FFFFFF, 0x00000000},
> +        {0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */
>  };
>  #else
>  /* Type B:Non liner quantization filter. */
>  static const int8_t zywrle_conv[4][256]={
>  {	/* bi=5, bo=5 r=0.0:PSNR=24.849 */
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
>  },
>  {	/* bi=5, bo=5 r=2.0:PSNR=74.031 */
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 32,
> -	32, 32, 32, 32, 32, 32, 32, 32,
> -	32, 32, 32, 32, 32, 32, 32, 32,
> -	48, 48, 48, 48, 48, 48, 48, 48,
> -	48, 48, 48, 56, 56, 56, 56, 56,
> -	56, 56, 56, 56, 64, 64, 64, 64,
> -	64, 64, 64, 64, 72, 72, 72, 72,
> -	72, 72, 72, 72, 80, 80, 80, 80,
> -	80, 80, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 96, 96,
> -	96, 96, 96, 104, 104, 104, 104, 104,
> -	104, 104, 104, 104, 104, 112, 112, 112,
> -	112, 112, 112, 112, 112, 112, 120, 120,
> -	120, 120, 120, 120, 120, 120, 120, 120,
> -	0, -120, -120, -120, -120, -120, -120, -120,
> -	-120, -120, -120, -112, -112, -112, -112, -112,
> -	-112, -112, -112, -112, -104, -104, -104, -104,
> -	-104, -104, -104, -104, -104, -104, -96, -96,
> -	-96, -96, -96, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -80,
> -	-80, -80, -80, -80, -80, -72, -72, -72,
> -	-72, -72, -72, -72, -72, -64, -64, -64,
> -	-64, -64, -64, -64, -64, -56, -56, -56,
> -	-56, -56, -56, -56, -56, -56, -48, -48,
> -	-48, -48, -48, -48, -48, -48, -48, -48,
> -	-48, -32, -32, -32, -32, -32, -32, -32,
> -	-32, -32, -32, -32, -32, -32, -32, -32,
> -	-32, -32, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 32,
> +        32, 32, 32, 32, 32, 32, 32, 32,
> +        32, 32, 32, 32, 32, 32, 32, 32,
> +        48, 48, 48, 48, 48, 48, 48, 48,
> +        48, 48, 48, 56, 56, 56, 56, 56,
> +        56, 56, 56, 56, 64, 64, 64, 64,
> +        64, 64, 64, 64, 72, 72, 72, 72,
> +        72, 72, 72, 72, 80, 80, 80, 80,
> +        80, 80, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 96, 96,
> +        96, 96, 96, 104, 104, 104, 104, 104,
> +        104, 104, 104, 104, 104, 112, 112, 112,
> +        112, 112, 112, 112, 112, 112, 120, 120,
> +        120, 120, 120, 120, 120, 120, 120, 120,
> +        0, -120, -120, -120, -120, -120, -120, -120,
> +        -120, -120, -120, -112, -112, -112, -112, -112,
> +        -112, -112, -112, -112, -104, -104, -104, -104,
> +        -104, -104, -104, -104, -104, -104, -96, -96,
> +        -96, -96, -96, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -80,
> +        -80, -80, -80, -80, -80, -72, -72, -72,
> +        -72, -72, -72, -72, -72, -64, -64, -64,
> +        -64, -64, -64, -64, -64, -56, -56, -56,
> +        -56, -56, -56, -56, -56, -56, -48, -48,
> +        -48, -48, -48, -48, -48, -48, -48, -48,
> +        -48, -32, -32, -32, -32, -32, -32, -32,
> +        -32, -32, -32, -32, -32, -32, -32, -32,
> +        -32, -32, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
>  },
>  {	/* bi=5, bo=4 r=2.0:PSNR=64.441 */
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	48, 48, 48, 48, 48, 48, 48, 48,
> -	48, 48, 48, 48, 48, 48, 48, 48,
> -	48, 48, 48, 48, 48, 48, 48, 48,
> -	64, 64, 64, 64, 64, 64, 64, 64,
> -	64, 64, 64, 64, 64, 64, 64, 64,
> -	80, 80, 80, 80, 80, 80, 80, 80,
> -	80, 80, 80, 80, 80, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	104, 104, 104, 104, 104, 104, 104, 104,
> -	104, 104, 104, 112, 112, 112, 112, 112,
> -	112, 112, 112, 112, 120, 120, 120, 120,
> -	120, 120, 120, 120, 120, 120, 120, 120,
> -	0, -120, -120, -120, -120, -120, -120, -120,
> -	-120, -120, -120, -120, -120, -112, -112, -112,
> -	-112, -112, -112, -112, -112, -112, -104, -104,
> -	-104, -104, -104, -104, -104, -104, -104, -104,
> -	-104, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -80, -80, -80, -80,
> -	-80, -80, -80, -80, -80, -80, -80, -80,
> -	-80, -64, -64, -64, -64, -64, -64, -64,
> -	-64, -64, -64, -64, -64, -64, -64, -64,
> -	-64, -48, -48, -48, -48, -48, -48, -48,
> -	-48, -48, -48, -48, -48, -48, -48, -48,
> -	-48, -48, -48, -48, -48, -48, -48, -48,
> -	-48, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        48, 48, 48, 48, 48, 48, 48, 48,
> +        48, 48, 48, 48, 48, 48, 48, 48,
> +        48, 48, 48, 48, 48, 48, 48, 48,
> +        64, 64, 64, 64, 64, 64, 64, 64,
> +        64, 64, 64, 64, 64, 64, 64, 64,
> +        80, 80, 80, 80, 80, 80, 80, 80,
> +        80, 80, 80, 80, 80, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        104, 104, 104, 104, 104, 104, 104, 104,
> +        104, 104, 104, 112, 112, 112, 112, 112,
> +        112, 112, 112, 112, 120, 120, 120, 120,
> +        120, 120, 120, 120, 120, 120, 120, 120,
> +        0, -120, -120, -120, -120, -120, -120, -120,
> +        -120, -120, -120, -120, -120, -112, -112, -112,
> +        -112, -112, -112, -112, -112, -112, -104, -104,
> +        -104, -104, -104, -104, -104, -104, -104, -104,
> +        -104, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -80, -80, -80, -80,
> +        -80, -80, -80, -80, -80, -80, -80, -80,
> +        -80, -64, -64, -64, -64, -64, -64, -64,
> +        -64, -64, -64, -64, -64, -64, -64, -64,
> +        -64, -48, -48, -48, -48, -48, -48, -48,
> +        -48, -48, -48, -48, -48, -48, -48, -48,
> +        -48, -48, -48, -48, -48, -48, -48, -48,
> +        -48, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
>  },
>  {	/* bi=5, bo=2 r=2.0:PSNR=43.175 */
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	88, 88, 88, 88, 88, 88, 88, 88,
> -	0, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, -88, -88, -88, -88, -88, -88, -88,
> -	-88, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> -	0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        88, 88, 88, 88, 88, 88, 88, 88,
> +        0, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, -88, -88, -88, -88, -88, -88, -88,
> +        -88, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
> +        0, 0, 0, 0, 0, 0, 0, 0,
>  }
>  };
>  
>  static const int8_t *zywrle_param[3][3][3]={
> -	{{zywrle_conv[0], zywrle_conv[2], zywrle_conv[0]},
> +        {{zywrle_conv[0], zywrle_conv[2], zywrle_conv[0]},
>           {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]},
>           {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}},
> -	{{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
> +        {{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
>           {zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]},
>           {zywrle_conv[0], zywrle_conv[0], zywrle_conv[0]}},
> -	{{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
> +        {{zywrle_conv[0], zywrle_conv[3], zywrle_conv[0]},
>           {zywrle_conv[2], zywrle_conv[2], zywrle_conv[2]},
>           {zywrle_conv[1], zywrle_conv[1], zywrle_conv[1]}},
>  };
> @@ -214,53 +214,53 @@ static const int8_t *zywrle_param[3][3][3]={
>  #define ZYWRLE_UVMASK15 0xFFFFFFF8
>  #define ZYWRLE_LOAD_PIXEL15(src, r, g, b)                               \
>      do {                                                                \
> -	r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
> -	g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
> +        r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
> +        g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
>          g &= 0xF8;                                                      \
> -	b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
> +        b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
>      } while (0)
>  
>  #define ZYWRLE_SAVE_PIXEL15(dst, r, g, b)                               \
>      do {                                                                \
> -	r &= 0xF8;                                                      \
> -	g &= 0xF8;                                                      \
> -	b &= 0xF8;                                                      \
> -	((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \
> -	((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
> +        r &= 0xF8;                                                      \
> +        g &= 0xF8;                                                      \
> +        b &= 0xF8;                                                      \
> +        ((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \
> +        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
>      } while (0)
>  
>  #define ZYWRLE_YMASK16  0xFFFFFFFC
>  #define ZYWRLE_UVMASK16 0xFFFFFFF8
>  #define ZYWRLE_LOAD_PIXEL16(src, r, g, b)                               \
>      do {                                                                \
> -	r = ((uint8_t*)src)[S_1] & 0xF8;                                \
> -	g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \
> +        r = ((uint8_t*)src)[S_1] & 0xF8;                                \
> +        g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \
>          g &= 0xFC;                                                      \
> -	b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \
> +        b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \
>      } while (0)
>  
>  #define ZYWRLE_SAVE_PIXEL16(dst, r, g,b)                                \
>      do {                                                                \
> -	r &= 0xF8;                                                      \
> -	g &= 0xFC;                                                      \
> -	b &= 0xF8;                                                      \
> -	((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5));                 \
> -	((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \
> +        r &= 0xF8;                                                      \
> +        g &= 0xFC;                                                      \
> +        b &= 0xF8;                                                      \
> +        ((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5));                 \
> +        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \
>      } while (0)
>  
>  #define ZYWRLE_YMASK32  0xFFFFFFFF
>  #define ZYWRLE_UVMASK32 0xFFFFFFFF
>  #define ZYWRLE_LOAD_PIXEL32(src, r, g, b)     \
>      do {                                      \
> -	r = ((uint8_t*)src)[L_2];             \
> -	g = ((uint8_t*)src)[L_1];             \
> -	b = ((uint8_t*)src)[L_0];             \
> +        r = ((uint8_t*)src)[L_2];             \
> +        g = ((uint8_t*)src)[L_1];             \
> +        b = ((uint8_t*)src)[L_0];             \
>      } while (0)
>  #define ZYWRLE_SAVE_PIXEL32(dst, r, g, b)             \
>      do {                                              \
> -	((uint8_t*)dst)[L_2] = (uint8_t)r;            \
> -	((uint8_t*)dst)[L_1] = (uint8_t)g;            \
> -	((uint8_t*)dst)[L_0] = (uint8_t)b;            \
> +        ((uint8_t*)dst)[L_2] = (uint8_t)r;            \
> +        ((uint8_t*)dst)[L_1] = (uint8_t)g;            \
> +        ((uint8_t*)dst)[L_0] = (uint8_t)b;            \
>      } while (0)
>  
>  static inline void harr(int8_t *px0, int8_t *px1)
> @@ -443,27 +443,27 @@ static inline void filter_wavelet_square(int *buf, int width, int height,
>  
>  static inline void wavelet(int *buf, int width, int height, int level)
>  {
> -	int l, s;
> -	int *top;
> -	int *end;
> -
> -	for (l = 0; l < level; l++) {
> -		top = buf;
> -		end = buf + height * width;
> -		s = width << l;
> -		while (top < end) {
> -			wavelet_level(top, width, l, 1);
> -			top += s;
> -		}
> -		top = buf;
> -		end = buf + width;
> -		s = 1<<l;
> -		while (top < end) {
> -			wavelet_level(top, height, l, width);
> -			top += s;
> -		}
> -		filter_wavelet_square(buf, width, height, level, l);
> -	}
> +        int l, s;
> +        int *top;
> +        int *end;
> +
> +        for (l = 0; l < level; l++) {
> +                top = buf;
> +                end = buf + height * width;
> +                s = width << l;
> +                while (top < end) {
> +                        wavelet_level(top, width, l, 1);
> +                        top += s;
> +                }
> +                top = buf;
> +                end = buf + width;
> +                s = 1<<l;
> +                while (top < end) {
> +                        wavelet_level(top, height, l, width);
> +                        top += s;
> +                }
> +                filter_wavelet_square(buf, width, height, level, l);
> +        }
>  }
>  
>  
> @@ -471,16 +471,16 @@ static inline void wavelet(int *buf, int width, int height, int level)
>   Coefficients manages as 24 bits little-endian pixel. */
>  #define ZYWRLE_LOAD_COEFF(src, r, g, b)         \
>      do {                                        \
> -	r = ((int8_t*)src)[2];                  \
> -	g = ((int8_t*)src)[1];                  \
> -	b = ((int8_t*)src)[0];                  \
> +        r = ((int8_t*)src)[2];                  \
> +        g = ((int8_t*)src)[1];                  \
> +        b = ((int8_t*)src)[0];                  \
>      } while (0)
>  
>  #define ZYWRLE_SAVE_COEFF(dst, r, g, b)       \
>      do {                                      \
> -	((int8_t*)dst)[2] = (int8_t)r;        \
> -	((int8_t*)dst)[1] = (int8_t)g;        \
> -	((int8_t*)dst)[0] = (int8_t)b;        \
> +        ((int8_t*)dst)[2] = (int8_t)r;        \
> +        ((int8_t*)dst)[1] = (int8_t)g;        \
> +        ((int8_t*)dst)[0] = (int8_t)b;        \
>      } while (0)
>  
>  /*
> @@ -502,22 +502,22 @@ static inline void wavelet(int *buf, int width, int height, int level)
>     More exact PLHarr, we reduce to odd range(-127<=x<=127). */
>  #define ZYWRLE_RGBYUV_(r, g, b, y, u, v, ymask, uvmask)          \
>      do {                                                         \
> -	y = (r + (g << 1) + b) >> 2;                             \
> -	u =  b - g;                                              \
> -	v =  r - g;                                              \
> -	y -= 128;                                                \
> -	u >>= 1;                                                 \
> -	v >>= 1;                                                 \
> -	y &= ymask;                                              \
> -	u &= uvmask;                                             \
> -	v &= uvmask;                                             \
> -	if (y == -128) {                                         \
> +        y = (r + (g << 1) + b) >> 2;                             \
> +        u =  b - g;                                              \
> +        v =  r - g;                                              \
> +        y -= 128;                                                \
> +        u >>= 1;                                                 \
> +        v >>= 1;                                                 \
> +        y &= ymask;                                              \
> +        u &= uvmask;                                             \
> +        v &= uvmask;                                             \
> +        if (y == -128) {                                         \
>              y += (0xFFFFFFFF - ymask + 1);                       \
>          }                                                        \
> -	if (u == -128) {                                         \
> +        if (u == -128) {                                         \
>              u += (0xFFFFFFFF - uvmask + 1);                      \
>          }                                                        \
> -	if (v == -128) {                                         \
> +        if (v == -128) {                                         \
>              v += (0xFFFFFFFF - uvmask + 1);                      \
>          }                                                        \
>      } while (0)
> 


ping

Paolo

Re: [Qemu-devel] [PATCH] ui: vnc: finish removing TABs
Posted by Daniel P. Berrangé 5 years, 3 months ago
On Tue, Dec 18, 2018 at 12:16:29AM +0100, Paolo Bonzini wrote:
> Suggested-by: Daniel P. Berrange <berrange@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  ui/vnc-enc-hextile-template.h | 268 +++++++++++------------
>  ui/vnc-enc-zywrle.h           | 394 +++++++++++++++++-----------------
>  2 files changed, 331 insertions(+), 331 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [Qemu-devel] [PATCH] ui: vnc: finish removing TABs
Posted by no-reply@patchew.org 5 years, 3 months ago
Patchew URL: https://patchew.org/QEMU/20181217231629.24147-1-pbonzini@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20181217231629.24147-1-pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH] ui: vnc: finish removing TABs

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20181217231629.24147-1-pbonzini@redhat.com -> patchew/20181217231629.24147-1-pbonzini@redhat.com
Switched to a new branch 'test'
21e3281 ui: vnc: finish removing TABs

=== OUTPUT BEGIN ===
ERROR: braces {} are necessary for all arms of this statement
#66: FILE: ui/vnc-enc-hextile-template.h:49:
+                    if (irow[i] == bg)
[...]
+                    else if (irow[i] == fg)
[...]

ERROR: braces {} are necessary for all arms of this statement
#68: FILE: ui/vnc-enc-hextile-template.h:51:
+                    else if (irow[i] == fg)
[...]

ERROR: braces {} are necessary for all arms of this statement
#76: FILE: ui/vnc-enc-hextile-template.h:59:
+        if (n_colors > 2)
[...]

ERROR: braces {} are necessary for all arms of this statement
#146: FILE: ui/vnc-enc-hextile-template.h:95:
+                    if (min_x == -1)
[...]

ERROR: braces {} are necessary for all arms of this statement
#172: FILE: ui/vnc-enc-hextile-template.h:117:
+        if (!*has_bg || *last_bg != bg)
[...]

ERROR: braces {} are necessary for all arms of this statement
#195: FILE: ui/vnc-enc-hextile-template.h:127:
+                    if (irow[i] == bg)
[...]

WARNING: Block comments use a leading /* on a separate line
#271: FILE: ui/vnc-enc-hextile-template.h:175:
+            /* we really don't have to invalidate either the bg or fg

WARNING: Block comments use * on subsequent lines
#272: FILE: ui/vnc-enc-hextile-template.h:176:
+            /* we really don't have to invalidate either the bg or fg
+               but we've lost the old values.  oh well. */

WARNING: Block comments use a trailing */ on a separate line
#272: FILE: ui/vnc-enc-hextile-template.h:176:
+               but we've lost the old values.  oh well. */

ERROR: braces {} are necessary for all arms of this statement
#301: FILE: ui/vnc-enc-hextile-template.h:192:
+        if (flags & 0x02)
[...]

ERROR: braces {} are necessary for all arms of this statement
#303: FILE: ui/vnc-enc-hextile-template.h:194:
+        if (flags & 0x04)
[...]

WARNING: Block comments use a trailing */ on a separate line
#339: FILE: ui/vnc-enc-zywrle.h:56:
+        {0x0000FF00, 0x00FFFFFF, 0x00FFFFFF}, */

ERROR: "(foo*)" should be "(foo *)"
#630: FILE: ui/vnc-enc-zywrle.h:217:
+        r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \

ERROR: spaces required around that '<<' (ctx:VxW)
#630: FILE: ui/vnc-enc-zywrle.h:217:
+        r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
                                  ^

ERROR: spaces required around that '&' (ctx:VxW)
#630: FILE: ui/vnc-enc-zywrle.h:217:
+        r = (((uint8_t*)src)[S_1]<< 1)& 0xF8;                           \
                                       ^

ERROR: "(foo*)" should be "(foo *)"
#631: FILE: ui/vnc-enc-zywrle.h:218:
+        g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \

ERROR: spaces required around that '<<' (ctx:VxW)
#631: FILE: ui/vnc-enc-zywrle.h:218:
+        g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
                                  ^

ERROR: spaces required around that '>>' (ctx:VxW)
#631: FILE: ui/vnc-enc-zywrle.h:218:
+        g = (((uint8_t*)src)[S_1]<< 6) | (((uint8_t*)src)[S_0]>> 2);    \
                                                               ^

ERROR: "(foo*)" should be "(foo *)"
#634: FILE: ui/vnc-enc-zywrle.h:220:
+        b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \

ERROR: spaces required around that '<<' (ctx:VxW)
#634: FILE: ui/vnc-enc-zywrle.h:220:
+        b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
                                   ^

ERROR: spaces required around that '&' (ctx:VxW)
#634: FILE: ui/vnc-enc-zywrle.h:220:
+        b =  (((uint8_t*)src)[S_0]<< 3)& 0xF8;                          \
                                        ^

ERROR: "(foo*)" should be "(foo *)"
#647: FILE: ui/vnc-enc-zywrle.h:228:
+        ((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \

ERROR: spaces required around that '|' (ctx:VxV)
#647: FILE: ui/vnc-enc-zywrle.h:228:
+        ((uint8_t*)dst)[S_1] = (uint8_t)((r >> 1)|(g >> 6));            \
                                                  ^

ERROR: "(foo*)" should be "(foo *)"
#648: FILE: ui/vnc-enc-zywrle.h:229:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \

ERROR: spaces required around that '|' (ctx:VxV)
#648: FILE: ui/vnc-enc-zywrle.h:229:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
                                                   ^

ERROR: spaces required around that '&' (ctx:VxW)
#648: FILE: ui/vnc-enc-zywrle.h:229:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 2))& 0xFF);    \
                                                             ^

ERROR: "(foo*)" should be "(foo *)"
#657: FILE: ui/vnc-enc-zywrle.h:236:
+        r = ((uint8_t*)src)[S_1] & 0xF8;                                \

ERROR: "(foo*)" should be "(foo *)"
#658: FILE: ui/vnc-enc-zywrle.h:237:
+        g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \

ERROR: spaces required around that '<<' (ctx:VxW)
#658: FILE: ui/vnc-enc-zywrle.h:237:
+        g = (((uint8_t*)src)[S_1]<< 5) | (((uint8_t*)src)[S_0] >> 3);   \
                                  ^

ERROR: "(foo*)" should be "(foo *)"
#661: FILE: ui/vnc-enc-zywrle.h:239:
+        b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \

ERROR: spaces required around that '<<' (ctx:VxW)
#661: FILE: ui/vnc-enc-zywrle.h:239:
+        b = (((uint8_t*)src)[S_0]<< 3) & 0xF8;                          \
                                  ^

ERROR: "(foo*)" should be "(foo *)"
#674: FILE: ui/vnc-enc-zywrle.h:247:
+        ((uint8_t*)dst)[S_1] = (uint8_t)(r | (g >> 5));                 \

ERROR: "(foo*)" should be "(foo *)"
#675: FILE: ui/vnc-enc-zywrle.h:248:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \

ERROR: spaces required around that '|' (ctx:VxV)
#675: FILE: ui/vnc-enc-zywrle.h:248:
+        ((uint8_t*)dst)[S_0] = (uint8_t)(((b >> 3)|(g << 3)) & 0xFF);   \
                                                   ^

ERROR: "(foo*)" should be "(foo *)"
#685: FILE: ui/vnc-enc-zywrle.h:255:
+        r = ((uint8_t*)src)[L_2];             \

ERROR: "(foo*)" should be "(foo *)"
#686: FILE: ui/vnc-enc-zywrle.h:256:
+        g = ((uint8_t*)src)[L_1];             \

ERROR: "(foo*)" should be "(foo *)"
#687: FILE: ui/vnc-enc-zywrle.h:257:
+        b = ((uint8_t*)src)[L_0];             \

ERROR: "(foo*)" should be "(foo *)"
#694: FILE: ui/vnc-enc-zywrle.h:261:
+        ((uint8_t*)dst)[L_2] = (uint8_t)r;            \

ERROR: "(foo*)" should be "(foo *)"
#695: FILE: ui/vnc-enc-zywrle.h:262:
+        ((uint8_t*)dst)[L_1] = (uint8_t)g;            \

ERROR: "(foo*)" should be "(foo *)"
#696: FILE: ui/vnc-enc-zywrle.h:263:
+        ((uint8_t*)dst)[L_0] = (uint8_t)b;            \

ERROR: spaces required around that '<<' (ctx:VxV)
#738: FILE: ui/vnc-enc-zywrle.h:460:
+                s = 1<<l;
                      ^

ERROR: "(foo*)" should be "(foo *)"
#755: FILE: ui/vnc-enc-zywrle.h:474:
+        r = ((int8_t*)src)[2];                  \

ERROR: "(foo*)" should be "(foo *)"
#756: FILE: ui/vnc-enc-zywrle.h:475:
+        g = ((int8_t*)src)[1];                  \

ERROR: "(foo*)" should be "(foo *)"
#757: FILE: ui/vnc-enc-zywrle.h:476:
+        b = ((int8_t*)src)[0];                  \

ERROR: "(foo*)" should be "(foo *)"
#765: FILE: ui/vnc-enc-zywrle.h:481:
+        ((int8_t*)dst)[2] = (int8_t)r;        \

ERROR: "(foo*)" should be "(foo *)"
#766: FILE: ui/vnc-enc-zywrle.h:482:
+        ((int8_t*)dst)[1] = (int8_t)g;        \

ERROR: "(foo*)" should be "(foo *)"
#767: FILE: ui/vnc-enc-zywrle.h:483:
+        ((int8_t*)dst)[0] = (int8_t)b;        \

total: 43 errors, 4 warnings, 778 lines checked

Commit 21e3281c3b64 (ui: vnc: finish removing TABs) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20181217231629.24147-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com