[Webkit-unassigned] [Bug 25415] [GTK][ATK] Please implement support for get_text_at_offset

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 24 00:49:55 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=25415


Jan Alonzo <jmalonzo at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #33259|review?                     |review+
               Flag|                            |




--- Comment #50 from Jan Alonzo <jmalonzo at gmail.com>  2009-07-24 00:49:53 PDT ---
(From update of attachment 33259)
> +static gchar* utf8_substr(const gchar* string, gint start, gint end)

Style - utf8Substr or similar.

>  {
>      gchar* startPtr = g_utf8_offset_to_pointer(string, start);
>      gsize lenInBytes = g_utf8_offset_to_pointer(string, end) -  startPtr + 1;
> @@ -581,27 +530,23 @@ static gchar* g_substr(const gchar* string, gint start, gint end)
>  // internals of WebCore's text presentation.
>  static gchar* convertUniCharToUTF8(const UChar* characters, gint length, int from, int to)
>  {
> -    gchar* utf8 = 0;
> -    gint newLength = 0;
> -    UTF16ToUTF8(characters, length, utf8, newLength);
> -    if (!utf8)
> -        return NULL;
> -
> -    gchar *pos = g_substr(utf8, from, to);
> -    g_free(utf8);
> -    gint len = strlen(pos);
> +    CString stringUTF8 = UTF8Encoding().encode(characters, length, QuestionMarksForUnencodables);
> +    gchar* utf8 = utf8_substr(stringUTF8.data(), from, to);
> +    if (!g_utf8_validate(utf8, -1, NULL))
> +        return 0;

Please change utf8 to something like utf8String. Also maybe free utf8 as well?
It may not validate but that doesn't mean utf8 is NULL either.

> +    gint len = strlen(utf8);

Use gsize here too.

r=me.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list