Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
unrecognized selector sent to instance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unrecognized selector sent to instance



Hello, all.

I am stumped by the error message in the subject of this email. I have spent several hours looking over my code, googling the list archives, etc. Typically, it seems that the error in question occurs at runtime when someone has a memory management issue in their application, and the message is sent to a released object.

In my case, I am getting the message on an initializer, so I'm assuming that there is some problem and my object is not being allocated in the first place, or possibly the object file is not properly linked, but I get no linker errors, just the unrecognized selector mesasge at runtime.

Originally, the code in question was in a framework, but when I got the error using the framework in a test program, I copied the relevant source files out of the framework and tried building a test program with just the necessary object files to see if the error persists, and it does. Thus, I think I have eliminated the linker as a source of the issue, but can't rule it out 100%.

Since the error occurs if I link the code from a dylib, link the .o file directly with the test application, or build it from the .m file in a single compile step, I assume there must be something wrong with my source code. However, I don't see it.

If I build the application with the following on the command line:

gcc -Wall -framework Foundation -lbz2 -o bztest bzOutputTest.m SIGIOBzip2OutputStream.m SIGIOArchiveKitErrors.m

I get no warnings or errors, and the bztest executable is created.

When I try to run the bztest executable with a filename to compress, I get the following error:


2009-04-15 08:53:12.823 bztest[16031:10b] *** -[SIGIOBzip2OutputStream initToFileAtPath:append:]: unrecognized selector sent to instance 0x106830
2009-04-15 08:53:12.825 bztest[16031:10b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[SIGIOBzip2OutputStream initToFileAtPath:append:]: unrecognized selector sent to instance 0x106830'
2009-04-15 08:53:12.826 bztest[16031:10b] Stack: (
2477433099,
2443857467,
2477462282,
2477455722,
2477455826,
10990,
9972,
9574
)
Trace/BPT trap


I have to admit that I am not very good with gdb, yet. However, when I run the application in the debugger and have it open a file, I get the same error. I've not been able to get anything that seems immediately useful out of gdb. I do get the following if I go up the call stack:

#4 0x00002aee in -[SIGIOBzip2OutputStream initToFileAtPath:append:] (self=0x106850, _cmd=0x91afb7dc, path=0x106790, shouldAppend=0 '\000') at SIGIOBzip2OutputStream.m:86
86 self = [super initToFileAtPath: path append: shouldAppend];


If I po self at this point, my object looks valid, AFAICT:

(gdb) po self
<SIGIOBzip2OutputStream: 0x106850>

So, the error that I get at runtime makes it appear that my SIGIOBzip2OutputStream does not respond to the -[initToFileAtPath:append:] selector, but it does. In the debugger, it looks as though SIGIOBzip2OutputStream's super class is the object that doesn't respond to that selector. But, it's superclass is NSOutputStream, and it is documented to respond to that selector and I get no warnings about the selector when compiling.

Just to note, I have also tried -[initToMemory] and get the same message about that selector.

I am attaching all of the relevant source files, and if anyone sees something that I've missed, I'd be most appreciative. NOTE: At this point, I'm not really concerned about any other bugs in my code, I just need to get past this error, then start look for other bugs.

Thanks,
Jason
#import <Foundation/Foundation.h>
#import "SIGIOBzip2OutputStream.h"

int main (int argc, char **argv)
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSProcessInfo *procInfo = [NSProcessInfo processInfo];
    NSArray *args = [procInfo arguments];
    SIGIOBzip2OutputStream *bzStream;
    NSInputStream *rawStream;

    uint8_t buffer[4096];
    NSInteger length;
    int i;
    for (i = 1; i < [args count]; i++) {
	rawStream = [NSInputStream inputStreamWithFileAtPath: [args objectAtIndex: i]];
	if (rawStream) {
	    NSString *outFilename = [[args objectAtIndex: i] stringByAppendingPathExtension: @"bz2"];
	    bzStream = [[SIGIOBzip2OutputStream alloc] initToFileAtPath: outFilename append: NO];
	    if (bzStream) {
		[rawStream open];
		[bzStream open];
		do {
		    length = [rawStream read: buffer maxLength: 4096];
		    if (length > 0)
			length = [bzStream write: (const uint8_t *) buffer maxLength: length];
		} while (length > 0);
		[rawStream close];
		[bzStream close];
		[bzStream release];
	    }
	}
    }

    [pool drain];
    return 0;
}
// -*- mode: ObjC; -*-
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Jason J. A. Stephenson
*
* SIGIOArchiveKitErrors.h - ArchiveKit error definitions and
* declarations for error string constants.
*
* SIGIOArchiveKitErrors.h is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License version 3 only, as published by the Free Software
* Foundation.
*
* SIGIOArchiveKitErrors.h is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License version 3 for more details (a copy is
* avaliable at <http://www.gnu.org/copyleft/lgpl.html>).
*
************************************************************************/
#import <Foundation/Foundation.h>


#define SIGIOArchiveKitErrorDomain @"com.sigio.ArchiveKit.ErrorDomain"


// Error codes/descriptions

// No error, just for completeness.
#define SIGIOArchiveKitNoError 0

// Bzip2 Error Strings.
#define SIGIOArchiveKitBzip2Error 1

// Zlib Error Strings.
#define SIGIOArchiveKitZlibError 2

// Generic Allocation error
#define SIGIOArchiveKitAllocationError 4

// LZMA Error Strings
#define SIGIOArchiveKitLzmaError 8

// Functions:
//NSString *lzmaErrorReason(NSInteger theCode);
//NSError *newLzmaError(NSInteger theCode);
NSError *newZlibError(NSInteger theCode);
NSString *zlibErrorReason(NSInteger theCode);
NSError *newBzip2Error(NSInteger theCode);
NSString *bzip2ErrorReason(NSInteger theCode);
NSError *newSIGIOAllocationError(void);

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Jason J. A. Stephenson
*
* SIGIOArchiveKitErrors.m - ArchiveKit error definitions and
* declarations for error string constants.
*
* SIGIOArchiveKitErrors.m is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License version 3 only, as published by the Free Software
* Foundation.
*
* SIGIOArchiveKitErrors.m is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License version 3 for more details (a copy is
* avaliable at <http://www.gnu.org/copyleft/lgpl.html>).
*
************************************************************************/
#import "SIGIOArchiveKitErrors.h"
#import <zlib.h>
#import <bzlib.h>

#ifndef HAS_UINT32
#define HAS_UINT32 1
#endif


#define FWK_BUNDLE [NSBundle bundleWithIdentifier: @"com.sigio.SIGIOArchiveKit"]

#define SIGIOArchiveKitLzmaErrorDesc NSLocalizedStringFromTableInBundle(@"A call to a lzma function returned error code %i.", nil, FWK_BUNDLE, @"A lzma error occurred.")
#define SIGIOArchiveKitZlibErrorDesc NSLocalizedStringFromTableInBundle(@"A call to a zlib function returned error code %i.", nil, FWK_BUNDLE, @"A Zlib error occurred.")
#define SIGIOArchiveKitBzip2ErrorDesc NSLocalizedStringFromTableInBundle(@"A call to a bzlib function returned error code %i.", nil, FWK_BUNDLE, @"A Bzip2 error occurred")

// Functions

NSError *newSIGIOAllocationError(void)
{
    NSString *errDesc = NSLocalizedStringFromTableInBundle(@"Failed to allocate memory for an interal buffer.", nil, FWK_BUNDLE, @"Generic Allocation Error Description");
    NSDictionary *errDict = [NSDictionary dictionaryWithObjectsAndKeys: errDesc, NSLocalizedDescriptionKey, nil];
    NSError *err = [[NSError alloc] initWithDomain: SIGIOArchiveKitErrorDomain code: SIGIOArchiveKitAllocationError userInfo: errDict];
    return err;
}

NSString *bzip2ErrorReason(NSInteger theCode)
{
    NSString *theReason;

    switch (theCode) {
    case BZ_SEQUENCE_ERROR:
	theReason = nil;
	break;
    case BZ_PARAM_ERROR:
	theReason = NSLocalizedStringFromTableInBundle(@"An internal error was encountered during Bzip2 compression or decompression.", nil, FWK_BUNDLE, @"BZ_PARAM_ERROR");
	break;
    case BZ_MEM_ERROR:
	theReason = NSLocalizedStringFromTableInBundle(@"A memory error was encountered during Bzip2 compression or decompression.", nil, FWK_BUNDLE, @"BZ_MEM_ERROR");
	break;
    case BZ_DATA_ERROR:
	theReason = NSLocalizedStringFromTableInBundle(@"A data integrity error was detected while decompressing Bzip2 stream.", nil, FWK_BUNDLE, @"BZ_DATA_ERROR");
	break;
    case BZ_DATA_ERROR_MAGIC:
	theReason = NSLocalizedStringFromTableInBundle(@"The input stream doesn't begin with the Bzip2 magic bytes.", nil, FWK_BUNDLE, @"BZ_DATA_ERROR_MAGIC");
	break;
    case BZ_IO_ERROR:
	theReason = nil;
	break;
    case BZ_UNEXPECTED_EOF:
	theReason = nil;
	break;
    case BZ_OUTBUFF_FULL:
	theReason = NSLocalizedStringFromTableInBundle(@"The output buffer is not large enough to hold the Bzip2 compressed data.", nil, FWK_BUNDLE, @"BZ_OUTBUFF_FULL");
	break;
    case BZ_CONFIG_ERROR:
	theReason = NSLocalizedStringFromTableInBundle(@"Your libbz2 installation appears to be corrupt/incorrect.", nil, FWK_BUNDLE, @"BZ_CONFIG_ERROR");
	break;
    default:
	theReason = nil;
	break;
    }

    return theReason;
}

NSError *newBzip2Error(NSInteger theCode)
{
    NSDictionary *errorDict;
    NSString *errorReason = bzip2ErrorReason(theCode);
    NSString *errorDesc = [NSString stringWithFormat: SIGIOArchiveKitBzip2ErrorDesc, theCode];

    if (errorReason != nil)
	errorDict = [NSDictionary dictionaryWithObjectsAndKeys: errorDesc, NSLocalizedDescriptionKey, errorReason, NSLocalizedFailureReasonErrorKey, nil];
    else
	errorDict = [NSDictionary dictionaryWithObjectsAndKeys: errorDesc, NSLocalizedDescriptionKey, nil];

    NSError *theError = [[NSError alloc] initWithDomain: SIGIOArchiveKitErrorDomain code: SIGIOArchiveKitBzip2Error userInfo: errorDict];
    return theError;
}

NSError *newZlibError(NSInteger theCode)
{
    NSDictionary *errorDict;
    NSString *errorReason = zlibErrorReason(theCode);
    NSString *errorDesc = [NSString stringWithFormat: SIGIOArchiveKitZlibErrorDesc, theCode];

    if (errorReason != nil)
	errorDict = [NSDictionary dictionaryWithObjectsAndKeys: errorDesc, NSLocalizedDescriptionKey, errorReason, NSLocalizedFailureReasonErrorKey, nil];
    else
	errorDict = [NSDictionary dictionaryWithObjectsAndKeys: errorDesc, NSLocalizedDescriptionKey, nil];

    NSError *theError = [[NSError alloc] initWithDomain: SIGIOArchiveKitErrorDomain code: SIGIOArchiveKitZlibError userInfo: errorDict];
    return theError;
}

NSString *zlibErrorReason(NSInteger theCode)
{
    NSString *theReason;
    switch (theCode) {
    case Z_STREAM_END:
	theReason = nil;
	break;
    case Z_NEED_DICT:
	theReason = nil;
	break;
    case Z_ERRNO:
	theReason = nil;
	break;
    case Z_STREAM_ERROR:
	theReason = NSLocalizedStringFromTableInBundle(@"An internal error was encountered during Zlib compression or decompression.", nil, FWK_BUNDLE, @"Z_STREAM_ERROR");
	break;
    case Z_DATA_ERROR:
	theReason = NSLocalizedStringFromTableInBundle(@"A data integrity error was detected while decompressing Zlib stream.", nil, FWK_BUNDLE, @"Z_DATA_ERROR");
	break;
    case Z_MEM_ERROR:
	theReason = NSLocalizedStringFromTableInBundle(@"A memory error was encountered during Zlib compression or decompression.", nil, FWK_BUNDLE, @"Z_MEM_ERROR");
	break;
    case Z_BUF_ERROR:
	theReason = NSLocalizedStringFromTableInBundle(@"The output buffer is not large enough to hold the Zlib compressed data.", nil, FWK_BUNDLE, @"Z_BUF_ERROR");
	break;
    case Z_VERSION_ERROR:
	theReason = nil;
	break;
    default:
	theReason = nil;
	break;
    }
    return theReason;
}
/*
NSString *lzmaErrorReason(NSInteger theCode)
{
    NSString *theReason;

    switch (theCode) {
    case SZ_ERROR_DATA:
	theReason = NSLocalizedStringFromTableInBundle(@"A data integrity error was detected while decompressing lzma data.", nil, FWK_BUNDLE, @"SZ_ERROR_DATA");
	break;

    case SZ_ERROR_MEM:
	theReason = NSLocalizedStringFromTableInBundle(@"A memory error occurred during lzma compression or decompression.", nil, FWK_BUNDLE, @"SZ_ERROR_MEM");
	break;

    case SZ_ERROR_CRC:
	theReason = NSLocalizedStringFromTableInBundle(@"A CRC error was encountered during lzma compression or decompression.", nil, FWK_BUNDLE, @"SZ_ERROR_CRC");
	break;

    case SZ_ERROR_UNSUPPORTED:
	theReason = NSLocalizedStringFromTableInBundle(@"The input data does not appear to be lzma compressed.", nil, FWK_BUNDLE, @"SZ_ERROR_UNSUPPORTED");
	break;

    case SZ_ERROR_PARAM:
	theReason = NSLocalizedStringFromTableInBundle(@"An internal error was encountered during lzma compression or decompression.", nil, FWK_BUNDLE, @"SZ_ERROR_PARAM");
	break;

    case SZ_ERROR_INPUT_EOF:
	theReason = NSLocalizedStringFromTableInBundle(@"Premature end of input was reached during lzma compression or decompression.", nil, FWK_BUNDLE, @"SZ_ERROR_INPUT_EOF");
	break;

    case SZ_ERROR_OUTPUT_EOF:
	theReason = NSLocalizedStringFromTableInBundle(@"Premature end of output was reached during lzma compression or decompression.", nil, FWK_BUNDLE, @"SZ_ERROR_OUTPUT_EOF");
	break;

    case SZ_ERROR_READ:
	theReason = NSLocalizedStringFromTableInBundle(@"A read error occurred during lzma compression or decompression.", nil, FWK_BUNDLE, @"SZ_ERROR_READ");
	break;

    case SZ_ERROR_WRITE:
	theReason = NSLocalizedStringFromTableInBundle(@"A write error occurred during lzma compression or decompression.", nil, FWK_BUNDLE, @"SZ_ERROR_WRITE");
	break;

    case SZ_ERROR_PROGRESS:
	theReason = NSLocalizedStringFromTableInBundle(@"A progress error occurred during lzma compression or decompression.", nil, FWK_BUNDLE, @"SZ_ERROR_PROGRESS");
	break;

    case SZ_ERROR_FAIL:
	theReason = NSLocalizedStringFromTableInBundle(@"A fail error occurred during lzma compression or decompression.", nil, FWK_BUNDLE, @"SZ_ERROR_FAIL");
	break;

    default:
	theReason = nil;
	break;
    }

    return theReason;
}

NSError *newLzmaError(NSInteger theCode)
{
    NSDictionary *errorDict;
    NSString *errorReason = lzmaErrorReason(theCode);
    NSString *errorDesc = [NSString stringWithFormat: SIGIOArchiveKitLzmaErrorDesc, theCode];

    if (errorReason != nil)
	errorDict = [NSDictionary dictionaryWithObjectsAndKeys: errorDesc, NSLocalizedDescriptionKey, errorReason, NSLocalizedFailureReasonErrorKey, nil];
    else
	errorDict = [NSDictionary dictionaryWithObjectsAndKeys: errorDesc, NSLocalizedDescriptionKey, nil];

    NSError *theError = [[NSError alloc] initWithDomain: SIGIOArchiveKitErrorDomain code: SIGIOArchiveKitLzmaError userInfo: errorDict];
    return theError;
}
*/
// -*- Mode: ObjC; -*-
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Jason J. A. Stephenson
*
* SIGIOBzip2OutputStream.h - A NSOutputStream subclass that Bzip2
* compresses as it writes output.
*
* SIGIOBzip2OutputStream.h is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License version 3 only, as published by the Free Software
* Foundation.
*
* SIGIOBzip2OutputStream.h is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License version 3 for more details (a copy is
* avaliable at <http://www.gnu.org/copyleft/lgpl.html>).
*
************************************************************************/
#import <Foundation/Foundation.h>
#import <bzlib.h>

@interface SIGIOBzip2OutputStream : NSOutputStream
{
    bz_stream *m_strm;
    uint8_t *m_buffer;
    NSInteger m_bzip2Error;
}

-(id) initToMemory;
-(id) initToBuffer: (uint8_t *) buffer capacity: (NSUInteger) capacity;
-(id) initToFileAtPath: (NSString *) path append: (BOOL) shouldAppend;
-(void) open;
-(void) close;
-(BOOL) hasSpaceAvailable;
-(NSInteger) write: (const uint8_t *) buffer maxLength: (NSUInteger) length;
-(NSStreamStatus) streamStatus;
-(NSError *) streamError;
@end
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Jason J. A. Stephenson
*
* SIGIOBzip2OutputStream.m - A NSOutputStream subclass that Bzip2
* compresses its output.
*
* SIGIOBzip2OutputStream.m is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License version 3 only, as published by the Free Software
* Foundation.
*
* SIGIOBzip2OutputStream.m is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License version 3 for more details (a copy is
* avaliable at <http://www.gnu.org/copyleft/lgpl.html>).
*
************************************************************************/
#import "SIGIOBzip2OutputStream.h"
#import "SIGIOArchiveKitErrors.h"

#define SIGIO_ALLOC_CHUNK 4096

@implementation SIGIOBzip2OutputStream
-(id) initToMemory
{
    self = [super initToMemory];
    if (self) {
	m_strm = malloc(sizeof(bz_stream));
	if (m_strm != NULL) {
	    m_strm->next_in = NULL;
	    m_strm->avail_in = 0;
	    m_strm->next_out = NULL;
	    m_strm->avail_out = 0;
	    m_strm->bzalloc = NULL;
	    m_strm->bzfree = NULL;
	    m_strm->opaque = NULL;
	}
	else {
	    [self release];
	    return nil;
	}
	m_buffer = malloc(SIGIO_ALLOC_CHUNK);
	if (m_buffer == NULL) {
	    [self release];
	    return nil;
	}
	m_bzip2Error = BZ_OK;
    }
    return self;
}

-(id) initToBuffer: (uint8_t *) buffer capacity: (NSUInteger) capacity
{
    self = [super initToBuffer: buffer capacity: capacity];
    if (self) {
	m_strm = malloc(sizeof(bz_stream));
	if (m_strm != NULL) {
	    m_strm->next_in = NULL;
	    m_strm->avail_in = 0;
	    m_strm->next_out = NULL;
	    m_strm->avail_out = 0;
	    m_strm->bzalloc = NULL;
	    m_strm->bzfree = NULL;
	    m_strm->opaque = NULL;
	}
	else {
	    [self release];
	    return nil;
	}
	m_buffer = malloc(SIGIO_ALLOC_CHUNK);
	if (m_buffer == NULL) {
	    [self release];
	    return nil;
	}
	m_bzip2Error = BZ_OK;
    }
    return self;
}

-(id) initToFileAtPath: (NSString *) path append: (BOOL) shouldAppend
{
    [super initToFileAtPath: path append: shouldAppend];
    if (self) {
	m_strm = malloc(sizeof(bz_stream));
	if (m_strm != NULL) {
	    m_strm->next_in = NULL;
	    m_strm->avail_in = 0;
	    m_strm->next_out = NULL;
	    m_strm->avail_out = 0;
	    m_strm->bzalloc = NULL;
	    m_strm->bzfree = NULL;
	    m_strm->opaque = NULL;
	}
	else {
printf("m_strm is null\n");
	    [self release];
	    return nil;
	}
	m_buffer = malloc(SIGIO_ALLOC_CHUNK);
	if (m_buffer == NULL) {
printf("m_buffer is null\n");
	    [self release];
	    return nil;
	}
	m_bzip2Error = BZ_OK;
    }
    return self;
}

-(void) open
{
    // Initialize the compression stream
    int bzReturn;
    m_strm->next_out = (char *)m_buffer;
    m_strm->avail_out = SIGIO_ALLOC_CHUNK;
    bzReturn = BZ2_bzCompressInit(m_strm, 5, 0, 0);
    if (bzReturn != BZ_OK) {
	m_bzip2Error = bzReturn;
	return;
    }

    [super open];
}

-(void) close
{
    /* Flush remaining compressed output. */
    int bzReturn;
    NSInteger result;
    do {
	bzReturn = BZ2_bzCompress(m_strm, BZ_FINISH);
	if (m_strm->avail_out == 0 || bzReturn == BZ_STREAM_END) {
	    result = [super write: m_buffer maxLength: SIGIO_ALLOC_CHUNK - m_strm->avail_out];
	    m_strm->next_out = (char *)m_buffer;
	    m_strm->avail_out = SIGIO_ALLOC_CHUNK;
	}
    } while (bzReturn == BZ_FINISH_OK && result != -1);

    // Done with compression.
    (void) BZ2_bzCompressEnd(m_strm);

    // Close the parent stream.
    [super close];
}

-(BOOL) hasSpaceAvailable
{
    if (m_strm->avail_out)
	return YES;
    else
	return [super hasSpaceAvailable];
}

-(NSInteger) write: (const uint8_t *) buffer maxLength: (NSUInteger) length
{
    // Return value
    NSInteger result, superResult;
    // Return value from bzip2 functions.
    int bzReturn;

    // We need to reset these on every call, anyway.
    m_strm->next_out = (char *)m_buffer;
    m_strm->avail_out = SIGIO_ALLOC_CHUNK;
    m_strm->next_in = (char *)buffer;
    m_strm->avail_in = length;
    result = 0;

    do {
	bzReturn = BZ2_bzCompress(m_strm, BZ_RUN);
	if (bzReturn == BZ_RUN_OK) {
	    if (m_strm->avail_out == 0) {
		superResult = [super write: m_buffer maxLength: SIGIO_ALLOC_CHUNK - m_strm->avail_out];
		if (superResult > 0) {
		    if (m_strm->avail_out == 0) {
			m_strm->avail_out = SIGIO_ALLOC_CHUNK;
			m_strm->next_out = (char *)m_buffer;
		    }
		}
		else {
		    result = superResult;
		    break;
		}
	    }
	    result = length - m_strm->avail_in;
	}
	else
	    m_bzip2Error = bzReturn;
    } while (bzReturn == BZ_RUN_OK && m_strm->avail_in > 0);

    return result;
}

-(NSStreamStatus) streamStatus
{
    if (m_bzip2Error != BZ_OK)
	return NSStreamStatusError;
    else
	return [super streamStatus];
}

-(NSError *) streamError
{
    NSError *error;
    if (m_bzip2Error != BZ_OK) {
	error = newBzip2Error(m_bzip2Error);
	[error release];
    }
    else
	error = [super streamError];
    return error;
}

-(void) dealloc
{
    if (m_strm != NULL)
	free(m_strm);

    if (m_buffer != NULL)
	free(m_buffer);

    [super dealloc];
}
@end
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.