- maximum length of user shortcut string set to 20

- old-style user shortcut detection fixed
- bx_param_string_c value needs one byte more space for the final null character
This commit is contained in:
Volker Ruppert 2005-10-22 08:07:53 +00:00
parent feb97a65a0
commit 3658399a4a
4 changed files with 14 additions and 12 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.49 2005-10-15 10:43:55 vruppert Exp $ // $Id: config.cc,v 1.50 2005-10-22 08:07:53 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -1612,7 +1612,7 @@ void bx_init_options ()
bx_options.Ouser_shortcut = new bx_param_string_c (BXP_USER_SHORTCUT, bx_options.Ouser_shortcut = new bx_param_string_c (BXP_USER_SHORTCUT,
"Userbutton shortcut", "Userbutton shortcut",
"Defines the keyboard shortcut to be sent when you press the 'user' button in the headerbar.", "Defines the keyboard shortcut to be sent when you press the 'user' button in the headerbar.",
"none", 16); "none", 20);
bx_options.Ouser_shortcut->set_runtime_param (1); bx_options.Ouser_shortcut->set_runtime_param (1);
// GDB stub // GDB stub
@ -3166,7 +3166,7 @@ parse_line_formatted(char *context, int num_params, char *params[])
} }
if(!strncmp(params[1], "keys=", 4)) { if(!strncmp(params[1], "keys=", 4)) {
bx_options.Ouser_shortcut->set (strdup(&params[1][5])); bx_options.Ouser_shortcut->set (strdup(&params[1][5]));
if (strchr(&params[1][5], '-') == NULL) if ((strchr(&params[1][5], '-') == NULL) && (strlen(&params[1][5]) > 5))
PARSE_WARN(("user_shortcut: old-style syntax detected")); PARSE_WARN(("user_shortcut: old-style syntax detected"));
} else { } else {
PARSE_ERR(("%s: user_shortcut directive malformed.", context)); PARSE_ERR(("%s: user_shortcut directive malformed.", context));

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.85 2005-10-21 18:00:17 vruppert Exp $ // $Id: gui.cc,v 1.86 2005-10-22 08:07:53 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -557,7 +557,8 @@ bx_gui_c::userbutton_handler(void)
strcpy(user_shortcut, bx_options.Ouser_shortcut->getptr()); strcpy(user_shortcut, bx_options.Ouser_shortcut->getptr());
if ((ret > 0) && user_shortcut[0] && (strcmp(user_shortcut, "none"))) { if ((ret > 0) && user_shortcut[0] && (strcmp(user_shortcut, "none"))) {
ptr = strtok(user_shortcut, "-"); ptr = strtok(user_shortcut, "-");
if (strcmp(ptr, bx_options.Ouser_shortcut->getptr())) { if ((strcmp(ptr, bx_options.Ouser_shortcut->getptr())) ||
(strlen(bx_options.Ouser_shortcut->getptr()) < 6)) {
while (ptr) { while (ptr) {
symbol = get_user_key(ptr); symbol = get_user_key(ptr);
if (symbol == BX_KEY_UNKNOWN) { if (symbol == BX_KEY_UNKNOWN) {

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: siminterface.cc,v 1.110 2005-10-15 10:43:55 vruppert Exp $ // $Id: siminterface.cc,v 1.111 2005-10-22 08:07:53 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// See siminterface.h for description of the siminterface concept. // See siminterface.h for description of the siminterface concept.
@ -1200,14 +1200,15 @@ bx_param_string_c::bx_param_string_c (bx_id id,
{ {
set_type (BXT_PARAM_STRING); set_type (BXT_PARAM_STRING);
if (maxsize < 0) if (maxsize < 0)
maxsize = strlen(initial_val) + 1; maxsize = strlen(initial_val);
this->val = new char[maxsize]; this->val = new char[maxsize + 1];
this->initial_val = new char[maxsize]; this->initial_val = new char[maxsize + 1];
this->handler = NULL; this->handler = NULL;
this->enable_handler = NULL; this->enable_handler = NULL;
this->maxsize = maxsize; this->maxsize = maxsize;
strncpy (this->val, initial_val, maxsize); strncpy (this->val, initial_val, maxsize);
strncpy (this->initial_val, initial_val, maxsize); strncpy (this->initial_val, initial_val, maxsize);
this->val[maxsize] = 0;
this->options = new bx_param_num_c (BXP_NULL, this->options = new bx_param_num_c (BXP_NULL,
"stringoptions", NULL, 0, BX_MAX_BIT64S, 0); "stringoptions", NULL, 0, BX_MAX_BIT64S, 0);
set (initial_val); set (initial_val);

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: x.cc,v 1.93 2005-10-21 18:00:17 vruppert Exp $ // $Id: x.cc,v 1.94 2005-10-22 08:07:53 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -2085,7 +2085,7 @@ int x11_string_dialog(bx_param_string_c *param)
int valid = 0, control = 0, oldctrl = -1; int valid = 0, control = 0, oldctrl = -1;
int done, i; int done, i;
unsigned long black_pixel, white_pixel; unsigned long black_pixel, white_pixel;
char editstr[80], name[80], text[10], value[80]; char editstr[24], name[80], text[10], value[24];
strcpy(name, param->get_name()); strcpy(name, param->get_name());
strcpy(value, param->getptr()); strcpy(value, param->getptr());
@ -2179,7 +2179,7 @@ int x11_string_dialog(bx_param_string_c *param)
value[strlen(value)-1] = 0; value[strlen(value)-1] = 0;
oldctrl = -1; oldctrl = -1;
} }
} else if ((i == 1) && (strlen(value) < 40)) { } else if ((i == 1) && (strlen(value) < 20)) {
strcat(value, text); strcat(value, text);
oldctrl = -1; oldctrl = -1;
} }