33
33
static int mbfl_filt_ident_utf32 (int c , mbfl_identify_filter * filter );
34
34
static int mbfl_filt_ident_utf32le (int c , mbfl_identify_filter * filter );
35
35
static int mbfl_filt_ident_utf32be (int c , mbfl_identify_filter * filter );
36
+ static int mbfl_filt_conv_utf32_wchar_flush (mbfl_convert_filter * filter );
36
37
37
38
static const char * mbfl_encoding_utf32_aliases [] = {"utf32" , NULL };
38
39
@@ -93,7 +94,7 @@ const struct mbfl_convert_vtbl vtbl_utf32_wchar = {
93
94
mbfl_filt_conv_common_ctor ,
94
95
NULL ,
95
96
mbfl_filt_conv_utf32_wchar ,
96
- mbfl_filt_conv_common_flush ,
97
+ mbfl_filt_conv_utf32_wchar_flush ,
97
98
NULL ,
98
99
};
99
100
@@ -113,7 +114,7 @@ const struct mbfl_convert_vtbl vtbl_utf32be_wchar = {
113
114
mbfl_filt_conv_common_ctor ,
114
115
NULL ,
115
116
mbfl_filt_conv_utf32be_wchar ,
116
- mbfl_filt_conv_common_flush ,
117
+ mbfl_filt_conv_utf32_wchar_flush ,
117
118
NULL ,
118
119
};
119
120
@@ -133,7 +134,7 @@ const struct mbfl_convert_vtbl vtbl_utf32le_wchar = {
133
134
mbfl_filt_conv_common_ctor ,
134
135
NULL ,
135
136
mbfl_filt_conv_utf32le_wchar ,
136
- mbfl_filt_conv_common_flush ,
137
+ mbfl_filt_conv_utf32_wchar_flush ,
137
138
NULL ,
138
139
};
139
140
@@ -312,6 +313,21 @@ int mbfl_filt_conv_wchar_utf32le(int c, mbfl_convert_filter *filter)
312
313
return c ;
313
314
}
314
315
316
+ static int mbfl_filt_conv_utf32_wchar_flush (mbfl_convert_filter * filter )
317
+ {
318
+ if (filter -> status & 0xF ) {
319
+ /* Input string was truncated */
320
+ CK ((* filter -> output_function )(filter -> cache | MBFL_WCSGROUP_THROUGH , filter -> data ));
321
+ }
322
+
323
+ if (filter -> flush_function ) {
324
+ (* filter -> flush_function )(filter -> data );
325
+ }
326
+
327
+ filter -> status = filter -> cache = 0 ;
328
+ return 0 ;
329
+ }
330
+
315
331
static int mbfl_filt_ident_utf32 (int c , mbfl_identify_filter * filter )
316
332
{
317
333
/* The largest valid codepoint is 0x10FFFF; we don't want values above that
0 commit comments