Remove trailing white space

--
This commit is contained in:
Werner Koch 2012-04-30 17:42:53 +02:00
parent 4cb408d33e
commit 22de98b7a6
2 changed files with 49 additions and 49 deletions

View File

@ -1,19 +1,19 @@
/* conversion.c - String conversion helper functions. /* conversion.c - String conversion helper functions.
Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 2007 g10 Code GmbH Copyright (C) 2001, 2002, 2003, 2004, 2007 g10 Code GmbH
This file is part of GPGME. This file is part of GPGME.
GPGME is free software; you can redistribute it and/or modify it GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version. the License, or (at your option) any later version.
GPGME is distributed in the hope that it will be useful, but GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@ -150,9 +150,9 @@ _gpgme_decode_c_string (const char *src, char **destp, size_t len)
/* A binary zero is not representable in a C /* A binary zero is not representable in a C
string. */ string. */
*(dest++) = '\\'; *(dest++) = '\\';
*(dest++) = '0'; *(dest++) = '0';
} }
else else
*((unsigned char *) dest++) = val; *((unsigned char *) dest++) = val;
src += 4; src += 4;
} }
@ -165,7 +165,7 @@ _gpgme_decode_c_string (const char *src, char **destp, size_t len)
*(dest++) = *(src++); *(dest++) = *(src++);
*(dest++) = *(src++); *(dest++) = *(src++);
} }
} }
} }
*(dest++) = 0; *(dest++) = 0;
@ -216,7 +216,7 @@ _gpgme_decode_percent_string (const char *src, char **destp, size_t len,
else else
{ {
int val = _gpgme_hextobyte (&src[1]); int val = _gpgme_hextobyte (&src[1]);
if (val == -1) if (val == -1)
{ {
/* Should not happen. */ /* Should not happen. */
@ -233,9 +233,9 @@ _gpgme_decode_percent_string (const char *src, char **destp, size_t len,
/* A binary zero is not representable in a C /* A binary zero is not representable in a C
string. */ string. */
*(dest++) = '\\'; *(dest++) = '\\';
*(dest++) = '0'; *(dest++) = '0';
} }
else else
*((unsigned char *) dest++) = val; *((unsigned char *) dest++) = val;
src += 3; src += 3;
} }
@ -269,7 +269,7 @@ _gpgme_encode_percent_string (const char *src, char **destp, size_t len)
the special plus format. */ the special plus format. */
while (*str) while (*str)
{ {
if (*str == '+' || *str == '\"' || *str == '%' if (*str == '+' || *str == '\"' || *str == '%'
|| *(const unsigned char *)str <= 0x20) || *(const unsigned char *)str <= 0x20)
destlen += 3; destlen += 3;
else else
@ -301,7 +301,7 @@ _gpgme_encode_percent_string (const char *src, char **destp, size_t len)
/* Convert the string. */ /* Convert the string. */
while (*src) while (*src)
{ {
if (*src == '+' || *src == '\"' || *src == '%' if (*src == '+' || *src == '\"' || *src == '%'
|| *(const unsigned char *)src <= 0x20) || *(const unsigned char *)src <= 0x20)
{ {
snprintf (dest, 4, "%%%02X", *(unsigned char *)src); snprintf (dest, 4, "%%%02X", *(unsigned char *)src);
@ -325,7 +325,7 @@ _gpgme_timegm (struct tm *tm)
SYSTEMTIME st; SYSTEMTIME st;
FILETIME ft; FILETIME ft;
unsigned long long cnsecs; unsigned long long cnsecs;
st.wYear = tm->tm_year + 1900; st.wYear = tm->tm_year + 1900;
st.wMonth = tm->tm_mon + 1; st.wMonth = tm->tm_mon + 1;
st.wDay = tm->tm_mday; st.wDay = tm->tm_mday;
@ -341,7 +341,7 @@ _gpgme_timegm (struct tm *tm)
gpg_err_set_errno (EINVAL); gpg_err_set_errno (EINVAL);
return (time_t)(-1); return (time_t)(-1);
} }
cnsecs = (((unsigned long long)ft.dwHighDateTime << 32) cnsecs = (((unsigned long long)ft.dwHighDateTime << 32)
| ft.dwLowDateTime); | ft.dwLowDateTime);
cnsecs -= 116444736000000000ULL; /* The filetime epoch is 1601-01-01. */ cnsecs -= 116444736000000000ULL; /* The filetime epoch is 1601-01-01. */
@ -381,7 +381,7 @@ _gpgme_parse_timestamp (const char *timestamp, char **endp)
memset (&buf, 0, sizeof buf); memset (&buf, 0, sizeof buf);
buf.tm_year = year - 1900; buf.tm_year = year - 1900;
buf.tm_mon = atoi_2 (timestamp+4) - 1; buf.tm_mon = atoi_2 (timestamp+4) - 1;
buf.tm_mday = atoi_2 (timestamp+6); buf.tm_mday = atoi_2 (timestamp+6);
buf.tm_hour = atoi_2 (timestamp+9); buf.tm_hour = atoi_2 (timestamp+9);
buf.tm_min = atoi_2 (timestamp+11); buf.tm_min = atoi_2 (timestamp+11);
@ -397,7 +397,7 @@ _gpgme_parse_timestamp (const char *timestamp, char **endp)
#else #else
{ {
time_t tim; time_t tim;
putenv ("TZ=UTC"); putenv ("TZ=UTC");
tim = mktime (&buf); tim = mktime (&buf);
#ifdef __GNUC__ #ifdef __GNUC__

View File

@ -3,17 +3,17 @@
Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
This file is part of GPGME. This file is part of GPGME.
GPGME is free software; you can redistribute it and/or modify it GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version. the License, or (at your option) any later version.
GPGME is distributed in the hope that it will be useful, but GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@ -119,7 +119,7 @@ gpgme_op_verify_result (gpgme_ctx_t ctx)
if (sig->notations) if (sig->notations)
{ {
TRACE_LOG1 ("sig[%i] = has notations (not shown)", i); TRACE_LOG1 ("sig[%i] = has notations (not shown)", i);
} }
sig = sig->next; sig = sig->next;
i++; i++;
} }
@ -135,7 +135,7 @@ static void
calc_sig_summary (gpgme_signature_t sig) calc_sig_summary (gpgme_signature_t sig)
{ {
unsigned long sum = 0; unsigned long sum = 0;
/* Calculate the red/green flag. */ /* Calculate the red/green flag. */
if (sig->validity == GPGME_VALIDITY_FULL if (sig->validity == GPGME_VALIDITY_FULL
|| sig->validity == GPGME_VALIDITY_ULTIMATE) || sig->validity == GPGME_VALIDITY_ULTIMATE)
@ -179,7 +179,7 @@ calc_sig_summary (gpgme_signature_t sig)
sum |= GPGME_SIGSUM_SYS_ERROR; sum |= GPGME_SIGSUM_SYS_ERROR;
break; break;
} }
/* Now look at the certain reason codes. */ /* Now look at the certain reason codes. */
switch (gpg_err_code (sig->validity_reason)) switch (gpg_err_code (sig->validity_reason))
{ {
@ -187,7 +187,7 @@ calc_sig_summary (gpgme_signature_t sig)
if (sig->validity == GPGME_VALIDITY_UNKNOWN) if (sig->validity == GPGME_VALIDITY_UNKNOWN)
sum |= GPGME_SIGSUM_CRL_TOO_OLD; sum |= GPGME_SIGSUM_CRL_TOO_OLD;
break; break;
case GPG_ERR_CERT_REVOKED: case GPG_ERR_CERT_REVOKED:
sum |= GPGME_SIGSUM_KEY_REVOKED; sum |= GPGME_SIGSUM_KEY_REVOKED;
break; break;
@ -199,15 +199,15 @@ calc_sig_summary (gpgme_signature_t sig)
/* Check other flags. */ /* Check other flags. */
if (sig->wrong_key_usage) if (sig->wrong_key_usage)
sum |= GPGME_SIGSUM_BAD_POLICY; sum |= GPGME_SIGSUM_BAD_POLICY;
/* Set the valid flag when the signature is unquestionable /* Set the valid flag when the signature is unquestionable
valid. (The test is identical to if(sum == GPGME_SIGSUM_GREEN)). */ valid. (The test is identical to if(sum == GPGME_SIGSUM_GREEN)). */
if ((sum & GPGME_SIGSUM_GREEN) && !(sum & ~GPGME_SIGSUM_GREEN)) if ((sum & GPGME_SIGSUM_GREEN) && !(sum & ~GPGME_SIGSUM_GREEN))
sum |= GPGME_SIGSUM_VALID; sum |= GPGME_SIGSUM_VALID;
sig->summary = sum; sig->summary = sum;
} }
static gpgme_error_t static gpgme_error_t
prepare_new_sig (op_data_t opd) prepare_new_sig (op_data_t opd)
@ -300,7 +300,7 @@ parse_new_sig (op_data_t opd, gpgme_status_code_t code, char *args)
end = tail; end = tail;
while (*end == ' ') while (*end == ' ')
end++; end++;
/* Parse the hash algo. */ /* Parse the hash algo. */
if (!*end) if (!*end)
goto parse_err_sig_fail; goto parse_err_sig_fail;
@ -326,7 +326,7 @@ parse_new_sig (op_data_t opd, gpgme_status_code_t code, char *args)
end = tail; end = tail;
while (*end == ' ') while (*end == ' ')
end++; end++;
/* Parse the return code. */ /* Parse the return code. */
if (end[0] && (!end[1] || end[1] == ' ')) if (end[0] && (!end[1] || end[1] == ' '))
{ {
@ -335,11 +335,11 @@ parse_new_sig (op_data_t opd, gpgme_status_code_t code, char *args)
case '4': case '4':
sig->status = gpg_error (GPG_ERR_UNSUPPORTED_ALGORITHM); sig->status = gpg_error (GPG_ERR_UNSUPPORTED_ALGORITHM);
break; break;
case '9': case '9':
sig->status = gpg_error (GPG_ERR_NO_PUBKEY); sig->status = gpg_error (GPG_ERR_NO_PUBKEY);
break; break;
default: default:
sig->status = gpg_error (GPG_ERR_GENERAL); sig->status = gpg_error (GPG_ERR_GENERAL);
} }
@ -348,12 +348,12 @@ parse_new_sig (op_data_t opd, gpgme_status_code_t code, char *args)
goto parse_err_sig_fail; goto parse_err_sig_fail;
goto parse_err_sig_ok; goto parse_err_sig_ok;
parse_err_sig_fail: parse_err_sig_fail:
sig->status = gpg_error (GPG_ERR_GENERAL); sig->status = gpg_error (GPG_ERR_GENERAL);
parse_err_sig_ok: parse_err_sig_ok:
break; break;
default: default:
return gpg_error (GPG_ERR_GENERAL); return gpg_error (GPG_ERR_GENERAL);
} }
@ -398,7 +398,7 @@ parse_valid_sig (gpgme_signature_t sig, char *args)
if (sig->timestamp == -1 || end == tail || (*tail && *tail != ' ')) if (sig->timestamp == -1 || end == tail || (*tail && *tail != ' '))
return gpg_error (GPG_ERR_INV_ENGINE); return gpg_error (GPG_ERR_INV_ENGINE);
end = tail; end = tail;
sig->exp_timestamp = _gpgme_parse_timestamp (end, &tail); sig->exp_timestamp = _gpgme_parse_timestamp (end, &tail);
if (sig->exp_timestamp == -1 || end == tail || (*tail && *tail != ' ')) if (sig->exp_timestamp == -1 || end == tail || (*tail && *tail != ' '))
return gpg_error (GPG_ERR_INV_ENGINE); return gpg_error (GPG_ERR_INV_ENGINE);
@ -521,7 +521,7 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args)
/* There is notation data without a previous notation /* There is notation data without a previous notation
name. The crypto backend misbehaves. */ name. The crypto backend misbehaves. */
return gpg_error (GPG_ERR_INV_ENGINE); return gpg_error (GPG_ERR_INV_ENGINE);
if (!notation->value) if (!notation->value)
{ {
dest = notation->value = malloc (len); dest = notation->value = malloc (len);
@ -537,7 +537,7 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args)
notation->value = dest; notation->value = dest;
dest += cur_len; dest += cur_len;
} }
err = _gpgme_decode_percent_string (args, &dest, len, 0); err = _gpgme_decode_percent_string (args, &dest, len, 0);
if (err) if (err)
return err; return err;
@ -618,7 +618,7 @@ parse_error (gpgme_signature_t sig, char *args, int set_status)
if (where) if (where)
*where = '\0'; *where = '\0';
where = args; where = args;
} }
else else
return gpg_error (GPG_ERR_INV_ENGINE); return gpg_error (GPG_ERR_INV_ENGINE);
@ -792,7 +792,7 @@ verify_status_handler (void *priv, gpgme_status_code_t code, char *args)
gpgme_error_t gpgme_error_t
_gpgme_op_verify_init_result (gpgme_ctx_t ctx) _gpgme_op_verify_init_result (gpgme_ctx_t ctx)
{ {
void *hook; void *hook;
op_data_t opd; op_data_t opd;
@ -924,27 +924,27 @@ gpgme_get_sig_status (gpgme_ctx_t ctx, int idx,
case GPG_ERR_NO_ERROR: case GPG_ERR_NO_ERROR:
*r_stat = GPGME_SIG_STAT_GOOD; *r_stat = GPGME_SIG_STAT_GOOD;
break; break;
case GPG_ERR_BAD_SIGNATURE: case GPG_ERR_BAD_SIGNATURE:
*r_stat = GPGME_SIG_STAT_BAD; *r_stat = GPGME_SIG_STAT_BAD;
break; break;
case GPG_ERR_NO_PUBKEY: case GPG_ERR_NO_PUBKEY:
*r_stat = GPGME_SIG_STAT_NOKEY; *r_stat = GPGME_SIG_STAT_NOKEY;
break; break;
case GPG_ERR_NO_DATA: case GPG_ERR_NO_DATA:
*r_stat = GPGME_SIG_STAT_NOSIG; *r_stat = GPGME_SIG_STAT_NOSIG;
break; break;
case GPG_ERR_SIG_EXPIRED: case GPG_ERR_SIG_EXPIRED:
*r_stat = GPGME_SIG_STAT_GOOD_EXP; *r_stat = GPGME_SIG_STAT_GOOD_EXP;
break; break;
case GPG_ERR_KEY_EXPIRED: case GPG_ERR_KEY_EXPIRED:
*r_stat = GPGME_SIG_STAT_GOOD_EXPKEY; *r_stat = GPGME_SIG_STAT_GOOD_EXPKEY;
break; break;
default: default:
*r_stat = GPGME_SIG_STAT_ERROR; *r_stat = GPGME_SIG_STAT_ERROR;
break; break;
@ -960,7 +960,7 @@ gpgme_get_sig_status (gpgme_ctx_t ctx, int idx,
number of the signature after a successful verify operation. WHAT number of the signature after a successful verify operation. WHAT
is an attribute where GPGME_ATTR_EXPIRE is probably the most useful is an attribute where GPGME_ATTR_EXPIRE is probably the most useful
one. WHATIDX is to be passed as 0 for most attributes . */ one. WHATIDX is to be passed as 0 for most attributes . */
unsigned long unsigned long
gpgme_get_sig_ulong_attr (gpgme_ctx_t ctx, int idx, gpgme_get_sig_ulong_attr (gpgme_ctx_t ctx, int idx,
_gpgme_attr_t what, int whatidx) _gpgme_attr_t what, int whatidx)
{ {
@ -994,22 +994,22 @@ gpgme_get_sig_ulong_attr (gpgme_ctx_t ctx, int idx,
{ {
case GPG_ERR_NO_ERROR: case GPG_ERR_NO_ERROR:
return GPGME_SIG_STAT_GOOD; return GPGME_SIG_STAT_GOOD;
case GPG_ERR_BAD_SIGNATURE: case GPG_ERR_BAD_SIGNATURE:
return GPGME_SIG_STAT_BAD; return GPGME_SIG_STAT_BAD;
case GPG_ERR_NO_PUBKEY: case GPG_ERR_NO_PUBKEY:
return GPGME_SIG_STAT_NOKEY; return GPGME_SIG_STAT_NOKEY;
case GPG_ERR_NO_DATA: case GPG_ERR_NO_DATA:
return GPGME_SIG_STAT_NOSIG; return GPGME_SIG_STAT_NOSIG;
case GPG_ERR_SIG_EXPIRED: case GPG_ERR_SIG_EXPIRED:
return GPGME_SIG_STAT_GOOD_EXP; return GPGME_SIG_STAT_GOOD_EXP;
case GPG_ERR_KEY_EXPIRED: case GPG_ERR_KEY_EXPIRED:
return GPGME_SIG_STAT_GOOD_EXPKEY; return GPGME_SIG_STAT_GOOD_EXPKEY;
default: default:
return GPGME_SIG_STAT_ERROR; return GPGME_SIG_STAT_ERROR;
} }