* avoid to output a wrong error message

* new GCC warning flag, trying to avoid a common MSVC unsupported C language construct
This commit is contained in:
Pedro Lopez-Cabanillas 2011-03-20 22:16:07 +00:00
parent f47d7dcddc
commit abc4ffc5f4
2 changed files with 7 additions and 2 deletions

View file

@ -139,7 +139,7 @@ if ( CMAKE_COMPILER_IS_GNUCC )
set ( CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
endif ( NOT APPLE AND NOT OS2 )
set ( GNUCC_WARNING_FLAGS "-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused-parameter -Wno-cast-qual")
set ( GNUCC_WARNING_FLAGS "-Wall -W -Wpointer-arith -Wbad-function-cast -Wno-cast-qual -Wcast-align -Wstrict-prototypes -Wno-unused-parameter -Wdeclaration-after-statement -Wno-vla -Wno-c++-compat" )
set ( CMAKE_C_FLAGS_DEBUG "-g -DDEBUG ${GNUCC_WARNING_FLAGS}" )
set ( CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -DNDEBUG ${GNUCC_WARNING_FLAGS}" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -fomit-frame-pointer -funroll-all-loops -finline-functions -DNDEBUG ${GNUCC_WARNING_FLAGS}" )

View file

@ -900,7 +900,12 @@ fluid_ostream_printf (fluid_ostream_t out, char* format, ...)
len = vsnprintf (buf, 4095, format, args);
va_end (args);
if (len <= 0)
if (len == 0)
{
return 0;
}
if (len < 0)
{
printf("fluid_ostream_printf: buffer overflow");
return -1;