summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-04-03 22:23:14 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-04-03 22:23:14 +0000
commitff6000745886cb085ca80e42498020497bc7f95f (patch)
tree41439653b4e24185009d6c48c9f8b37b4c93894f /desktop
parent2ca6e9a3e6bd7450cd1fb80db3a777956c804e11 (diff)
downloadnetsurf-ff6000745886cb085ca80e42498020497bc7f95f.tar.gz
netsurf-ff6000745886cb085ca80e42498020497bc7f95f.tar.bz2
Fix build with NDEBUG defined
svn path=/trunk/netsurf/; revision=12154
Diffstat (limited to 'desktop')
-rw-r--r--desktop/knockout.c9
-rw-r--r--desktop/textinput.c11
2 files changed, 16 insertions, 4 deletions
diff --git a/desktop/knockout.c b/desktop/knockout.c
index 3525df972..5d0ecbc2a 100644
--- a/desktop/knockout.c
+++ b/desktop/knockout.c
@@ -67,9 +67,10 @@
#include "desktop/knockout.h"
#include "desktop/plotters.h"
#include "image/bitmap.h"
-#define NDEBUG
#include "utils/log.h"
-#undef NDEBUG
+
+/* Define to enable knockout debug */
+#undef KNOCKOUT_DEBUG
#define KNOCKOUT_ENTRIES 3072 /* 40 bytes each */
#define KNOCKOUT_BOXES 768 /* 28 bytes each */
@@ -278,10 +279,12 @@ bool knockout_plot_flush(void)
struct knockout_box *box;
/* debugging information */
+#ifdef KNOCKOUT_DEBUG
LOG(("Entries are %i/%i, %i/%i, %i/%i",
knockout_entry_cur, KNOCKOUT_ENTRIES,
knockout_box_cur, KNOCKOUT_BOXES,
knockout_polygon_cur, KNOCKOUT_POLYGONS));
+#endif
/* release our plotter */
plot = real_plot;
@@ -690,8 +693,10 @@ bool knockout_plot_path(const float *p, unsigned int n, colour fill,
bool knockout_plot_clip(const struct rect *clip)
{
if (clip->x1 < clip->x0 || clip->y0 > clip->y1) {
+#ifdef KNOCKOUT_DEBUG
LOG(("bad clip rectangle %i %i %i %i",
clip->x0, clip->y0, clip->x1, clip->y1));
+#endif
return false;
}
diff --git a/desktop/textinput.c b/desktop/textinput.c
index 55b81b053..920d8fa99 100644
--- a/desktop/textinput.c
+++ b/desktop/textinput.c
@@ -38,13 +38,14 @@
#include "render/font.h"
#include "render/form.h"
#include "render/layout.h"
-#define NDEBUG
#include "utils/log.h"
-#undef NDEBUG
#include "utils/talloc.h"
#include "utils/utf8.h"
#include "utils/utils.h"
+/* Define to enable textinput debug */
+#undef TEXTINPUT_DEBUG
+
/** ghost caret used to indicate the insertion point when dragging text
into a textarea/input field */
struct caret ghost_caret;
@@ -335,8 +336,10 @@ bool browser_window_textarea_callback(struct browser_window *bw,
plot_font_style_t fstyle;
/* box_dump(textarea, 0); */
+#ifdef TEXTINPUT_DEBUG
LOG(("key %i at %i in '%.*s'", key, char_offset,
(int) text_box->length, text_box->text));
+#endif
box_coords(textarea, &box_x, &box_y);
box_x -= scroll_get_offset(textarea->scroll_x);
@@ -1380,9 +1383,11 @@ bool browser_window_textarea_paste_text(struct browser_window *bw,
while ((char_offset > text_box->length + SPACE_LEN(text_box)) &&
(text_box->next) &&
(text_box->next->type == BOX_TEXT)) {
+#ifdef TEXTINPUT_DEBUG
LOG(("Caret out of range: Was %d in boxlen %d "
"space %d", char_offset,
text_box->length, SPACE_LEN(text_box)));
+#endif
char_offset -= text_box->length + SPACE_LEN(text_box);
text_box = text_box->next;
}
@@ -1390,9 +1395,11 @@ bool browser_window_textarea_paste_text(struct browser_window *bw,
/* not sure if this will happen or not...
* but won't stick an assert here as we can recover from it */
if (char_offset > text_box->length) {
+#ifdef TEXTINPUT_DEBUG
LOG(("Caret moved beyond end of line: "
"Was %d in boxlen %d", char_offset,
text_box->length));
+#endif
char_offset = text_box->length;
}