[webkit-reviews] review granted: [Bug 25415] [GTK][ATK] Please implement support for get_text_at_offset : [Attachment 33258] leninbytes.patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jul 24 01:07:09 PDT 2009
Jan Alonzo <jmalonzo at gmail.com> has granted Xan Lopez <xan.lopez at gmail.com>'s
request for review:
Bug 25415: [GTK][ATK] Please implement support for get_text_at_offset
https://bugs.webkit.org/show_bug.cgi?id=25415
Attachment 33258: leninbytes.patch
https://bugs.webkit.org/attachment.cgi?id=33258&action=review
------- Additional Comments from Jan Alonzo <jmalonzo at gmail.com>
> static gchar* g_substr(const gchar* string, gint start, gint end)
> {
> - gsize len = end - start + 1;
> - gchar* output = static_cast<gchar*>(g_malloc0(len + 1));
> - return g_utf8_strncpy(output, string +start, len);
> + gchar* startPtr = g_utf8_offset_to_pointer(string, start);
According to the doc, g_utf8_offset_to_pointer doesn't check if offset is
within the boundaries of string. Can we add a check here?
> + gsize lenInBytes = g_utf8_offset_to_pointer(string, end) - startPtr +
1;
Ditto for 'end' and check if startPtr is 0 first. Looks fine otherwise. r=me.
More information about the webkit-reviews
mailing list