mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Nuked almost all trailing white space.
We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
This commit is contained in:
parent
ffd099eb19
commit
b008274afd
305 changed files with 5385 additions and 5592 deletions
|
@ -59,7 +59,7 @@ static size_t (* __stdcall iconv) (iconv_t cd,
|
|||
char **outbuf, size_t *outbytesleft);
|
||||
static int (* __stdcall iconv_close) (iconv_t cd);
|
||||
|
||||
static int
|
||||
static int
|
||||
load_libiconv (void)
|
||||
{
|
||||
#ifdef HAVE_W32CE_SYSTEM
|
||||
|
@ -67,21 +67,21 @@ load_libiconv (void)
|
|||
is at all required. */
|
||||
#else
|
||||
static int done;
|
||||
|
||||
|
||||
if (!done)
|
||||
{
|
||||
void *handle;
|
||||
|
||||
done = 1; /* Do it right now because we might get called recursivly
|
||||
through gettext. */
|
||||
|
||||
|
||||
handle = dlopen ("iconv.dll", RTLD_LAZY);
|
||||
if (handle)
|
||||
{
|
||||
iconv_open = dlsym (handle, "libiconv_open");
|
||||
if (iconv_open)
|
||||
iconv = dlsym (handle, "libiconv");
|
||||
if (iconv)
|
||||
if (iconv)
|
||||
iconv_close = dlsym (handle, "libiconv_close");
|
||||
}
|
||||
if (!handle || !iconv_close)
|
||||
|
@ -99,7 +99,7 @@ load_libiconv (void)
|
|||
}
|
||||
return iconv_open? 0: -1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
|
@ -157,13 +157,13 @@ set_native_charset (const char *newset)
|
|||
{
|
||||
const char *full_newset;
|
||||
|
||||
if (!newset)
|
||||
if (!newset)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
static char codepage[30];
|
||||
unsigned int cpno;
|
||||
const char *aliases;
|
||||
|
||||
|
||||
/* We are a console program thus we need to use the
|
||||
GetConsoleOutputCP function and not the the GetACP which
|
||||
would give the codepage for a GUI program. Note this is not
|
||||
|
@ -208,7 +208,7 @@ set_native_charset (const char *newset)
|
|||
}
|
||||
|
||||
#else /*!HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
#ifdef HAVE_LANGINFO_CODESET
|
||||
newset = nl_langinfo (CODESET);
|
||||
#else /*!HAVE_LANGINFO_CODESET*/
|
||||
|
@ -232,7 +232,7 @@ set_native_charset (const char *newset)
|
|||
mod = strchr (++dot, '@');
|
||||
if (!mod)
|
||||
mod = dot + strlen (dot);
|
||||
if (mod - dot < sizeof codepage && dot != mod)
|
||||
if (mod - dot < sizeof codepage && dot != mod)
|
||||
{
|
||||
memcpy (codepage, dot, mod - dot);
|
||||
codepage [mod - dot] = 0;
|
||||
|
@ -279,21 +279,21 @@ set_native_charset (const char *newset)
|
|||
else
|
||||
{
|
||||
iconv_t cd;
|
||||
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
if (load_libiconv ())
|
||||
return -1;
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
cd = iconv_open (full_newset, "utf-8");
|
||||
if (cd == (iconv_t)-1)
|
||||
if (cd == (iconv_t)-1)
|
||||
{
|
||||
handle_iconv_error (full_newset, "utf-8", 0);
|
||||
return -1;
|
||||
}
|
||||
iconv_close (cd);
|
||||
cd = iconv_open ("utf-8", full_newset);
|
||||
if (cd == (iconv_t)-1)
|
||||
if (cd == (iconv_t)-1)
|
||||
{
|
||||
handle_iconv_error ("utf-8", full_newset, 0);
|
||||
return -1;
|
||||
|
@ -313,7 +313,7 @@ get_native_charset ()
|
|||
}
|
||||
|
||||
/* Return true if the native charset is utf-8. */
|
||||
int
|
||||
int
|
||||
is_native_utf8 (void)
|
||||
{
|
||||
return no_translation;
|
||||
|
@ -360,13 +360,13 @@ native_to_utf8 (const char *orig_string)
|
|||
*p = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
/* Need to use iconv. */
|
||||
iconv_t cd;
|
||||
const char *inptr;
|
||||
char *outptr;
|
||||
size_t inbytes, outbytes;
|
||||
|
||||
|
||||
cd = iconv_open ("utf-8", active_charset_name);
|
||||
if (cd == (iconv_t)-1)
|
||||
{
|
||||
|
@ -374,14 +374,14 @@ native_to_utf8 (const char *orig_string)
|
|||
return native_to_utf8 (string);
|
||||
}
|
||||
|
||||
for (s=string; *s; s++ )
|
||||
for (s=string; *s; s++ )
|
||||
{
|
||||
length++;
|
||||
if ((*s & 0x80))
|
||||
length += 5; /* We may need up to 6 bytes for the utf8 output. */
|
||||
}
|
||||
buffer = jnlib_xmalloc (length + 1);
|
||||
|
||||
|
||||
inptr = string;
|
||||
inbytes = strlen (string);
|
||||
outptr = buffer;
|
||||
|
@ -455,10 +455,10 @@ do_utf8_to_native (const char *string, size_t length, int delim,
|
|||
if (!nleft)
|
||||
{
|
||||
if (!(*s & 0x80))
|
||||
{
|
||||
{
|
||||
/* Plain ascii. */
|
||||
if ( delim != -1
|
||||
&& (*s < 0x20 || *s == 0x7f || *s == delim
|
||||
&& (*s < 0x20 || *s == 0x7f || *s == delim
|
||||
|| (delim && *s == '\\')))
|
||||
{
|
||||
n++;
|
||||
|
@ -497,35 +497,35 @@ do_utf8_to_native (const char *string, size_t length, int delim,
|
|||
encbuf[encidx++] = *s;
|
||||
}
|
||||
else if ((*s & 0xf0) == 0xe0) /* 1110 xxxx */
|
||||
{
|
||||
{
|
||||
val = *s & 0x0f;
|
||||
nleft = 2;
|
||||
encidx = 0;
|
||||
encbuf[encidx++] = *s;
|
||||
}
|
||||
else if ((*s & 0xf8) == 0xf0) /* 1111 0xxx */
|
||||
{
|
||||
{
|
||||
val = *s & 0x07;
|
||||
nleft = 3;
|
||||
encidx = 0;
|
||||
encbuf[encidx++] = *s;
|
||||
}
|
||||
else if ((*s & 0xfc) == 0xf8) /* 1111 10xx */
|
||||
{
|
||||
{
|
||||
val = *s & 0x03;
|
||||
nleft = 4;
|
||||
encidx = 0;
|
||||
encbuf[encidx++] = *s;
|
||||
}
|
||||
else if ((*s & 0xfe) == 0xfc) /* 1111 110x */
|
||||
{
|
||||
{
|
||||
val = *s & 0x01;
|
||||
nleft = 5;
|
||||
encidx = 0;
|
||||
encbuf[encidx++] = *s;
|
||||
}
|
||||
else /* Invalid encoding: print as \xNN. */
|
||||
{
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
sprintf (p, "\\x%02x", *s);
|
||||
|
@ -558,7 +558,7 @@ do_utf8_to_native (const char *string, size_t length, int delim,
|
|||
val <<= 6;
|
||||
val |= *s & 0x3f;
|
||||
if (!--nleft) /* Ready. */
|
||||
{
|
||||
{
|
||||
if (no_translation)
|
||||
{
|
||||
if (p)
|
||||
|
@ -597,12 +597,12 @@ do_utf8_to_native (const char *string, size_t length, int delim,
|
|||
if (val >= 0x80 && val < 256)
|
||||
{
|
||||
/* We can simply print this character */
|
||||
n++;
|
||||
n++;
|
||||
if (p)
|
||||
*p++ = val;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
/* We do not have a translation: print utf8. */
|
||||
if (p)
|
||||
{
|
||||
|
@ -632,7 +632,7 @@ do_utf8_to_native (const char *string, size_t length, int delim,
|
|||
const char *inptr;
|
||||
char *outbuf, *outptr;
|
||||
size_t inbytes, outbytes;
|
||||
|
||||
|
||||
*p = 0; /* Terminate the buffer. */
|
||||
|
||||
cd = iconv_open (active_charset_name, "utf-8");
|
||||
|
@ -649,14 +649,14 @@ do_utf8_to_native (const char *string, size_t length, int delim,
|
|||
inbytes = n - 1;;
|
||||
inptr = buffer;
|
||||
outbytes = n * MB_LEN_MAX;
|
||||
if (outbytes / MB_LEN_MAX != n)
|
||||
if (outbytes / MB_LEN_MAX != n)
|
||||
BUG (); /* Actually an overflow. */
|
||||
outbuf = outptr = jnlib_xmalloc (outbytes);
|
||||
if ( iconv (cd, (ICONV_CONST char **)&inptr, &inbytes,
|
||||
&outptr, &outbytes) == (size_t)-1)
|
||||
&outptr, &outbytes) == (size_t)-1)
|
||||
{
|
||||
static int shown;
|
||||
|
||||
|
||||
if (!shown)
|
||||
log_info (_("conversion from `%s' to `%s' failed: %s\n"),
|
||||
"utf-8", active_charset_name, strerror (errno));
|
||||
|
@ -668,7 +668,7 @@ do_utf8_to_native (const char *string, size_t length, int delim,
|
|||
outbuf = do_utf8_to_native (string, length, delim, 0);
|
||||
}
|
||||
else /* Success. */
|
||||
{
|
||||
{
|
||||
*outptr = 0; /* Make sure it is a string. */
|
||||
/* We could realloc the buffer now but I doubt that it
|
||||
makes much sense given that it will get freed
|
||||
|
@ -703,13 +703,13 @@ utf8_to_native (const char *string, size_t length, int delim)
|
|||
|
||||
/* Wrapper function for iconv_open, required for W32 as we dlopen that
|
||||
library on that system. */
|
||||
jnlib_iconv_t
|
||||
jnlib_iconv_t
|
||||
jnlib_iconv_open (const char *tocode, const char *fromcode)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
if (load_libiconv ())
|
||||
return (jnlib_iconv_t)(-1);
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
return (jnlib_iconv_t)iconv_open (tocode, fromcode);
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ jnlib_iconv (jnlib_iconv_t cd,
|
|||
#ifdef HAVE_W32_SYSTEM
|
||||
if (load_libiconv ())
|
||||
return 0;
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
return iconv ((iconv_t)cd, (char**)inbuf, inbytesleft, outbuf, outbytesleft);
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ jnlib_iconv_close (jnlib_iconv_t cd)
|
|||
#ifdef HAVE_W32_SYSTEM
|
||||
if (load_libiconv ())
|
||||
return 0;
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
return iconv_close ((iconv_t)cd);
|
||||
}
|
||||
|
@ -797,7 +797,7 @@ utf8_to_wchar (const char *string)
|
|||
}
|
||||
|
||||
nbytes = (size_t)(n+1) * sizeof(*result);
|
||||
if (nbytes / sizeof(*result) != (n+1))
|
||||
if (nbytes / sizeof(*result) != (n+1))
|
||||
{
|
||||
jnlib_set_errno (ENOMEM);
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue