Avoid unsafe cast of int* to size_t*

svn path=/trunk/netsurf/; revision=11597
This commit is contained in:
John Mark Bell 2011-02-01 21:57:25 +00:00
parent 656a2d20c1
commit ad69ae0923
1 changed files with 6 additions and 3 deletions

View File

@ -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;
}