[epiphany] Use correct UTF8 length when converting JSStrings



commit 8ee6dd74ab9f8aa5a51a73fb84e9f07870ae682a
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Sun Feb 14 14:15:32 2010 -0500

    Use correct UTF8 length when converting JSStrings
    
    JSStringGetLength returns the number of UTF8 chars in the string, using this
    value results in trimmed strings when they contain UTF8 chars.
    The correct function is JSStringGetMaximumUTF8CStringSize that reports the
    number of bytes the string requires to be allocated, including null-byte.
    
    Bug #609936

 embed/ephy-web-view.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index e87416d..bc32154 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -550,7 +550,7 @@ js_value_to_string (JSContextRef js_context,
   g_return_val_if_fail (JSValueIsString (js_context, js_value), NULL);
 
   str = JSValueToStringCopy (js_context, js_value, NULL);
-  length = JSStringGetLength (str) + 1;
+  length = JSStringGetMaximumUTF8CStringSize (str);
 
   buffer = g_malloc0 (length);
   JSStringGetUTF8CString (str, buffer, length);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]