commit bash-20090924 snapshot

This commit is contained in:
Chet Ramey
2011-12-08 20:16:21 -05:00
parent a8fd3f3e51
commit 82a5df635a
24 changed files with 9052 additions and 169 deletions
+8 -3
View File
@@ -100,6 +100,7 @@ fnx_tofs (string, len)
#ifdef MACOSX
ICONV_CONST char *inbuf;
char *tempbuf;
size_t templen;
if (conv_tofs == (iconv_t)-1)
init_tofs ();
@@ -121,10 +122,11 @@ fnx_tofs (string, len)
outbuf = outbuf ? xrealloc (outbuf, outlen + 1) : xmalloc (outlen + 1);
}
tempbuf = outbuf;
templen = outlen;
iconv (conv_tofs, NULL, NULL, NULL, NULL);
if (iconv (conv_tofs, &inbuf, &len, &tempbuf, &outlen) == (size_t)-1)
if (iconv (conv_tofs, &inbuf, &len, &tempbuf, &templen) == (size_t)-1)
return string;
*tempbuf = '\0';
@@ -142,6 +144,7 @@ fnx_fromfs (string, len)
#ifdef MACOSX
ICONV_CONST char *inbuf;
char *tempbuf;
size_t templen;
if (conv_fromfs == (iconv_t)-1)
init_fromfs ();
@@ -157,16 +160,17 @@ fnx_fromfs (string, len)
}
inbuf = string;
if (outbuf == 0 || outlen < len + 8)
if (outbuf == 0 || outlen < (len + 8))
{
outlen = len + 8;
outbuf = outbuf ? xrealloc (outbuf, outlen + 1) : xmalloc (outlen + 1);
}
tempbuf = outbuf;
templen = outlen;
iconv (conv_fromfs, NULL, NULL, NULL, NULL);
if (iconv (conv_fromfs, &inbuf, &len, &tempbuf, &outlen) == (size_t)-1)
if (iconv (conv_fromfs, &inbuf, &len, &tempbuf, &templen) == (size_t)-1)
return string;
*tempbuf = '\0';
@@ -181,6 +185,7 @@ char *
fnx_tofs (string)
char *string;
{
bar
return string;
}
+28 -3
View File
@@ -42,6 +42,8 @@ extern const char *locale_charset __P((void));
static iconv_t conv_fromfs = (iconv_t)-1;
static iconv_t conv_tofs = (iconv_t)-1;
#define OUTLEN_MAX 4096
static char *outbuf = 0;
static size_t outlen = 0;
@@ -98,12 +100,21 @@ fnx_tofs (string, len)
#ifdef MACOSX
ICONV_CONST char *inbuf;
char *tempbuf;
size_t templen;
if (conv_tofs == (iconv_t)-1)
init_tofs ();
if (conv_tofs == (iconv_t)-1)
return string;
/* Free and reallocate outbuf if it's *too* big */
if (outlen >= OUTLEN_MAX && len < OUTLEN_MAX - 8)
{
free (outbuf);
outbuf = 0;
outlen = 0;
}
inbuf = string;
if (outbuf == 0 || outlen < len + 8)
{
@@ -111,10 +122,11 @@ fnx_tofs (string, len)
outbuf = outbuf ? xrealloc (outbuf, outlen + 1) : xmalloc (outlen + 1);
}
tempbuf = outbuf;
templen = outlen;
iconv (conv_tofs, NULL, NULL, NULL, NULL);
if (iconv (conv_tofs, &inbuf, &len, &tempbuf, &outlen) == (size_t)-1)
if (iconv (conv_tofs, &inbuf, &len, &tempbuf, &templen) == (size_t)-1)
return string;
*tempbuf = '\0';
@@ -132,23 +144,35 @@ fnx_fromfs (string, len)
#ifdef MACOSX
ICONV_CONST char *inbuf;
char *tempbuf;
size_t templen;
if (conv_fromfs == (iconv_t)-1)
init_fromfs ();
if (conv_fromfs == (iconv_t)-1)
return string;
itrace("fnx_fromfs: outlen = %d after init_fromfs", outlen);
/* Free and reallocate outbuf if it's *too* big */
if (outlen >= OUTLEN_MAX && len < OUTLEN_MAX - 8)
{
free (outbuf);
outbuf = 0;
outlen = 0;
}
inbuf = string;
if (outbuf == 0 || outlen < len + 8)
if (outbuf == 0 || outlen < (len + 8))
{
outlen = len + 8;
outbuf = outbuf ? xrealloc (outbuf, outlen + 1) : xmalloc (outlen + 1);
itrace("fnx_fromfs: increased outlen to %d", outlen);
}
tempbuf = outbuf;
templen = outlen;
iconv (conv_fromfs, NULL, NULL, NULL, NULL);
if (iconv (conv_fromfs, &inbuf, &len, &tempbuf, &outlen) == (size_t)-1)
if (iconv (conv_fromfs, &inbuf, &len, &tempbuf, &templen) == (size_t)-1)
return string;
*tempbuf = '\0';
@@ -163,6 +187,7 @@ char *
fnx_tofs (string)
char *string;
{
bar
return string;
}
+2 -1
View File
@@ -61,7 +61,8 @@
# include <config.h>
#endif
#if defined(DEBUG)
/* GCC 4.2 on Snow Leopard doesn't like the snprintf prototype */
#if defined(DEBUG) && !defined (MACOSX)
# undef HAVE_SNPRINTF
# undef HAVE_ASPRINTF
#endif
+2163
View File
File diff suppressed because it is too large Load Diff