portbility fixes for mswindows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36829 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2013-07-04 06:03:59 +00:00
parent 9c1209f421
commit 002a4a8da7
5 changed files with 23 additions and 10 deletions

View file

@ -27,7 +27,6 @@
#import "GSSocks5Parser.h"
#import "GSSocksParserPrivate.h"
#import <arpa/inet.h>
typedef enum GSSocks5ParserState {
GSSocks5ParserStateHandshake,
@ -222,7 +221,7 @@ typedef enum GSSocks5ResponseStatus {
[data appendBytes: &length length: 1];
}
[data appendData: addressData];
portWithNetworkEndianness = htons((uint16_t)port);
portWithNetworkEndianness = NSSwapHostShortToBig((uint16_t)port);
[data appendBytes: &portWithNetworkEndianness length: 2];
state = GSSocks5ParserStateResponse;
@ -269,7 +268,7 @@ typedef enum GSSocks5ResponseStatus {
length: addressSize];
bndAddress = [self addressFromData: data
withType: addressType];
bndPort = ntohs(*(uint16_t *)(bytes + addressSize));
bndPort = NSSwapBigShortToHost(*(uint16_t *)(bytes + addressSize));
[delegate parser: self finishedWithAddress: bndAddress port: bndPort];
break;
}