3
3
#line __LINE__ "string.c"
4
4
#endif
5
5
6
- uint8_t * s3dat_internal_read_cstr (s3dat_t * handle , s3util_exception_t * * throws ) {
7
- #define STRING_BUFFER 1024
8
-
9
- uint8_t * bfr = s3util_alloc_func (s3dat_memset (handle ), STRING_BUFFER , throws );
6
+ char * s3dat_internal_read_cstr (s3dat_t * handle , s3util_exception_t * * throws ) {
7
+ char * bfr = s3util_alloc_func (s3dat_memset (handle ), STRING_BUFFER , throws );
10
8
if (* throws != NULL ) {
11
9
s3util_add_to_stack (s3dat_memset (handle ), throws , __FILE__ , __func__ , __LINE__ );
12
10
return NULL ;
@@ -23,7 +21,7 @@ uint8_t* s3dat_internal_read_cstr(s3dat_t* handle, s3util_exception_t** throws)
23
21
}
24
22
25
23
if (pos + 1 == bfr_size ) {
26
- uint8_t * bfr2 = s3util_alloc_func (s3dat_memset (handle ), bfr_size + STRING_BUFFER , throws );
24
+ char * bfr2 = s3util_alloc_func (s3dat_memset (handle ), bfr_size + STRING_BUFFER , throws );
27
25
if (* throws != NULL ) {
28
26
s3util_add_to_stack (s3dat_memset (handle ), throws , __FILE__ , __func__ , __LINE__ );
29
27
s3util_free_func (s3dat_memset (handle ), bfr );
@@ -40,10 +38,10 @@ uint8_t* s3dat_internal_read_cstr(s3dat_t* handle, s3util_exception_t** throws)
40
38
return bfr ;
41
39
}
42
40
43
- void s3dat_internal_short (s3dat_t * handle , uint8_t * * str ) {
44
- uint8_t * bfr = * str ;
41
+ void s3dat_internal_short (s3dat_t * handle , char * * str ) {
42
+ char * bfr = * str ;
45
43
46
- uint8_t * bfr2 = s3util_alloc_func (s3dat_memset (handle ), strlen (bfr )+ 1 , NULL );
44
+ char * bfr2 = s3util_alloc_func (s3dat_memset (handle ), strlen (bfr )+ 1 , NULL );
47
45
if (bfr2 == NULL ) return ;
48
46
49
47
strcpy (bfr2 , bfr );
@@ -102,7 +100,7 @@ void s3dat_internal_iso8859_to_utf8(s3dat_t* handle, uint8_t** str, uint32_t len
102
100
}
103
101
104
102
#ifdef USE_ICONV
105
- void s3dat_internal_iconv_dat_to_utf8 (s3dat_t * handle , s3dat_language language , uint8_t * cstr , uint8_t * * utf8_str , s3util_exception_t * * throws ) {
103
+ void s3dat_internal_iconv_dat_to_utf8 (s3dat_t * handle , s3dat_language language , char * cstr , char * * utf8_str , s3util_exception_t * * throws ) {
106
104
char * charset ;
107
105
108
106
switch (language ) {
@@ -128,14 +126,14 @@ void s3dat_internal_iconv_dat_to_utf8(s3dat_t* handle, s3dat_language language,
128
126
129
127
size_t inlen = strlen (cstr );
130
128
size_t outlen = inlen * 4 + 4 ;
131
- uint8_t * utf8s = s3util_alloc_func (s3dat_memset (handle ), outlen , throws );
129
+ char * utf8s = s3util_alloc_func (s3dat_memset (handle ), outlen , throws );
132
130
if (* throws != NULL ) {
133
131
s3util_add_to_stack (s3dat_memset (handle ), throws , __FILE__ , __func__ , __LINE__ );
134
132
return ;
135
133
}
136
134
137
135
* utf8_str = utf8s ;
138
- uint8_t * instr = cstr ;
136
+ char * instr = cstr ;
139
137
140
138
if (iconv (iconv_s , (char * * )& instr , & inlen , (char * * )& utf8s , & outlen ) == (size_t )-1 ) {
141
139
s3util_free_func (s3dat_memset (handle ), * utf8_str );
@@ -154,7 +152,7 @@ void s3dat_internal_extract_string(s3dat_t* handle, uint16_t text, uint16_t lang
154
152
s3dat_internal_seek_func (handle , handle -> string_index -> sequences [text ].pointers [language ], S3UTIL_SEEK_SET , throws );
155
153
S3UTIL_HANDLE_EXCEPTION (s3dat_memset (handle ), throws , __FILE__ , __func__ , __LINE__ );
156
154
157
- uint8_t * cstr = s3dat_internal_read_cstr (handle , throws );
155
+ char * cstr = s3dat_internal_read_cstr (handle , throws );
158
156
S3UTIL_HANDLE_EXCEPTION (s3dat_memset (handle ), throws , __FILE__ , __func__ , __LINE__ );
159
157
160
158
s3dat_internal_short (handle , & cstr );
@@ -182,7 +180,7 @@ void s3dat_utf8_encoding_handler(s3dat_extracthandler_t* me, s3dat_res_t* res, s
182
180
s3dat_string_t * string = res -> res -> data .str ;
183
181
184
182
#ifdef USE_ICONV
185
- uint8_t * utf8_str = NULL ;
183
+ char * utf8_str = NULL ;
186
184
s3dat_internal_iconv_dat_to_utf8 (handle , string -> language , string -> string_data , & utf8_str , throws );
187
185
188
186
if (* throws == NULL ) {
@@ -206,7 +204,7 @@ bool s3dat_utf8(s3dat_ref_t* str) {
206
204
return !str -> data .str -> original_encoding ;
207
205
}
208
206
209
- uint8_t * s3dat_strdata (s3dat_ref_t * str ) {
207
+ char * s3dat_strdata (s3dat_ref_t * str ) {
210
208
if (!s3dat_is_string (str )) return NULL ;
211
209
return str -> data .str -> string_data ;
212
210
}
0 commit comments