Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update for stdint

  • Loading branch information...
commit 0ee2bdc0efdd1bd8b1912f35ddbe329f87336867 1 parent 0c06086
Dave Täht authored
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/include/utf8.h
View
17 src/include/utf8.h
@@ -1,16 +1,17 @@
#include <stdarg.h>
+#include <stdint.h>
/* is c the start of a utf8 sequence? */
#define isutf(c) (((c)&0xC0)!=0x80)
/* convert UTF-8 data to wide character */
-int u8_toucs(u_int32_t *dest, int sz, char *src, int srcsz);
+int u8_toucs(uint32_t *dest, int sz, char *src, int srcsz);
/* the opposite conversion */
-int u8_toutf8(char *dest, int sz, u_int32_t *src, int srcsz);
+int u8_toutf8(char *dest, int sz, uint32_t *src, int srcsz);
/* single character to UTF-8 */
-int u8_wc_toutf8(char *dest, u_int32_t ch);
+int u8_wc_toutf8(char *dest, uint32_t ch);
/* character number to byte offset */
int u8_offset(char *str, int charnum);
@@ -19,7 +20,7 @@ int u8_offset(char *str, int charnum);
int u8_charnum(char *s, int offset);
/* return next character, updating an index variable */
-u_int32_t u8_nextchar(char *s, int *i);
+uint32_t u8_nextchar(char *s, int *i);
/* move to next character */
void u8_inc(char *s, int *i);
@@ -33,11 +34,11 @@ int u8_seqlen(char *s);
/* assuming src points to the character after a backslash, read an
escape sequence, storing the result in dest and returning the number of
input characters processed */
-int u8_read_escape_sequence(char *src, u_int32_t *dest);
+int u8_read_escape_sequence(char *src, uint32_t *dest);
/* given a wide character, convert it to an ASCII escape sequence stored in
buf, where buf is "sz" bytes. returns the number of characters output. */
-int u8_escape_wchar(char *buf, int sz, u_int32_t ch);
+int u8_escape_wchar(char *buf, int sz, uint32_t ch);
/* convert a string "src" containing escape sequences to UTF-8 */
int u8_unescape(char *buf, int sz, char *src);
@@ -53,11 +54,11 @@ int hex_digit(char c);
/* return a pointer to the first occurrence of ch in s, or NULL if not
found. character index of found character returned in *charn. */
-char *u8_strchr(char *s, u_int32_t ch, int *charn);
+char *u8_strchr(char *s, uint32_t ch, int *charn);
/* same as the above, but searches a buffer of a given size instead of
a NUL-terminated string. */
-char *u8_memchr(char *s, u_int32_t ch, size_t sz, int *charn);
+char *u8_memchr(char *s, uint32_t ch, size_t sz, int *charn);
/* count the number of characters in a UTF-8 string */
int u8_strlen(char *s);
Please sign in to comment.
Something went wrong with that request. Please try again.