Fix typo causing preamature termination of long headers

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40065 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2016-08-28 09:53:38 +00:00
parent 53abf92dbb
commit fb8b9a7eb0
3 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2016-08-28 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSMime.m: Fix typo which was causing premature termination of
long headers.
2016-08-19 Richard Frith-Macdonald <rfm@gnu.org>
* config/objc-common.g: Darwin patch by David Wetzel

View file

@ -4103,7 +4103,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
*/
[m appendBytes: ptr + pos length: next - pos];
offset += next - pos;
pos += next;
pos = next;
if (pos < len)
{
/* We have more text to output, so fold the line.

View file

@ -72,6 +72,7 @@ int main()
GSMimeParser *parser;
GSMimeDocument *doc;
GSMimeDocument *idoc;
GSMimeHeader *hdr;
BOOL oldStyleFolding;
oldStyleFolding = [[NSUserDefaults standardUserDefaults]
@ -79,6 +80,11 @@ int main()
cr = [NSData dataWithBytes: "\r" length: 1];
hdr = [GSMimeHeader headerWithName: @"From"
value: @"Maurizio Buratti is testing the lenght of the field so it doesn't create issues with email sending <emailtesting@emailtest-dragontest2.brainstorm.co.uk>" parameters: nil];
data = [hdr rawMimeData];
PASS_EQUAL([data description], @"<46726f6d 3a204d61 7572697a 696f2042 75726174 74692069 73207465 7374696e 67207468 65206c65 6e676874 206f6620 74686520 6669656c 6420736f 20697420 646f6573 6e27740d 0a206372 65617465 20697373 75657320 77697468 20656d61 696c2073 656e6469 6e670d0a 203c656d 61696c74 65737469 6e674065 6d61696c 74657374 2d647261 676f6e74 65737432 2e627261 696e7374 6f726d2e 636f2e75 6b3e0d0a>", "encode long header ok");
data = [NSData dataWithBytes: "DQ==" length: 4];
PASS_EQUAL([GSMimeDocument decodeBase64: data], cr,
"decodeBase64 works for padded data");