[ECOS] disabling CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF breaks sprintf()
Neundorf, Alexander
Alexander.Neundorf@jenoptik.com
Mon Apr 11 10:48:00 GMT 2005
Hi,
if I disable both CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF and CYGSEM_LIBC_STDIO_SETVBUF_MALLOC it breaks sprintf(). Probably this is not surprisingly for people who know the code.
sprintf() creates a Cyg_StdioStream using the user-supplied buffer for io_buf. But if CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF is disabled, it is not possible to set a different than the default static buffer for the stream, so this buffer isn't used and during runtime the application will break somewhere.
I'd suggest to insert an assert e.g. in stream.cxx:
Cyg_StdioStreamBuffer::set_buffer( cyg_ucount32 size,
cyg_uint8 *new_buffer )
...
#else // ifdef CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF
// In this config we can't use a different buffer, or set a
// size greater than now. We can pretend to shrink it though
// Note on the next line we compare it with the size of static_buffer
// and not the current size, as that's what is the limiting factor
CYG_ASSERT(new_buffer==0, "you cant use user buffers with
CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF disabled !");
if ( (new_buffer != NULL) || (size > sizeof(static_buffer)) )
return EINVAL;
#endif // ifdef CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF
buffer_top = current_buffer_position = &buffer_bottom[0];
Or maybe even better disabling sprintf() if CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF is disabled.
What do you think ?
Bye
Alex
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list