Fixed possible endian problems in NSString category. Universal buildable now.
[ITFoundation.git] / ITCategory-NSString.m
index fd036ae..e08e046 100644 (file)
@@ -7,18 +7,22 @@
 }
 
 - (id)initWithFourCharCode:(unsigned long)fourCharCode {
 }
 
 - (id)initWithFourCharCode:(unsigned long)fourCharCode {
-       return [self initWithFormat:@"%.4s", &fourCharCode];
+       return UTCreateStringForOSType(fourCharCode);
+       //return [self initWithFormat:@"%.4s", &fourCharCode];
 }
 
 - (unsigned long)fourCharCode {
 }
 
 - (unsigned long)fourCharCode {
-       const unsigned char *c_s = [self UTF8String];
+       return UTGetOSTypeFromString((CFStringRef)self);
+       
+       //Die nasty bitshifting
+       /*const unsigned char *c_s = [self UTF8String];
        unsigned long tmp = *c_s++;
        tmp <<= 8;
        tmp |= *c_s++;
        tmp <<= 8;
        tmp |= *c_s++;
        tmp <<= 8;
        unsigned long tmp = *c_s++;
        tmp <<= 8;
        tmp |= *c_s++;
        tmp <<= 8;
        tmp |= *c_s++;
        tmp <<= 8;
-       return tmp |= *c_s++;
+       return tmp |= *c_s++;*/
 }
 
 @end
\ No newline at end of file
 }
 
 @end
\ No newline at end of file