libc: improve handling of stream error
This commit is contained in:
parent
d3c56f7a52
commit
867cdc0098
@ -70,8 +70,13 @@ int foug_stlb_read(foug_stlb_read_args_t args)
|
||||
while (foug_stlb_no_error(error) && accum_facet_count_read < total_facet_count) {
|
||||
const size_t facet_count_read =
|
||||
foug_stream_read(args.stream, buffer, FOUG_STLB_TRIANGLE_SIZE, buffer_facet_count);
|
||||
error = foug_stream_error(args.stream) != 0 ? FOUG_STLB_READ_STREAM_ERROR :
|
||||
FOUG_STLB_READ_NO_ERROR;
|
||||
if (foug_stream_error(args.stream) != 0)
|
||||
error = FOUG_STLB_READ_STREAM_ERROR;
|
||||
else if (facet_count_read > 0)
|
||||
error = FOUG_STLB_READ_NO_ERROR;
|
||||
else
|
||||
break; /* Exit if no facet to read */
|
||||
|
||||
if (foug_stlb_no_error(error)) {
|
||||
uint32_t buffer_offset = 0;
|
||||
uint32_t i_facet;
|
||||
|
@ -58,10 +58,10 @@ static size_t foug_stream_stdio_write(foug_stream_t* stream,
|
||||
foug_stream_manip_t foug_stream_manip_stdio()
|
||||
{
|
||||
foug_stream_manip_t manip;
|
||||
manip.at_end_func = &foug_stream_stdio_at_end;
|
||||
manip.error_func = &foug_stream_stdio_error;
|
||||
manip.read_func = &foug_stream_stdio_read;
|
||||
manip.write_func = &foug_stream_stdio_write;
|
||||
manip.at_end_func = foug_stream_stdio_at_end;
|
||||
manip.error_func = foug_stream_stdio_error;
|
||||
manip.read_func = foug_stream_stdio_read;
|
||||
manip.write_func = foug_stream_stdio_write;
|
||||
return manip;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user