diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-10-16 08:33:40 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-10-16 08:33:40 +0000 |
commit | b2543fed6c24a62b5029ca3027779a87e90c17a7 (patch) | |
tree | 16d0e461562ff58b56a85d16234f408773488e48 /gtk/prefs_dlg.c | |
parent | 64394fdef2e0e732003bbb09cba1137f68156b92 (diff) |
Make the nranges member of a range_t be the number of ranges, not the
number of ranges - 1, and update loops that iterate over all the ranges
appropriately.
Make "range_convert_str()" return a success/failure indication, and
check it. Rewrite it to do more checks, and not to blithely ignore
unknown characters.
svn path=/trunk/; revision=12313
Diffstat (limited to 'gtk/prefs_dlg.c')
-rw-r--r-- | gtk/prefs_dlg.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gtk/prefs_dlg.c b/gtk/prefs_dlg.c index a5fcde6b3e..c5c305ed16 100644 --- a/gtk/prefs_dlg.c +++ b/gtk/prefs_dlg.c @@ -904,12 +904,8 @@ pref_check(pref_t *pref, gpointer user_data) if (strlen(str_val)) { range_t newrange; - range_convert_str(&newrange, str_val, pref->info.max_value); - if (newrange.nranges == 0) { - /* If the user specified a string of non-zero length but - * range_convert_str() couldn't find a single range in it, - * it must be bad. - */ + if (range_convert_str(&newrange, str_val, pref->info.max_value) != + CVT_NO_ERROR) { *badpref = pref; return PREFS_SET_SYNTAX_ERR; /* range was bad */ } @@ -993,9 +989,14 @@ pref_fetch(pref_t *pref, gpointer user_data) case PREF_RANGE: { range_t newrange; + convert_ret_t ret; str_val = gtk_entry_get_text(GTK_ENTRY(pref->control)); - range_convert_str(&newrange, str_val, pref->info.max_value); + ret = range_convert_str(&newrange, str_val, pref->info.max_value); +#if 0 + if (ret != CVT_NO_ERROR) + return PREFS_SET_SYNTAX_ERR; /* range was bad */ +#endif if (!ranges_are_equal(pref->varp.rangep, &newrange)) { |