Skip to contentSkip to conversation

vnc patch queue

GIT PULL Applied Gerd Hoffmann 2 participants 4 messages Dec 10, 2014 – Dec 11, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

Starting to flush queues after the 2.2 release, starting with two little vnc fixes. Well, keymap is strictly speaking not vnc, but vnc is the major user of keymap support, so I sticked it in here.

please pull,
Gerd

The following changes since commit 45e1611de8be0eae55967694dd6e627c2dc354f2:

Update version for v2.2.0 release (2014-12-09 12:13:37 +0000)

are available in the git repository at:

git://git.kraxel.org/qemu tags/pull-vnc-20141210-1

for you to fetch changes up to 43948386bb109b97b3de0bb48573f317bdcb5008:

keymaps: correct keymaps.c following Qemu coding style (2014-12-10 10:08:12 +0100)

----------------------------------------------------------------
vnc-enc-tight fix, keymaps code style.

----------------------------------------------------------------
Gonglei (2):
vnc-enc-tight: fix Arguments in wrong order
keymaps: correct keymaps.c following Qemu coding style

 ui/keymaps.c       | 196 +++++++++++++++++++++++++++++------------------------
 ui/vnc-enc-tight.c |   2 +-
 2 files changed, 109 insertions(+), 89 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/2] vnc-enc-tight: fix Arguments in wrong order

From: Gonglei <[email protected]>

Arguments in wrong order (SWAPPED_ARGUMENTS)
The positions of arguments in the call to tight_fill_palette do not match the ordering of the parameters:
&fg is passed to bg
&bg is passed to fg

---
 ui/vnc-enc-tight.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/vnc-enc-tight.c +1 -1
index 3d1b5cd..9a9ddf2 100644
@@ -1489,7 +1489,7 @@ static int send_sub_rect(VncState *vs, int x, int y, int w, int h)
     }
 #endif
 
-    colors = tight_fill_palette(vs, x, y, w * h, &fg, &bg, &palette);
+    colors = tight_fill_palette(vs, x, y, w * h, &bg, &fg, &palette);
 
 #ifdef CONFIG_VNC_JPEG
     if (allow_jpeg && vs->tight.quality != (uint8_t)-1) {
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL 2/2] keymaps: correct keymaps.c following Qemu coding style

In reply to Gerd Hoffmann

From: Gonglei <[email protected]>

It's hard to read because of the confused coding style in this file. Let's correct it following Qemu coding style.

---
 ui/keymaps.c | 196 ++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 108 insertions(+), 88 deletions(-)
ui/keymaps.c +108 -88
index 80d658d..49410ae 100644
@@ -26,18 +26,20 @@
 #include "sysemu/sysemu.h"
 
 static int get_keysym(const name2keysym_t *table,
-		      const char *name)
+                      const char *name)
 {
     const name2keysym_t *p;
     for(p = table; p->name != NULL; p++) {
-        if (!strcmp(p->name, name))
+        if (!strcmp(p->name, name)) {
             return p->keysym;
+        }
     }
     if (name[0] == 'U' && strlen(name) == 5) { /* try unicode Uxxxx */
         char *end;
         int ret = (int)strtoul(name + 1, &end, 16);
-        if (*end == '\0' && ret > 0)
-          return ret;
+        if (*end == '\0' && ret > 0) {
+            return ret;
+        }
     }
     return 0;
 }
