Wanted: Elegant way to manage this task

2015-06-09 Thread Graham Cox
I have the following task I need to implement. 1. I have a queue of NSData objects, usually representing a continuous stream, but delivered in variable-sized chunks. However some chunks could be missing, but the queue represents the correct order of the stream that was delivered, and the

Re: Wanted: Elegant way to manage this task

2015-06-09 Thread Michael David Crawford
Would it help to read some of the Internet RFCs? They deal with this kind of things in various ways. Not that they're concerned with Objective-C or Cocoa but the concepts might be useful. On 6/8/15, Graham Cox graham@bigpond.com wrote: I have the following task I need to implement. 1. I

Re: Wanted: Elegant way to manage this task

2015-06-09 Thread Roland King
On 9 Jun 2015, at 14:18, Graham Cox graham@bigpond.com wrote: I have the following task I need to implement. 1. I have a queue of NSData objects, usually representing a continuous stream, but delivered in variable-sized chunks. However some chunks could be missing, but the queue

Re: Wanted: Elegant way to manage this task

2015-06-09 Thread Greg Parker
On Jun 8, 2015, at 11:47 PM, Roland King r...@rols.org wrote: Without answering 98.7% of your question, or more. Are you wedded to NSData for this? I have a stream processor, it takes randomly chunked up data from a bluetooth dongle and .. processes it. I used dispatch_data_t for it. That

Re: Strange Warning Message from the Analyzer?

2015-06-09 Thread Quincey Morris
On Jun 9, 2015, at 06:54 , Dave d...@looktowindward.com wrote: the thing is that malloc should never return NULL On Jun 9, 2015, at 09:25 , Jens Alfke j...@mooseyard.com wrote: But the C standard says malloc can return NULL if it can’t allocate the block, and there are many ways that can

Re: Strange Warning Message from the Analyzer?

2015-06-09 Thread Jens Alfke
On Jun 9, 2015, at 6:54 AM, Dave d...@looktowindward.com wrote: I was just about to post as I figured it out, the thing is that malloc should never return NULL and I thought the analyzer knew that, I guess it’s safer to test anyway. It’s sort of a gray area. In a 64-bit Darwin process I

Re: Strange Warning Message from the Analyzer?

2015-06-09 Thread Jens Alfke
On Jun 9, 2015, at 9:51 AM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: I might be misremembering, but I think this has come up before, and one other way is that malloc is allowed to return NULL if the requested size is 0. (Whether or not it does so is

Releasing resources when cells are returned to the queue?

2015-06-09 Thread Rick Mann
I'd like to release resources in my collection view cells when they are returned to the reuse queue. But I can't see a way to do this. There is a call on the cell when they are popped from the queue and about to be reused, but none when they're put on the queue in the first place. Our

Re: Wanted: Elegant way to manage this task

2015-06-09 Thread Graham Cox
On 9 Jun 2015, at 4:47 pm, Roland King r...@rols.org wrote: Without answering 98.7% of your question, or more. Are you wedded to NSData for this? I have a stream processor, it takes randomly chunked up data from a bluetooth dongle and .. processes it. I used dispatch_data_t for it. That

Re: Releasing resources when cells are returned to the queue?

2015-06-09 Thread Roland King
I'd like to release resources in my collection view cells when they are returned to the reuse queue. But I can't see a way to do this. There is a call on the cell when they are popped from the queue and about to be reused, but none when they're put on the queue in the first place. -

Re: Releasing resources when cells are returned to the queue?

2015-06-09 Thread Rick Mann
Oh, nice catch! On Jun 9, 2015, at 16:07 , Roland King r...@rols.org wrote: I'd like to release resources in my collection view cells when they are returned to the reuse queue. But I can't see a way to do this. There is a call on the cell when they are popped from the queue and about

Re: Releasing resources when cells are returned to the queue?

2015-06-09 Thread Rick Mann
Sorry, this is on iOS. But your suggestions might work anyway. Thanks! Sent from my iPhone On Jun 9, 2015, at 14:34, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Jun 9, 2015, at 14:23 , Rick Mann rm...@latencyzero.com wrote: I'd like to release resources in my collection

Re: Releasing resources when cells are returned to the queue?

2015-06-09 Thread Quincey Morris
On Jun 9, 2015, at 14:23 , Rick Mann rm...@latencyzero.com wrote: I'd like to release resources in my collection view cells when they are returned to the reuse queue. But I can't see a way to do this. There is a call on the cell when they are popped from the queue and about to be reused,

Strange Warning Message from the Analyzer?

2015-06-09 Thread Dave
Hi All, Mac project, XCode 6.3.1, non ARC. I’m getting the following Analyzer (Blue) Warnings in the method below (see comments): -(void) insertIndexes:(NSUInteger*) theIndexBufferPtr length:(NSInteger) theInsertLength atPosition:(NSUInteger) thePosition { void*

Re: Strange Warning Message from the Analyzer?

2015-06-09 Thread Dave
Hi, I would assume it’s because you aren’t checking the value of myBaseBufferPtr after malloc returns. It could be nil there. So then later is the first place you try to deref it (even though it’s now assigned to a new variable), so that’s the first place a nil deref can be checked. You

Re: Strange Warning Message from the Analyzer?

2015-06-09 Thread Steve Mills
On Jun 9, 2015, at 07:35:11, Dave d...@looktowindward.com wrote: [self setupIndexBuffer]; //This sets self.pIndexBaseBufferPtr to a buffer created with malloc() myDestIndexBufferPtr = self.pIndexBaseBufferPtr;