Permalink
Browse files

Updated hostname. Thanks, Gunnary Larisch

  • Loading branch information...
1 parent e351ee9 commit ff59e564a6003de95f2156d2d47ffc36c687cb75 Erica Sadun committed Dec 3, 2009
@@ -71,10 +71,10 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
NSString* HostGetName()
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // This is a simulator killer in the 3.1.2 SDK
+ baseHostName[255] = '\0';
return [NSString stringWithCString:baseHostName];
}
@@ -73,10 +73,10 @@ - (void) snapImage: (id) sender
- (NSString *) hostname
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // This is a Simulator Killer in SDK 3.1.2
+ baseHostName[255] = '\0';
return [NSString stringWithCString:baseHostName];
}
@@ -71,10 +71,10 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
NSString* HostGetName()
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // This is a Simulator killer in 3.1.2 SDK
+ baseHostName[255] = '\0';
return [NSString stringWithCString:baseHostName];
}
@@ -71,15 +71,11 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
NSString* HostGetName()
{
-#if TARGET_IPHONE_SIMULATOR
- return @"Simulator";
-#else
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // This is a Simulator killer in 3.1.2 SDK
- return [NSString stringWithCString:baseHostName encoding:NSUTF8StringEncoding];
-#endif
+ baseHostName[255] = '\0';
+ return [NSString stringWithCString:baseHostName];
}
NSString* SockaddrToString(const struct sockaddr* address)
@@ -82,10 +82,10 @@ + (NSString *) stringFromAddress: (const struct sockaddr *) address
+ (NSString *) localHostname
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // This is a Simulator killer in 3.1.2 SDK
+ baseHostName[255] = '\0';
#if TARGET_IPHONE_SIMULATOR
return [NSString stringWithCString:baseHostName encoding: NSUTF8StringEncoding];
#else
@@ -71,15 +71,11 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
NSString* HostGetName()
{
-#if TARGET_IPHONE_SIMULATOR
- return @"Simulator";
-#else
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // This is a Simulator killer in 3.1.2 SDK
- return [NSString stringWithCString:baseHostName encoding:NSUTF8StringEncoding];
-#endif
+ baseHostName[255] = '\0';
+ return [NSString stringWithCString:baseHostName];
}
NSString* SockaddrToString(const struct sockaddr* address)
@@ -84,10 +84,10 @@ + (NSString *) stringFromAddress: (const struct sockaddr *) address
+ (NSString *) localHostname
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // This is a Simulator killer in 3.1.2 SDK
+ baseHostName[255] = '\0';
#if TARGET_IPHONE_SIMULATOR
return [NSString stringWithCString:baseHostName encoding: NSUTF8StringEncoding];
#else
@@ -46,10 +46,10 @@ + (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)ad
+ (NSString *) hostname
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0';
+ baseHostName[255] = '\0';
#if !TARGET_IPHONE_SIMULATOR
return [NSString stringWithFormat:@"%s.local", baseHostName];
@@ -52,10 +52,10 @@ + (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)ad
+ (NSString *) hostname
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // 3.1.2 SDK bug
+ baseHostName[255] = '\0';
#if !TARGET_IPHONE_SIMULATOR
return [NSString stringWithFormat:@"%s.local", baseHostName];
@@ -52,10 +52,10 @@ + (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)ad
+ (NSString *) hostname
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // 3.1.2 SDK bug
+ baseHostName[255] = '\0';
#if !TARGET_IPHONE_SIMULATOR
return [NSString stringWithFormat:@"%s.local", baseHostName];
@@ -52,10 +52,10 @@ + (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)ad
+ (NSString *) hostname
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // 3.1.2 SDK bug
+ baseHostName[255] = '\0';
#if !TARGET_IPHONE_SIMULATOR
return [NSString stringWithFormat:@"%s.local", baseHostName];
@@ -52,10 +52,10 @@ + (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)ad
+ (NSString *) hostname
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // 3.1.2 SDK bug
+ baseHostName[255] = '\0';
#if !TARGET_IPHONE_SIMULATOR
return [NSString stringWithFormat:@"%s.local", baseHostName];
@@ -52,10 +52,10 @@ + (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)ad
+ (NSString *) hostname
{
- char baseHostName[255];
+ char baseHostName[256]; // Thanks, Gunnar Larisch
int success = gethostname(baseHostName, 255);
if (success != 0) return nil;
- // baseHostName[255] = '\0'; // 3.1.2 SDK bug
+ baseHostName[255] = '\0';
#if !TARGET_IPHONE_SIMULATOR
return [NSString stringWithFormat:@"%s.local", baseHostName];

0 comments on commit ff59e56

Please sign in to comment.