[glib: 1/2] gutf8: Document that out args from g_utf16_to_utf8() are non-negative




commit 90b2ad80eee2795622b366aac5cf4bc840fa8c72
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu Oct 14 12:45:30 2021 +0100

    gutf8: Document that out args from g_utf16_to_utf8() are non-negative
    
    Despite their type, the values returned will always be ≥ 0. It’s
    unfortunate they weren’t declared with an unsigned type, but we can’t
    change that now without breaking API.
    
    Spotted in !2294.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/gutf8.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/glib/gutf8.c b/glib/gutf8.c
index ca1a395c1..7d053540d 100644
--- a/glib/gutf8.c
+++ b/glib/gutf8.c
@@ -987,9 +987,10 @@ g_ucs4_to_utf8 (const gunichar *str,
  *     words read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will
  *     be returned in case @str contains a trailing partial character. If
  *     an error occurs then the index of the invalid input is stored here.
+ *     It’s guaranteed to be non-negative.
  * @items_written: (out) (optional): location to store number
  *     of bytes written, or %NULL. The value stored here does not include the
- *     trailing 0 byte.
+ *     trailing 0 byte. It’s guaranteed to be non-negative.
  * @error: location to store the error occurring, or %NULL to ignore
  *     errors. Any of the errors in #GConvertError other than
  *     %G_CONVERT_ERROR_NO_CONVERSION may occur.


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