Minor tidyup

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23064 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-06-15 14:05:22 +00:00
parent e1f32050ce
commit a5a2b746ad
2 changed files with 22 additions and 14 deletions

View file

@ -3,7 +3,10 @@
* Additions/GNUstepBase/GSXML.h: New XMLRPC settings to control * Additions/GNUstepBase/GSXML.h: New XMLRPC settings to control
timezone and to produce compact output. timezone and to produce compact output.
* Source/Additions/GSXML.m: New methods and bugfix for handling * Source/Additions/GSXML.m: New methods and bugfix for handling
strng data with no 'string' element markup. string data with no 'string' element markup.
* Additions/GNUstepBase/GSMime.h: Fix possible cases of parsing
saying that it needs more data when you have passed it an empty
data item to terminate parsing.
2006-06-06 Richard Frith-Macdonald <rfm@gnu.org> 2006-06-06 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -1472,15 +1472,13 @@ wordData(NSString *word)
} }
else else
{ {
BOOL result;
if (flags.wantEndOfLine == 1) if (flags.wantEndOfLine == 1)
{ {
result = [self parse: [NSData dataWithBytes: "\r\n" length: 2]]; [self parse: [NSData dataWithBytes: "\r\n" length: 2]];
} }
else if (flags.inBody == 1) else if (flags.inBody == 1)
{ {
result = [self _decodeBody: d]; [self _decodeBody: d];
} }
else else
{ {
@ -1488,12 +1486,12 @@ wordData(NSString *word)
* If still parsing headers, add CR-LF sequences to terminate * If still parsing headers, add CR-LF sequences to terminate
* the headers. * the headers.
*/ */
result = [self parse: [NSData dataWithBytes: "\r\n\r\n" length: 4]]; [self parse: [NSData dataWithBytes: "\r\n\r\n" length: 4]];
} }
flags.wantEndOfLine = 0; flags.wantEndOfLine = 0;
flags.inBody = 0; flags.inBody = 0;
flags.complete = 1; /* Finished parsing */ flags.complete = 1; /* Finished parsing */
return result; return NO; /* Want no more data */
} }
} }
@ -1684,21 +1682,24 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
/** /**
* <p> * <p>
* This method is called to parse a header line and split its * This method is called to parse a header line and split its
* contents into an info dictionary. * contents into the supplied [GSMimeHeader] instance.
* </p> * </p>
* <p> * <p>
* On entry, the dictionary is already partially filled, * On entry, the header (info) is already partially filled,
* the name argument is a lowercase representation of the * the name is a lowercase representation of the
* header name, and the scanner is set to a scan location * header name. The the scanner must be set to a scan location
* immediately after the colon in the header string. * immediately after the colon in the original header string
* (ie to the header value string).
* </p> * </p>
* <p> * <p>
* If the header is parsed successfully, the method should * If the header is parsed successfully, the method should
* return YES, otherwise NO. * return YES, otherwise NO.
* </p> * </p>
* <p> * <p>
* You should not call this method directly yourself, but may * You would not normally call this method directly yourself,
* override it to support parsing of new headers. * but may override it to support parsing of new headers.<br />
* If you do call this yourself, you need to be aware that it
* may change the state of the document in the parser.
* </p> * </p>
* <p> * <p>
* You should be aware of the parsing that the standard * You should be aware of the parsing that the standard
@ -2328,6 +2329,10 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
return hdr; return hdr;
} }
/*
* Return YES if more data is needed, NO if the body has been completely
* parsed.
*/
- (BOOL) _decodeBody: (NSData*)d - (BOOL) _decodeBody: (NSData*)d
{ {
unsigned l = [d length]; unsigned l = [d length];