(ITCarbonSupport) Rewrite FCC utilities, add "extern"
[ITFoundation.git] / ITCarbonSupport.m
old mode 100755 (executable)
new mode 100644 (file)
index 75c5e53..3995a65
@@ -1,9 +1,16 @@
 #import "ITCarbonSupport.h"
 
 NSString *NSStringFromFourCharCode(unsigned long code) {
-    return [NSString stringWithUTF8String:&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