3333static int mbfl_filt_ident_utf32 (int c , mbfl_identify_filter * filter );
3434static int mbfl_filt_ident_utf32le (int c , mbfl_identify_filter * filter );
3535static int mbfl_filt_ident_utf32be (int c , mbfl_identify_filter * filter );
36+ static int mbfl_filt_conv_utf32_wchar_flush (mbfl_convert_filter * filter );
3637
3738static const char * mbfl_encoding_utf32_aliases [] = {"utf32" , NULL };
3839
@@ -93,7 +94,7 @@ const struct mbfl_convert_vtbl vtbl_utf32_wchar = {
9394 mbfl_filt_conv_common_ctor ,
9495 NULL ,
9596 mbfl_filt_conv_utf32_wchar ,
96- mbfl_filt_conv_common_flush ,
97+ mbfl_filt_conv_utf32_wchar_flush ,
9798 NULL ,
9899};
99100
@@ -113,7 +114,7 @@ const struct mbfl_convert_vtbl vtbl_utf32be_wchar = {
113114 mbfl_filt_conv_common_ctor ,
114115 NULL ,
115116 mbfl_filt_conv_utf32be_wchar ,
116- mbfl_filt_conv_common_flush ,
117+ mbfl_filt_conv_utf32_wchar_flush ,
117118 NULL ,
118119};
119120
@@ -133,7 +134,7 @@ const struct mbfl_convert_vtbl vtbl_utf32le_wchar = {
133134 mbfl_filt_conv_common_ctor ,
134135 NULL ,
135136 mbfl_filt_conv_utf32le_wchar ,
136- mbfl_filt_conv_common_flush ,
137+ mbfl_filt_conv_utf32_wchar_flush ,
137138 NULL ,
138139};
139140
@@ -312,6 +313,21 @@ int mbfl_filt_conv_wchar_utf32le(int c, mbfl_convert_filter *filter)
312313 return c ;
313314}
314315
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+
315331static int mbfl_filt_ident_utf32 (int c , mbfl_identify_filter * filter )
316332{
317333 /* The largest valid codepoint is 0x10FFFF; we don't want values above that
0 commit comments