diff options
author | Josh Rickmar <jrick@conformal.com> | 2013-07-05 10:49:23 -0400 |
---|---|---|
committer | Josh Rickmar <jrick@conformal.com> | 2013-07-08 14:52:56 -0400 |
commit | 5b1ee64417bece200bef05972a0d4ac205120121 (patch) | |
tree | 3f4dfa197c8764a617bc0df6897e1d2c8c00e9c6 | |
parent | c5ec3f447beb3ca21dfc6c7d9ebcc072352f7716 (diff) | |
download | xombrero-5b1ee64417bece200bef05972a0d4ac205120121.tar.gz |
Kill float equality comparisons.
Add -Wfloat-equal to CFLAGS to prevent more from showing up in the future.
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | about.c | 3 | ||||
-rw-r--r-- | xombrero.c | 9 |
3 files changed, 10 insertions, 7 deletions
diff --git a/Makefile b/Makefile index e552b18..235344d 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,9 @@ DEBUG= -g SRCS= cookie.c inspector.c marco.c about.c whitelist.c settings.c inputfocus.c SRCS+= history.c completion.c tldlist.c externaleditor.c unix.c xombrero.c -CFLAGS+= -O2 -Wall -Wno-format-extra-args -Wunused -CFLAGS+= -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare -Wno-deprecated-declarations ${DEBUG} +CFLAGS+= -O2 -Wall -Wno-format-extra-args -Wunused -Wextra -Wno-unused-parameter +CFLAGS+= -Wno-missing-field-initializers -Wno-sign-compare +CFLAGS+= -Wno-deprecated-declarations -Wfloat-equal ${DEBUG} CFLAGS+= -DGTK_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE CFLAGS+= -I. -I${.CURDIR} LDADD= -lutil diff --git a/about.c b/about.c index b609567..655de9a 100644 --- a/about.c +++ b/about.c @@ -954,7 +954,8 @@ xtp_handle_rt(struct tab *t, uint8_t cmd, int id, const char *query) modify = 1; break; case XT_S_FLOAT: - if (atof(val) != *rs[i].fval) + if (atof(val) < (*rs[i].fval - 0.0001) || + atof(val) > (*rs[i].fval + 0.0001)) modify = 1; break; case XT_S_STR: diff --git a/xombrero.c b/xombrero.c index 631016e..f7baf49 100644 --- a/xombrero.c +++ b/xombrero.c @@ -5414,7 +5414,8 @@ mark(struct tab *t, struct karg *arg) if (arg->i == XT_MARK_SET) t->mark[index] = gtk_adjustment_get_value(t->adjust_v); else if (arg->i == XT_MARK_GOTO) { - if (t->mark[index] == XT_INVALID_MARK) { + if (t->mark[index] > (XT_INVALID_MARK - 0.001) && + t->mark[index] < (XT_INVALID_MARK + 0.001)) { show_oops(t, "mark '%c' does not exist", mark); return (-1); } @@ -6927,11 +6928,11 @@ update_statusbar_position(GtkAdjustment* adjustment, gpointer data) value = gtk_adjustment_get_value(adjustment); max = gtk_adjustment_get_upper(adjustment) - view_size; - if (max == 0) + if (max > -0.0001 && max < 0.0001) position = g_strdup("All"); - else if (value == max) + else if (value > (max - 0.0001) && value < (max + 0.0001)) position = g_strdup("Bot"); - else if (value == 0) + else if (value > -0.0001 && value < 0.0001) position = g_strdup("Top"); else position = g_strdup_printf("%d%%", (int) ((value / max) * 100)); |