Ticket #3984: patch-src_diffviewer_ydiff_c_proposal

File patch-src_diffviewer_ydiff_c_proposal, 672 bytes (added by Bernward, 6 years ago)

patch proposal for src/diffviewer/ydiff.c

Line 
1--- src/diffviewer/ydiff.c.orig Fri Dec 28 20:35:25 2018
2+++ src/diffviewer/ydiff.c      Sun May  5 23:41:00 2019
3@@ -619,7 +619,7 @@
4         return length;
5 
6     if (g_utf8_validate (text, -1, NULL))
7-        result = g_utf8_offset_to_pointer (text, length) - text;
8+       result =  g_utf8_strlen (text, length);
9     else
10     {
11         gunichar uni;
12@@ -637,10 +637,10 @@
13                 tmpbuf++;
14             }
15         }
16-        result = g_utf8_offset_to_pointer (tmpbuf, length) - tmpbuf;
17+       result =  g_utf8_strlen (tmpbuf, length);
18         g_free (buffer);
19     }
20-    return MAX (length, (size_t) result);
21+       return 2 * length - result;
22 }
23 #endif /*HAVE_CHARSET */
24