[vala/staging] glib-2.0: Consistently use type long as index in strings



commit cfddb5f705214a80900e79c195bc417cb3db3bfb
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Feb 27 10:59:28 2018 +0100

    glib-2.0: Consistently use type long as index in strings
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/183

 vapi/glib-2.0.vapi | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index e248f42be..17530fee7 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -1183,7 +1183,7 @@ public class string {
 
        // checks whether valid string character starts at specified index
        // embedded NULs are not supported by the string class
-       public bool valid_char (int index) {
+       public bool valid_char (long index) {
                uint8 c = ((uint8*) this)[index];
                if (c == 0x00 || (c >= 0x80 && c < 0xc2) || c >= 0xf5) {
                        return false;
@@ -1196,10 +1196,10 @@ public class string {
        public unowned string next_char ();
        [CCode (cname = "g_utf8_next_char")]
        static char* utf8_next_char (char* str);
-       public bool get_next_char (ref int index, out unichar c) {
+       public bool get_next_char (ref long index, out unichar c) {
                c = utf8_get_char ((char*) this + index);
                if (c != 0) {
-                       index = (int) (utf8_next_char ((char*) this + index) - (char*) this);
+                       index = (long) (utf8_next_char ((char*) this + index) - (char*) this);
                        return true;
                } else {
                        return false;
@@ -1227,17 +1227,17 @@ public class string {
        [CCode (cname = "g_utf8_offset_to_pointer")]
        char* utf8_offset_to_pointer (long offset);
 
-       public int index_of_nth_char (long c) {
-               return (int) (this.utf8_offset_to_pointer (c) - (char*) this);
+       public long index_of_nth_char (long c) {
+               return (long) (this.utf8_offset_to_pointer (c) - (char*) this);
        }
 
        [CCode (cname = "g_utf8_prev_char")]
        public unowned string prev_char ();
        [CCode (cname = "g_utf8_prev_char")]
        static char* utf8_prev_char (char* str);
-       public bool get_prev_char (ref int index, out unichar c) {
+       public bool get_prev_char (ref long index, out unichar c) {
                if (0 < index) {
-                       index = (int) (utf8_prev_char ((char*) this + index) - (char*) this);
+                       index = (long) (utf8_prev_char ((char*) this + index) - (char*) this);
                        c = utf8_get_char ((char*) this + index);
                        return true;
                } else {
@@ -1487,7 +1487,7 @@ public class string {
        }
 
        [CCode (cname = "g_utf8_strlen")]
-       public int char_count (ssize_t max = -1);
+       public long char_count (ssize_t max = -1);
 
        public int length {
                [CCode (cname = "strlen")]


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