чување b2e048aa3b81b8bce74c7968c65b997178ffd415
родитељ cb75aa520a49011f8986abd60b296f14173a86e9
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Sat, 29 Jun 2024 08:51:50 +0200
utf8.[ch]: Use int instead of size_t where appropriate
Diffstat:
измењених датотека: 2, додавања: 9(+), брисања: 9(-)
diff --git a/utf8.c b/utf8.c
@@ -63,12 +63,12 @@ u8_char_to_u32(u32* to, const u8* from, size_t* from_delta)
return 0;
}
-size_t
+int
u32_char_to_u8(u8* to, const u32 from)
{
- size_t len = 0;
- u8 start = 0;
- u32 cfrom = from;
+ u32 cfrom = from;
+ u8 start = 0;
+ int len = 0;
if (from >= BOUND6)
{
start = START6;
@@ -130,12 +130,12 @@ u8_to_u32(u32* to, const u8* from, size_t* from_delta)
return 0;
}
-size_t
+int
u32_to_u8(u8* to, const u32* from)
{
- u8* pto = to;
const u32* pfrom = from;
- size_t len = 0;
+ u8* pto = to;
+ int len = 0;
if (!from)
return 0;
while (*pfrom)
diff --git a/utf8.h b/utf8.h
@@ -35,7 +35,7 @@ typedef uint8_t u8;
typedef uint32_t u32;
int u8_char_to_u32(u32* to, const u8* from, size_t* from_delta);
-size_t u32_char_to_u8(u8* to, const u32 from);
+int u32_char_to_u8(u8* to, const u32 from);
int u8_to_u32(u32* to, const u8* from, size_t* from_delta);
-size_t u32_to_u8(u8* to, const u32* from);
+int u32_to_u8(u8* to, const u32* from);
size_t u32_strlen(const u32* s);