[vte] keymap: Use int8_t for the length of the short keymap strings



commit 7619bf481882ec34ddcc1da6dfbb05891fc047ab
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 2944ef56..a2daf796 100644
--- a/src/keymap.cc
+++ b/src/keymap.cc
@@ -18,6 +18,8 @@
 
 #include "config.h"
 
+#include <cassert>
+
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
@@ -73,7 +75,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 ""
@@ -756,6 +758,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]