Commit Graph

8 Commits

Author SHA1 Message Date
Martin Storsjo 5e2f6fa9a3 ucrtbase: Add a test for snprintf to a NULL buffer.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-06 21:59:08 +09:00
Martin Storsjo 4a79e54917 ucrtbase: Handle the C99 'z' size_t specifier for integers.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-04 19:19:32 +09:00
Martin Storsjo b9d0f5d562 ucrtbase: Implement the new printf corner case behaviour.
Check the option flags whether the new or old legacy behaviours are
wanted.

For _MSVCR_VER < 140, don't check the option flags but hardcode them to
TRUE. (This avoids having to manually add all three flags into every
caller of pf_printf.) Mask out any other flags, to avoid other
out-of-range flags to be interpreted as the other flags (positional
params, invoke invalid param handler).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-04 19:19:12 +09:00
Martin Storsjo b09aadd202 ucrtbase: Handle the swprintf style termination and return values.
When neither the "legacy vsprintf null termination" nor the "standard
snprintf behaviour" flags are specified, the functions return -2 when
the output string didn't fit (similar to old style msvcrt _snprintf that
returned -1), but they are null terminated (similar to the C99 snprintf
style behaviour). This is the same way as the C99 swprintf function
behaves.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-04 19:18:42 +09:00
Martin Storsjo fcf9ec8080 ucrtbase: Add defines for the printf/scanf options constants.
Avoid using hardcoded magic numbers for these options.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-02 23:02:24 +09:00
Martin Storsjo 4b47da3ad7 ucrtbase: Simplify the snprintf/swprintf tests.
Avoid repeating the test strings, calculate the expected return value
with code.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-02 23:02:23 +09:00
Martin Storsjo 255a7fe067 ucrtbase: Implement some printf functions.
Not all functions are implemented (yet not all variants are
implemented in the normal msvcrt either).

The new functions are more generalized and are C99 compliant.
They take an options parameter that e.g. for the snprintf
family of functions indicate whether the truncation and return
value should be handled as before or in the standards compliant
way.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-10-28 22:31:24 +09:00
Martin Storsjo 8578702e06 ucrtbase: Make the strtod implementation C99 compatible.
Add a test for ucrtbase that verifies these aspects of the C99
behaviour of strtod.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
2015-10-02 20:50:10 +09:00