+2005-04-24 Helge Hess <helge.hess@opengroupware.org>
+
+ * NGMime, NGImap4, NGMail: fixed gcc 4.0 warnings (v4.5.220)
+
2005-03-24 Helge Hess <helge.hess@skyrix.com>
* NGMime, NGMail: fixed OGo bug #1324 by adding support for multivalue
+2005-04-24 Helge Hess <helge.hess@opengroupware.org>
+
+ * fixed gcc 4.0 warnings
+
2005-03-24 Helge Hess <helge.hess@opengroupware.org>
* EOQualifier+IMAPAdditions.m: fixed a warning
- (NSDictionary *)unsubscribe:(NSString *)_name;
- (NSDictionary *)expunge;
-- (NSDictionary *)sort:(NSArray *)_sortOrderings
- qualifier:(EOQualifier *)_qual
+- (NSDictionary *)sort:(id)_sortOrderings qualifier:(EOQualifier *)_qual
encoding:(NSString *)_encoding;
- (NSDictionary *)fetchUids:(NSArray *)_uids parts:(NSArray *)_parts;
- (NSDictionary *)fetchUid:(unsigned)_uid parts:(NSArray *)_parts;
return [self->normer normalizeSortResponse:[self processCommand:sortStr]];
}
-- (NSDictionary *)sort:(id)_sortSpec
- qualifier:(EOQualifier *)_qual
+- (NSDictionary *)sort:(id)_sortSpec qualifier:(EOQualifier *)_qual
encoding:(NSString *)_encoding
{
/*
CountClient++;
}
-- (id<NGExtendedTextStream>)textStream {
+- (NGCTextStream *)textStream {
if (self->text == nil) {
if ([self->context lastException] == nil)
[self reconnect];
}
- return self->text;
+ return (NGCTextStream *)self->text;
}
/* description */
#import <NGExtensions/EODataSource+NGExtensions.h>
#import <NGImap4/NGImap4Folder.h>
+/*
+ NGImap4DataSource
+
+ Returned by the NGImap4FileManager when -dataSourceAtPath: is called.
+
+ TODO: does this also handle subfolders? If not, we should rename the
+ datasource class (eg NGImap4MessageDataSource).
+*/
+
@class NSArray;
@class NGImap4Folder;
@class EOFetchSpecification;
password:(NSString *)_pwd
host:(NSString *)_host;
-- (NGImap4Folder *)_lookupFolderAtPath:(NSArray *)_paths;
-
-- (NGImap4Folder *)_lookupFolderAtPathString:(NSString *)_path;
+- (id<NGImap4Folder>)_lookupFolderAtPath:(NSArray *)_paths;
+- (id<NGImap4Folder>)_lookupFolderAtPathString:(NSString *)_path;
- (EOQualifier *)_qualifierForFileName:(NSString *)_filename;
+
@end
@implementation NGImap4FileManager
/* internals */
- (id<NGImap4Folder>)_lookupFolderAtPath:(NSArray *)_paths {
+ id<NGImap4Folder> folder;
NSEnumerator *e;
NSString *path;
- id<NGImap4Folder> folder;
folder = self->currentFolder;
return folder;
}
-- (NGImap4Folder *)_lookupFolderAtPathString:(NSString *)_path {
+- (id<NGImap4Folder>)_lookupFolderAtPathString:(NSString *)_path {
return [self _lookupFolderAtPath:[_path pathComponents]];
}
- (BOOL)createDirectoryAtPath:(NSString *)_path
attributes:(NSDictionary *)_attributes
{
- NGImap4Folder *folder;
+ id<NGImap4Folder> folder;
NSString *filename;
if (![_path isAbsolutePath])
}
- (BOOL)changeCurrentDirectoryPath:(NSString *)_path {
- NGImap4Folder *folder;
+ id<NGImap4Folder> folder;
if ([_path length] == 0)
return NO;
directories:(BOOL)_dirs
files:(BOOL)_files
{
- NGImap4Folder *folder;
+ id<NGImap4Folder> folder;
NSMutableArray *results;
NSEnumerator *e;
NGImap4Folder *tmp;
}
- (NGImap4Message *)messageAtPath:(NSString *)_path {
- NGImap4Folder *folder;
+ id<NGImap4Folder> folder;
NSString *filename;
EOQualifier *q;
NSArray *msgs;
}
- (NSData *)contentsAtPath:(NSString *)_path part:(NSString *)_part {
- NSString *fileName;
- NGImap4Folder *folder;
+ id<NGImap4Folder> folder;
+ NSString *fileName;
if (![_path isAbsolutePath])
_path = [[self currentDirectoryPath] stringByAppendingPathComponent:_path];
if ((folder = [self _lookupFolderAtPath:[_path pathComponents]]) == nil)
return nil;
-
- return [folder blobForUid:[fileName unsignedIntValue] part:_part];
+
+ if (![folder respondsToSelector:@selector(blobForUid:part:)])
+ return nil;
+
+ return [(NGImap4Folder *)folder blobForUid:[fileName unsignedIntValue]
+ part:_part];
}
- (BOOL)fileExistsAtPath:(NSString *)_path {
return [self fileExistsAtPath:_path isDirectory:&isDir];
}
- (BOOL)fileExistsAtPath:(NSString *)_path isDirectory:(BOOL *)_isDir {
- NSArray *paths;
- NSString *fileName;
- NGImap4Folder *folder;
+ id<NGImap4Folder> folder;
+ NSArray *paths;
+ NSString *fileName;
if (![_path isAbsolutePath])
_path = [[self currentDirectoryPath] stringByAppendingPathComponent:_path];
traverseLink:(BOOL)flag
{
NSString *fileName;
- NGImap4Folder *folder, *sfolder;
+ id<NGImap4Folder> folder, sfolder;
if (![_path isAbsolutePath])
_path = [[self currentDirectoryPath] stringByAppendingPathComponent:_path];
if ((sfolder = [folder subFolderWithName:fileName caseInsensitive:NO]))
return [self _fileAttributesOfFolder:sfolder];
-
+
/* check for messages */
+
+ if (![folder isKindOfClass:[NGImap4Folder class]])
+ return nil;
+
{
EOQualifier *q;
NSArray *msgs;
}
return [self _fileAttributesOfMessage:[msgs objectAtIndex:0]
- inFolder:folder];
+ inFolder:(NGImap4Folder *)folder];
}
}
- (EODataSource *)dataSourceAtPath:(NSString *)_path {
- NGImap4Folder *f;
+ id<NGImap4Folder> f;
if ((f = [self _lookupFolderAtPath:[_path pathComponents]]) == nil)
return nil;
-
- return [[[NGImap4DataSource alloc] initWithFolder:f] autorelease];
+
+ // TODO: check whether 'f' is really an NGImap4Folder?
+ return [[[NGImap4DataSource alloc] initWithFolder:(NGImap4Folder *)f]
+ autorelease];
}
- (BOOL)syncMode {
#endif
}
-- (id)initWithContext:_context
+- (id)initWithContext:(NGImap4Context *)_context
name:(NSString *)_name
flags:(NSArray *)_flags
parentFolder:(id<NGImap4Folder>)_folder
#include "NGImap4Message+BodyStructure.h"
+@class NSNotification;
+
@interface NGImap4Message(Internals)
- (void)initializeMessage;
- (void)generateBodyStructure;
- (NSString *)_addFlagNotificationName;
- (NSString *)_removeFlagNotificationName;
-- (void)_removeFlag:(id)_obj;
-- (void)_addFlag:(id)_obj;
+- (void)_removeFlag:(NSNotification *)_obj;
+- (void)_addFlag:(NSNotification *)_obj;
- (void)setIsRead:(BOOL)_isRead;
@end /* NGImap4Message(Internals) */
: c;
}
static __inline__ BOOL _matchesString(NGImap4ResponseParser *self,
- unsigned char *s)
+ const char *s)
{
register unsigned int i;
return _subFolderWithName(self, _name, _caseIns);
}
-- (id<NGImap4Folder>)parentFolder {
+- (NGImap4Folder *)parentFolder {
return nil;
}
return _deleteSubFolder(self, _folder);
}
-- (BOOL)copySubFolder:(NGImap4Folder *)_f to:(id<NGImap4Folder>)_folder {
+- (BOOL)copySubFolder:(NGImap4Folder *)_f to:(NGImap4Folder *)_folder {
return _copySubFolder(self, _f, _folder);
}
-- (BOOL)moveSubFolder:(NGImap4Folder *)_f to:(id<NGImap4Folder>)_folder {
+- (BOOL)moveSubFolder:(NGImap4Folder *)_f to:(NGImap4Folder *)_folder {
return _moveSubFolder(self, _f, _folder);
}
[self logWithFormat:@"ERROR: could not connect: %@", self->address];
return nil;
}
-
- self->io = [[NGBufferedStream alloc] initWithSource:(id)self->socket];
+
+ self->io = [NGBufferedStream alloc]; // keep gcc happy
+ self->io = [self->io initWithSource:(id)self->socket];
self->parser = [[NGImap4ResponseParser alloc] initWithStream:self->socket];
/* receive greeting from server without tag-id */
int bufLen, logLen;
if (![self->socket isConnected]) {
- id con;
+ NSDictionary *con;
if ((con = [self openConnection]) == nil)
return nil;
forKeys:keys count:2];
}
-- (NSDictionary *)normalizeOpenConnectionResponse:(NGHashMap *)_map {
+- (NSMutableDictionary *)normalizeOpenConnectionResponse:(NGHashMap *)_map {
/* filter for open connection */
NSMutableDictionary *result;
NSString *tmp;
countBuf[i] = c;
}
countBuf[i] = '\0';
- byteCount = i > 0 ? atoi(countBuf) : 0;
+ byteCount = i > 0 ? atoi((char *)countBuf) : 0;
/* read CRLF */
}
octets[byteCount] = '\0';
- return [[NSString alloc] initWithUTF8String:octets];
+ return [[NSString alloc] initWithUTF8String:(char *)octets];
}
- (NSString *)readQuoted {
if (c == -1)
return nil;
- return [[NSString alloc] initWithUTF8String:buf];
+ return [[NSString alloc] initWithUTF8String:(char *)buf];
}
- (NSString *)readStringToCRLF {
}
}
- return [[NSString alloc] initWithUTF8String:buf];
+ return [[NSString alloc] initWithUTF8String:(char *)buf];
}
- (NSString *)readString {
static void _encodeToModifiedUTF7(unsigned char *_buf, int encLen,
unsigned char **result_,
unsigned int *cntRes_);
-static int _decodeOfModifiedUTF7(char *_target, unsigned _targetLen,
+static int _decodeOfModifiedUTF7(unsigned char *_target, unsigned _targetLen,
unsigned *usedBytes_ ,
unsigned char **buffer_,
int *bufLen_, int maxBuf);
res = calloc((len * 6) + 3, sizeof(char));
buf[len] = '\0';
res[len * 6] = '\0';
- [self getCString:buf];
+ [self getCString:(char *)buf];
while (cnt < len) {
int c = buf[cnt];
}
}
}
- result = [[NSString alloc] initWithCStringNoCopy:res
- length:cntRes
- freeWhenDone:YES];
+ result = [[NSString alloc] initWithCStringNoCopy:(char *)res
+ length:cntRes
+ freeWhenDone:YES];
free(buf); buf = NULL;
return [result autorelease];
}
buf[len] = '\0';
res[len] = '\0';
- [self getCString:buf];
+ [self getCString:(char *)buf];
while (cnt < (len - 1)) { /* &- */
unsigned char c;
if (cnt < len)
res[cntRes++] = buf[cnt++];
- result = [[NSString alloc] initWithCStringNoCopy:res
+ result = [[NSString alloc] initWithCStringNoCopy:(char *)res
length:cntRes
freeWhenDone:YES];
- free(buf); buf = NULL;
+ if (buf) free(buf); buf = NULL;
return [result autorelease];
}
- (NSString *)stringByEscapingImap4Password {
- // TODO: Unicode, perf
- unsigned char *buffer;
- const unsigned char *chars;
- unsigned len, i, j;
-
- len = [self cStringLength];
- chars = [self cString];
-
- buffer = calloc(len * 2 + 2, sizeof(char));
+ // TODO: perf
+ unichar *buffer;
+ unichar *chars;
+ unsigned len, i, j;
+ NSString *s;
+
+ len = [self length];
+ chars = calloc(len + 2, sizeof(unichar));
+ [self getCharacters:chars];
+
+ buffer = calloc(len * 2 + 2, sizeof(unichar));
buffer[len * 2] = '\0';
-
+
for (i = 0, j = 0; i < len; i++, j++) {
BOOL conv = NO;
if (chars[i] <= 0x1F || chars[i] > 0x7F) {
conv = YES;
}
- switch (chars[i]) {
+ else switch (chars[i]) {
case '(':
case ')':
case '{':
case '"':
case '\\':
conv = YES;
+ break;
}
-
+
if (conv) {
- buffer[j++] = '\\';
+ buffer[j] = '\\';
+ j++;
}
buffer[j] = chars[i];
- }
+ }
+ if (chars != NULL) free(chars); chars = NULL;
- return [[(NSString *)[NSString alloc]
- initWithCString:buffer length:j] autorelease];
+ s = [NSString stringWithCharacters:buffer length:j];
+ if (buffer != NULL) free(buffer); buffer = NULL;
+ return s;
}
@end /* NSString(Imap4) */
#define char64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)])
-static int _decodeOfModifiedUTF7(char *_target, unsigned _targetLen,
+static int _decodeOfModifiedUTF7(unsigned char *_target, unsigned _targetLen,
unsigned *usedBytes_ , unsigned char **buffer_,
int *bufLen_, int maxBuf)
{
+2005-04-24 Helge Hess <helge.hess@opengroupware.org>
+
+ * fixed gcc 4.0 warnings
+
2005-03-24 Helge Hess <helge.hess@opengroupware.org>
* NGMimeMessageGenerator.m: mark To, Cc and Bcc as multivalue header
}
static inline NSString *mkStrObj(const unsigned char *s, unsigned int l) {
- return [(NSString *)[StrClass alloc] initWithCString:s length:l];
+ // TODO: unicode
+ return [(NSString *)[StrClass alloc] initWithCString:(char *)s length:l];
}
static inline id parseWhiteSpaces(NGMailAddressParser *self, BOOL _guessMode) {
int keepPos = self->dataPos; // keep reference for backtracking
id returnValue = nil;
BOOL isAtom = YES;
- char text[self->maxLength]; // token text
+ unsigned char text[self->maxLength + 2]; // token text
int length = 0; // token text length
BOOL done = NO;
int keepPos = self->dataPos; // keep reference for backtracking
id returnValue = nil;
BOOL isQText = YES;
- char text[self->maxLength]; // token text
+ unsigned char text[self->maxLength + 4]; // token text
int length = 0; // token text length
BOOL done = YES;
int keepPos = self->dataPos; // keep reference for backtracking
id returnValue = nil;
BOOL isDText = YES;
- char text[self->maxLength]; // token text
+ unsigned char text[self->maxLength]; // token text
int length = 0; // token text length
BOOL done = YES;
/* constructors */
-+ (id)mailAddressParserWithString:(NSString *)_string {
- return [[(NGMailAddressParser *)[self alloc]
- initWithCString:[_string cString]
- length:[_string cStringLength]] autorelease];
-}
+ (id)mailAddressParserWithData:(NSData *)_data {
return [[(NGMailAddressParser *)[self alloc]
- initWithCString:(char *)[_data bytes]
+ initWithCString:[_data bytes]
length:[_data length]] autorelease];
}
+ (id)mailAddressParserWithCString:(char *)_cString {
return [[(NGMailAddressParser *)[self alloc]
- initWithCString:_cString
+ initWithCString:(unsigned char *)_cString
length:strlen(_cString)] autorelease];
}
- (id)initWithCString:(const unsigned char *)_cstr length:(int unsigned)_len {
if ((self = [super init])) {
+ // TODO: remember some string encoding?
self->data = (unsigned char *)_cstr;
self->maxLength = _len;
self->dataPos = 0;
}
return self;
}
+
+- (id)initWithString:(NSString *)_str {
+ // TODO: unicode
+ return [self initWithCString:(unsigned char *)[_str cString]
+ length:[_str cStringLength]];
+}
+
- (id)init {
return [self initWithCString:NULL length:0];
}
++ (id)mailAddressParserWithString:(NSString *)_string {
+ return [[(NGMailAddressParser *)[self alloc] initWithString:_string]
+ autorelease];
+}
+
- (void)dealloc {
self->data = NULL;
self->maxLength = 0;
// memcpy(des, bytes, cnt);
memcpy(des, iso, isoLen);
- desLen = NGEncodeQuotedPrintableMime(bytes, length,
- des + isoLen, desLen - isoLen);
+ desLen = NGEncodeQuotedPrintableMime((unsigned char *)bytes, length,
+ (unsigned char *)(des + isoLen),
+ desLen - isoLen);
if ((int)desLen != -1) {
memcpy(des + isoLen + desLen, isoEnd, isoEndLen);
if (UseFoundationStringEncodingForMimeHeader == -1) {
UseFoundationStringEncodingForMimeHeader
= [[NSUserDefaults standardUserDefaults]
- boolForKey:@"UseFoundationStringEncodingForMimeHeader"]
+ boolForKey:@"UseFoundationStringEncodingForMimeHeader"]
? 1 : 0;
}
if (NGMimeMessageParserClass == NULL) {
}
}
-- (id)parser:(id)_parser parseHeaderField:(NSString *)_field data:(NSData *)_data
+- (id)parser:(NGMimePartParser *)_p parseHeaderField:(NSString *)_field
+ data:(NSData *)_data
{
- id v = nil;
+ NGMimeMessageParser *parser = nil;
+ id v;
- if ([_parser isKindOfClass:NGMimeMessageParserClass] == NO) {
- NGMimeMessageParser *parser = nil;
-
- parser = [[NGMimeMessageParserClass alloc] init];
- v = [parser valueOfHeaderField:_field data:_data];
- [parser release]; parser = nil;
- }
+ if ([_p isKindOfClass:NGMimeMessageParserClass])
+ return nil;
+
+ parser = [[NGMimeMessageParserClass alloc] init];
+ v = [parser valueOfHeaderField:_field data:_data];
+ [parser release]; parser = nil;
return v;
}
- (id<NGMimeBodyParser>)parser:(NGMimePartParser *)_parser
bodyParserForPart:(id<NGMimePart>)_part
{
- id ctype;
- NGMimeType *contentType;
+ id ctype;
+ NGMimeType *contentType;
ctype = [_part contentType];
if (bytes[cnt] == '?') {
charset =
- [NSStringClass stringWithCString:(bytes + tmp) length:cnt - tmp];
+ [NSStringClass stringWithCString:(char *)(bytes + tmp)
+ length:(cnt - tmp)];
tmp = -1;
if ((length - cnt) > 2) {
NSString *tmpStr;
unsigned int tmpLen;
- tmpData = _rfc2047Decoding(encoding, bytes + tmp, cnt - tmp);
+ tmpData = _rfc2047Decoding(encoding, (char *)bytes + tmp, cnt - tmp);
foundQP = YES;
/*
+2005-04-24 Helge Hess <helge.hess@opengroupware.org>
+
+ * fixed gcc 4.0 warnings
+
2005-03-24 Helge Hess <helge.hess@opengroupware.org>
* NGMimePartGenerator.m: minor improvement in field generation API,
unsigned desLen;
unsigned char *des;
- if (buffer) free(buffer);
+ if (buffer != NULL) free(buffer); buffer = NULL;
{
NSData *data;
memcpy(des, buffer, cnt);
memcpy(des + cnt, iso, isoLen);
desLen =
- NGEncodeQuotedPrintableMime(buffer + cnt, bufLen - cnt,
+ NGEncodeQuotedPrintableMime((unsigned char *)buffer + cnt, bufLen- cnt,
des + cnt + isoLen,
desLen - cnt - isoLen);
if ((int)desLen != -1) {
memcpy(des + cnt + isoLen + desLen, isoEnd, isoEndLen);
- tmp = [NSString stringWithCString:des
+ tmp = [NSString stringWithCString:(char *)des
length:(cnt + isoLen + desLen + isoEndLen)];
}
else {
// TODO: unicode?
len = [tmp cStringLength];
ctmp = malloc(len + 3);
- [tmp getCString:ctmp]; ctmp[len] = '\0';
+ [tmp getCString:(char *)ctmp]; ctmp[len] = '\0';
cnt = 0;
doEnc = NO;
while (cnt < len) {
memcpy(des, ctmp, cnt);
memcpy(des + cnt, iso, isoLen);
desLen =
- NGEncodeQuotedPrintableMime(ctmp + cnt, len - cnt,
- des + cnt + isoLen,
- desLen - cnt - isoLen);
+ NGEncodeQuotedPrintableMime((unsigned char *)ctmp + cnt, len - cnt,
+ (unsigned char *)des + cnt + isoLen,
+ desLen - cnt - isoLen);
if ((int)desLen != -1) {
memcpy(des + cnt + isoLen + desLen, isoEnd, isoEndLen);
[data appendBytes:des length:(cnt + isoLen + desLen + isoEndLen)];
MimeLogEnabled = [self isMIMELogEnabled];
}
-- (id)parseValue:(NSString *)_data ofHeaderField:(NSString *)_field {
+- (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
unsigned len = [_data length];
- unichar src[len+1];
+ unichar src[len + 1];
unsigned cnt;
BOOL didModify;
NSString *str;
[_data getCharacters:src];
- // strip leading spaces
+ /* strip leading spaces */
if (StripLeadingSpaces) {
while (isRfc822_LWSP(src[cnt]) && (len > 0)) {
cnt++;
didModify = YES;
}
}
- // strip trailing spaces
+ /* strip trailing spaces */
while (len > 0) {
if (isRfc822_LWSP(src[len - 1])) {
len--;
}
str = nil;
- if (didModify)
- str = [[[NSString alloc] initWithCharacters:src+cnt length:len] autorelease];
- else
- str = _data;
+ str = (didModify)
+ ? [NSString stringWithCharacters:(src + cnt) length:len]
+ : _data;
return [[[NGMimeContentDispositionHeaderField alloc] initWithString:str]
autorelease];
return 2;
}
-- (id)parseValue:(NSString *)_data ofHeaderField:(NSString *)_field {
+- (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
const char *buf, *ptr;
_data = [self removeCommentsFromValue:_data];
tmp = [type type];
NSAssert(tmp, @"type should not be nil");
len = [tmp length];
- ctmp = malloc(len + 1);
- [tmp getCString:ctmp]; ctmp[len] = '\0';
+ ctmp = malloc(len + 4);
+ [tmp getCString:(char *)ctmp]; ctmp[len] = '\0';
[data appendBytes:ctmp length:len];
free(ctmp);
tmp = [type subType];
if (tmp != nil) {
len = [tmp length];
- ctmp = malloc(len + 1);
- [tmp getCString:ctmp]; ctmp[len] = '\0';
+ ctmp = malloc(len + 4);
+ [tmp getCString:(char *)ctmp]; ctmp[len] = '\0';
[data appendBytes:ctmp length:len];
free(ctmp);
}
len = [name cStringLength];
ctmp = malloc(len + 1);
- [name getCString:ctmp]; ctmp[len] = '\0';
+ [name getCString:(char *)ctmp]; ctmp[len] = '\0';
[data appendBytes:ctmp length:len];
free(ctmp);
BOOL doEnc;
len = [value cStringLength];
- ctmp = malloc(len + 1);
- [value getCString:ctmp]; ctmp[len] = '\0';
+ ctmp = malloc(len + 4);
+ [value getCString:(char *)ctmp]; ctmp[len] = '\0';
cnt = 0;
doEnc = NO;
while (cnt < len) {
MimeLogEnabled = [self isMIMELogEnabled];
}
-- (id)parseValue:(NSString *)_data ofHeaderField:(NSString *)_field {
+- (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
NSString *typeString;
unsigned len;
return _value;
}
-- (id)parseValue:(NSString *)_data ofHeaderField:(NSString *)_field {
+- (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
// abstract
NSLog(@"ERROR(%s): subclass should override this method: %@",
__PRETTY_FUNCTION__, self);
BOOL wasFound;
// TODO: do we need to treat the boundary as a CString?
- boundary = [_boundary cString];
+ boundary = (const unsigned char *)[_boundary cString];
length = [_boundary length];
enumerator = [_data objectEnumerator];
data = nil;
if (bytes[cnt] == '\n') {// LF*-
if (bytes[cnt + 1] == '-') { // LF--
- if (strncmp(boundary, bytes + cnt + 3, length) == 0) {
+ if (strncmp((char *)boundary, (char *)(bytes+cnt+3), length) == 0) {
wasFound = YES;
break;
}
}
else if (bytes[cnt] == '\r') { //CR*-
if (bytes[cnt + 1] == '-') { //CR--
- if (strncmp(boundary, bytes + cnt + 3, length) == 0) {
+ if (strncmp((char *)boundary, (char *)(bytes+cnt+3), length) == 0) {
wasFound = YES;
break;
}
}
else if ((bytes[cnt + 1] == '\n') && (bytes[cnt + 3] == '-')) {
- if (strncmp(boundary, bytes + cnt + 4, length) == 0) { // CRLF--
+ if (strncmp((char*)boundary, (char *)(bytes+cnt+4), length)==0) { // CRLF--
wasFound = YES;
break;
}
BOOL isMultiValue, isFirst;
/* get field name and strip leading spaces */
- fcname = [_field cString];
+ fcname = (const unsigned char *)[_field cString];
for (len = [_field cStringLength]; len > 0; fcname++, len--) {
if (*fcname != ' ')
break;
if (len > 0) { // len==0 means the value was a string of LWSP
[self->contentTransferEncoding release];
self->contentTransferEncoding =
- [[StringClass alloc] initWithCString:cstr length:len];
+ [[StringClass alloc] initWithCString:(char *)cstr length:len];
}
- else
- ASSIGN(self->contentTransferEncoding, (id)nil);
+ else {
+ [self->contentTransferEncoding release];
+ self->contentTransferEncoding = nil;
+ }
}
/*
take a look on content-length headers, since the parser
cstr++;
}
buf[i] = '\0'; // stop string after last digit (ignore the rest)
- self->contentLength = atoi(buf);
+ self->contentLength = atoi((char *)buf);
}
else {
/* header value are only spaces */
(value='Tue, 13 Jul 2004 21:39:28 +0530')
TODO: this is because libFoundation doesn't accept 'GMT+0530' as input.
*/
- unsigned char *p = s;
- NSTimeZone *tz;
- NSString *ts;
+ char *p = (char *)s;
+ NSTimeZone *tz;
+ NSString *ts;
if (len == 0)
return nil;
}
/* special case for GMT+0530 */
- if (strncmp(s, "+0530", 5) == 0)
+ if (strncmp((char *)s, "+0530", 5) == 0)
return gmt0530;
}
else if (len == 7) {
if (isdigit(p[1]) && isdigit(p[2]) && (p[3] == '-'||p[3] == '+')) {
unsigned char tmp[8];
- strncpy(tmp, p, 3);
+ strncpy((char *)tmp, p, 3);
tmp[3] = '0';
tmp[4] = '0';
tmp[5] = '\0';
}
}
else if (len == 3) {
- if (strcasecmp(s, "GMT") == 0) return gmt;
- if (strcasecmp(s, "MET") == 0) return met;
+ if (strcasecmp((char *)s, "GMT") == 0) return gmt;
+ if (strcasecmp((char *)s, "MET") == 0) return met;
}
if (isalpha(*s)) {
- ts = [[NSString alloc] initWithCString:s length:len];
+ ts = [[NSString alloc] initWithCString:(char *)s length:len];
}
else {
char buf[len + 5];
buf[0] = 'G'; buf[1] = 'M'; buf[2] = 'T';
if (*s == '+' || *s == '-') {
- strcpy(&(buf[3]), s);
+ strcpy(&(buf[3]), (char *)s);
}
else {
buf[3] = '+';
- strcpy(&(buf[4]), s);
+ strcpy(&(buf[4]), (char *)s);
}
ts = [[NSString alloc] initWithCString:buf];
}
return tz;
}
-- (id)parseValue:(NSString *)_data ofHeaderField:(id)_field {
+- (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
// TODO: use UNICODE
NSCalendarDate *date = nil;
unsigned char buf[256];
length = 254;
}
- [_data getCString:buf maxLength:length];
+ [_data getCString:(char *)buf maxLength:length];
buf[length] = '\0';
/* remove leading chars (skip to first digit, the day of the month) */
;
if (*pe == 0) goto failed;
*pe = '\0';
- dayOfMonth = atoi(bytes);
+ dayOfMonth = atoi((char *)bytes);
bytes = pe + 1;
/* parse month-abbrev (should be English, could be other langs) */
;
if (*pe == 0) goto failed;
*pe = '\0';
- year = atoi(bytes);
+ year = atoi((char *)bytes);
bytes = pe + 1;
if (year >= 70 && year < 135) // Y2K
year += 1900;
;
flag = (*pe == 0);
*pe = '\0';
- hour = bytes != pe ? atoi(bytes) : 0;
+ hour = bytes != pe ? atoi((char *)bytes) : 0;
if (flag) goto finished; // this is: '12\0'
bytes = pe + 1;
;
flag = (*pe == 0);
*pe = '\0';
- minute = bytes != pe ? atoi(bytes) : 0;
+ minute = bytes != pe ? atoi((char *)bytes) : 0;
if (flag) goto finished; // this is: '12:23\0'
bytes = pe + 1;
;
flag = (*pe == 0);
*pe = '\0';
- second = bytes != pe ? atoi(bytes) : 0;
+ second = bytes != pe ? atoi((char *)bytes) : 0;
if (flag) goto finished; // this is: '12:23:12\0'
bytes = pe + 1;
}
/* operation */
-- (id)parseValue:(NSString *)_value ofHeaderField:(NSString *)_field {
+- (id)parseValue:(id)_value ofHeaderField:(NSString *)_field {
// TODO: fixup
unsigned len = [_value length];
unsigned cnt;
if (len == 0) return NO; // no type was read
{
- unsigned char buf[len + 1];
+ unsigned char buf[len + 3];
register unsigned i;
buf[len] = '\0';
for (i = 0; i < len; i++) buf[i] = tolower(tmp[i]);
- *type = _stringForType(buf, len);
+ *type = _stringForType((char *)buf, len);
}
if (*cstr == '/') { // subtype name
buf[len] = '\0';
for (i = 0; i < len; i++) buf[i] = tolower(tmp[i]);
- *subType = _stringForSubType(buf, len);
+ *subType = _stringForSubType((char *)buf, len);
}
}
else {
buf[len] = '\0';
for (i = 0; i < len; i++) buf[i] = tolower(tmp[i]);
- attrName = _stringForParameterName(buf, len);
+ attrName = _stringForParameterName((char *)buf, len);
}
// skip spaces
while ((*cstr != '\0') && (isRfc822_LWSP(*cstr))) {
MAJOR_VERSION:=4
MINOR_VERSION:=5
-SUBMINOR_VERSION:=219
+SUBMINOR_VERSION:=220
# v4.5.214 requires libNGExtensions v4.5.146
# v4.2.149 requires libNGStreams v4.2.34