Re: Problem with NSData

2010-04-05 Thread Graham Cox
On 06/04/2010, at 1:12 AM, McLaughlin, Michael P. wrote: > In normal operation, getDataSz takes in a buffer allocated by an STL vector > in the following call: > > [mySubtaskServer getDataSz:&my_vec[0] ofSize:dataSize]; > > If (just for testing), I replace the argument, data, with a local mallo

Re: Problem with NSData

2010-04-05 Thread McLaughlin, Michael P.
I may be off on an island by myself here but I thought I'd add some more info just in case someone recognizes it and has a useful thought. The error described below occurs because the data I sent through NSFileHandle to NSData (in the subtask) was actually the elements of a vector [just the array,

Problem with NSData

2010-04-05 Thread McLaughlin, Michael P.
In a Cocoa app targeting Leopard, I am getting a malloc error when using the NSData method - (void)getBytes:(void *)buffer My function is as follows: -(void)getDataSz:(void*)data ofSize:(NSUInteger)sz { NSData *theData = [input readDataOfLength:sz]; [theData getBytes:data]; // <-- no e

Re: Problem with NSData to NSString to NSData

2008-10-31 Thread Joel Norvell
Dear Cocoa-dev People, I wanted to thank everyone for their helpful replies to my question: How to save metadata for a PDF file? Graham, thank you for confirming and clarifying "the Cocoa way." Your caveat (problem with other pdf readers) was also well taken! Ricky, thank you for your trencha

Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Jeff Dutky
On Wed, Oct 29, 2008 at 4:46 PM, Joel Norvell <[EMAIL PROTECTED]> wrote: > Dear Cocoa-dev People, > > First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the > problem with my NSData->NSString->NSData approach. > > As an alternative, would it be fruitful to use a Directory Wrapper

Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Dave Geering
> From your original implementation of putting the metadata directly into the > PDF file, you'll now end up with obviously a proprietary file. i.e. No > application that works with PDF will be able to work with that file. That is not at all true. You can embed the data into a PDF stream but nev

Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Marcel Weiher
On Oct 29, 2008, at 1:46 PM, Joel Norvell wrote: First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the problem with my NSData->NSString->NSData approach. As an alternative, would it be fruitful to use a Directory Wrapper to represent the data as two files; one the metada

Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Michael Ash
On Wed, Oct 29, 2008 at 4:46 PM, Joel Norvell <[EMAIL PROTECTED]> wrote: > Dear Cocoa-dev People, > > First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the > problem with my NSData->NSString->NSData approach. > > As an alternative, would it be fruitful to use a Directory Wrapper

Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Ricky Sharp
On Oct 29, 2008, at 3:46 PM, Joel Norvell wrote: Dear Cocoa-dev People, First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the problem with my NSData->NSString->NSData approach. As an alternative, would it be fruitful to use a Directory Wrapper to represent the data as t

Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Graham Cox
On 30 Oct 2008, at 7:46 am, Joel Norvell wrote: As an alternative, would it be fruitful to use a Directory Wrapper to represent the data as two files; one the metadata and the other the pdf? Then I could work with the metadata file, but just display the pdf file. In the "What could go w

Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Joel Norvell
Dear Cocoa-dev People, First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the problem with my NSData->NSString->NSData approach. As an alternative, would it be fruitful to use a Directory Wrapper to represent the data as two files; one the metadata and the other the pdf? Then

Re: Problem with NSData to NSString to NSData

2008-10-28 Thread Rob Keniger
On 29/10/2008, at 2:43 PM, Joel Norvell wrote: I have a file with some metadata prepended to a pdf. I want to strip the metadata off and display the pdf. I was trying to do this: - (void) loadFromPath: (NSString *) path { NSData *myData = [NSData dataWithContentsOfFile:path]; NSString *myS

Re: Problem with NSData to NSString to NSData

2008-10-28 Thread Aki Inoue
Joel, The PDF is a binary data format. So, trying to decode with an ASCII encoding vonverter would result in data loss. I recommend processing it as mere bytes without mapping to a string. Aki from iPhone On 2008/10/28, at 21:43, Joel Norvell <[EMAIL PROTECTED]> wrote: Dear Cocoa-dev Peop

Problem with NSData to NSString to NSData

2008-10-28 Thread Joel Norvell
Dear Cocoa-dev People, I have a file with some metadata prepended to a pdf. I want to strip the metadata off and display the pdf. I was trying to do this: - (void) loadFromPath: (NSString *) path { NSData *myData = [NSData dataWithContentsOfFile:path]; NSString *myStr = [[NSString alloc] i