mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Fix folding of headers containing underscores.
The quotedWord() and quotableLength() functions were disagreeing about which characters to quote. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39303 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b2b4f3cc5e
commit
26712aed33
2 changed files with 9 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2016-01-21 Niels Grewe <niels.grewe@halbordnung.de>
|
||||
|
||||
* Source/Additions/GSMime.m: Fix folding of headers containing
|
||||
a '_' character.
|
||||
|
||||
2016-01-21 Niels Grewe <niels.grewe@halbordnung.de>
|
||||
|
||||
* Tests/base/GSMime/general.m: Test case for quoted boundary
|
||||
|
|
|
@ -3750,6 +3750,8 @@ lastWhiteSpace(const uint8_t *ptr, NSUInteger minimum, NSUInteger from)
|
|||
return NSNotFound;
|
||||
}
|
||||
|
||||
static char* _charsToEncode = "()<>@,;:_\"/[]?.=";
|
||||
|
||||
static NSUInteger
|
||||
quotableLength(const uint8_t *ptr, NSUInteger size, NSUInteger max,
|
||||
NSUInteger *quotedLength)
|
||||
|
@ -3762,7 +3764,7 @@ quotableLength(const uint8_t *ptr, NSUInteger size, NSUInteger max,
|
|||
uint8_t c = ptr[index];
|
||||
int add = 1;
|
||||
|
||||
if (c < 32 || c >= 127 || strchr("()<>@,;:\"/[]?.=", c))
|
||||
if (c < 32 || c >= 127 || strchr(_charsToEncode, c))
|
||||
{
|
||||
add += 2;
|
||||
}
|
||||
|
@ -3790,7 +3792,7 @@ quotedWord(const uint8_t *ptr, NSUInteger size, uint8_t *buffer)
|
|||
{
|
||||
buffer[encoded++] = '_';
|
||||
}
|
||||
else if (c < 32 || c >= 127 || strchr("()<>@,;:_\"/[]?.=", c))
|
||||
else if (c < 32 || c >= 127 || strchr(_charsToEncode, c))
|
||||
{
|
||||
buffer[encoded++] = '=';
|
||||
buffer[encoded++] = hex[c>>4];
|
||||
|
|
Loading…
Reference in a new issue