From 486038e9b47c04d12902ada36863619145521cc2 Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Sat, 23 Nov 2002 17:26:55 +0000 Subject: [PATCH] * editoptions.c (edit_options_dialog): Clean up and use g_snprintf() instead of sprintf(). --- edit/ChangeLog | 5 +++++ edit/editoptions.c | 28 +++++++++++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/edit/ChangeLog b/edit/ChangeLog index 304e9d400..2d24adb82 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,3 +1,8 @@ +2002-11-23 Andrew V. Samoilov + + * editoptions.c (edit_options_dialog): Clean up and use g_snprintf() + instead of sprintf(). + 2002-11-14 Pavel Roskin * edit.h: Decentralize includes. diff --git a/edit/editoptions.c b/edit/editoptions.c index 72273cf7a..fc1ee27ee 100644 --- a/edit/editoptions.c +++ b/edit/editoptions.c @@ -123,8 +123,9 @@ void edit_options_dialog (void) i18n_flag = 1; } - sprintf (wrap_length, "%d", option_word_wrap_line_length); - sprintf (tab_spacing, "%d", option_tab_spacing); + g_snprintf (wrap_length, sizeof (wrap_length), "%d", + option_word_wrap_line_length); + g_snprintf (tab_spacing, sizeof (tab_spacing), "%d", option_tab_spacing); quick_widgets[3].text = wrap_length; quick_widgets[3].str_result = &p; @@ -169,17 +170,18 @@ void edit_options_dialog (void) option_tab_spacing = 8; free (q); } - option_syntax_highlighting = *quick_widgets[5 + OA].result; - edit_confirm_save = *quick_widgets[6 + OA].result; - option_fill_tabs_with_spaces = *quick_widgets[7 + OA].result; - option_return_does_auto_indent = *quick_widgets[8 + OA].result; - option_backspace_through_tabs = *quick_widgets[9 + OA].result; - option_fake_half_tabs = *quick_widgets[10 + OA].result; - if (*quick_widgets[11 + OA].result == 1) { + option_syntax_highlighting = tedit_syntax_highlighting; + edit_confirm_save = tedit_confirm_save; + option_fill_tabs_with_spaces = toption_fill_tabs_with_spaces; + option_return_does_auto_indent = toption_return_does_auto_indent; + option_backspace_through_tabs = toption_backspace_through_tabs; + option_fake_half_tabs = toption_fake_half_tabs; + + if (wrap_mode == 1) { option_auto_para_formatting = 1; option_typewriter_wrap = 0; - } else if (*quick_widgets[11 + OA].result == 2) { + } else if (wrap_mode == 2) { option_auto_para_formatting = 0; option_typewriter_wrap = 1; } else { @@ -187,15 +189,11 @@ void edit_options_dialog (void) option_typewriter_wrap = 0; } - edit_key_emulation = *quick_widgets[13 + OA].result; + edit_key_emulation = tedit_key_emulation; /* Load or unload syntax rules if the option has changed */ if (option_syntax_highlighting != old_syntax_hl) edit_load_syntax (wedit, 0, 0); - - return; - } else { - return; } } }