mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Fix leaks
This commit is contained in:
parent
70b687d3fd
commit
093ab72a47
3 changed files with 20 additions and 20 deletions
|
@ -30,10 +30,10 @@ print_matrix (const char *str, NSAffineTransformStruct MM)
|
|||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSAffineTransform *testObj;
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSAffineTransform *testObj;
|
||||
NSAffineTransformStruct flip = {1.0,0.0,0.0,-1.0,0.0,0.0};
|
||||
NSMutableArray *testObjs = [NSMutableArray new];
|
||||
NSMutableArray *testObjs = [NSMutableArray array];
|
||||
NSAffineTransform *aa, *bb, *cc;
|
||||
NSAffineTransformStruct as = {2, 3, 4, 5, 10, 20};
|
||||
NSAffineTransformStruct bs = {6, 7, 8, 9, 14, 15};
|
||||
|
@ -55,7 +55,7 @@ int main()
|
|||
NSPoint p;
|
||||
NSSize s;
|
||||
|
||||
testObj = [NSAffineTransform new];
|
||||
testObj = AUTORELEASE([NSAffineTransform new]);
|
||||
[testObjs addObject:testObj];
|
||||
PASS(testObj != nil, "can create a new transfor");
|
||||
|
||||
|
@ -109,19 +109,19 @@ int main()
|
|||
[bb setTransformStruct: bs];
|
||||
|
||||
/* Append matrix */
|
||||
cc = [aa copy];
|
||||
cc = AUTORELEASE([aa copy]);
|
||||
[cc appendTransform: bb];
|
||||
cs = [cc transformStruct];
|
||||
PASS((is_equal_struct(cs, answer1)), "appendTransform:")
|
||||
|
||||
/* Prepend matrix */
|
||||
cc = [aa copy];
|
||||
cc = AUTORELEASE([aa copy]);
|
||||
[cc prependTransform: bb];
|
||||
cs = [cc transformStruct];
|
||||
PASS((is_equal_struct(cs, answer2)), "prependTransform:")
|
||||
|
||||
/* scaling */
|
||||
cc = [aa copy];
|
||||
cc = AUTORELEASE([aa copy]);
|
||||
[cc scaleXBy: 3 yBy: 2];
|
||||
cs = [cc transformStruct];
|
||||
PASS((is_equal_struct(cs, answer3)), "scaleXBy:yBy:")
|
||||
|
@ -132,7 +132,7 @@ int main()
|
|||
//print_matrix ("Trans X Scale X A", cs);
|
||||
|
||||
/* rotation */
|
||||
cc = [aa copy];
|
||||
cc = AUTORELEASE([aa copy]);
|
||||
[cc rotateByDegrees: 2.5];
|
||||
cs = [cc transformStruct];
|
||||
PASS((is_equal_struct(cs, answer5)), "rotateByDegrees")
|
||||
|
|
|
@ -4,9 +4,11 @@ int main()
|
|||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
test_alloc(@"NSArchiver");
|
||||
test_NSObject(@"NSArchiver",[NSArray arrayWithObject:[[NSArchiver alloc] init]]);
|
||||
test_NSObject(@"NSArchiver",
|
||||
[NSArray arrayWithObject: AUTORELEASE([[NSArchiver alloc] init])]);
|
||||
test_alloc(@"NSUnarchiver");
|
||||
test_NSObject(@"NSUnarchiver",[NSArray arrayWithObject:[[NSUnarchiver alloc] init]]);
|
||||
test_NSObject(@"NSUnarchiver",
|
||||
[NSArray arrayWithObject: AUTORELEASE([[NSUnarchiver alloc] init])]);
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
|
|
|
@ -7,23 +7,21 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
id obj = [NSArchiver new];
|
||||
NSMutableData *data1;
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
id obj = [NSArchiver new];
|
||||
NSMutableData *data1;
|
||||
|
||||
PASS((obj != nil && [obj isKindOfClass:[NSArchiver class]] &&
|
||||
[obj archiverData] != nil), "+new creates an empty NSArchiver");
|
||||
[obj release];
|
||||
obj = [NSArchiver alloc];
|
||||
data1 = [NSMutableData dataWithLength: 0];
|
||||
obj = [obj initForWritingWithMutableData: data1];
|
||||
PASS((obj != nil && [obj isKindOfClass:[NSArchiver class]] && data1 == [obj archiverData]), "-initForWritingWithMutableData seems ok");
|
||||
obj = AUTORELEASE([[NSArchiver alloc] initForWritingWithMutableData: data1]);
|
||||
PASS((obj != nil && [obj isKindOfClass: [NSArchiver class]]
|
||||
&& data1 == [obj archiverData]), "-initForWritingWithMutableData seems ok");
|
||||
|
||||
PASS_EXCEPTION([[NSUnarchiver alloc] initForReadingWithData:nil];,
|
||||
@"NSInvalidArgumentException",
|
||||
"Creating an NSUnarchiver with nil data throws an exception");
|
||||
|
||||
|
||||
@"NSInvalidArgumentException",
|
||||
"Creating an NSUnarchiver with nil data throws an exception");
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue