On Sat, 13 Feb 2010, Szak�ts Viktor wrote: Hi,
> >>>> Currently hb_itemGetStr*() don't always duplicate > >>>> the string, which causes the problem. I'd need the > >>>> simplest way to make the conversion and force > >>>> duplication. Przemek, if you see this, what do you > >>>> suggest? > >>> HB_STRUNSHARE() > >> 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. best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour