Hi,
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?
Thanks.
Germán.
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep