Re: gunicode.h



Owen Taylor <otaylor@redhat.com> writes:
> gunichar g_utf8_get_char        (gchar       *iter);
> gchar *  g_utf8_iter_from_index (const gchar *str,
> 				 gint         index);
> gint     g_utf8_iter_to_index   (const gchar *str,
> 				 const gchar *pos);

I think the use of "iter" is cryptic here, I like "pointer" more
i.e. g_utf8_pointer_from_index() g_utf8_pointer_to_index().

> gchar *  g_utf8_next_char       (gchar       *iter);
> gchar *  g_utf8_prev_char       (gchar       *iter);

These args should be const if "pos" above is const, right?

> gchar *  g_utf8_find_next_char  (gchar       *iter,
> 				 const gchar *bound);
> gchar *  g_utf8_find_prev_char  (const gchar *str,
> 				 gchar       *iter);
> 

Why is bound const but not iter?
 
> /* Copies n characters from src to dest */
> gchar *g_utf8_strncpy (gchar       *dest,
> 		       const gchar *src,
> 		       size_t       n);
>

Use of size_t here seems weird since size_t is almost always used to
count bytes. I would think just int, there's no sense in which this n
is a memory offset or size.

> gunichar2 *g_utf8_to_ucs2 (const char *str,
> 			 gint        len);
> gunichar *g_utf8_to_ucs4 (const char *str,
> 			 int         len);
>

Include the inverse of these, maybe? (g_ucs4_to_utf8() etc.)

Havoc




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