* key.c (push_char): Fix buffer length calculation.
By drk@sgi.com. http://bugzilla.gnome.org/show_bug.cgi?id=60932 (define_sequence): Likewise. (key_define_t): Add const declaration.
Этот коммит содержится в:
родитель
9bdfa6d833
Коммит
58f1577542
@ -1,3 +1,12 @@
|
|||||||
|
2001-10-26 Andrew V. Samoilov <kai@cmail.ru>
|
||||||
|
|
||||||
|
* key.c (push_char): Fix buffer length calculation.
|
||||||
|
By drk@sgi.com.
|
||||||
|
http://bugzilla.gnome.org/show_bug.cgi?id=60932
|
||||||
|
|
||||||
|
(define_sequence): Likewise.
|
||||||
|
(key_define_t): Add const declaration.
|
||||||
|
|
||||||
2001-10-22 Pavel Roskin <proski@gnu.org>
|
2001-10-22 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* main.h: Declare view_one_file and edit_one_file.
|
* main.h: Declare view_one_file and edit_one_file.
|
||||||
|
@ -165,7 +165,7 @@ void channels_up (void)
|
|||||||
disabled_channels--;
|
disabled_channels--;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef const struct {
|
||||||
int code;
|
int code;
|
||||||
char *seq;
|
char *seq;
|
||||||
int action;
|
int action;
|
||||||
@ -354,7 +354,8 @@ static key_def *create_sequence (char *seq, int code, int action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The maximum sequence length (32 + null terminator) */
|
/* The maximum sequence length (32 + null terminator) */
|
||||||
static int seq_buffer [33];
|
#define SEQ_BUFFER_LEN 33
|
||||||
|
static int seq_buffer [SEQ_BUFFER_LEN];
|
||||||
static int *seq_append = 0;
|
static int *seq_append = 0;
|
||||||
|
|
||||||
static int push_char (int c)
|
static int push_char (int c)
|
||||||
@ -362,7 +363,7 @@ static int push_char (int c)
|
|||||||
if (!seq_append)
|
if (!seq_append)
|
||||||
seq_append = seq_buffer;
|
seq_append = seq_buffer;
|
||||||
|
|
||||||
if (seq_append == &(seq_buffer [sizeof (seq_buffer)-2]))
|
if (seq_append == &(seq_buffer [SEQ_BUFFER_LEN-2]))
|
||||||
return 0;
|
return 0;
|
||||||
*(seq_append++) = c;
|
*(seq_append++) = c;
|
||||||
*seq_append = 0;
|
*seq_append = 0;
|
||||||
@ -377,7 +378,7 @@ int define_sequence (int code, char *seq, int action)
|
|||||||
{
|
{
|
||||||
key_def *base;
|
key_def *base;
|
||||||
|
|
||||||
if (strlen (seq) > sizeof (seq_buffer)-1)
|
if (strlen (seq) > SEQ_BUFFER_LEN-1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (base = keys; (base != 0) && *seq; ){
|
for (base = keys; (base != 0) && *seq; ){
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user