[3/5] ntdll: Allow passing NULL buffer to printf functions
Sebastian Lackner
sebastian at fds-team.de
Fri Dec 20 00:46:18 CST 2013
The windows version allows passing a NULL pointer instead of a buffer to
count the required length without any output.
---
dlls/ntdll/printf.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
-------------- next part --------------
From 8a04824ff79e4ea242c965c876dcee4ceb415c6f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian at fds-team.de>
Date: Fri, 20 Dec 2013 05:56:40 +0100
Subject: ntdll: Allow passing NULL buffer to printf functions
---
dlls/ntdll/printf.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/printf.c b/dlls/ntdll/printf.c
index 3a5067a..6c904cc 100644
--- a/dlls/ntdll/printf.c
+++ b/dlls/ntdll/printf.c
@@ -47,6 +47,7 @@ typedef struct pf_output_t
int len;
BOOL unicode;
union {
+ void *X;
LPWSTR W;
LPSTR A;
} buf;
@@ -72,7 +73,12 @@ static inline int pf_output_stringW( pf_output *out, LPCWSTR str, int len )
if( len < 0 )
len = strlenW( str );
- if( out->unicode )
+ if (!out->buf.X)
+ {
+ out->used += len;
+ return len;
+ }
+ else if (out->unicode)
{
LPWSTR p = out->buf.W + out->used;
@@ -110,7 +116,12 @@ static inline int pf_output_stringA( pf_output *out, LPCSTR str, int len )
if( len < 0 )
len = strlen( str );
- if( !out->unicode )
+ if (!out->buf.X)
+ {
+ out->used += len;
+ return len;
+ }
+ else if (!out->unicode)
{
LPSTR p = out->buf.A + out->used;
--
1.7.9.5
More information about the wine-patches
mailing list