Permalink
Browse files

Merge pull request #3 from stcui/master

fix some memory leak, (@stcui, thanks dude!)
  • Loading branch information...
2 parents fbf56cc + 85aac41 commit 043d35026f764c2c894b14921c0a70ea9178595d @gavinkwoe gavinkwoe committed Sep 17, 2012
@@ -82,7 +82,7 @@ - (void)setFilePath:(NSString *)path
else
{
NSData * data = [NSData dataWithContentsOfFile:path];
- _content.text = [NSString stringWithCString:[data bytes] length:[data length]];
+ _content.text = [NSString stringWithCString:[data bytes] encoding:NSUTF8StringEncoding];
}
}
@@ -131,7 +131,7 @@ - (NSData *)serialize:(NSObject *)obj
return (NSData *)obj;
if ( [obj respondsToSelector:@selector(JSONData)] )
- return (NSData *)[obj JSONData];
+ return (NSData *)[(id)obj JSONData];
return nil;
}
@@ -130,7 +130,7 @@ - (BeeRequest *)POST:(NSString *)url params:(id)first, ...
for ( ;; )
{
- NSObject * key = [dict count] ? va_arg( args, NSObject * ) : first;
+ NSObject<NSCopying> * key = [dict count] ? va_arg( args, NSObject * ) : first;
if ( nil == key )
break;
@@ -192,7 +192,7 @@ - (BeeRequest *)POST:(NSString *)url files:(NSDictionary *)files params:(id)firs
for ( ;; )
{
- NSObject * key = [dict count] ? va_arg( args, NSObject * ) : first;
+ NSObject<NSCopying> * key = [dict count] ? va_arg( args, NSObject * ) : first;
if ( nil == key )
break;
@@ -186,7 +186,7 @@ - (NSString *)urlByAppendingKeyValues:(id)first, ...
for ( ;; )
{
- NSObject * key = [dict count] ? va_arg( args, NSObject * ) : first;
+ NSObject<NSCopying> * key = [dict count] ? va_arg( args, NSObject * ) : first;
if ( nil == key )
break;
@@ -209,7 +209,7 @@ - (NSString *)queryStringFromKeyValues:(id)first, ...
for ( ;; )
{
- NSObject * key = [dict count] ? va_arg( args, NSObject * ) : first;
+ NSObject<NSCopying> * key = [dict count] ? va_arg( args, NSObject * ) : first;
if ( nil == key )
break;
@@ -410,7 +410,7 @@ - (BeeMessage *)input:(id)first, ...
for ( ;; )
{
- NSObject * key = [self.input count] ? va_arg( args, NSObject * ) : first;
+ NSObject<NSCopying> * key = [self.input count] ? va_arg( args, NSObject * ) : first;
if ( nil == key )
break;
@@ -433,7 +433,7 @@ - (BeeMessage *)output:(id)first, ...
for ( ;; )
{
- NSObject * key = [self.output count] ? va_arg( args, NSObject * ) : first;
+ NSObject<NSCopying> * key = [self.output count] ? va_arg( args, NSObject * ) : first;
if ( nil == key )
break;
@@ -72,11 +72,11 @@ + (BeeUIGridCell *)spawn
- (id)init
{
- self = [super init];
+ self = [super init]; // will call initWithFrame
if ( self )
{
- [self initSelf];
- [self load];
+// [self initSelf];
+// [self load];
}
return self;
}
@@ -79,7 +79,8 @@ - (id)initWithItems:(NSArray *)items
self = [super initWithItems:items];
if ( self )
{
- [self initSelf];
+// initWithItems willl call initWithFrame
+// [self initSelf];
}
return self;
}
@@ -91,7 +92,7 @@ - (void)initSelf
self.segmentedControlStyle = UISegmentedControlStyleBar;
self.selectedSegmentIndex = 0;
// self.tintColor = [UIColor darkGrayColor];
-
+ assert(nil == _tags);
_tags = [[NSMutableArray alloc] init];
[self addTarget:self action:@selector(didSelectionChanged:) forControlEvents:UIControlEventValueChanged];
@@ -112,7 +112,6 @@
63FE1C4615D0191C00432794 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 63FE1C2F15D0191C00432794 /* icon.png */; };
63FE1C4715D0191C00432794 /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 63FE1C3015D0191C00432794 /* icon@2x.png */; };
63FE1C4815D0191C00432794 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 63FE1C3115D0191C00432794 /* main.m */; };
- 63FE1C4915D0191C00432794 /* WhatsBug-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 63FE1C3215D0191C00432794 /* WhatsBug-Info.plist */; };
63FE1DDF15D118D500432794 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63FE1DDE15D118D200432794 /* MobileCoreServices.framework */; };
63FE1DE115D11A0200432794 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63FE1DE015D119FF00432794 /* CoreGraphics.framework */; };
/* End PBXBuildFile section */
@@ -812,7 +811,6 @@
63FE1C4515D0191C00432794 /* Default@2x.png in Resources */,
63FE1C4615D0191C00432794 /* icon.png in Resources */,
63FE1C4715D0191C00432794 /* icon@2x.png in Resources */,
- 63FE1C4915D0191C00432794 /* WhatsBug-Info.plist in Resources */,
63133C8515D4E5F0009A5BFC /* bug@2x.png in Resources */,
63133C8615D4E5F0009A5BFC /* close@2x.png in Resources */,
63133C8715D4E5F0009A5BFC /* file@2x.png in Resources */,

0 comments on commit 043d350

Please sign in to comment.