2012-03-25 7 views
0

私はこの方法で立ち往生していますし、なぜか分からないのです! 誰かが私にいくつかのソースコードを指摘できますか? ありがとうございました! これは私のソースコードです:私のようないくつかの機能を使用しましたNSDataのデータを割り当てる際にスタック/リーク?

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; 
....... 
readData = [readFileHandle readDataOfLength:defaultLen] 
NSData *decryptedData = nil; 
//check is last buffer of file 
NSUInteger exLen = [readData length] % 16; 
NSUInteger decryptionLen = [readData length] - exLen; 
NSData *dataForDecryption = nil; 
    if(exLen != 0) 
    { 

    stuck at here-> [readData getBytes:dataForDecryption length:decryptionLen]; 
     // 
     decryptedData = [dataForDecryption AES256DecryptWithKey:KEY]; 
     self.isEndOfFile = YES; 
    } 
    else 
     decryptedData = [readData AES256DecryptWithKey:KEY]; 
[readFileHandle closeFile]; 
....... 
[pool drain]; 

NSData *dataForDecryption = [[[NSData alloc] initWithBytes:readData length:decryptionLen]autorelease]; 
NSData *dataForDecryption = [NSData dataWithBytes:readData length:decryptionLen]; 

しかし、私は同じエラーを取得します。 私が使用しているときは、 dataForDecryption = [readFileHandle readDataOfLength:decryptionLen]; これは上記のposでスタックされており、読み込まれるサイズは0ですが、EOFではありません。

おかげ

答えて

0
stuck at here-> [readData getBytes:dataForDecryption length:decryptionLen]; 

あなたはNSData*ある、dataForDecryptionを渡しているが、パラメータは、バッファ、すなわちvoid*ことになっています。 NSData*が必要な場合は、代わりにsubdataWithRange:のようなメソッドを使用する必要があります。

dataForEncryption = [readData subdataWithRange:NSRangeMake(0, decryptionLen)]; 
+0

おかげで、おかげでCaleb :) –