From a8878f2baf8b974b28a9a08bc94a3c4232b72e1c Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Thu, 31 Mar 2005 04:26:59 +0000 Subject: [PATCH] (ITCarbonSupport) Rewrite FCC utilities, add "extern" (ITDebug) Add "extern" --- ITCarbonSupport.h | 4 ++-- ITCarbonSupport.m | 11 +++++++++-- ITDebug.h | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ITCarbonSupport.h b/ITCarbonSupport.h index 063fc36..7f0442a 100644 --- a/ITCarbonSupport.h +++ b/ITCarbonSupport.h @@ -14,5 +14,5 @@ #import -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 diff --git a/ITCarbonSupport.m b/ITCarbonSupport.m index 9e8d1ee..3995a65 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 diff --git a/ITDebug.h b/ITDebug.h index a9fda2d..eaf6483 100644 --- a/ITDebug.h +++ b/ITDebug.h @@ -13,5 +13,5 @@ #import -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 -- 2.20.1