add comments and fix tiny optimisation

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37049 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-09-08 20:52:12 +00:00
parent 54f8ff5971
commit e3784d6474

View file

@ -2929,14 +2929,25 @@ unfold(const unsigned char *src, const unsigned char *end, BOOL *folded)
length: src - beg
encoding: NSASCIIStringEncoding];
}
if (s == nil && _defaultEncoding != NSASCIIStringEncoding)
if (nil == s && _defaultEncoding != NSASCIIStringEncoding)
{
/* The parser has been explicitly set to accept an
* alternative coding ... which means that this is
* not a MIME document. Trey the encoding we were
* given.
*/
s = [NSStringClass allocWithZone: NSDefaultMallocZone()];
s = [s initWithBytes: beg
length: src - beg
encoding: _defaultEncoding];
if (s == nil && _defaultEncoding != NSUTF8StringEncoding)
if (nil == s && _defaultEncoding != NSUTF8StringEncoding)
{
/* The specified encoding didn't work, but the case
* where we would not be paresing a MIME document is
* generally when parsing HTTP, and if the remote
* system (usually browser) is buggy and sending the
* wrong characterset it's almost certain to be UTF8
*/
s = [NSStringClass allocWithZone: NSDefaultMallocZone()];
s = [s initWithBytes: beg
length: src - beg