discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSIternalInconsistencyException with NSMutableData


From: Fred Kiefer
Subject: Re: NSIternalInconsistencyException with NSMutableData
Date: Sun, 05 Jan 2014 18:02:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 04.01.2014 06:27, Germán Arias wrote:
> I'm having a problem with NSMutableData at GNUMail. This app declares 
> extensions for NSData at file NSData+Extension.m, inside these methods 
> NSMutableData objects are used. Specifically the methos 
> -replaceBytesInRange:withBytes:length:, which causes an 
> NSIternalInconsistencyException with message: missing bytes in 
> replaceByteInRange:withBytes:. I thought this was because the object 
> NSMutableData was modified before call -replaceByteInRange:withBytes:. So, I 
> changed this and to now the bytes are removed with -setLength:, which works 
> for me. But after re-read the documentation, I see I misunderstand this, and 
> that -replaceBytesInRange:withBytes:length: should work.
> 
> The correspondign code is, the exceptions occurs at last line:
> 
>        // The line is fixed, we append it.
>         [lines appendData: aLine];
>         
>         // We add the necessary quote characters in the paragraph
>         if (quote_depth)
>           {
>             NSData *d;
>             
>             d = [lines quoteWithLevel: quote_depth   wrappingLimit: 
> theQuoteLimit];
>             [lines replaceBytesInRange: NSMakeRange(0, [lines length])
>                    withBytes: [d bytes]  length: [d length]];
>           }
> 
>         // We append the paragraph (if any)
>         if ([lines length])
>           {
>             [aMutableData appendData: lines];
>           }
>         [aMutableData appendCString: "\n"];
>         
>         // We empty the paragraph buffer
>         [lines replaceBytesInRange: NSMakeRange(0, [lines length] withBytes: 
> NULL  length: 0];
> 
> 
> Any advice?

Hi German,

first off, technical questions like this one would be better of on the
developer mailing list.

Next if you look at the code in NSData.m you will see that this
exception gets raised when the call [self mutableBytes] returns 0. Now
this is one of the methods specific to each class in the class cluster.
That means nobody is able to comment on the problem without knowing how
"lines" gets instantiated. I tried to find the code for GNUmail on the
internet before replying, but failed to. The official address seems to
be dead.

Sorry for being of no help here,
Fred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]