summaryrefslogtreecommitdiff
path: root/gettext-tools/gnulib-lib/vasnprintf.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-12-28 00:06:36 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-12-28 00:06:36 +0000
commit6eb5949dd99d174393465069c2fd0bab32deddcc (patch)
treed104f72ac2dcb0f592b1c8e06a5af6790bd4080c /gettext-tools/gnulib-lib/vasnprintf.c
parent482840e61f86ca321838a91e902c41d40c098bbb (diff)
downloadgettext-tarball-6eb5949dd99d174393465069c2fd0bab32deddcc.tar.gz
gettext-0.19.7gettext-0.19.7
Diffstat (limited to 'gettext-tools/gnulib-lib/vasnprintf.c')
-rw-r--r--gettext-tools/gnulib-lib/vasnprintf.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/gettext-tools/gnulib-lib/vasnprintf.c b/gettext-tools/gnulib-lib/vasnprintf.c
index ec7302a..88332f0 100644
--- a/gettext-tools/gnulib-lib/vasnprintf.c
+++ b/gettext-tools/gnulib-lib/vasnprintf.c
@@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1886,7 +1886,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
else
{
do
- result[length++] = (unsigned char) *cp++;
+ result[length++] = *cp++;
while (--n > 0);
}
}
@@ -4793,7 +4793,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
const FCHAR_T *mp = dp->width_start;
do
- *fbp++ = (unsigned char) *mp++;
+ *fbp++ = *mp++;
while (--n > 0);
}
}
@@ -4814,7 +4814,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
const FCHAR_T *mp = dp->precision_start;
do
- *fbp++ = (unsigned char) *mp++;
+ *fbp++ = *mp++;
while (--n > 0);
}
}
@@ -5179,18 +5179,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
/* SNPRINTF or sprintf failed. Save and use the errno
that it has set, if any. */
int saved_errno = errno;
+ if (saved_errno == 0)
+ {
+ if (dp->conversion == 'c' || dp->conversion == 's')
+ saved_errno = EILSEQ;
+ else
+ saved_errno = EINVAL;
+ }
if (!(result == resultbuf || result == NULL))
free (result);
if (buf_malloced != NULL)
free (buf_malloced);
CLEANUP ();
- errno =
- (saved_errno != 0
- ? saved_errno
- : (dp->conversion == 'c' || dp->conversion == 's'
- ? EILSEQ
- : EINVAL));
+
+ errno = saved_errno;
return NULL;
}
@@ -5379,7 +5382,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
tmpsrc += count;
tmpdst += count;
for (n = count; n > 0; n--)
- *--tmpdst = (unsigned char) *--tmpsrc;
+ *--tmpdst = *--tmpsrc;
}
}
#endif