@@ -46,19 +48,20 @@ static int get_keysym(const name2keysym_t *table,
 static void add_to_key_range(struct key_range **krp, int code) {
     struct key_range *kr;
     for (kr = *krp; kr; kr = kr->next) {
-	if (code >= kr->start && code <= kr->end)
-	    break;
-	if (code == kr->start - 1) {
-	    kr->start--;
-	    break;
-	}
-	if (code == kr->end + 1) {
-	    kr->end++;
-	    break;
-	}
+        if (code >= kr->start && code <= kr->end) {
+            break;
+        }
+        if (code == kr->start - 1) {
+            kr->start--;
+            break;
+        }
+        if (code == kr->end + 1) {
+            kr->end++;
+            break;
+        }
     }
     if (kr == NULL) {
-	kr = g_malloc0(sizeof(*kr));
+        kr = g_malloc0(sizeof(*kr));
         kr->start = kr->end = code;
         kr->next = *krp;
         *krp = kr;
@@ -67,30 +70,30 @@ static void add_to_key_range(struct key_range **krp, int code) {
 
 static void add_keysym(char *line, int keysym, int keycode, kbd_layout_t *k) {
     if (keysym < MAX_NORMAL_KEYCODE) {
-	//fprintf(stderr,"Setting keysym %s (%d) to %d\n",line,keysym,keycode);
-	k->keysym2keycode[keysym] = keycode;
+        /* fprintf(stderr,"Setting keysym %s (%d) to %d\n",
+                   line, keysym, keycode); */
+        k->keysym2keycode[keysym] = keycode;
     } else {
-	if (k->extra_count >= MAX_EXTRA_COUNT) {
-	    fprintf(stderr,
-		    "Warning: Could not assign keysym %s (0x%x) because of memory constraints.\n",
-		    line, keysym);
-	} else {
+        if (k->extra_count >= MAX_EXTRA_COUNT) {
+            fprintf(stderr, "Warning: Could not assign keysym %s (0x%x)"
+                    " because of memory constraints.\n", line, keysym);
+        } else {
 #if 0
-	    fprintf(stderr, "Setting %d: %d,%d\n",
-		    k->extra_count, keysym, keycode);
+            fprintf(stderr, "Setting %d: %d,%d\n",
+                    k->extra_count, keysym, keycode);
 #endif
-	    k->keysym2keycode_extra[k->extra_count].
-		keysym = keysym;
-	    k->keysym2keycode_extra[k->extra_count].
-		keycode = keycode;
-	    k->extra_count++;
-	}
+            k->keysym2keycode_extra[k->extra_count].
+            keysym = keysym;
+            k->keysym2keycode_extra[k->extra_count].
+            keycode = keycode;
+            k->extra_count++;
+        }
     }
 }
 
 static kbd_layout_t *parse_keyboard_layout(const name2keysym_t *table,
-					   const char *language,
-					   kbd_layout_t * k)
+                                           const char *language,
+                                           kbd_layout_t *k)
 {
     FILE *f;
     char * filename;
@@ -101,69 +104,78 @@ static kbd_layout_t *parse_keyboard_layout(const name2keysym_t *table,
     f = filename ? fopen(filename, "r") : NULL;
     g_free(filename);
     if (!f) {
-	fprintf(stderr,
-		"Could not read keymap file: '%s'\n", language);
-	return NULL;
+        fprintf(stderr, "Could not read keymap file: '%s'\n", language);
+        return NULL;
     }
 
-    if (!k)
-	k = g_malloc0(sizeof(kbd_layout_t));
+    if (!k) {
+        k = g_malloc0(sizeof(kbd_layout_t));
+    }
 
     for(;;) {
-	if (fgets(line, 1024, f) == NULL)
+        if (fgets(line, 1024, f) == NULL) {
             break;
+        }
         len = strlen(line);
-        if (len > 0 && line[len - 1] == '\n')
+        if (len > 0 && line[len - 1] == '\n') {
             line[len - 1] = '\0';
-        if (line[0] == '#')
-	    continue;
-	if (!strncmp(line, "map ", 4))
-	    continue;
-	if (!strncmp(line, "include ", 8)) {
-	    parse_keyboard_layout(table, line + 8, k);
+        }
+        if (line[0] == '#') {
+            continue;
+        }
+        if (!strncmp(line, "map ", 4)) {
+            continue;
+        }
+        if (!strncmp(line, "include ", 8)) {
+            parse_keyboard_layout(table, line + 8, k);
         } else {
-	    char *end_of_keysym = line;
-	    while (*end_of_keysym != 0 && *end_of_keysym != ' ')
-		end_of_keysym++;
-	    if (*end_of_keysym) {
-		int keysym;
-		*end_of_keysym = 0;
-		keysym = get_keysym(table, line);
-		if (keysym == 0) {
-                    //		    fprintf(stderr, "Warning: unknown keysym %s\n", line);
-		} else {
-		    const char *rest = end_of_keysym + 1;
+            char *end_of_keysym = line;
+            while (*end_of_keysym != 0 && *end_of_keysym != ' ') {
+                end_of_keysym++;
+            }
+            if (*end_of_keysym) {
+                int keysym;
+                *end_of_keysym = 0;
+                keysym = get_keysym(table, line);
+                if (keysym == 0) {
+                    /* fprintf(stderr, "Warning: unknown keysym %s\n", line);*/
+                } else {
+                    const char *rest = end_of_keysym + 1;
                     int keycode = strtol(rest, NULL, 0);
 
                     if (strstr(rest, "numlock")) {
-			add_to_key_range(&k->keypad_range, keycode);
-			add_to_key_range(&k->numlock_range, keysym);
-			//fprintf(stderr, "keypad keysym %04x keycode %d\n", keysym, keycode);
-		    }
+                        add_to_key_range(&k->keypad_range, keycode);
+                        add_to_key_range(&k->numlock_range, keysym);
+                        /* fprintf(stderr, "keypad keysym %04x keycode %d\n",
+                                   keysym, keycode); */
+                    }
 
                     if (strstr(rest, "shift")) {
-			keycode |= SCANCODE_SHIFT;
+                        keycode |= SCANCODE_SHIFT;
                     }
                     if (strstr(rest, "altgr")) {
-			keycode |= SCANCODE_ALTGR;
+                        keycode |= SCANCODE_ALTGR;
                     }
                     if (strstr(rest, "ctrl")) {
-			keycode |= SCANCODE_CTRL;
+                        keycode |= SCANCODE_CTRL;
                     }
 
-		    add_keysym(line, keysym, keycode, k);
+                    add_keysym(line, keysym, keycode, k);
 
                     if (strstr(rest, "addupper")) {
-			char *c;
-			for (c = line; *c; c++)
-			    *c = qemu_toupper(*c);
-			keysym = get_keysym(table, line);
-			if (keysym)
-			    add_keysym(line, keysym, keycode | SCANCODE_SHIFT, k);
-		    }
-		}
-	    }
-	}
+                        char *c;
+                        for (c = line; *c; c++) {
+                            *c = qemu_toupper(*c);
+                        }
+                        keysym = get_keysym(table, line);
+                        if (keysym) {
+                            add_keysym(line, keysym,
+                                       keycode | SCANCODE_SHIFT, k);
+                        }
+                    }
+                }
+            }
+        }
     }
     fclose(f);
     return k;
@@ -180,19 +192,23 @@ int keysym2scancode(void *kbd_layout, int keysym)
 {
     kbd_layout_t *k = kbd_layout;
     if (keysym < MAX_NORMAL_KEYCODE) {
-	if (k->keysym2keycode[keysym] == 0)
-	    fprintf(stderr, "Warning: no scancode found for keysym %d\n",
-		    keysym);
-	return k->keysym2keycode[keysym];
+        if (k->keysym2keycode[keysym] == 0) {
+            fprintf(stderr, "Warning: no scancode found for keysym %d\n",
+                    keysym);
+        }
+        return k->keysym2keycode[keysym];
     } else {
-	int i;
+        int i;
 #ifdef XK_ISO_Left_Tab
-	if (keysym == XK_ISO_Left_Tab)
-	    keysym = XK_Tab;
+        if (keysym == XK_ISO_Left_Tab) {
+            keysym = XK_Tab;
+        }
 #endif
-	for (i = 0; i < k->extra_count; i++)
-	    if (k->keysym2keycode_extra[i].keysym == keysym)
-		return k->keysym2keycode_extra[i].keycode;
+        for (i = 0; i < k->extra_count; i++) {
+            if (k->keysym2keycode_extra[i].keysym == keysym) {
+                return k->keysym2keycode_extra[i].keycode;
+            }
+        }
     }
     return 0;
 }
@@ -202,9 +218,11 @@ int keycode_is_keypad(void *kbd_layout, int keycode)
     kbd_layout_t *k = kbd_layout;
     struct key_range *kr;
 
-    for (kr = k->keypad_range; kr; kr = kr->next)
-        if (keycode >= kr->start && keycode <= kr->end)
+    for (kr = k->keypad_range; kr; kr = kr->next) {
+        if (keycode >= kr->start && keycode <= kr->end) {
             return 1;
+        }
+    }
     return 0;
 }
 
@@ -213,8 +231,10 @@ int keysym_is_numlock(void *kbd_layout, int keysym)
     kbd_layout_t *k = kbd_layout;
     struct key_range *kr;
 
-    for (kr = k->numlock_range; kr; kr = kr->next)
-        if (keysym >= kr->start && keysym <= kr->end)
+    for (kr = k->numlock_range; kr; kr = kr->next) {
+        if (keysym >= kr->start && keysym <= kr->end) {
             return 1;
+        }
+    }
     return 0;
 }
Signature · 1 line
1.8.3.1
#3 lore raw
In reply to Gerd Hoffmann
Quoted 17 lines · Gerd Hoffmann

Hi,

Starting to flush queues after the 2.2 release, starting with two little vnc fixes. Well, keymap is strictly speaking not vnc, but vnc is the major user of keymap support, so I sticked it in here.

please pull,
Gerd

The following changes since commit 45e1611de8be0eae55967694dd6e627c2dc354f2:

Update version for v2.2.0 release (2014-12-09 12:13:37 +0000)

are available in the git repository at:

git://git.kraxel.org/qemu tags/pull-vnc-20141210-1

Quoted 8 lines

for you to fetch changes up to 43948386bb109b97b3de0bb48573f317bdcb5008:

keymaps: correct keymaps.c following Qemu coding style (2014-12-10 10:08:12 +0100)

----------------------------------------------------------------
vnc-enc-tight fix, keymaps code style.

----------------------------------------------------------------

Applied, thanks.

-- PMM