[git] GpgOL - branch, master, updated. gpgol-1.1.3-48-g1a9124f
by Andre Heinecke
cvs at cvs.gnupg.org
Thu Aug 1 15:38:04 CEST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".
The branch, master has been updated
via 1a9124f08d88a4549623b45146870fe7125ab60d (commit)
from e5f2b3f718ab56c1ecc0528d9117cbdd953815f6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1a9124f08d88a4549623b45146870fe7125ab60d
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Thu Aug 1 13:05:45 2013 +0000
Be more agressive in fix linebreaks
This now replaces all consecutive break indicating characters
by a single \n.
* src/common.c (fix_linebreaks): Replace all consecutive
linebreaks.
--
There are problems that some messages can not be decrypted because
the line endings are so messed up. \r\r\n\r\r\n is an example
of a line break I get when I've sent an encrypted message with
KMail. Outlook shows only one break but returns that if you
access the body over the OOM.
diff --git a/src/common.c b/src/common.c
index f458b15..9818ae5 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1023,10 +1023,11 @@ percent_escape (const char *str, const char *extra)
}
/* Fix linebreaks.
- This either removes the \r if it is followed by a \n
- or replaces it by a \n. This is neccessary because
- Micrsoft Word buffers appearently use only the \r
- to indicate line breaks.
+ This replaces all consecutive \r or \n characters
+ by a single \n.
+ There can be extremly weird combinations of linebreaks
+ like \r\r\n\r\r\n at the end of each line when
+ getting the body of a mail message.
*/
void
fix_linebreaks (char *str, int *len)
@@ -1038,11 +1039,17 @@ fix_linebreaks (char *str, int *len)
dst = str;
while (*src)
{
- if (src[0] == '\r' && src[1] == '\n')
- src++;
- else if (src[0] == '\r')
- src[0] = '\n';
- *(dst++) = *(src++);
+ if (*src == '\r' || *src == '\n')
+ {
+ do
+ src++;
+ while (*src == '\r' || *src == '\n');
+ *(dst++) = '\n';
+ }
+ else
+ {
+ *(dst++) = *(src++);
+ }
}
*dst = '\0';
*len = dst - str;
-----------------------------------------------------------------------
Summary of changes:
src/common.c | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
hooks/post-receive
--
GnuPG extension for MS Outlook
http://git.gnupg.org
More information about the Gnupg-commits
mailing list