mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
(ostream_open_memory): Use new MemoryStream method to specify that
buffer should not be deallocated when MemoryStream is deallocated. Don't do the extra retain that was the previous workaround. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1798 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
797e1bdec9
commit
d9bce0510c
1 changed files with 7 additions and 9 deletions
|
@ -234,17 +234,15 @@ ostream_open_memory (const char *addr, int size, int mode)
|
||||||
ostream* stream = _ostream_new_stream_struct(mode, &fmode);
|
ostream* stream = _ostream_new_stream_struct(mode, &fmode);
|
||||||
if (addr)
|
if (addr)
|
||||||
{
|
{
|
||||||
stream->stream_obj = [[MemoryStream alloc] _initOnMallocBuffer: addr
|
stream->stream_obj = [[MemoryStream alloc]
|
||||||
size: size
|
_initOnMallocBuffer: addr
|
||||||
eofPosition: size
|
freeWhenDone: NO
|
||||||
prefix: 0
|
size: size
|
||||||
position: 0];
|
eofPosition: size
|
||||||
|
prefix: 0
|
||||||
|
position: 0];
|
||||||
if (!stream->stream_obj)
|
if (!stream->stream_obj)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* xxxFIXME: Now way of telling MemoryStream that we own this buffer
|
|
||||||
so just ad an extra retain so we never free the stream */
|
|
||||||
[(id)stream->stream_obj retain];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue