Changeset 4979
- Timestamp:
- 10/19/07 13:26:04 (11 months ago)
- Files:
-
- WiredAdditions/trunk/NSError-WIAdditions.h (modified) (1 diff)
- WiredAdditions/trunk/NSError-WIAdditions.m (modified) (2 diffs)
- WiredAdditions/trunk/WIApplication.m (modified) (1 diff)
- WiredAdditions/trunk/WNAddress.h (copied) (copied from WiredAdditions/trunk/WIAddress.h) (2 diffs)
- WiredAdditions/trunk/WNAddress.m (moved) (moved from WiredAdditions/trunk/WIAddress.m) (8 diffs)
- WiredAdditions/trunk/WNError.h (copied) (copied from WiredAdditions/trunk/WIError.h) (1 diff)
- WiredAdditions/trunk/WNError.m (copied) (copied from WiredAdditions/trunk/WIError.m) (6 diffs)
- WiredAdditions/trunk/WNSocket.h (moved) (moved from WiredAdditions/trunk/WISocket.h) (5 diffs)
- WiredAdditions/trunk/WNSocket.m (moved) (moved from WiredAdditions/trunk/WISocket.m) (19 diffs)
- WiredAdditions/trunk/WNThread.h (moved) (moved from WiredAdditions/trunk/WIThread.h) (1 diff)
- WiredAdditions/trunk/WNThread.m (moved) (moved from WiredAdditions/trunk/WIThread.m) (3 diffs)
- WiredAdditions/trunk/WiredAdditions (added)
- WiredAdditions/trunk/WiredAdditions.h (modified) (2 diffs)
- WiredAdditions/trunk/WiredAdditions.xcodeproj/project.pbxproj (modified) (39 diffs)
- WiredAdditions/trunk/WiredAdditions/English.lproj (moved) (moved from WiredAdditions/trunk/English.lproj)
- WiredAdditions/trunk/WiredAdditions/English.lproj/Localizable.strings (modified) (5 diffs)
- WiredAdditions/trunk/WiredAdditions/French.lproj (moved) (moved from WiredAdditions/trunk/French.lproj)
- WiredAdditions/trunk/WiredAdditions/French.lproj/Localizable.strings (modified) (5 diffs)
- WiredAdditions/trunk/WiredAdditions/German.lproj (moved) (moved from WiredAdditions/trunk/German.lproj)
- WiredAdditions/trunk/WiredAdditions/German.lproj/Localizable.strings (modified) (5 diffs)
- WiredAdditions/trunk/WiredAdditions/Info.plist (moved) (moved from WiredAdditions/trunk/Info.plist) (1 diff)
- WiredAdditions/trunk/WiredAdditions/Japanese.lproj (moved) (moved from WiredAdditions/trunk/Japanese.lproj)
- WiredAdditions/trunk/WiredAdditions/Japanese.lproj/Localizable.strings (modified) (5 diffs)
- WiredAdditions/trunk/WiredAdditions/prefix.pch (copied) (copied from WiredAdditions/trunk/prefix.pch) (2 diffs)
- WiredAdditions/trunk/WiredNetworking (added)
- WiredAdditions/trunk/WiredNetworking/English.lproj (added)
- WiredAdditions/trunk/WiredNetworking/English.lproj/InfoPlist.strings (added)
- WiredAdditions/trunk/WiredNetworking/English.lproj/Localizable.strings (added)
- WiredAdditions/trunk/WiredNetworking/French.lproj (added)
- WiredAdditions/trunk/WiredNetworking/French.lproj/InfoPlist.strings (added)
- WiredAdditions/trunk/WiredNetworking/French.lproj/Localizable.strings (added)
- WiredAdditions/trunk/WiredNetworking/German.lproj (added)
- WiredAdditions/trunk/WiredNetworking/German.lproj/InfoPlist.strings (added)
- WiredAdditions/trunk/WiredNetworking/German.lproj/Localizable.strings (added)
- WiredAdditions/trunk/WiredNetworking/Info.plist (added)
- WiredAdditions/trunk/WiredNetworking/Japanese.lproj (added)
- WiredAdditions/trunk/WiredNetworking/Japanese.lproj/InfoPlist.strings (added)
- WiredAdditions/trunk/WiredNetworking/Japanese.lproj/Localizable.strings (added)
- WiredAdditions/trunk/WiredNetworking/prefix.pch (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredAdditions/trunk/NSError-WIAdditions.h
r4438 r4979 27 27 */ 28 28 29 #define WIArgumentErrorKey @"WIArgumentErrorKey" 30 29 31 @interface NSError(WIAdditions) 30 32 33 + (id)errorWithDomain:(NSString *)domain code:(NSInteger)code argument:(id)argument; 31 34 + (id)errorWithDomain:(NSString *)domain code:(NSInteger)code; 32 35 - (id)initWithDomain:(NSString *)domain code:(NSInteger)code; 33 36 37 - (NSAlert *)alert; 38 34 39 @end WiredAdditions/trunk/NSError-WIAdditions.m
r4438 r4979 31 31 @implementation NSError(WIAdditions) 32 32 33 + (id)errorWithDomain:(NSString *)domain code:(NSInteger)code argument:(id)argument { 34 return [self errorWithDomain:domain code:code userInfo:[NSDictionary dictionaryWithObject:argument forKey:WIArgumentErrorKey]]; 35 } 36 37 38 33 39 + (id)errorWithDomain:(NSString *)domain code:(NSInteger)code { 34 40 return [self errorWithDomain:domain code:code userInfo:NULL]; … … 41 47 } 42 48 49 50 51 #pragma mark - 52 53 - (NSAlert *)alert { 54 return [NSAlert alertWithMessageText:[self localizedDescription] 55 defaultButton:WILS(@"OK", @"NSError-WIAdditions: OK button") 56 alternateButton:NULL 57 otherButton:NULL 58 informativeTextWithFormat:@"%@", [self localizedFailureReason]]; 59 } 60 43 61 @end WiredAdditions/trunk/WIApplication.m
r4495 r4979 68 68 @implementation WIApplication 69 69 70 + (void)load {71 wi_initialize();72 }73 74 75 76 70 - (void)finishLaunching { 77 NSArray *arguments;78 const char **argv;79 int i, argc;80 81 arguments = [[NSProcessInfo processInfo] arguments];82 argc = (int) [arguments count];83 argv = malloc(argc);84 85 for(i = 0; i < argc; i++)86 argv[i] = [[arguments objectAtIndex:i] UTF8String];87 88 wi_load(argc, argv);89 free(argv);90 91 wi_log_stderr = true;92 93 71 [[NSNotificationCenter defaultCenter] 94 72 addObserver:self WiredAdditions/trunk/WNAddress.h
r4438 r4979 27 27 */ 28 28 29 enum _W IAddressFamily {30 W IAddressNull = WI_ADDRESS_NULL,31 W IAddressIPv4 = WI_ADDRESS_IPV4,32 W IAddressIPv6 = WI_ADDRESS_IPV629 enum _WNAddressFamily { 30 WNAddressNull = WI_ADDRESS_NULL, 31 WNAddressIPv4 = WI_ADDRESS_IPV4, 32 WNAddressIPv6 = WI_ADDRESS_IPV6 33 33 }; 34 typedef enum _W IAddressFamily WIAddressFamily;34 typedef enum _WNAddressFamily WNAddressFamily; 35 35 36 36 37 @class W IError;37 @class WNError; 38 38 39 @interface W IAddress : WIObject {39 @interface WNAddress : WIObject { 40 40 wi_address_t *_address; 41 41 } 42 42 43 43 44 + (W IAddress *)addressWithString:(NSString *)address error:(WIError **)error;45 + (W IAddress *)addressWithNetService:(NSNetService *)netService error:(WIError **)error;44 + (WNAddress *)addressWithString:(NSString *)address error:(WNError **)error; 45 + (WNAddress *)addressWithNetService:(NSNetService *)netService error:(WNError **)error; 46 46 47 - (id)initWithString:(NSString *)address error:(W IError **)error;48 - (id)initWithNetService:(NSNetService *)netService error:(W IError **)error;47 - (id)initWithString:(NSString *)address error:(WNError **)error; 48 - (id)initWithNetService:(NSNetService *)netService error:(WNError **)error; 49 49 50 50 - (void)setPort:(NSUInteger)port; 51 51 - (NSUInteger)port; 52 52 53 - (W IAddressFamily)family;53 - (WNAddressFamily)family; 54 54 - (NSString *)string; 55 55 - (NSString *)hostname; … … 58 58 59 59 60 @interface W IAddress(WISocketAdditions)60 @interface WNAddress(WISocketAdditions) 61 61 62 62 - (wi_address_t *)address; WiredAdditions/trunk/WNAddress.m
r4438 r4979 27 27 */ 28 28 29 #import <WiredAdditions/NSError-WIAdditions.h> 30 #import <WiredAdditions/WIAddress.h> 31 #import <WiredAdditions/WIError.h> 29 #import <WiredNetworking/WNAddress.h> 30 #import <WiredNetworking/WNError.h> 32 31 33 @implementation W IAddress32 @implementation WNAddress 34 33 35 + (W IAddress *)addressWithString:(NSString *)address error:(WIError **)error {34 + (WNAddress *)addressWithString:(NSString *)address error:(WNError **)error { 36 35 return [[[self alloc] initWithString:address error:error] autorelease]; 37 36 } … … 39 38 40 39 41 + (W IAddress *)addressWithNetService:(NSNetService *)netService error:(WIError **)error {40 + (WNAddress *)addressWithNetService:(NSNetService *)netService error:(WNError **)error { 42 41 return [[[self alloc] initWithNetService:netService error:error] autorelease]; 43 42 } … … 45 44 46 45 47 - (id)initWithString:(NSString *)address error:(W IError **)error {46 - (id)initWithString:(NSString *)address error:(WNError **)error { 48 47 wi_pool_t *pool; 49 48 … … 56 55 if(!_address) { 57 56 if(error) { 58 *error = [W IError errorWithDomain:WIWiredAdditionsErrorDomain59 code:W IAddressLookupFailed57 *error = [WNError errorWithDomain:WNWiredNetworkingErrorDomain 58 code:WNAddressLookupFailed 60 59 userInfo:[NSDictionary dictionaryWithObjectsAndKeys: 61 [W IError errorWithDomain:WILibWiredErrorDomain], WILibWiredErrorKey,60 [WNError errorWithDomain:WNLibWiredErrorDomain], WNLibWiredErrorKey, 62 61 address, WIArgumentErrorKey, 63 62 NULL]]; … … 74 73 75 74 76 - (id)initWithNetService:(NSNetService *)netService error:(W IError **)error {75 - (id)initWithNetService:(NSNetService *)netService error:(WNError **)error { 77 76 NSArray *addresses; 78 77 NSData *data; … … 85 84 if([addresses count] == 0) { 86 85 if(error) { 87 *error = [W IError errorWithDomain:WIWiredAdditionsErrorDomain88 code:W IAddressNetServiceLookupFailed];86 *error = [WNError errorWithDomain:WNWiredNetworkingErrorDomain 87 code:WNAddressNetServiceLookupFailed]; 89 88 } 90 89 … … 133 132 #pragma mark - 134 133 135 - (W IAddressFamily)family {136 return (W IAddressFamily) wi_address_family(_address);134 - (WNAddressFamily)family { 135 return (WNAddressFamily) wi_address_family(_address); 137 136 } 138 137 … … 167 166 168 167 169 @implementation W IAddress(WISocketAdditions)168 @implementation WNAddress(WISocketAdditions) 170 169 171 170 - (wi_address_t *)address { WiredAdditions/trunk/WNError.h
r4438 r4979 27 27 */ 28 28 29 enum _W IWiredAdditionsErrorDomain {30 W IAddressLookupFailed,31 W IAddressNetServiceLookupFailed,32 33 W ISocketConnectFailed,34 W ISocketWriteFailed,35 W ISocketReadFailed29 enum _WNWiredAdditionsErrorDomain { 30 WNAddressLookupFailed, 31 WNAddressNetServiceLookupFailed, 32 33 WNSocketConnectFailed, 34 WNSocketWriteFailed, 35 WNSocketReadFailed 36 36 }; 37 37 38 38 39 @interface WIError : NSError 40 41 #define WIWiredAdditionsErrorDomain @"WIWiredAdditionsErrorDomain" 42 #define WILibWiredErrorDomain @"WILibWiredErrorDomain" 43 44 #define WILibWiredErrorKey @"WILibWiredErrorKey" 45 #define WIArgumentErrorKey @"WIArgumentErrorKey" 39 #define WNWiredNetworkingErrorDomain @"WNWiredNetworkingErrorDomain" 40 #define WNLibWiredErrorDomain @"WNLibWiredErrorDomain" 41 #define WNLibWiredErrorKey @"WNLibWiredErrorKey" 46 42 47 43 48 + (id)errorWithDomain:(NSString *)domain code:(NSInteger)code argument:(id)argument; 44 @interface WNError : NSError 45 49 46 + (id)errorWithDomain:(NSString *)domain; 50 47 - (id)initWithDomain:(NSString *)domain; 51 48 52 - (NSAlert *)alert;53 54 49 @end WiredAdditions/trunk/WNError.m
r4438 r4979 27 27 */ 28 28 29 #import <Wired Additions/WIError.h>29 #import <WiredNetworking/WNError.h> 30 30 31 @implementation W IError31 @implementation WNError 32 32 33 33 + (id)errorWithDomain:(NSString *)domain code:(NSInteger)code argument:(id)argument { … … 47 47 wi_pool_t *pool; 48 48 49 if([domain isEqualToString:W ILibWiredErrorDomain]) {49 if([domain isEqualToString:WNLibWiredErrorDomain]) { 50 50 pool = wi_pool_init(wi_pool_alloc()); 51 51 … … 72 72 73 73 - (NSString *)localizedDescription { 74 if([[self domain] isEqualToString:W IWiredAdditionsErrorDomain]) {74 if([[self domain] isEqualToString:WNWiredNetworkingErrorDomain]) { 75 75 switch([self code]) { 76 case W IAddressLookupFailed:77 return WILS(@"Address Lookup Failed", @"W IError: WIAddressLookupFailed title");76 case WNAddressLookupFailed: 77 return WILS(@"Address Lookup Failed", @"WNError: WNAddressLookupFailed title"); 78 78 break; 79 79 80 case W IAddressNetServiceLookupFailed:81 return WILS(@"Address Lookup Failed", @"W IError: WIAddressNetServiceLookupFailed title");80 case WNAddressNetServiceLookupFailed: 81 return WILS(@"Address Lookup Failed", @"WNError: WNAddressNetServiceLookupFailed title"); 82 82 break; 83 83 84 case W ISocketConnectFailed:85 return WILS(@"Connect Failed", @"W IError: WISocketConnectFailed title");84 case WNSocketConnectFailed: 85 return WILS(@"Connect Failed", @"WNError: WNSocketConnectFailed title"); 86 86 break; 87 87 88 case W ISocketWriteFailed:89 return WILS(@"Socket Write Failed", @"W IError: WISocketWriteFailed title");88 case WNSocketWriteFailed: 89 return WILS(@"Socket Write Failed", @"WNError: WNSocketWriteFailed title"); 90 90 break; 91 91 92 case W ISocketReadFailed:93 return WILS(@"Socket Read Failed", @"W IError: WISocketReadFailed title");92 case WNSocketReadFailed: 93 return WILS(@"Socket Read Failed", @"WNError: WNSocketReadFailed title"); 94 94 break; 95 95 … … 108 108 id argument; 109 109 110 if([[self domain] isEqualToString:W IWiredAdditionsErrorDomain]) {111 error = [[[self userInfo] objectForKey:W ILibWiredErrorKey] localizedFailureReason];110 if([[self domain] isEqualToString:WNWiredNetworkingErrorDomain]) { 111 error = [[[self userInfo] objectForKey:WNLibWiredErrorKey] localizedFailureReason]; 112 112 argument = [[self userInfo] objectForKey:WIArgumentErrorKey]; 113 113 114 114 switch([self code]) { 115 case W IAddressLookupFailed:116 return [NSSWF:WILS(@"Could not resolve the address \"%@\": %@.", @"W IError: WIAddressLookupFailed description (hostname, underlying error)"),115 case WNAddressLookupFailed: 116 return [NSSWF:WILS(@"Could not resolve the address \"%@\": %@.", @"WNError: WNAddressLookupFailed description (hostname, underlying error)"), 117 117 argument, error]; 118 118 break; 119 119 120 case W IAddressNetServiceLookupFailed:121 return WILS(@"Could not retrieve address for server via Bonjour.", @"W IError: WIAddressNetServiceLookupFailed description");120 case WNAddressNetServiceLookupFailed: 121 return WILS(@"Could not retrieve address for server via Bonjour.", @"WNError: WNAddressNetServiceLookupFailed description"); 122 122 break; 123 123 124 case W ISocketConnectFailed:125 return [NSSWF:WILS(@"Could not connect to %@: %@.", @"W IError: WISocketConnectFailed description (address, underlying error)"),124 case WNSocketConnectFailed: 125 return [NSSWF:WILS(@"Could not connect to %@: %@.", @"WNError: WNSocketConnectFailed description (address, underlying error)"), 126 126 argument, error]; 127 127 break; 128 128 129 case W ISocketWriteFailed:130 return [NSSWF:WILS(@"Could not write to %@: %@.", @"W IError: WISocketWriteFailed description (address, underlying error)"),129 case WNSocketWriteFailed: 130 return [NSSWF:WILS(@"Could not write to %@: %@.", @"WNError: WNSocketWriteFailed description (address, underlying error)"), 131 131 argument, error]; 132 132 break; 133 133 134 case W ISocketReadFailed:135 return [NSSWF:WILS(@"Could not read from %@: %@.", @"W IError: WISocketReadFailed description (address, underlying error)"),134 case WNSocketReadFailed: 135 return [NSSWF:WILS(@"Could not read from %@: %@.", @"WNError: WNSocketReadFailed description (address, underlying error)"), 136 136 argument, error]; 137 137 break; … … 141 141 } 142 142 } 143 else if([[self domain] isEqualToString:W ILibWiredErrorDomain]) {143 else if([[self domain] isEqualToString:WNLibWiredErrorDomain]) { 144 144 return [self localizedDescription]; 145 145 } … … 148 148 } 149 149 150 151 152 #pragma mark -153 154 - (NSAlert *)alert {155 return [NSAlert alertWithMessageText:[self localizedDescription]156 defaultButton:WILS(@"OK", @"WIError: OK button")157 alternateButton:NULL158 otherButton:NULL159 informativeTextWithFormat:@"%@", [self localizedFailureReason]];160 }161 162 150 @end WiredAdditions/trunk/WNSocket.h
r4438 r4979 29 29 #import <openssl/ssl.h> 30 30 31 @interface W ISocketContext : WIObject {31 @interface WNSocketContext : WIObject { 32 32 wi_socket_context_t *_context; 33 33 } 34 34 35 35 36 + (W ISocketContext *)socketContextForClient;36 + (WNSocketContext *)socketContextForClient; 37 37 38 38 - (void)setSSLCiphers:(NSString *)iphers; … … 41 41 42 42 43 #define W ISocketBufferSize WI_SOCKET_BUFFER_SIZE43 #define WNSocketBufferSize WI_SOCKET_BUFFER_SIZE 44 44 45 45 46 enum _W ISocketType {47 W ISocketTCP = WI_SOCKET_TCP,48 W ISocketUDP = WI_SOCKET_UDP46 enum _WNSocketType { 47 WNSocketTCP = WI_SOCKET_TCP, 48 WNSocketUDP = WI_SOCKET_UDP 49 49 }; 50 typedef enum _W ISocketType WISocketType;50 typedef enum _WNSocketType WNSocketType; 51 51 52 52 53 enum _W ISocketDirection {54 W ISocketRead = WI_SOCKET_READ,55 W ISocketWrite = WI_SOCKET_WRITE53 enum _WNSocketDirection { 54 WNSocketRead = WI_SOCKET_READ, 55 WNSocketWrite = WI_SOCKET_WRITE 56 56 }; 57 typedef enum _W ISocketDirection WISocketDirection;57 typedef enum _WNSocketDirection WNSocketDirection; 58 58 59 59 60 @class W IAddress, WIError;60 @class WNAddress, WNError; 61 61 62 @interface W ISocket : WIObject {62 @interface WNSocket : WIObject { 63 63 wi_socket_t *_socket; 64 64 65 W IAddress *_address;65 WNAddress *_address; 66 66 67 67 NSMutableString *_buffer; … … 69 69 70 70 71 + (W ISocket *)socketWithAddress:(WIAddress *)address type:(WISocketType)type;72 + (W ISocket *)socketWithFileDescriptor:(int)sd;71 + (WNSocket *)socketWithAddress:(WNAddress *)address type:(WNSocketType)type; 72 + (WNSocket *)socketWithFileDescriptor:(int)sd; 73 73 74 - (id)initWithAddress:(W IAddress *)address type:(WISocketType)type;74 - (id)initWithAddress:(WNAddress *)address type:(WNSocketType)type; 75 75 - (id)initWithFileDescriptor:(int)sd; 76 76 77 - (W IAddress *)address;77 - (WNAddress *)address; 78 78 - (int)fileDescriptor; 79 79 - (SSL *)SSL; … … 87 87 - (void)setPort:(NSUInteger)port; 88 88 - (NSUInteger)port; 89 - (void)setDirection:(W ISocketDirection)direction;90 - (W ISocketDirection)direction;89 - (void)setDirection:(WNSocketDirection)direction; 90 - (WNSocketDirection)direction; 91 91 - (void)setBlocking:(BOOL)blocking; 92 92 - (BOOL)blocking; … … 96 96 - (BOOL)waitWithTimeout:(double)timeout; 97 97 98 - (BOOL)connectWithContext:(W ISocketContext *)context timeout:(double)timeout error:(WIError **)error;98 - (BOOL)connectWithContext:(WNSocketContext *)context timeout:(double)timeout error:(WNError **)error; 99 99 - (void)close; 100 100 101 - (BOOL)writeString:(NSString *)string encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(W IError **)error;101 - (BOOL)writeString:(NSString *)string encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(WNError **)error; 102 102 103 - (NSString *)readStringOfLength:(NSUInteger)length encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(W IError **)error;104 - (NSString *)readStringUpToString:(NSString *)separator encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(W IError **)error;103 - (NSString *)readStringOfLength:(NSUInteger)length encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(WNError **)error; 104 - (NSString *)readStringUpToString:(NSString *)separator encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(WNError **)error; 105 105 106 106 @end WiredAdditions/trunk/WNSocket.m
r4438 r4979 27 27 */ 28 28 29 #import <WiredAdditions/NSError-WIAdditions.h> 30 #import <WiredAdditions/WIAddress.h> 31 #import <WiredAdditions/WIError.h> 32 #import <WiredAdditions/WISocket.h> 33 34 #define _WISocketBufferMaxSize 131072 35 36 37 @interface WISocketContext(Private) 29 #import <WiredNetworking/WNAddress.h> 30 #import <WiredNetworking/WNError.h> 31 #import <WiredNetworking/WNSocket.h> 32 33 #define _WNSocketBufferMaxSize 131072 34 35 36 @interface WNSocketContext(Private) 38 37 39 38 - (wi_socket_context_t *)_context; … … 42 41 43 42 44 @implementation W ISocketContext(Private)43 @implementation WNSocketContext(Private) 45 44 46 45 - (wi_socket_context_t *)_context { … … 51 50 52 51 53 @implementation W ISocketContext54 55 + (W ISocketContext *)socketContextForClient {56 W ISocketContext *context;52 @implementation WNSocketContext 53 54 + (WNSocketContext *)socketContextForClient { 55 WNSocketContext *context; 57 56 58 57 context = [[self alloc] init]; … … 100 99 101 100 102 @implementation W ISocket103 104 + (W ISocket *)socketWithAddress:(WIAddress *)address type:(WISocketType)type {101 @implementation WNSocket 102 103 + (WNSocket *)socketWithAddress:(WNAddress *)address type:(WNSocketType)type { 105 104 return [[[self alloc] initWithAddress:address type:type] autorelease]; 106 105 } … … 108 107 109 108 110 + (W ISocket *)socketWithFileDescriptor:(int)sd {109 + (WNSocket *)socketWithFileDescriptor:(int)sd { 111 110 return [[[self alloc] initWithFileDescriptor:sd] autorelease]; 112 111 } … … 114 113 115 114 116 - (id)initWithAddress:(W IAddress *)address type:(WISocketType)type {115 - (id)initWithAddress:(WNAddress *)address type:(WNSocketType)type { 117 116 wi_pool_t *pool; 118 117 … … 147 146 self = [super init]; 148 147 149 _buffer = [[NSMutableString alloc] initWithCapacity:W ISocketBufferSize];148 _buffer = [[NSMutableString alloc] initWithCapacity:WNSocketBufferSize]; 150 149 151 150 return self; … … 171 170 #pragma mark - 172 171 173 - (W IAddress *)address {172 - (WNAddress *)address { 174 173 return _address; 175 174 } … … 279 278 280 279 281 - (void)setDirection:(W ISocketDirection)direction {280 - (void)setDirection:(WNSocketDirection)direction { 282 281 wi_socket_set_direction(_socket, (wi_socket_direction_t) direction); 283 282 } … … 285 284 286 285 287 - (W ISocketDirection)direction {288 return (W ISocketDirection) wi_socket_direction(_socket);286 - (WNSocketDirection)direction { 287 return (WNSocketDirection) wi_socket_direction(_socket); 289 288 } 290 289 … … 332 331 #pragma mark - 333 332 334 - (BOOL)connectWithContext:(W ISocketContext *)context timeout:(double)timeout error:(WIError **)error {333 - (BOOL)connectWithContext:(WNSocketContext *)context timeout:(double)timeout error:(WNError **)error { 335 334 wi_pool_t *pool; 336 335 BOOL result = YES; … … 342 341 if(!wi_socket_connect(_socket, [context _context], timeout)) { 343 342 if(error) { 344 *error = [W IError errorWithDomain:WIWiredAdditionsErrorDomain345 code:W ISocketConnectFailed343 *error = [WNError errorWithDomain:WNWiredNetworkingErrorDomain 344 code:WNSocketConnectFailed 346 345 userInfo:[NSDictionary dictionaryWithObjectsAndKeys: 347 [W IError errorWithDomain:WILibWiredErrorDomain], WILibWiredErrorKey,346 [WNError errorWithDomain:WNLibWiredErrorDomain], WNLibWiredErrorKey, 348 347 [_address string], WIArgumentErrorKey, 349 348 NULL]]; … … 372 371 #pragma mark - 373 372 374 - (BOOL)writeString:(NSString *)string encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(W IError **)error {373 - (BOOL)writeString:(NSString *)string encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(WNError **)error { 375 374 NSData *data; 376 375 wi_pool_t *pool; … … 382 381 if(wi_socket_write_buffer(_socket, timeout, [data bytes], [data length]) < 0) { 383 382 if(error) { 384 *error = [W IError errorWithDomain:WIWiredAdditionsErrorDomain385 code:W ISocketWriteFailed383 *error = [WNError errorWithDomain:WNWiredNetworkingErrorDomain 384 code:WNSocketWriteFailed 386 385 userInfo:[NSDictionary dictionaryWithObjectsAndKeys: 387 [W IError errorWithDomain:WILibWiredErrorDomain], WILibWiredErrorKey,386 [WNError errorWithDomain:WNLibWiredErrorDomain], WNLibWiredErrorKey, 388 387 [_address string], WIArgumentErrorKey, 389 388 NULL]]; … … 402 401 #pragma mark - 403 402 404 - (NSString *)readStringOfLength:(NSUInteger)length encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(W IError **)error {403 - (NSString *)readStringOfLength:(NSUInteger)length encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(WNError **)error { 405 404 NSMutableString *string, *substring; 406 405 wi_pool_t *pool; 407 char buffer[W ISocketBufferSize];406 char buffer[WNSocketBufferSize]; 408 407 wi_integer_t bytes = -1; 409 408 … … 447 446 if(bytes < 0) { 448 447 if(error) { 449 *error = [W IError errorWithDomain:WIWiredAdditionsErrorDomain450 code:W ISocketReadFailed448 *error = [WNError errorWithDomain:WNWiredNetworkingErrorDomain 449 code:WNSocketReadFailed 451 450 userInfo:[NSDictionary dictionaryWithObjectsAndKeys: 452 [W IError errorWithDomain:WILibWiredErrorDomain], WILibWiredErrorKey,451 [WNError errorWithDomain:WNLibWiredErrorDomain], WNLibWiredErrorKey, 453 452 [_address string], WIArgumentErrorKey, 454 453 NULL]]; … … 468 467 469 468 470 - (NSString *)readStringUpToString:(NSString *)separator encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(W IError **)error {469 - (NSString *)readStringUpToString:(NSString *)separator encoding:(NSStringEncoding)encoding timeout:(double)timeout error:(WNError **)error { 471 470 NSString *string, *substring; 472 471 NSUInteger index; … … 482 481 } 483 482 484 while((string = [self readStringOfLength:W ISocketBufferSize encoding:encoding timeout:timeout error:error])) {483 while((string = [self readStringOfLength:WNSocketBufferSize encoding:encoding timeout:timeout error:error])) { 485 484 if([string length] == 0) 486 485 return string; … … 491 490 492 491 if(index == NSNotFound) { 493 if([_buffer length] > _W ISocketBufferMaxSize) {494 substring = [_buffer substringToIndex:_W ISocketBufferMaxSize];492 if([_buffer length] > _WNSocketBufferMaxSize) { 493 substring = [_buffer substringToIndex:_WNSocketBufferMaxSize]; 495 494 496 495 [_buffer deleteCharactersInRange:NSMakeRange(0, [substring length])]; WiredAdditions/trunk/WNThread.h
r4438 r4979 27 27 */ 28 28 29 @interface W IThread : NSThread29 @interface WNThread : NSThread 30 30 31 31 @end WiredAdditions/trunk/WNThread.m
r4438 r4979 27 27 */ 28 28 29 #import <WiredAdditions/NSInvocation-WIAdditions.h> 30 #import <WiredAdditions/WIThread.h> 29 #import <WiredNetworking/WNThread.h> 31 30 32 @interface W IThread(Private)31 @interface WNThread(Private) 33 32 34 33 + (void)_threadTrampoline:(id)arg; … … 37 36 38 37 39 @implementation W IThread(Private)38 @implementation WNThread(Private) 40 39 41 40 + (void)_threadTrampoline:(id)arg { … … 52 51 53 52 54 @implementation WIThread 53 54 @implementation WNThread 55 55 56 56 + (void)detachNewThreadSelector:(SEL)selector toTarget:(id)target withObject:(id)argument { WiredAdditions/trunk/WiredAdditions.h
r4787 r4979 64 64 #endif 65 65 66 #import <wired/wired.h>67 68 66 #import <WiredAdditions/WIFunctions.h> 69 67 #import <WiredAdditions/WIMacros.h> … … &nbs
