[vte/vte-0-62] keymap: Use int8_t for the length of the short keymap strings



commit c80a8693cd1ef30d91fd1c007f35df5d8c33c69d
Author: Christian Persch <chpe src gnome org>
Date:   Thu Feb 4 18:40:51 2021 +0100

    keymap: Use int8_t for the length of the short keymap strings
    
    ... instead of ssize_t.

 src/keymap.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/keymap.cc b/src/keymap.cc
index f6d68bbe..9c31bce5 100644
--- a/src/keymap.cc
+++ b/src/keymap.cc
@@ -19,6 +19,8 @@
 
 #include "config.h"
 
+#include <cassert>
+
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
@@ -74,7 +76,7 @@ struct _vte_keymap_entry {
        guint keypad_mode;
        guint mod_mask;
        const char normal[8];
-       gssize normal_length;
+        int8_t normal_length;
 };
 
 #define X_NULL ""
@@ -757,6 +759,7 @@ _vte_keymap_map(guint keyval,
        if ((modifiers & entries[i].mod_mask) == entries[i].mod_mask) {
                 if (entries[i].normal_length != -1) {
                         *normal_length = entries[i].normal_length;
+                        assert(entries[i].normal_length < G_MAXINT);
                         *normal = (char*)g_memdup(entries[i].normal,
                                                   entries[i].normal_length);
                 } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]