Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-08-01 11:39:21 +0400
committerCorinna Vinschen <corinna@vinschen.de>2007-08-01 11:39:21 +0400
commit44587e392df972e08a7d8097b9f5a3de82106e4b (patch)
treea7b43a31914df51f94b25e183d70c85eab96055f /winsup/cygwin/smallprint.cc
parentf7c978d50fb7f510864ff4770fa7793a47a0b613 (diff)
* smallprint.cc (__small_vsprintf): Add format specifier 'W' for
PWCHAR arguments. Move wide char handling after char handling.
Diffstat (limited to 'winsup/cygwin/smallprint.cc')
-rw-r--r--winsup/cygwin/smallprint.cc34
1 files changed, 21 insertions, 13 deletions
diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc
index d06f558da..bdf50288b 100644
--- a/winsup/cygwin/smallprint.cc
+++ b/winsup/cygwin/smallprint.cc
@@ -66,6 +66,8 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
char tmp[CYG_MAX_PATH + 1];
char *orig = dst;
const char *s;
+ PWCHAR w;
+ UNICODE_STRING uw, *us;
DWORD err = GetLastError ();
@@ -171,9 +173,27 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
else
s = tmp;
goto fillin;
+ case '.':
+ n = strtol (fmt, (char **) &fmt, 10);
+ if (*fmt++ != 's')
+ goto endfor;
+ case 's':
+ s = va_arg (ap, char *);
+ if (s == NULL)
+ s = "(null)";
+ fillin:
+ for (i = 0; *s && i < n; i++)
+ *dst++ = *s++;
+ break;
+ case 'W':
+ w = va_arg (ap, PWCHAR);
+ RtlInitUnicodeString (&uw, w);
+ us = &uw;
+ goto wfillin;
case 'S':
+ us = va_arg (ap, PUNICODE_STRING);
+ wfillin:
{
- PUNICODE_STRING us = va_arg (ap, PUNICODE_STRING);
ANSI_STRING as = { 0, 0, NULL };
NTSTATUS status;
@@ -194,18 +214,6 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
RtlFreeOemString (&as);
}
break;
- case '.':
- n = strtol (fmt, (char **) &fmt, 10);
- if (*fmt++ != 's')
- goto endfor;
- case 's':
- s = va_arg (ap, char *);
- if (s == NULL)
- s = "(null)";
- fillin:
- for (i = 0; *s && i < n; i++)
- *dst++ = *s++;
- break;
default:
*dst++ = '?';
*dst++ = fmt[-1];