Changeset 3262

Show
Ignore:
Timestamp:
06/07/06 00:44:15 (2 years ago)
Author:
timothy
Message:

More warning fixes. Silly Xcode never showed these earlier.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Additions/NSAttributedStringAdditions.m

    r3072 r3262  
    238238        const char *bytes = [data bytes]; 
    239239        unsigned length = [data length]; 
    240         int i, j, start, end
     240        unsigned i = 0, j = 0, start = 0, end = 0
    241241        NSStringEncoding currentEncoding = encoding; 
    242242        for( i = 0, start = 0; i < length; i++ ) { 
     
    661661        NSCharacterSet *nonASCIISet = [[NSCharacterSet characterSetWithRange:NSMakeRange( 0, 127 )] invertedSet]; 
    662662 
    663         char *ctcpEncoding = NULL; 
     663        const char *ctcpEncoding = NULL; 
    664664        if( [[self string] rangeOfCharacterFromSet:nonASCIISet].location != NSNotFound ) { 
    665665                switch( encoding ) { 
  • trunk/Additions/NSDataAdditions.m

    r3146 r3262  
    9494        unsigned long ixtext = 0; 
    9595        unsigned long lentext = [self length]; 
    96         long ctremaining = 0; 
     96        unsigned long ctremaining = 0; 
    9797        unsigned char inbuf[3], outbuf[4]; 
    98         short i = 0; 
    99         short charsonline = 0, ctcopy = 0; 
     98        unsigned short i = 0; 
     99        unsigned short charsonline = 0, ctcopy = 0; 
    100100        unsigned long ix = 0; 
    101101 
     
    135135 
    136136                if( lineLength > 0 ) { 
    137                         if (charsonline >= lineLength) { 
     137                        if( charsonline >= lineLength ) { 
    138138                                charsonline = 0; 
    139139                                [result appendString:@"\n"]; 
  • trunk/Additions/NSMethodSignatureAdditions.m

    r3072 r3262  
    1616        va_start( strings, retType ); 
    1717 
    18         while( type = va_arg( strings, char * ) ) 
     18        while( ( type = va_arg( strings, char * ) ) ) 
    1919                [types appendString:[NSString stringWithUTF8String:type]]; 
    2020 
  • trunk/Additions/NSScannerAdditions.h

    r3072 r3262  
    44@interface NSScanner (NSScannerAdditions) 
    55- (BOOL) scanCharacterInto:(unichar *) unicharValue; 
    6 - (BOOL) scanStringLength:(int) length intoString:(NSString **) stringValue; 
    7 - (BOOL) scanCharactersFromSet:(NSCharacterSet *) scanSet maxLength:(int) length intoString:(NSString **) stringValue; 
     6- (BOOL) scanStringLength:(unsigned) length intoString:(NSString **) stringValue; 
     7- (BOOL) scanCharactersFromSet:(NSCharacterSet *) scanSet maxLength:(unsigned) length intoString:(NSString **) stringValue; 
    88@end 
  • trunk/Additions/NSScannerAdditions.m

    r3072 r3262  
    33 
    44#import "NSScannerAdditions.h" 
     5 
     6#define min(a,b) (a) > (b) ? (b) : (a) 
    57 
    68@implementation NSScanner (NSScannerAdditions) 
     
    1618} 
    1719 
    18 - (BOOL) scanStringLength:(int) maxLength intoString:(NSString **) stringValue { 
     20- (BOOL) scanStringLength:(unsigned) maxLength intoString:(NSString **) stringValue { 
    1921        if( ! [self isAtEnd] ) { 
    2022                unsigned location = [self scanLocation]; 
    2123                NSString *source = [self string]; 
    22                 int length = MIN( maxLength, [source length] - location ); 
     24                unsigned length = min( maxLength, [source length] - location ); 
    2325                if( length > 0 ) { 
    2426                        *stringValue = [[self string] substringWithRange:NSMakeRange( location, length )]; 
     
    3133} 
    3234 
    33 - (BOOL) scanCharactersFromSet:(NSCharacterSet *) scanSet maxLength:(int) maxLength intoString:(NSString **) stringValue { 
     35- (BOOL) scanCharactersFromSet:(NSCharacterSet *) scanSet maxLength:(unsigned) maxLength intoString:(NSString **) stringValue { 
    3436        if( ! [self isAtEnd] ) { 
    3537                unsigned location = [self scanLocation]; 
    3638                NSString *source = [self string]; 
    37                 int length = MIN( maxLength, [source length] - location ); 
     39                unsigned length = min( maxLength, [source length] - location ); 
    3840                if( length > 0 ) { 
    3941                        unichar *chars = calloc( length, sizeof( unichar ) ); 
  • trunk/Chat Core/AsyncSocket.m

    r3150 r3262  
    100100@public 
    101101        NSMutableData *buffer; 
    102         CFIndex bytesDone; 
     102        unsigned bytesDone; 
    103103        NSTimeInterval timeout; 
    104104        long tag; 
     
    138138        @public 
    139139        NSData *buffer; 
    140         CFIndex bytesDone; 
     140        unsigned bytesDone; 
    141141        long tag; 
    142142        NSTimeInterval timeout; 
     
    431431        NSData *resultData = nil; 
    432432         
    433         struct addrinfo hints = {0}, *result; 
     433        struct addrinfo hints; 
     434        struct addrinfo *result = NULL; 
    434435        hints.ai_family  = PF_UNSPEC; 
    435436        hints.ai_socktype = SOCK_STREAM; 
     
    11011102        { 
    11021103                int percentDone; 
    1103                 if ([theCurrentRead->buffer length] != 0) 
    1104                        percentDone = (float)theCurrentRead->bytesDone / 
    1105                                                  (float)[theCurrentRead->buffer length] * 100.0; 
     1104                unsigned length = [theCurrentRead->buffer length]; 
     1105                if (length != 0) 
     1106                        percentDone = (float)theCurrentRead->bytesDone / (float)length * 100.0; 
    11061107                else 
    11071108                        percentDone = 100; 
     
    11171118        { 
    11181119                int percentDone; 
    1119                 if ([theCurrentWrite->buffer length] != 0) 
    1120                        percentDone = (float)theCurrentWrite->bytesDone / 
    1121                                                  (float)[theCurrentWrite->buffer length] * 100.0; 
     1120                unsigned length = [theCurrentWrite->buffer length]; 
     1121                if (length != 0) 
     1122                        percentDone = (float)theCurrentWrite->bytesDone / (float)length * 100.0; 
    11221123                else 
    11231124                        percentDone = 100; 
     
    12441245 
    12451246                        // Read stuff into start of unfilled packet buffer space. 
    1246                         UInt8 *packetbuf = (UInt8 *)( [theCurrentRead->buffer mutableBytes] + theCurrentRead->bytesDone ); 
     1247                        UInt8 *packetbuf = ( (UInt8 *)[theCurrentRead->buffer mutableBytes] + theCurrentRead->bytesDone ); 
    12471248                        CFIndex bytesRead = CFReadStreamRead (theReadStream, packetbuf, bytesToRead); 
    12481249 
     
    12611262                                { 
    12621263                                        // Search for the terminating sequence in the buffer. 
    1263                                         int termlen = [theCurrentRead->term length]; 
     1264                                        unsigned termlen = [theCurrentRead->term length]; 
    12641265                                        if (theCurrentRead->bytesDone >= termlen) 
    12651266                                        { 
    1266                                                 const void *buf = [theCurrentRead->buffer bytes] + (theCurrentRead->bytesDone - termlen); 
     1267                                                const void *buf = (UInt8 *)[theCurrentRead->buffer bytes] + (theCurrentRead->bytesDone - termlen); 
    12671268                                                const void *seq = [theCurrentRead->term bytes]; 
    12681269                                                done = (memcmp (buf, seq, termlen) == 0); 
     
    13821383                        CFIndex bytesRemaining = [theCurrentWrite->buffer length] - theCurrentWrite->bytesDone; 
    13831384                        CFIndex bytesToWrite = (bytesRemaining < WRITE_CHUNKSIZE) ? bytesRemaining : WRITE_CHUNKSIZE; 
    1384                         UInt8 *writestart = (UInt8 *)([theCurrentWrite->buffer bytes] + theCurrentWrite->bytesDone); 
     1385                        UInt8 *writestart = ((UInt8 *)[theCurrentWrite->buffer bytes] + theCurrentWrite->bytesDone); 
    13851386 
    13861387                        // Write. 
  • trunk/Chat Core/InterThreadMessaging.m

    r3195 r3262  
    5656 
    5757static NSMapTable *pThreadMessagePorts = NULL; 
    58 static pthread_mutex_t pGate = { 0 }
     58static pthread_mutex_t pGate
    5959 
    6060@interface InterThreadManager : NSObject 
  • trunk/Chat Core/MVChatConnection.m

    r3201 r3262  
    553553                        [data appendData:stringData]; 
    554554                } 
    555         } while( object = va_arg( ap, void * ) ); 
     555        } while( ( object = va_arg( ap, void * ) ) ); 
    556556 
    557557        va_end( ap ); 
     
    580580                        [data appendData:stringData]; 
    581581                } 
    582         } while( object = va_arg( ap, void * ) ); 
     582        } while( ( object = va_arg( ap, void * ) ) ); 
    583583 
    584584        va_end( ap ); 
     
    10881088                if( ! [connection isConnected] ) return nil; 
    10891089 
    1090                 NSString *nickname = target; 
    10911090                target = [[connection chatUsersWithNickname:[target description]] allObjects]; 
    10921091 
  • trunk/Chat Core/MVChatPluginManager.m

    r3150 r3262  
    1111@implementation MVChatPluginManager 
    1212+ (MVChatPluginManager *) defaultManager { 
    13         extern MVChatPluginManager *sharedInstance; 
    1413        return ( sharedInstance ? sharedInstance : ( sharedInstance = [[self allocWithZone:nil] init] ) ); 
    1514} 
     
    3635 
    3736- (void) finalize { 
    38         extern MVChatPluginManager *sharedInstance; 
    3937        [[NSNotificationCenter defaultCenter] removeObserver:self]; 
    4038        if( self == sharedInstance ) sharedInstance = nil; 
     
    4341 
    4442- (void) dealloc { 
    45         extern MVChatPluginManager *sharedInstance; 
    46  
    4743        [[NSNotificationCenter defaultCenter] removeObserver:self]; 
    4844        if( self == sharedInstance ) sharedInstance = nil; 
  • trunk/Chat Core/MVIRCChatConnection.m

    r3243 r3262  
    420420        @synchronized( _knownUsers ) { 
    421421                return [NSSet setWithArray:[_knownUsers allValues]]; 
    422         } 
     422        } return nil; 
    423423} 
    424424 
     
    14921492 
    14931493        NSMutableData *arguments = nil; 
    1494         if( line != end ) arguments = [[NSMutableData allocWithZone:nil] initWithBytes:++line length:(end - line)]; 
     1494        if( line != end ) { 
     1495                line++; 
     1496                arguments = [[NSMutableData allocWithZone:nil] initWithBytes:line length:(end - line)]; 
     1497        } 
    14951498 
    14961499        if( [command caseInsensitiveCompare:@"ACTION"] == NSOrderedSame && arguments ) { 
     
    21042107- (void) _handle352WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_WHOREPLY 
    21052108        if( [parameters count] >= 7 ) { 
    2106                 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; 
    21072109                MVChatUser *member = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:5]]; 
    21082110                [member _setUsername:[parameters objectAtIndex:2]]; 
  • trunk/Chat Core/MVIRCChatUser.m

    r3197 r3262  
    4848- (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action { 
    4949        NSParameterAssert( message != nil ); 
    50         NSData *msg = [MVIRCChatConnection _flattenedIRCDataForMessage:message withEncoding:encoding andChatFormat:[[self connection] outgoingChatFormat]]; 
    5150        [[self connection] _sendMessage:message withEncoding:encoding toTarget:[self nickname] asAction:action]; 
    5251} 
  • trunk/Chat Core/MVSILCChatConnection.m

    r3229 r3262  
    425425                        } 
    426426 
    427                         if( ! kill_message ) kill_message = ""; 
     427                        if( ! kill_message ) kill_message = (char *) ""; 
    428428                        NSString *killMessage = [NSString stringWithUTF8String:kill_message]; 
    429429 
     
    545545                break; 
    546546        case SILC_COMMAND_NICK: { 
    547                 SilcClientEntry local_entry = va_arg( list, SilcClientEntry ); 
    548547                char *nickname = va_arg( list, char * ); 
    549548                /*const SilcClientID *old_client_id =*/ va_arg( list, SilcClientID * ); 
     
    570569 
    571570                if( ! channel_name ) break; 
    572                 if( ! channel_topic ) channel_topic = ""; 
     571                if( ! channel_topic ) channel_topic = (char *) ""; 
    573572 
    574573                NSString *r = [[NSString allocWithZone:nil] initWithUTF8String:channel_name]; 
     
    625624                [room _clearBannedUsers]; 
    626625 
    627                 if( ! topic ) topic = ""; 
     626                if( ! topic ) topic = (char *) ""; 
    628627 
    629628                NSData *msgData = [[NSData allocWithZone:nil] initWithBytes:topic length:strlen( topic )]; 
  • trunk/Chat Core/MVSILCFileTransfer.m

    r3150 r3262  
    1010#pragma mark - 
    1111 
    12 void silc_client_file_monitor( SilcClient client, SilcClientConnection conn, SilcClientMonitorStatus status, SilcClientFileError error, SilcUInt64 offset, SilcUInt64 filesize, SilcClientEntry client_entry, SilcUInt32 session_id, const char *filepath, void *context ) { 
     12static void silc_client_file_monitor( SilcClient client, SilcClientConnection conn, SilcClientMonitorStatus status, SilcClientFileError error, SilcUInt64 offset, SilcUInt64 filesize, SilcClientEntry client_entry, SilcUInt32 session_id, const char *filepath, void *context ) { 
    1313        MVFileTransfer *transfer = context; 
    1414