git.ithinksw.org
/
ITFoundation.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Enabling garbage collection support.
[ITFoundation.git]
/
ITCategory-NSString.m
diff --git
a/ITCategory-NSString.m
b/ITCategory-NSString.m
index
fd036ae
..
6aed778
100644
(file)
--- a/
ITCategory-NSString.m
+++ b/
ITCategory-NSString.m
@@
-1,4
+1,5
@@
#import "ITCategory-NSString.h"
#import "ITCategory-NSString.h"
+#import "ITCategory-NSData.h"
@implementation NSString (ITFoundationCategory)
@implementation NSString (ITFoundationCategory)
@@
-7,18
+8,30
@@
}
- (id)initWithFourCharCode:(unsigned long)fourCharCode {
}
- (id)initWithFourCharCode:(unsigned long)fourCharCode {
- return [self initWithFormat:@"%.4s", &fourCharCode];
+ return [self initWithString:(NSString *)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++;*/
+}
+
+- (NSData *)MD5 {
+ return [[self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO] MD5];
+}
+
+- (NSData *)SHA1 {
+ return [[self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO] SHA1];
}
@end
\ No newline at end of file
}
@end
\ No newline at end of file