(ITCarbonSupport) Rewrite FCC utilities, add "extern"
authorAlexander Strange <astrange@ithinksw.com>
Thu, 31 Mar 2005 04:26:59 +0000 (04:26 +0000)
committerAlexander Strange <astrange@ithinksw.com>
Thu, 31 Mar 2005 04:26:59 +0000 (04:26 +0000)
(ITDebug) Add "extern"

ITCarbonSupport.h
ITCarbonSupport.m
ITDebug.h

index 063fc36..7f0442a 100644 (file)
@@ -14,5 +14,5 @@
 
 #import <Foundation/Foundation.h>
 
-NSString *NSStringFromFourCharCode(unsigned long code);
-unsigned long FourCharCodeFromNSString(NSString *string);
\ No newline at end of file
+extern NSString *NSStringFromFourCharCode(unsigned long code);
+extern unsigned long FourCharCodeFromNSString(NSString *string);
\ No newline at end of file
index 9e8d1ee..3995a65 100644 (file)
@@ -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
index a9fda2d..eaf6483 100644 (file)
--- a/ITDebug.h
+++ b/ITDebug.h
@@ -13,5 +13,5 @@
 
 #import <Foundation/Foundation.h>
 
-void SetITDebugMode(BOOL mode);
-void ITDebugLog(NSString *format, ...);
\ No newline at end of file
+extern void SetITDebugMode(BOOL mode);
+extern void ITDebugLog(NSString *format, ...);
\ No newline at end of file