From 6017a8515d2d3746b19fae5c5e1faec14c84ac37 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 15 Jun 2002 10:12:43 +0000 Subject: [PATCH] Enable %wZ and %Z format specifiers (remove #if 0). Fix check for NULL Buffer (it was checking for non-null Buffer). Fix length field when printing unicode strings; it was printing twice as many characters as it should have. (Patch by Joseph Galbraith) svn path=/trunk/; revision=3091 --- reactos/lib/crtdll/stdio/vfprintf.c | 8 +++----- reactos/lib/msvcrt/stdio/vfprintf.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/reactos/lib/crtdll/stdio/vfprintf.c b/reactos/lib/crtdll/stdio/vfprintf.c index a352918639b..394cd742657 100644 --- a/reactos/lib/crtdll/stdio/vfprintf.c +++ b/reactos/lib/crtdll/stdio/vfprintf.c @@ -693,23 +693,22 @@ int __vfprintf(FILE *f, const char *fmt, va_list args) } continue; -#if 0 case 'Z': if (qualifier == 'w') { /* print counted unicode string */ PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING); - if ((pus == NULL) || (pus->Buffer)) { + if ((pus == NULL) || (pus->Buffer == NULL)) { s = ""; while ((*s) != 0) putc(*s++, f); } else { - for (i = 0; pus->Buffer[i] && i < pus->Length; i++) + for (i = 0; pus->Buffer[i] && i < pus->Length / sizeof(WCHAR); i++) putc((unsigned char)(pus->Buffer[i]), f); } } else { /* print counted ascii string */ PANSI_STRING pus = va_arg(args, PANSI_STRING); - if ((pus == NULL) || (pus->Buffer)) { + if ((pus == NULL) || (pus->Buffer == NULL)) { s = ""; while ((*s) != 0) putc(*s++, f); @@ -719,7 +718,6 @@ int __vfprintf(FILE *f, const char *fmt, va_list args) } } continue; -#endif case 'e': case 'E': diff --git a/reactos/lib/msvcrt/stdio/vfprintf.c b/reactos/lib/msvcrt/stdio/vfprintf.c index 7dbe0b89f90..fd5bc9c5891 100644 --- a/reactos/lib/msvcrt/stdio/vfprintf.c +++ b/reactos/lib/msvcrt/stdio/vfprintf.c @@ -694,23 +694,22 @@ int __vfprintf(FILE *f, const char *fmt, va_list args) } continue; -#if 0 case 'Z': if (qualifier == 'w') { /* print counted unicode string */ PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING); - if ((pus == NULL) || (pus->Buffer)) { + if ((pus == NULL) || (pus->Buffer == NULL)) { s = ""; while ((*s) != 0) putc(*s++, f); } else { - for (i = 0; pus->Buffer[i] && i < pus->Length; i++) + for (i = 0; pus->Buffer[i] && i < pus->Length / sizeof(WCHAR); i++) putc((unsigned char)(pus->Buffer[i]), f); } } else { /* print counted ascii string */ PANSI_STRING pus = va_arg(args, PANSI_STRING); - if ((pus == NULL) || (pus->Buffer)) { + if ((pus == NULL) || (pus->Buffer == NULL)) { s = ""; while ((*s) != 0) putc(*s++, f); @@ -720,7 +719,6 @@ int __vfprintf(FILE *f, const char *fmt, va_list args) } } continue; -#endif case 'e': case 'E':