1
1

* syntax.c(this_try_alloc_color_pair): Use g_strlcpy instead

sequence strncpy(), name[len] = '\0'
(edit_read_syntax_rules):Likewise.
Этот коммит содержится в:
Andrew V. Samoilov 2004-09-01 18:37:14 +00:00
родитель de59cf86c4
Коммит 83de09639c
2 изменённых файлов: 14 добавлений и 16 удалений

Просмотреть файл

@ -1,3 +1,9 @@
2004-09-01 Pavel S. Shirshov <pavelsh@mail.ru>
* syntax.c(this_try_alloc_color_pair): Use g_strlcpy instead
sequence strncpy(), name[len] = '\0'
(edit_read_syntax_rules):Likewise.
2004-08-29 Roland Illig <roland.illig@gmx.de> 2004-08-29 Roland Illig <roland.illig@gmx.de>
* Code cleanup: Added const qualifier for variables and * Code cleanup: Added const qualifier for variables and

Просмотреть файл

@ -593,16 +593,14 @@ this_try_alloc_color_pair (char *fg, char *bg)
if (!*fg) if (!*fg)
fg = 0; fg = 0;
if (fg) { if (fg) {
strncpy (f, fg, sizeof (f) - 1); g_strlcpy (f, fg, sizeof (f));
f[sizeof (f) - 1] = 0;
p = strchr (f, '/'); p = strchr (f, '/');
if (p) if (p)
*p = '\0'; *p = '\0';
fg = f; fg = f;
} }
if (bg) { if (bg) {
strncpy (b, bg, sizeof (b) - 1); g_strlcpy (b, bg, sizeof (b));
b[sizeof (b) - 1] = 0;
p = strchr (b, '/'); p = strchr (b, '/');
if (p) if (p)
*p = '\0'; *p = '\0';
@ -705,17 +703,13 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args)
check_a; check_a;
if (!strcmp (*a, "left")) { if (!strcmp (*a, "left")) {
a++; a++;
strncpy (whole_left, *a, sizeof (whole_left) - 1); g_strlcpy (whole_left, *a, sizeof (whole_left));
whole_left[sizeof (whole_left) - 1] = 0;
} else if (!strcmp (*a, "right")) { } else if (!strcmp (*a, "right")) {
a++; a++;
strncpy (whole_right, *a, sizeof (whole_right) - 1); g_strlcpy (whole_right, *a, sizeof (whole_right));
whole_right[sizeof (whole_right) - 1] = 0;
} else { } else {
strncpy (whole_left, *a, sizeof (whole_left) - 1); g_strlcpy (whole_left, *a, sizeof (whole_left));
whole_left[sizeof (whole_left) - 1] = 0; g_strlcpy (whole_right, *a, sizeof (whole_right));
strncpy (whole_right, *a, sizeof (whole_right) - 1);
whole_right[sizeof (whole_right) - 1] = 0;
} }
a++; a++;
check_not_a; check_not_a;
@ -777,10 +771,8 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args)
bg = *a; bg = *a;
if (*a) if (*a)
a++; a++;
strncpy (last_fg, fg ? fg : "", sizeof (last_fg) - 1); g_strlcpy (last_fg, fg ? fg : "", sizeof (last_fg));
last_fg[sizeof (last_fg) - 1] = 0; g_strlcpy (last_bg, bg ? bg : "", sizeof (last_bg));
strncpy (last_bg, bg ? bg : "", sizeof (last_bg) - 1);
last_bg[sizeof (last_bg) - 1] = 0;
c->keyword[0]->color = this_try_alloc_color_pair (fg, bg); c->keyword[0]->color = this_try_alloc_color_pair (fg, bg);
c->keyword[0]->keyword = g_strdup (" "); c->keyword[0]->keyword = g_strdup (" ");
check_not_a; check_not_a;