Changeset 3262
- Timestamp:
- 06/07/06 00:44:15 (2 years ago)
- Files:
-
- trunk/Additions/NSAttributedStringAdditions.m (modified) (2 diffs)
- trunk/Additions/NSDataAdditions.m (modified) (2 diffs)
- trunk/Additions/NSMethodSignatureAdditions.m (modified) (1 diff)
- trunk/Additions/NSScannerAdditions.h (modified) (1 diff)
- trunk/Additions/NSScannerAdditions.m (modified) (3 diffs)
- trunk/Chat Core/AsyncSocket.m (modified) (8 diffs)
- trunk/Chat Core/InterThreadMessaging.m (modified) (1 diff)
- trunk/Chat Core/MVChatConnection.m (modified) (3 diffs)
- trunk/Chat Core/MVChatPluginManager.m (modified) (3 diffs)
- trunk/Chat Core/MVIRCChatConnection.m (modified) (3 diffs)
- trunk/Chat Core/MVIRCChatUser.m (modified) (1 diff)
- trunk/Chat Core/MVSILCChatConnection.m (modified) (4 diffs)
- trunk/Chat Core/MVSILCFileTransfer.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Additions/NSAttributedStringAdditions.m
r3072 r3262 238 238 const char *bytes = [data bytes]; 239 239 unsigned length = [data length]; 240 int i, j, start, end;240 unsigned i = 0, j = 0, start = 0, end = 0; 241 241 NSStringEncoding currentEncoding = encoding; 242 242 for( i = 0, start = 0; i < length; i++ ) { … … 661 661 NSCharacterSet *nonASCIISet = [[NSCharacterSet characterSetWithRange:NSMakeRange( 0, 127 )] invertedSet]; 662 662 663 c har *ctcpEncoding = NULL;663 const char *ctcpEncoding = NULL; 664 664 if( [[self string] rangeOfCharacterFromSet:nonASCIISet].location != NSNotFound ) { 665 665 switch( encoding ) { trunk/Additions/NSDataAdditions.m
r3146 r3262 94 94 unsigned long ixtext = 0; 95 95 unsigned long lentext = [self length]; 96 long ctremaining = 0;96 unsigned long ctremaining = 0; 97 97 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; 100 100 unsigned long ix = 0; 101 101 … … 135 135 136 136 if( lineLength > 0 ) { 137 if (charsonline >= lineLength) {137 if( charsonline >= lineLength ) { 138 138 charsonline = 0; 139 139 [result appendString:@"\n"]; trunk/Additions/NSMethodSignatureAdditions.m
r3072 r3262 16 16 va_start( strings, retType ); 17 17 18 while( type = va_arg( strings, char *) )18 while( ( type = va_arg( strings, char * ) ) ) 19 19 [types appendString:[NSString stringWithUTF8String:type]]; 20 20 trunk/Additions/NSScannerAdditions.h
r3072 r3262 4 4 @interface NSScanner (NSScannerAdditions) 5 5 - (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; 8 8 @end trunk/Additions/NSScannerAdditions.m
r3072 r3262 3 3 4 4 #import "NSScannerAdditions.h" 5 6 #define min(a,b) (a) > (b) ? (b) : (a) 5 7 6 8 @implementation NSScanner (NSScannerAdditions) … … 16 18 } 17 19 18 - (BOOL) scanStringLength:( int) maxLength intoString:(NSString **) stringValue {20 - (BOOL) scanStringLength:(unsigned) maxLength intoString:(NSString **) stringValue { 19 21 if( ! [self isAtEnd] ) { 20 22 unsigned location = [self scanLocation]; 21 23 NSString *source = [self string]; 22 int length = MIN( maxLength, [source length] - location );24 unsigned length = min( maxLength, [source length] - location ); 23 25 if( length > 0 ) { 24 26 *stringValue = [[self string] substringWithRange:NSMakeRange( location, length )]; … … 31 33 } 32 34 33 - (BOOL) scanCharactersFromSet:(NSCharacterSet *) scanSet maxLength:( int) maxLength intoString:(NSString **) stringValue {35 - (BOOL) scanCharactersFromSet:(NSCharacterSet *) scanSet maxLength:(unsigned) maxLength intoString:(NSString **) stringValue { 34 36 if( ! [self isAtEnd] ) { 35 37 unsigned location = [self scanLocation]; 36 38 NSString *source = [self string]; 37 int length = MIN( maxLength, [source length] - location );39 unsigned length = min( maxLength, [source length] - location ); 38 40 if( length > 0 ) { 39 41 unichar *chars = calloc( length, sizeof( unichar ) ); trunk/Chat Core/AsyncSocket.m
r3150 r3262 100 100 @public 101 101 NSMutableData *buffer; 102 CFIndexbytesDone;102 unsigned bytesDone; 103 103 NSTimeInterval timeout; 104 104 long tag; … … 138 138 @public 139 139 NSData *buffer; 140 CFIndexbytesDone;140 unsigned bytesDone; 141 141 long tag; 142 142 NSTimeInterval timeout; … … 431 431 NSData *resultData = nil; 432 432 433 struct addrinfo hints = {0}, *result; 433 struct addrinfo hints; 434 struct addrinfo *result = NULL; 434 435 hints.ai_family = PF_UNSPEC; 435 436 hints.ai_socktype = SOCK_STREAM; … … 1101 1102 { 1102 1103 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; 1106 1107 else 1107 1108 percentDone = 100; … … 1117 1118 { 1118 1119 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; 1122 1123 else 1123 1124 percentDone = 100; … … 1244 1245 1245 1246 // 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 ); 1247 1248 CFIndex bytesRead = CFReadStreamRead (theReadStream, packetbuf, bytesToRead); 1248 1249 … … 1261 1262 { 1262 1263 // Search for the terminating sequence in the buffer. 1263 inttermlen = [theCurrentRead->term length];1264 unsigned termlen = [theCurrentRead->term length]; 1264 1265 if (theCurrentRead->bytesDone >= termlen) 1265 1266 { 1266 const void *buf = [theCurrentRead->buffer bytes] + (theCurrentRead->bytesDone - termlen);1267 const void *buf = (UInt8 *)[theCurrentRead->buffer bytes] + (theCurrentRead->bytesDone - termlen); 1267 1268 const void *seq = [theCurrentRead->term bytes]; 1268 1269 done = (memcmp (buf, seq, termlen) == 0); … … 1382 1383 CFIndex bytesRemaining = [theCurrentWrite->buffer length] - theCurrentWrite->bytesDone; 1383 1384 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); 1385 1386 1386 1387 // Write. trunk/Chat Core/InterThreadMessaging.m
r3195 r3262 56 56 57 57 static NSMapTable *pThreadMessagePorts = NULL; 58 static pthread_mutex_t pGate = { 0 };58 static pthread_mutex_t pGate; 59 59 60 60 @interface InterThreadManager : NSObject trunk/Chat Core/MVChatConnection.m
r3201 r3262 553 553 [data appendData:stringData]; 554 554 } 555 } while( object = va_arg( ap, void *) );555 } while( ( object = va_arg( ap, void * ) ) ); 556 556 557 557 va_end( ap ); … … 580 580 [data appendData:stringData]; 581 581 } 582 } while( object = va_arg( ap, void *) );582 } while( ( object = va_arg( ap, void * ) ) ); 583 583 584 584 va_end( ap ); … … 1088 1088 if( ! [connection isConnected] ) return nil; 1089 1089 1090 NSString *nickname = target;1091 1090 target = [[connection chatUsersWithNickname:[target description]] allObjects]; 1092 1091 trunk/Chat Core/MVChatPluginManager.m
r3150 r3262 11 11 @implementation MVChatPluginManager 12 12 + (MVChatPluginManager *) defaultManager { 13 extern MVChatPluginManager *sharedInstance;14 13 return ( sharedInstance ? sharedInstance : ( sharedInstance = [[self allocWithZone:nil] init] ) ); 15 14 } … … 36 35 37 36 - (void) finalize { 38 extern MVChatPluginManager *sharedInstance;39 37 [[NSNotificationCenter defaultCenter] removeObserver:self]; 40 38 if( self == sharedInstance ) sharedInstance = nil; … … 43 41 44 42 - (void) dealloc { 45 extern MVChatPluginManager *sharedInstance;46 47 43 [[NSNotificationCenter defaultCenter] removeObserver:self]; 48 44 if( self == sharedInstance ) sharedInstance = nil; trunk/Chat Core/MVIRCChatConnection.m
r3243 r3262 420 420 @synchronized( _knownUsers ) { 421 421 return [NSSet setWithArray:[_knownUsers allValues]]; 422 } 422 } return nil; 423 423 } 424 424 … … 1492 1492 1493 1493 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 } 1495 1498 1496 1499 if( [command caseInsensitiveCompare:@"ACTION"] == NSOrderedSame && arguments ) { … … 2104 2107 - (void) _handle352WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_WHOREPLY 2105 2108 if( [parameters count] >= 7 ) { 2106 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]];2107 2109 MVChatUser *member = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:5]]; 2108 2110 [member _setUsername:[parameters objectAtIndex:2]]; trunk/Chat Core/MVIRCChatUser.m
r3197 r3262 48 48 - (void) sendMessage:(NSAttributedString *) message withEncoding:(NSStringEncoding) encoding asAction:(BOOL) action { 49 49 NSParameterAssert( message != nil ); 50 NSData *msg = [MVIRCChatConnection _flattenedIRCDataForMessage:message withEncoding:encoding andChatFormat:[[self connection] outgoingChatFormat]];51 50 [[self connection] _sendMessage:message withEncoding:encoding toTarget:[self nickname] asAction:action]; 52 51 } trunk/Chat Core/MVSILCChatConnection.m
r3229 r3262 425 425 } 426 426 427 if( ! kill_message ) kill_message = "";427 if( ! kill_message ) kill_message = (char *) ""; 428 428 NSString *killMessage = [NSString stringWithUTF8String:kill_message]; 429 429 … … 545 545 break; 546 546 case SILC_COMMAND_NICK: { 547 SilcClientEntry local_entry = va_arg( list, SilcClientEntry );548 547 char *nickname = va_arg( list, char * ); 549 548 /*const SilcClientID *old_client_id =*/ va_arg( list, SilcClientID * ); … … 570 569 571 570 if( ! channel_name ) break; 572 if( ! channel_topic ) channel_topic = "";571 if( ! channel_topic ) channel_topic = (char *) ""; 573 572 574 573 NSString *r = [[NSString allocWithZone:nil] initWithUTF8String:channel_name]; … … 625 624 [room _clearBannedUsers]; 626 625 627 if( ! topic ) topic = "";626 if( ! topic ) topic = (char *) ""; 628 627 629 628 NSData *msgData = [[NSData allocWithZone:nil] initWithBytes:topic length:strlen( topic )]; trunk/Chat Core/MVSILCFileTransfer.m
r3150 r3262 10 10 #pragma mark - 11 11 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 ) {12 static 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 ) { 13 13 MVFileTransfer *transfer = context; 14 14
