} WOSetMethodType;
typedef struct {
- char *ckey;
+ unsigned char *ckey;
short keyLen:12;
short isFault:1;
WOKeyType type:3;
memcpy(info->ckey, cstr, info->keyLen);
info->ckey[info->keyLen] = '\0';
- NSCAssert(strlen(info->ckey) > 0, @"invalid ckey ..");
- NSCAssert((int)strlen(info->ckey) == (int)info->keyLen,
+ NSCAssert(strlen((char *)info->ckey) > 0, @"invalid ckey ..");
+ NSCAssert((int)strlen((char *)info->ckey) == (int)info->keyLen,
@"size and content differ");
info->object = nil;
method = class_get_instance_method(clazz, @selector(valueForBinding:));
info->type = WOKeyType_binding;
info->extra.key =
- [[StringClass alloc] initWithCString:(info->ckey + 1)];
+ [[StringClass alloc] initWithCString:(char *)(info->ckey + 1)];
}
else {
if (object) {
if (method != METHOD_NULL) {
info->type = WOKeyType_kvc;
info->extra.key =
- [[StringClass alloc] initWithCString:info->ckey];
+ [[StringClass alloc] initWithCString:(char *)info->ckey];
}
else {
- info->extra.sel.get = sel_get_uid(info->ckey);
+ info->extra.sel.get = sel_get_uid((char *)info->ckey);
method = class_get_instance_method(clazz, info->extra.sel.get);
if (method != METHOD_NULL)
info->type = WOKeyType_method;
}
}
else {
- info->extra.sel.get = sel_get_uid(info->ckey);
+ info->extra.sel.get = sel_get_uid((char *)info->ckey);
method = class_get_instance_method(clazz, info->extra.sel.get);
if (method != METHOD_NULL)
if (method != METHOD_NULL) {
info->type = WOKeyType_kvc;
info->extra.key =
- [[StringClass alloc] initWithCString:info->ckey];
+ [[StringClass alloc] initWithCString:(char *)info->ckey];
}
}
}
method = class_get_class_method(object, @selector(valueForKey:));
if (method != METHOD_NULL) {
info->type = WOKeyType_kvc;
- info->extra.key = [[StringClass alloc] initWithCString:info->ckey];
+ info->extra.key =
+ [[StringClass alloc] initWithCString:(char *)info->ckey];
}
else {
- info->extra.sel.get = sel_get_uid(info->ckey);
+ info->extra.sel.get = sel_get_uid((char *)info->ckey);
method =
class_get_class_method(*(Class *)object, info->extra.sel.get);
if (method != METHOD_NULL) {
}
static inline SEL _getSetSel(register const unsigned char *_key,
register unsigned _len) {
- char buf[259];
+ unsigned char buf[259];
_getSetSelName(buf, _key, _len);
- return sel_get_uid(buf);
+ return sel_get_uid((char *)buf);
}
static BOOL _setValue(WOKeyPathAssociation *self, id _value, id root) {
if ((clen = [_value cStringLength]) == 0)
sm.strmethod(object, setSel, "");
else {
- unsigned char *buf;
+ char *buf;
buf = malloc(clen + 4);
[_value getCString:buf]; buf[clen] = '\0';
sm.strmethod(object, setSel, buf);
- if (buf) free(buf);
+ if (buf != NULL) free(buf);
}
}
break;
2005-04-24 Helge Hess <helge.hess@opengroupware.org>
+ * v4.5.155
+
+ * WOMailDelivery.m: generate \r\n instead of \n when writing to the
+ sendmail process
+
+ * fixed gcc 4.0 warnings
+
* WOHttpAdaptor, WebDAV: fixed gcc 4.0 warnings (v4.5.154)
* v4.5.153
return;
}
- cookieValue = [_cookie value];
+ cookieValue = [(NGHttpCookie *)_cookie value];
if ([cookieValue isKindOfClass:[NSArray class]]) {
if ([cookieValue count] == 0)
cookieValue = @"";
}
p++; // skip the '?'
- map = NGDecodeUrlFormParameters(p, strlen(p));
- if (uribuf) free(uribuf); uribuf = NULL; p = NULL;
+ map = NGDecodeUrlFormParameters((unsigned char *)p, strlen((char *)p));
+ if (uribuf != NULL) free(uribuf); uribuf = NULL; p = NULL;
if (map == nil)
return formContent;
}
if (len == 0) return nil;
- body = NGDecodeUrlFormParameters(bytes, len);
+ body = NGDecodeUrlFormParameters((unsigned char *)bytes, len);
return [body autorelease];
}
- (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
unsigned len = 0;
- const unsigned char *src = NULL;
+ const unsigned char *src = NULL;
NGHttpHostHeaderField *value = nil;
NSString *str = nil;
}
else {
len = [_data cStringLength];
- src = [_data cString];
+ src = (const unsigned char *)[_data cString];
}
if (len == 0) {
#if DEBUG
len--;
}
- str = [[NSString alloc] initWithCString:src length:len];
+ str = [[NSString alloc] initWithCString:(char *)src length:len];
NSAssert(str, @"string allocation failed ..");
if ([_field isEqualToString:@"host"])
}
else {
len = [_data cStringLength];
- src = [_data cString];
+ src = (const unsigned char *)[_data cString];
}
if (len == 0) {
src++;
len--;
}
- scheme = [NSString stringWithCString:start length:(src - start)];
+ scheme = [NSString stringWithCString:(char *)start length:(src - start)];
}
// skip spaces
}
else {
len = [_data cStringLength];
- src = [_data cString];
+ src = (const unsigned char *)[_data cString];
}
if (len == 0) {
NSLog(@"field %@: current len=%i %s(%i)", _field, len, startPos, partLen);
#endif
- part = [self parseValuePart:startPos
+ part = [self parseValuePart:(const char *)startPos
length:partLen
zone:[array zone]];
if (part) {
@implementation NGHttpCharsetHeaderFieldParser
-- (id)parseValue:(NSData *)_data ofHeaderField:(NSString *)_field {
+- (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
id value = nil;
- value = [super parseValue:_data ofHeaderField:_field];
- if (value) {
- if (NSArrayClass == Nil)
- NSArrayClass = [NSArray class];
-
- NSAssert([value isKindOfClass:NSArrayClass], @"invalid value ..");
+ if ((value = [super parseValue:_data ofHeaderField:_field]) == nil)
+ return nil;
+
+ if (NSArrayClass == Nil)
+ NSArrayClass = [NSArray class];
- value = [[NGHttpCharsetHeaderField alloc] initWithArray:value];
- value = AUTORELEASE(value);
- }
+ NSAssert([value isKindOfClass:NSArrayClass], @"invalid value ..");
+
+ value = [[NGHttpCharsetHeaderField alloc] initWithArray:value];
+ value = [value autorelease];
return value;
}
bytes = [data mutableBytes];
/* strip trailing spaces ... */
- len = strlen(bytes);
+ len = strlen((char *)bytes);
while (len > 0) {
if (bytes[len - 1] != 32) break;
len--;
bytes[len] = '\0';
}
- if ((tmp = rindex(bytes, 32))) {
+ if ((tmp = (unsigned char *)rindex((char *)bytes, 32))) {
unsigned char *t2;
- if ((t2 = strstr(tmp, "HTTP"))) {
+ if ((t2 = (unsigned char *)strstr((char *)tmp, "HTTP"))) {
/* has a HTTP version spec ... */
*tmp = '\0';
tmp++;
- self->version = [[NSString alloc] initWithCString:tmp];
+ self->version = [[NSString alloc] initWithCString:(char *)tmp];
/* strip trailing spaces ... */
- len = strlen(bytes);
+ len = strlen((char *)bytes);
while (len > 0) {
if (bytes[len - 1] != 32) break;
len--;
/* has no HTTP version spec, but possibly trailing spaces */
/* strip trailing spaces ... */
- len = strlen(bytes);
+ len = strlen((char *)bytes);
while (len > 0) {
if (bytes[len - 1] != 32) break;
len--;
else {
/* has no HTTP version spec */
}
- self->uri = [[NSString alloc] initWithCString:bytes];
+ self->uri = [[NSString alloc] initWithCString:(char *)bytes];
- RELEASE(data); data = nil;
+ [data release]; data = nil;
}
#if 0
return NO;
}
-- (NGMimeBodyParser *)parserForBodyOfPart:(id<NGMimePart>)_part
+- (id<NGMimeBodyParser>)parserForBodyOfPart:(id<NGMimePart>)_part
data:(NSData *)_dt
{
NGMimeType *contentType;
- (NGHashMap *)uriParameters { // parameters in x-www-form-urlencoded encoding
if (self->uriParameters == nil) {
- const char *cstr = [self->uri cString];
- const char *pos = index(cstr, '?');
-
- if (pos) {
+ const char *cstr;
+ const unsigned char *pos;
+
+ cstr = [self->uri cString];
+ pos = (const unsigned char *)index(cstr, '?');
+ if (pos != NULL) {
pos++;
- self->uriParameters = NGDecodeUrlFormParameters(pos, strlen(pos));
+ self->uriParameters = NGDecodeUrlFormParameters(pos, strlen((char*)pos));
}
}
return self->uriParameters;
}
static __inline__ unsigned
-_unescapeUrl(const char *_src, unsigned _len, char *_dest)
+_unescapeUrl(const unsigned char *_src, unsigned _len, unsigned char *_dest)
{
+ // ODO: return Unicode?
register unsigned i, i2;
for (i = 0, i2 = 0; i < _len; i++, i2++) {
{
// TODO: we assume ISO-Latin-1/Unicode encoding, which might be wrong
#if LIB_FOUNDATION_LIBRARY
- return [[StrClass alloc] initWithCString:buffer length:len];
+ return [[StrClass alloc] initWithCString:(char *)buffer length:len];
#else
register signed int i;
unichar *s;
NSString *value;
- s = malloc((len + 2) * sizeof(unichar));
+ s = calloc((len + 2), sizeof(unichar));
for (i = len - 1; i >= 0; i--)
s[i] = buffer[i];
value = [[StrClass alloc] initWithCharacters:s length:len];
do {
NSString *key = nil, *value = nil;
unsigned tmp, len;
- char buffer[_len];
+ unsigned char buffer[_len];
/* read key */
tmp = pos;
while ((pos < _len) && (_buffer[pos] != '='))
pos++;
-
+
len = _unescapeUrl(&(_buffer[tmp]), (pos - tmp), buffer);
key = len > 0 ? urlStringFromBuffer(buffer, len) : @"";
static inline SEL _getSetSel(register const unsigned char *_key,
register unsigned _len) {
char buf[259];
- _getSetSelName(buf, _key, _len);
+ _getSetSelName((unsigned char *)buf, _key, _len);
#if APPLE_RUNTIME || NeXT_RUNTIME
return sel_getUid(buf);
#else
buf = malloc(keyLen + 2);
[_key getCString:buf];
- setSel = _getSetSel(buf, keyLen);
+ setSel = _getSetSel((unsigned char *)buf, keyLen);
free(buf); buf = NULL;
if (setSel == NULL) // no such selector
return (WOElement *)[cdef template];
}
-- (WOComponent *)pageWithName:(NSString *)_name
- languages:(NSArray *)_languages
-{
+- (id)pageWithName:(NSString *)_name languages:(NSArray *)_languages {
/*
TODO: this appears to be deprecated since the WOComponent initializer
is now -initWithContext: and we have no context here ...
- (void)setSession:(WOSession *)_session {
[self logWithFormat:@"ignoring -setSession:%@ on sub-context", _session];
}
-- (WOSession *)session {
+- (id)session {
return [[self parentContext] session];
}
- (void)setPage:(WOComponent *)_page {
[self logWithFormat:@"ignoring -setPage:%@ on sub-context", _page];
}
-- (WOComponent *)page {
+- (id)page {
return [[self parentContext] page];
}
- (BOOL)isCallable {
return YES;
}
-- (id)callOnObject:(id)_object inContext:(WOContext *)_ctx {
+- (id)callOnObject:(id)_object inContext:(id)_ctx {
return [_object ? _object : self->parent performActionNamed:self->daName];
}
- (id)initWithRequest:(WORequest *)_request {
NSString *ac;
- const unsigned char *ua;
- const unsigned char *tmp;
+ const char *ua;
+ const char *tmp;
int defaultOS = WEOS_UNKNOWN;
int defaultCPU = WECPU_UNKNOWN;
unsigned char buf[20];
sessionCount++;
- sprintf(buf, "%04X%04X%02X%08X",
+ sprintf((char *)buf, "%04X%04X%02X%08X",
[[self number] intValue], getpid(), sessionCount,
(unsigned int)time(NULL));
- wosid = [NSString stringWithCString:buf];
+ wosid = [NSString stringWithCString:(char *)buf];
return wosid;
}
-- (WOSession *)createSessionForRequest:(WORequest *)_request {
+- (id)createSessionForRequest:(WORequest *)_request {
if ([self respondsToSelector:@selector(createSession)]) {
/* call deprecated method */
[self warnWithFormat:@"calling deprecated -createSession .."];
}
}
-- (WOSession *)restoreSessionWithID:(NSString *)_sid
- inContext:(WOContext *)_ctx
-{
+- (id)restoreSessionWithID:(NSString *)_sid inContext:(WOContext *)_ctx {
WOSession *session;
*(&session) = nil;
}
}
-- (WOSession *)session {
+- (id)session {
return [[self context] session];
}
return self->permanentPageCacheSize;
}
-- (WOComponent *)pageWithName:(NSString *)_name {
+- (id)pageWithName:(NSString *)_name {
// deprecated in WO4
return [self pageWithName:_name inContext:[self context]];
}
return [page autorelease];
}
-- (WOComponent *)pageWithName:(NSString *)_name inContext:(WOContext *)_ctx {
+- (id)pageWithName:(NSString *)_name inContext:(WOContext *)_ctx {
return [self _pageWithName:_name inContext:_ctx];
}
-- (WOComponent *)pageWithName:(NSString *)_name forRequest:(WORequest *)_req {
+- (id)pageWithName:(NSString *)_name forRequest:(WORequest *)_req {
WOResourceManager *rm;
if ((rm = [self resourceManager]) == nil)
return self->childName;
}
-- (WOElement *)template {
+- (id)template {
return self->template;
}
return [@"/" stringByAppendingString:[self name]];
}
-- (WOApplication *)application {
+- (id)application {
if (self->application == nil)
return (self->application = [WOApplication application]);
return self->application;
return nil;
}
-- (WOSession *)session {
+- (id)session {
if (self->session == nil) {
if ((self->session = [[self context] session]) == nil) {
[self debugWithFormat:@"could not get session object from context %@",
return (!self->componentFlags.reloadTemplates) ? YES : NO;
}
-- (WOComponent *)pageWithName:(NSString *)_name {
+- (id)pageWithName:(NSString *)_name {
NSArray *languages;
WOResourceManager *rm;
WOComponent *component;
- (void)setParent:(WOComponent *)_parent {
self->parentComponent = _parent;
}
-- (WOComponent *)parent {
+- (id)parent {
return self->parentComponent;
}
- (id)initWithRequest:(WORequest *)_request {
if ((self = [super init])) {
- unsigned char buf[24];
+ char buf[24];
self->qpJoin = @"&";
sprintf(buf, "%03x%08x%08x", ++contextCount, (int)time(NULL), (int)self);
ASSIGN(self->session, _session);
}
-- (WOSession *)session {
+- (id)session {
// in WO4 -session creates a new session if none is associated
if (self->session == nil) {
/* components */
-- (WOComponent *)component {
+- (id)component {
return (self->componentStackCount > 0)
? self->componentStack[self->componentStackCount - 1]
: nil;
[_page ensureAwakeInContext:self];
ASSIGN(self->page, _page);
}
-- (WOComponent *)page {
+- (id)page {
return self->page;
}
/* DeprecatedMethodsInWO4 */
-- (WOApplication *)application {
+- (id)application {
if (self->application == nil)
self->application = [WOAppClass application];
- if (self->application == nil)
- NSLog(@"%s: missing application for context %@", __PRETTY_FUNCTION__, self);
+ if (self->application == nil) {
+ [self logWithFormat:
+ @"%s: missing application for context %@",
+ __PRETTY_FUNCTION__, self];
+ }
return self->application;
}
return [[self context] request];
}
-- (WOSession *)session {
+- (id)session {
return [[self context] session];
}
-- (WOSession *)existingSession {
+- (id)existingSession {
WOContext *ctx = [self context];
/* check whether the context has a session */
/* pages */
-- (WOComponent *)pageWithName:(NSString *)_name {
+- (id)pageWithName:(NSString *)_name {
return [[WOApplication application]
pageWithName:_name
inContext:[self context]];
self->extraAttributes = ea;
}
-- (WOElement *)template {
+- (id)template {
return nil;
}
@end /* WOElement(QueryString) */
NGObjWeb_DECLARE id OWGetProperty(NSDictionary *_set, NSString *_name) {
- id propValue = [_set objectForKey:_name];
-
- if (propValue) {
- propValue = RETAIN(propValue);
- [(id)_set removeObjectForKey:_name];
+ register id propValue;
+
+ if ((propValue = [_set objectForKey:_name]) != nil) {
+ propValue = [propValue retain];
+ [(NSMutableDictionary *)_set removeObjectForKey:_name];
}
return propValue;
}
}
}
-- (WOSession *)restoreSessionWithID:(NSString *)_sid
- request:(WORequest *)_request
-{
+- (id)restoreSessionWithID:(NSString *)_sid request:(WORequest *)_request {
NSAutoreleasePool *pool;
NSString *snp;
WOSession *session = nil;
[(NGActiveSocket *)self->socket setSendTimeout:[self sendTimeout]];
[(NGActiveSocket *)self->socket setReceiveTimeout:[self receiveTimeout]];
- if (self->socket) {
- id bStr;
-
- bStr = [[NGBufferedStream alloc] initWithSource:self->socket];
- if (logStream)
- self->log = [[WORecordRequestStream alloc] initWithSource:bStr];
+ if (self->socket != nil) {
+ NGBufferedStream *bStr;
+
+ bStr = [NGBufferedStream alloc]; // keep gcc happy
+ bStr = [bStr initWithSource:self->socket];
+ if (logStream) {
+ self->log = [WORecordRequestStream alloc]; // keep gcc happy
+ self->log = [(WORecordRequestStream *)self->log initWithSource:bStr];
+ }
else
self->log = nil;
- self->io =
- [[NGCTextStream alloc] initWithSource:(id)(self->log?self->log:bStr)];
+ self->io = [NGCTextStream alloc]; // keep gcc happy
+ self->io = [self->io initWithSource:(id)(self->log ? self->log : bStr)];
[bStr release]; bStr = nil;
}
NSArray *to, *cc;
FILE *toMail;
- to = [_email objectForKey:@"to"];
- cc = [_email objectForKey:@"cc"];
+ to = [(NSDictionary *)_email objectForKey:@"to"];
+ cc = [(NSDictionary *)_email objectForKey:@"cc"];
[sendmail appendString:[[NSUserDefaults standardUserDefaults]
stringForKey:@"WOSendMail"]];
[sendmail appendString:@" "];
[sendmail appendString:[cc componentsJoinedByString:@" "]];
- if ((toMail = popen([sendmail cString], "w"))) {
+ if ((toMail = popen([sendmail cString], "w")) != NULL) {
NSEnumerator *e = nil;
id entry;
NSString *tmp;
- if ((tmp = [[_email objectForKey:@"from"] stringValue])) {
- if (fprintf(toMail, "Reply-To: %s\n", [tmp cString]) < 0)
+ if ((tmp = [[(NSDictionary *)_email objectForKey:@"from"] stringValue])) {
+ if (fprintf(toMail, "Reply-To: %s\r\n", [tmp cString]) < 0)
goto failed;
- if (fprintf(toMail, "From: %s\n", [tmp cString]) < 0)
+ if (fprintf(toMail, "From: %s\r\n", [tmp cString]) < 0)
goto failed;
}
e = [to objectEnumerator];
- while ((entry = [e nextObject])) {
- if (fprintf(toMail, "To:%s\n", [[entry stringValue] cString]) < 0)
+ while ((entry = [e nextObject]) != nil) {
+ if (fprintf(toMail, "To:%s\r\n", [[entry stringValue] cString]) < 0)
goto failed;
}
e = [cc objectEnumerator];
- while ((entry = [e nextObject])) {
- if (fprintf(toMail, "Cc:%s\n", [[entry stringValue] cString]) < 0)
+ while ((entry = [e nextObject]) != nil) {
+ if (fprintf(toMail, "Cc:%s\r\n", [[entry stringValue] cString]) < 0)
goto failed;
}
- if ((tmp = [[_email objectForKey:@"subject"] stringValue])) {
- if (fprintf(toMail, "Subject:%s\n", [tmp cString]) < 0)
+ if ((tmp = [[(NSDictionary *)_email objectForKey:@"subject"] stringValue])) {
+ if (fprintf(toMail, "Subject:%s\r\n", [tmp cString]) < 0)
goto failed;
}
- if ((tmp = [[_email objectForKey:@"content-type"] stringValue])) {
- if (fprintf(toMail, "Content-type:%s\n", [tmp cString]) < 0)
+ if ((tmp = [[(NSDictionary *)_email objectForKey:@"content-type"] stringValue])) {
+ if (fprintf(toMail, "Content-type:%s\r\n", [tmp cString]) < 0)
goto failed;
}
- if ((tmp = [[_email objectForKey:@"content-length"] stringValue])) {
- if (fprintf(toMail, "Content-length:%s\n", [tmp cString]) < 0)
+ if ((tmp = [[(NSDictionary *)_email objectForKey:@"content-length"] stringValue])) {
+ if (fprintf(toMail, "Content-length:%s\r\n", [tmp cString]) < 0)
goto failed;
}
- // end header
- if (fprintf(toMail, "\n") < 0)
+ /* end header */
+ if (fprintf(toMail, "\r\n") < 0)
goto failed;
- // write body
+ /* write body */
{
- NSData *body = [_email objectForKey:@"body"];
+ NSData *body;
+
+ body = [(NSDictionary *)_email objectForKey:@"body"];
if (fwrite([body bytes], [body length], 1, toMail) < 0)
goto failed;
}
- fprintf(toMail, "\n");
+ fprintf(toMail, "\r\n");
pclose(toMail);
return YES;
profile.appendC++;
if (self->content == nil) _ensureBody(self);
- if ((len = _value ? strlen(_value) : 0) == 0)
+ if ((len = _value ? strlen((char *)_value) : 0) == 0)
return;
switch (self->contentEncoding) {
/* worst case ... */
NSString *s;
- if ((s = [[NSString alloc] initWithCString:_value])) {
+ if ((s = [[NSString alloc] initWithCString:(char *)_value])) {
self->addStr(self, @selector(appendContentString:), s);
[s release];
}
if (_p) {
printf("%s", [_p cString]);
- if (fh) fprintf(fh, "%s", [_p cString]);
+ if (fh != NULL) fprintf(fh, "%s", [_p cString]);
}
/* headers */
id val;
vals = [[_msg headersForKey:key] objectEnumerator];
- while ((val = [vals nextObject])) {
- s = [[val stringValue] cString];
+ while ((val = [vals nextObject]) != NULL) {
+ s = (unsigned char *)[[val stringValue] cString];
printf("%s: %s\n", [key cString], s);
- if (fh) fprintf(fh, "%s: %s\r\n", [key cString], s);
+ if (fh != NULL) fprintf(fh, "%s: %s\r\n", [key cString], s);
}
}
/* content */
- if ((s = [[_msg contentAsString] cString])) {
+ if ((s = (unsigned char *)[[_msg contentAsString] cString])) {
printf("\n%s\n", s);
- if (fh) fprintf(fh, "\r\n%s", s);
+ if (fh != NULL) fprintf(fh, "\r\n%s", s);
}
else {
printf("\n");
- if (fh) fprintf(fh, "\r\n");
+ if (fh != NULL) fprintf(fh, "\r\n");
}
- if (fh) fclose(fh);
+ if (fh != NULL) fclose(fh);
}
- (void)logRequest:(WORequest *)_rq {
return debugOn;
}
- (NSString *)loggingPrefix {
- unsigned char buf[32];
+ char buf[32];
sprintf(buf, "[wo-rm-0x%08X]", (unsigned)self);
return [NSString stringWithCString:buf];
}
return (WOElement *)[cdef template];
}
-- (WOComponent *)pageWithName:(NSString *)_name languages:(NSArray *)_langs {
+- (id)pageWithName:(NSString *)_name languages:(NSArray *)_langs {
/*
TODO: this appears to be deprecated since the WOComponent initializer
is now -initWithContext: and we have no context over here ...
rmkey = [handlerPath objectAtIndex:0];
if ([rmkey length] > 0) {
WOResourceManager *rm;
- id data;
+ NSDictionary *data;
rm = [[WOApplication application] resourceManager];
- if ((data = [rm _dataForKey:rmkey sessionID:nil])) {
+ if ((data = [rm _dataForKey:rmkey sessionID:nil]) != nil) {
WOResponse *response;
response = [WOResponse responseWithRequest:_request];
/* client caching */
-static __inline__ unsigned char *weekdayName(int dow) {
+static __inline__ char *weekdayName(int dow) {
switch (dow) {
case 0: return "Sun"; case 1: return "Mon"; case 2: return "Tue";
case 3: return "Wed"; case 4: return "Thu"; case 5: return "Fri";
default: return "UNKNOWN DAY OF WEEK !";
}
}
-static __inline__ unsigned char *monthName(int m) {
+static __inline__ char *monthName(int m) {
switch (m) {
case 1: return "Jan"; case 2: return "Feb"; case 3: return "Mar";
case 4: return "Apr"; case 5: return "May"; case 6: return "Jun";
{
NSCalendarDate *now;
NSString *s;
- unsigned char buf[32];
+ char buf[32];
now = [[NSCalendarDate alloc] initWithTimeIntervalSinceNow:-3600.0];
[now setTimeZone:gmt];
[self->lock unlock];
}
-- (WOSession *)restoreSessionWithID:(NSString *)_sid
- request:(WORequest *)_request
-{
+- (id)restoreSessionWithID:(NSString *)_sid request:(WORequest *)_request {
WOSession *session = nil;
if ([_sid length] == 0)
return self->isTerminating;
}
-- (WOApplication *)application {
+- (id)application {
if (self->application == nil)
self->application = [WOApplication application];
return self->application;
/* pages */
-- (WOComponent *)restorePageForContextID:(NSString *)_contextID {
+- (id)restorePageForContextID:(NSString *)_contextID {
unsigned short i;
unsigned ctxHash;
WOComponent *page = nil;
/* checkin/out */
-- (WOSession *)checkOutSessionWithSessionID:(NSString *)_sid
- request:(WORequest *)_request
-{
+- (id)checkOutSessionWithSessionID:(NSString *)_sid request:(WORequest *)_rq {
WOSession *session;
*(&session) = nil;
IS_DEPRECATED;
[self saveSessionForContext:[_session context]];
}
-- (WOSession *)restoreSessionWithID:(NSString *)_sid {
+- (id)restoreSessionWithID:(NSString *)_sid {
IS_DEPRECATED;
return [self restoreSessionWithID:_sid request:nil];
}
- (void)saveSessionForContext:(WOContext *)_context {
[self subclassResponsibility:_cmd];
}
-- (WOSession *)restoreSessionWithID:(NSString *)_sid
- request:(WORequest *)_request
-{
+- (id)restoreSessionWithID:(NSString *)_sid request:(WORequest *)_request {
[self subclassResponsibility:_cmd];
return nil;
}
static NSString *ContentLengthHeaderName = @"content-length";
-static NSString *stringForHeaderName(unsigned char *p) {
+static NSString *stringForHeaderName(char *p) { /* Note: arg is _not_ const */
/*
process header name
we try to be smart to avoid creation of NSString objects ...
*/
register unsigned len;
- register unsigned char c1;
+ register char c1;
if ((len = strlen(p)) == 0)
return @"";
{
unsigned char *t;
- for (t = p; *t != '\0'; t++)
+ for (t = (unsigned char *)p; *t != '\0'; t++)
*t = tolower(*t);
}
return [[NSString alloc] initWithCString:p];
if (heavyDebugOn)
printf("read header line: '%s'\n", self->lineBuffer);
- if (strlen(self->lineBuffer) == 0) {
+ if (strlen((char *)self->lineBuffer) == 0) {
/* found end of header */
break;
}
}
/* find key/value separator */
- if ((v = index(p, ':')) == NULL) {
+ if ((v = (unsigned char *)index((char *)p, ':')) == NULL) {
[self warnWithFormat:@"got malformed header line: '%s'",
self->lineBuffer];
continue;
if (*v != '\0') {
/* trim trailing spaces */
- for (idx = strlen(v) - 1; idx >= 0; idx--) {
+ for (idx = strlen((char *)v) - 1; idx >= 0; idx--) {
if ((v[idx] != ' ' && v[idx] != '\t'))
break;
}
}
- headerName = stringForHeaderName(p);
- headerValue = [[NSStringClass alloc] initWithCString:v];
+ headerName = stringForHeaderName((char *)p);
+ headerValue = [[NSStringClass alloc] initWithCString:(char *)v];
if (headerName == ContentLengthHeaderName)
- self->clen = atoi(v);
+ self->clen = atoi((char *)v);
if (headerName != nil || headerValue != nil) {
if (self->headers == nil)
// body. The current implementation is far from optimal and only added
// for Mono compatibility (and actually produces the same behaviour
// like with HTTP/1.0 ...)
- static unsigned char *contStatLine =
+ static char *contStatLine =
"HTTP/1.0 100 Continue\r\n"
"content-length: 0\r\n"
"\r\n";
- static unsigned char *failStatLine =
+ static char *failStatLine =
"HTTP/1.0 417 Expectation Failed\r\n"
"content-length: 0\r\n"
"\r\n";
- unsigned char *respline = NULL;
+ char *respline = NULL;
BOOL ok = YES;
[self debugWithFormat:@"process 100 continue on IO: %@", self->io];
{
/* sample line: "GET / HTTP/1.0" */
- unsigned char *p, *t;
+ char *p, *t;
/* parse method */
- p = self->lineBuffer;
+ p = (char *)self->lineBuffer;
if ((t = index(p, ' ')) == NULL) {
[self logWithFormat:@"got broken request line '%s'", self->lineBuffer];
return nil;
{
/* sample line: "HTTP/1.0 200 OK" */
- unsigned char *p, *t;
+ char *p, *t;
/* version */
- p = self->lineBuffer;
+ p = (char *)self->lineBuffer;
if ((t = index(p, ' ')) == NULL) {
[self logWithFormat:@"got broken response line '%s'", self->lineBuffer];
return nil;
@implementation WOStatisticsStore
-static unsigned char *monthAbbr[13] = {
+static char *monthAbbr[13] = {
"Dec",
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}
static id mkdbl(double d) {
#if 1
- unsigned char buf[64];
+ char buf[64];
sprintf(buf, "%.3f", d);
return [NSStringClass stringWithCString:buf];
#else
NSCalendarDate *now;
NSDate *startDate;
NSString *tmp;
- unsigned char buf[64];
+ char buf[64];
request = [_context request];
result = [NSMutableString stringWithCapacity:256];
value = [NSNumber numberWithInt:[value intValue] * 1024];
}
- if (d == nil) d = [NSMutableDictionary dictionary];
- [d setObject:value forKey:key];
+ if (d == nil)
+ d = [NSMutableDictionary dictionaryWithCapacity:16];
+ [(NSMutableDictionary *)d setObject:value forKey:key];
}
}
return d;