aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-10-20 14:52:43 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-10-20 14:52:43 +0000
commitc94a1006c62d655fd44abcd527ebfdbe4f36702a (patch)
tree54fe426c11e21a9306e32522ef88f1f764b19cef
parentcbea3f7d93e19af536ed8ba8225fb02454dac8ca (diff)
downloadnewlib-c94a1006c62d655fd44abcd527ebfdbe4f36702a.zip
newlib-c94a1006c62d655fd44abcd527ebfdbe4f36702a.tar.gz
newlib-c94a1006c62d655fd44abcd527ebfdbe4f36702a.tar.bz2
* smallprint.cc (__small_vsprintf): Simplify UNICODE string handling
and allow empty strings.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/smallprint.cc13
2 files changed, 9 insertions, 9 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 83fea34..aca36f9 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2009-10-20 Corinna Vinschen <corinna@vinschen.de>
+ * smallprint.cc (__small_vsprintf): Simplify UNICODE string handling
+ and allow empty strings.
+
+2009-10-20 Corinna Vinschen <corinna@vinschen.de>
+
* fhandler_disk_file.cc (fhander_disk_file::readdir): Handle a status
code STATUS_NOT_SUPPORTED. Add matching comment.
diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc
index 9a5cd1a..bf6fd67 100644
--- a/winsup/cygwin/smallprint.cc
+++ b/winsup/cygwin/smallprint.cc
@@ -195,16 +195,11 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
if (!us)
RtlInitUnicodeString (us = &uw, L"(null)");
wfillin:
+ if (sys_wcstombs (tmp, NT_MAX_PATH, us->Buffer,
+ us->Length / sizeof (WCHAR)))
{
- if (!sys_wcstombs (tmp, NT_MAX_PATH, us->Buffer,
- us->Length / sizeof (WCHAR)))
- {
- s = "invalid UNICODE_STRING";
- goto fillin;
- }
- char *t = tmp;
- for (i = 0; *t && i < n; i++)
- *dst++ = *t++;
+ s = tmp;
+ goto fillin;
}
break;
default: