"Ronald S. Bultje" <rsbul...@gmail.com> writes: >>> +#undef vsnprintf >>> +int avpriv_vsnprintf(char *restrict s, size_t n, const char >>> *restrict fmt, va_list ap) >>> +{ >>> + int ret; >>> + >>> + if (n == 0 || n > INT_MAX) >>> + return 0; >> >> I don't think zero is the proper value to return here. It is not >> consistent with any existing snprintf variant. > > Is -ERANGE OK for n > INT_MAX? I'm not sure what the user intended if > n == 0, so not sure what to return either.
POSIX says EOVERFLOW for n > INT_MAX. For n == 0, I would assume the user was expecting the standard behaviour. >> These replacements should be in separate files so that they can be >> enabled independently. -- > > Will split in snprintf.[ch] and strtod.[ch] (in compat/). What would I > use to test for HAVE_BROKEN_STRTOD? For now, just enable it if > snprintf is not there and refine later? Testing for a broken strtod() directly isn't possible, so we'll have to check for the microsoft runtime by some other means. That's why I was asking for some symbol, anything, that only this library defines. It doesn't have to be a dedicated version symbol, just something that nobody else has. -- Måns Rullgård m...@mansr.com _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel