+2005-04-24 Helge Hess <helge.hess@opengroupware.org>
+
+ * v4.5.47
+
+ * fixed some gcc 4.0 warnings
+
+ * NGCTextStream.m, NGFileStream.m: do not flush input streams
+
2004-11-07 Helge Hess <helge.hess@opengroupware.org>
* NGStreams.xcode: properly link against libssl/libcrypto and set
}
+ (void)_flushForExit:(NSNotification *)_notification {
- [NGTextIn flush]; [NGTextIn release]; NGTextIn = nil;
+ // [NGTextIn flush];
+ [NGTextIn release]; NGTextIn = nil;
[NGTextOut flush]; [NGTextOut release]; NGTextOut = nil;
[NGTextErr flush]; [NGTextErr release]; NGTextErr = nil;
}
static void _flushAtExit(void) {
- [NGTextIn flush]; [NGTextIn release]; NGTextIn = nil;
+ // [NGTextIn flush];
+ [NGTextIn release]; NGTextIn = nil;
[NGTextOut flush]; [NGTextOut release]; NGTextOut = nil;
[NGTextErr flush]; [NGTextErr release]; NGTextErr = nil;
}
return YES;
buf = str = calloc(toGo + 1, sizeof(unsigned char));
- [_string getCString:str]; str[toGo] = '\0';
+ [_string getCString:(char *)str]; str[toGo] = '\0';
NS_DURING {
while (toGo > 0) {
- (id<NGDatagramPacket>)primaryReceivePacketWithMaxSize:(int)_maxSize {
id<NGSocketAddress> remote = nil;
id<NGDatagramPacket> packet = nil;
- char buffer[_maxSize];
- size_t size;
- int len = [[self domain] addressRepresentationSize];
- char data[len];
+ char buffer[_maxSize];
+ size_t size;
+ unsigned int len = [[self domain] addressRepresentationSize];
+ char data[len + 2];
size = recvfrom(self->fd, buffer, _maxSize,
0, // flags
to = [[NGFileStream alloc] __initWithOutConsole];
te = [to retain];
#else
- ti = [[NGFileStream alloc] __initWithDescriptor:0 mode:NGStreamMode_readOnly];
- to = [[NGFileStream alloc] __initWithDescriptor:1 mode:NGStreamMode_writeOnly];
- te = [[NGFileStream alloc] __initWithDescriptor:2 mode:NGStreamMode_writeOnly];
+ ti = [[NGFileStream alloc] __initWithDescriptor:0
+ mode:NGStreamMode_readOnly];
+ to = [[NGFileStream alloc] __initWithDescriptor:1
+ mode:NGStreamMode_writeOnly];
+ te = [[NGFileStream alloc] __initWithDescriptor:2
+ mode:NGStreamMode_writeOnly];
#endif
NGIn = [[NGBufferedStream alloc] initWithSource:(id)ti];
if ([NGIn isKindOfClass:[NGLockingStream class]])
return;
-
- li = [[NGLockingStream alloc] initWithSource:NGIn]; [NGIn release]; NGIn = li;
- lo = [[NGLockingStream alloc] initWithSource:NGOut]; [NGOut release]; NGOut = lo;
- le = [[NGLockingStream alloc] initWithSource:NGErr]; [NGErr release]; NGErr = le;
+
+ li = [[NGLockingStream alloc] initWithSource:(id)NGIn];
+ [NGIn release]; NGIn = li;
+ lo = [[NGLockingStream alloc] initWithSource:(id)NGOut];
+ [NGOut release]; NGOut = lo;
+ le = [[NGLockingStream alloc] initWithSource:(id)NGErr];
+ [NGErr release]; NGErr = le;
}
+ (void)_flushForExit:(NSNotification *)_notification {
- [NGIn flush];
+ //[NGIn flush];
[NGOut flush];
[NGErr flush];
}
static void _flushForExit(void) {
- [NGIn flush];
+ //[NGIn flush];
[NGOut flush];
[NGErr flush];
}
else {
const unsigned char *chost;
- chost = [[self hostName] cString];
+ chost = (unsigned char *)[[self hostName] cString];
// try to interpret hostname as INET dotted address (eg 122.133.44.87)
- *ia = inet_addr(chost);
+ *ia = inet_addr((char *)chost);
if ((int)*ia != -1) { // succeeded
self->isAddressFilled = YES;
#else
[systemLock lock];
{
- if ((hostEntity = gethostbyname(chost)) == NULL) {
+ if ((hostEntity = gethostbyname((char *)chost)) == NULL) {
didFail = YES;
#if defined(WIN32) && !defined(__CYGWIN32__)
errorCode = WSAGetLastError();
#include "common.h"
id<NGSocketAddress> NGSocketAddressFromString(NSString *_string) {
- const unsigned char *cstr = [_string cString];
+ const unsigned char *cstr = (unsigned char *)[_string cString];
if (cstr == NULL) return nil;
if ([_string length] < 1) return nil;
{
- const unsigned char *tmp = index(cstr, ':');
+ const unsigned char *tmp = (unsigned char *)index((char *)cstr, ':');
if (tmp) { // INET socket
NSString *hostName = nil;
if (((tmp - cstr) == 1) && (*cstr == '*'))
hostName = nil; // wildcard host
- else
- hostName = [NSString stringWithCString:cstr length:(tmp - cstr)];
+ else {
+ hostName = [NSString stringWithCString:(char *)cstr
+ length:(tmp - cstr)];
+ }
// check what comes after colon
if (isdigit(tmp[1])) {
// a port
- int port = atoi(tmp + 1);
+ int port = atoi((char *)tmp + 1);
return [NGInternetSocketAddress addressWithPort:port onHost:hostName];
}
else {
// a service or 'auto' for auto-assigned ports
- const unsigned char *tmp2 = index((tmp + 1), '/');
+ const unsigned char *tmp2;
NSString *protocol = @"tcp";
NSString *service;
-
+
+ tmp2 = (unsigned char *)index((char *)(tmp + 1), '/');
tmp++;
if (tmp2 == NULL)
- service = [NSString stringWithCString:tmp];
+ service = [NSString stringWithCString:(char *)tmp];
else {
- service = [NSString stringWithCString:tmp length:(tmp2 - tmp)];
- protocol = [NSString stringWithCString:(tmp2 + 1)];
+ service = [NSString stringWithCString:(char *)tmp
+ length:(tmp2 - tmp)];
+ protocol = [NSString stringWithCString:(char *)(tmp2 + 1)];
}
if ([service isEqualToString:@"auto"])
SYNCHRONIZED(self->acceptLock) {
id<NGSocketAddress> local = nil;
id<NGSocketAddress> remote = nil;
- int len;
+ socklen_t len;
char *data;
int newFd = NGInvalidSocketDescriptor;
NSString *reason = nil;
reason = [self reasonForLastError];
reason = [@"Could not accept: " stringByAppendingString:reason];
-
+
[[[NGCouldNotAcceptException alloc]
initWithReason:reason socket:self] raise];
}
}
- (void)getOption:(int)_option level:(int)_level value:(void *)_value
- len:(int *)_len {
+ len:(int *)_len
+{
+ int rc;
+ socklen_t tlen;
- if (getsockopt(fd, _level, _option, _value, _len) != 0) {
+ rc = getsockopt(fd, _level, _option, _value, &tlen);
+ if (_len) *_len = tlen;
+ if (rc != 0) {
NSString *reason = nil;
#if defined(WIN32) && !defined(__CYGWIN32__)
int e = WSAGetLastError();
# version file
-SUBMINOR_VERSION:=46
+SUBMINOR_VERSION:=47