X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/692faf9cb79903190c1885a7ed08a2c97cc7fb8b..034559d9a2f0b8e607b0365152b9c73732f00e6e:/ITCarbonSupport.m diff --git a/ITCarbonSupport.m b/ITCarbonSupport.m index 9e8d1ee..31d25cd 100644 --- a/ITCarbonSupport.m +++ b/ITCarbonSupport.m @@ -1,9 +1,16 @@ #import "ITCarbonSupport.h" NSString *NSStringFromFourCharCode(unsigned long code) { - return [NSString stringWithUTF8String:(const char *)&code]; + return [NSString stringWithFormat:@"%.4s", &code]; } unsigned long FourCharCodeFromNSString(NSString *string) { - return (*((unsigned long*)[string UTF8String])); + const unsigned char *c_s = [string UTF8String]; + unsigned long tmp = *c_s++; + tmp <<= 8; + tmp |= *c_s++; + tmp <<= 8; + tmp |= *c_s++; + tmp <<= 8; + return tmp |= *c_s++; } \ No newline at end of file