]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - keys.c
gave names to nearly all structs and enums which should make for better C++ error...
[xonotic/darkplaces.git] / keys.c
diff --git a/keys.c b/keys.c
index 4be917f352ad3a9412ce74101d798fd67c06fc7a..7a218b58039d0cb1f3deb7d4da0ed3d99e6dd7c5 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -39,10 +39,12 @@ char                *keybindings[MAX_BINDMAPS][MAX_KEYS];
 static int     key_bmap, key_bmap2;
 static qbyte keydown[MAX_KEYS];        // 0 = up, 1 = down, 2 = repeating
 
-typedef struct {
+typedef struct keyname_s
+{
        const char      *name;
        int                     keynum;
-} keyname_t;
+}
+keyname_t;
 
 static const keyname_t   keynames[] = {
        {"TAB", K_TAB},
@@ -348,7 +350,7 @@ Key_Console (int key, char ascii)
        // delete char on cursor
        if (key == K_DEL || key == K_KP_DEL)
        {
-               if ((size_t)key_linepos < strlen(key_lines[edit_line]))
+               if (key_linepos < (int)strlen(key_lines[edit_line]))
                        strcpy(key_lines[edit_line] + key_linepos, key_lines[edit_line] + key_linepos + 1);
                return;
        }
@@ -358,7 +360,7 @@ Key_Console (int key, char ascii)
        // otherwise just go right one
        if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW)
        {
-               if ((size_t)key_linepos < strlen(key_lines[edit_line]))
+               if (key_linepos < (int)strlen(key_lines[edit_line]))
                        key_linepos++;
 
                return;
@@ -553,7 +555,7 @@ Key_KeynumToString (int keynum)
 void
 Key_SetBinding (int keynum, int bindmap, const char *binding)
 {
-       char *new;
+       char *newbinding;
        size_t l;
 
        if (keynum == -1)
@@ -566,10 +568,10 @@ Key_SetBinding (int keynum, int bindmap, const char *binding)
        }
 // allocate memory for new binding
        l = strlen (binding);
-       new = Z_Malloc (l + 1);
-       strcpy (new, binding);
-       new[l] = 0;
-       keybindings[bindmap][keynum] = new;
+       newbinding = (char *)Z_Malloc (l + 1);
+       strcpy (newbinding, binding);
+       newbinding[l] = 0;
+       keybindings[bindmap][keynum] = newbinding;
 }
 
 static void