>>>> I know about it (already using for raw buffers), but 
>>>> how to make the CP conversion when using unshare?
>>> Sorry but I do not understand what's the problem.
>>> What is wrong with CP conversion made by hb_itemGetStr*()?
>> I had to find out that I need to chain them and how.
>> 
>> Going mad. It's still not okay. F.e. it doesn't unshare 
>> empty string created with SPACE(). It does unshare it 
>> if it's an empty string literal though.
> 
> It doesn't unshare 0 length strings only: "" it doesn't
> matter how they were created what seems to be correct and
> expected behavior, isn't it?
> 
>> HB_SIZE nLen;
>> const char * s = hb_itemGetStr( pParam, hb_setGetOSCP(), &hString, &nLen );
>> p = hb_strunshare( &hString, s, nLen );
> 
> Exactly and now 'p' is writable string with 'nLen' characters which
> you can change.

It doesn't seem so. In win_dll.c it will still let the callee 
overwrite the item string buffer since: p == hb_itemGetCPtr( pParam ))
At least where cData is initialized using SPACE(), in test_dll.prg. 
(maybe the rules is something else, but that was the closest 
I can come up with this time).

Anyway, I'm trying to figure it out since 6 hours, so I give 
it up now and let it corrupt memory :(

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to