diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2011-02-01 21:57:25 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2011-02-01 21:57:25 +0000 |
commit | ad69ae092320193424bb341030c8712d3db3fcf7 (patch) | |
tree | 318d5b059e6411dab98edb9ea46304b776cc3522 /desktop | |
parent | 656a2d20c1b3ea2d4025f1c74134bc0c065f09d7 (diff) | |
download | netsurf-ad69ae092320193424bb341030c8712d3db3fcf7.tar.gz netsurf-ad69ae092320193424bb341030c8712d3db3fcf7.tar.bz2 |
Avoid unsafe cast of int* to size_t*
svn path=/trunk/netsurf/; revision=11597
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/textinput.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/desktop/textinput.c b/desktop/textinput.c index ea8d7d227..70fdca6c4 100644 --- a/desktop/textinput.c +++ b/desktop/textinput.c @@ -177,6 +177,7 @@ struct box *textarea_get_position(struct box *textarea, int x, int y, struct box *inline_container, *text_box; plot_font_style_t fstyle; + size_t char_offset = 0; inline_container = textarea->children; @@ -190,7 +191,7 @@ struct box *textarea_get_position(struct box *textarea, int x, int y, nsfont.font_position_in_string(&fstyle, text_box->text, text_box->length, (unsigned int)(x - text_box->x), - (size_t *) pchar_offset, ppixel_offset); + &char_offset, ppixel_offset); } else { /* find the relevant text box */ y -= inline_container->y; @@ -214,7 +215,7 @@ struct box *textarea_get_position(struct box *textarea, int x, int y, text_box->text, text_box->length, textarea->width, - (size_t *) pchar_offset, + &char_offset, ppixel_offset); } else { /* in a text box */ @@ -235,11 +236,13 @@ struct box *textarea_get_position(struct box *textarea, int x, int y, text_box->text, text_box->length, (unsigned int)(x - text_box->x), - (size_t *) pchar_offset, + &char_offset, ppixel_offset); } } + *pchar_offset = char_offset; + assert(text_box); return text_box; } |