]> err.no Git - sope/commitdiff
fixed gcc 4.0 warnings
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sun, 24 Apr 2005 18:52:51 +0000 (18:52 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sun, 24 Apr 2005 18:52:51 +0000 (18:52 +0000)
do not flush input streams

git-svn-id: http://svn.opengroupware.org/SOPE/trunk@772 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-core/NGStreams/ChangeLog
sope-core/NGStreams/NGCTextStream.m
sope-core/NGStreams/NGDatagramSocket.m
sope-core/NGStreams/NGFileStream.m
sope-core/NGStreams/NGInternetSocketAddress.m
sope-core/NGStreams/NGNetUtilities.m
sope-core/NGStreams/NGPassiveSocket.m
sope-core/NGStreams/NGSocket.m
sope-core/NGStreams/Version

index f705d41c9b59f88717940b3b59cafe8988ae42af..247e80ac590b5e12e8d2c1bd99ef1dcaf4cc7d51 100644 (file)
@@ -1,3 +1,11 @@
+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
index 4708ed1cb58dbdc9ad8e6e685f0ab733c5d3640d..2fe1a447eaade303108cf8c7eeead782d56c819e 100644 (file)
@@ -64,13 +64,15 @@ NGStreams_DECLARE void NGInitTextStdio(void) {
 }
 
 + (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;
 }
@@ -293,7 +295,7 @@ static void _flushAtExit(void) {
     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) {
index fd64044a80bbab925506ab6e2bb6123a23c81787..b60c092eeefea770f028f2c0dca2d3a11ecf1941 100644 (file)
@@ -230,10 +230,10 @@ static const NSTimeInterval NGNoTimeout = 0.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
index d3c9f629dae97bbeb44ad55a2837240a8d41e987..4b99c1525f7ef6cdf306b857c9a379dfaca00ed8 100644 (file)
@@ -125,9 +125,12 @@ void NGInitStdio(void) {
     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];
@@ -145,20 +148,23 @@ void NGInitStdio(void) {
   
   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];
 }
index d106cdfe3353f1a27f776a8e2206b4fe7c2182e1..d50abdc421858c052006afb79a596db0c6d2645c 100644 (file)
@@ -262,10 +262,10 @@ static inline NSString *_nameOfLocalhost(void) {
   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;
@@ -297,7 +297,7 @@ static inline NSString *_nameOfLocalhost(void) {
 #else
       [systemLock lock];
       {
-        if ((hostEntity = gethostbyname(chost)) == NULL) {
+        if ((hostEntity = gethostbyname((char *)chost)) == NULL) {
           didFail = YES;
 #if defined(WIN32) && !defined(__CYGWIN32__)
           errorCode = WSAGetLastError();
index f0c41d46ce5730c5d73e9582a3bd73238963217a..a421b3e58e69842bd1270740b193f6c40bad6969 100644 (file)
 #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"])
index 57da080f3878eb55593f40948791ceb4676caa1d..8c4a6fc32f6d506b6d665716ed2132d9497cdea7 100644 (file)
   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];
     }
index 4641897a6e97c2f1e7ad14c85f4f0ef9931b72f4..51af5131aae31e5388411528eb718605074a8d14 100644 (file)
@@ -462,9 +462,14 @@ static void _killWinSock(void) {
 }
 
 - (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();
index 3e648f9518ad9e2a6f4d354849fed4dd84aa96f5..25b5b300b1c04946a177a8da7354fa8f8d53c6bf 100644 (file)
@@ -1,3 +1,3 @@
 # version file
 
-SUBMINOR_VERSION:=46
+SUBMINOR_VERSION:=47