Fixed another issue reported by valgrind and some tab2space changes.
This commit is contained in:
parent
0c24af112d
commit
e6f0e7f328
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2013 The Bochs Project
|
||||
// Copyright (C) 2002-2020 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -148,28 +148,30 @@ static Bit32s get_next_word(char *output)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Bit32s get_next_keymap_line (FILE *fp, char *bxsym, char *modsym, Bit32s *ascii, char *hostsym)
|
||||
static Bit32s get_next_keymap_line(FILE *fp, char *bxsym, char *modsym, Bit32s *ascii, char *hostsym)
|
||||
{
|
||||
char line[256];
|
||||
char buf[256];
|
||||
line[0] = 0;
|
||||
|
||||
buf[0] = 0;
|
||||
while (1) {
|
||||
lineCount++;
|
||||
if (!fgets(line, sizeof(line)-1, fp)) return -1; // EOF
|
||||
init_parse_line (line);
|
||||
if (get_next_word (bxsym) >= 0) {
|
||||
line[sizeof(line) - 1] = '\0';
|
||||
init_parse_line(line);
|
||||
if (get_next_word(bxsym) >= 0) {
|
||||
modsym[0] = 0;
|
||||
char *p;
|
||||
if ((p = strchr (bxsym, '+')) != NULL) {
|
||||
if ((p = strchr(bxsym, '+')) != NULL) {
|
||||
*p = 0; // truncate bxsym.
|
||||
p++; // move one char beyond the +
|
||||
strcpy (modsym, p); // copy the rest to modsym
|
||||
strcpy(modsym, p); // copy the rest to modsym
|
||||
}
|
||||
if (get_next_word (buf) < 0) {
|
||||
BX_PANIC (("keymap line %d: expected 3 columns", lineCount));
|
||||
if (get_next_word(buf) < 0) {
|
||||
BX_PANIC(("keymap line %d: expected 3 columns", lineCount));
|
||||
return -1;
|
||||
}
|
||||
if (buf[0] == '\'' && buf[2] == '\'' && buf[3]==0) {
|
||||
if (buf[0] == '\'' && buf[2] == '\'' && buf[3] == 0) {
|
||||
*ascii = (Bit8u) buf[1];
|
||||
} else if (!strcmp(buf, "space")) {
|
||||
*ascii = ' ';
|
||||
@ -184,9 +186,9 @@ static Bit32s get_next_keymap_line (FILE *fp, char *bxsym, char *modsym, Bit32s
|
||||
} else if (!strcmp(buf, "none")) {
|
||||
*ascii = -1;
|
||||
} else {
|
||||
BX_PANIC (("keymap line %d: ascii equivalent is \"%s\" but it must be char constant like 'x', or one of space,tab,return,none", lineCount, buf));
|
||||
BX_PANIC(("keymap line %d: ascii equivalent is \"%s\" but it must be char constant like 'x', or one of space,tab,return,none", lineCount, buf));
|
||||
}
|
||||
if (get_next_word (hostsym) < 0) {
|
||||
if (get_next_word(hostsym) < 0) {
|
||||
BX_PANIC (("keymap line %d: expected 3 columns", lineCount));
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user