Brian,

The "Adopt" portion of the name indicates that the created item will adopt the 
memory. The "Raw" portion means it may have binary info, so that strlen() can't 
be used. Sorry, I don't understand the other issue you describe. Do you have a 
small, reduced, self contained, sample that show the problem?

Ron

 
From: bhays 
Sent: Monday, July 06, 2009 1:55 AM
To: 'xharbour developer list' 
Subject: [xHarbour-developers] hb_uncompress in hbcomprs.c returns anunstable 
string


Ron and friends:

 

This function returns an xgrabbed memory block in this way, and does not 
release it:

        hb_retclenAdoptRaw( cDest, ulDstlen );

 

Notice the "RAW".

Can you please tell me if this is currently accepted code, or does it return an 
unstable pointer to something that might get released or mangled?

 

The attached isolated test shows that if I try to macro compile a string that 
was returned to a variable from hb_uncompress, the &() line throws an error.

Here are the 2 lines of code in question:

         

cOrgStr := hb_UnCompress( nOrgLen, cCompressed )

? &( cOrgStr )

 

If I hack an EXACT COPY of the string with this:

cCopy := alltrim( cOrgStr + " " )

the cCopy WILL compile, even though it traces out as the exact same string.

 

There's some internal property of the uncompressed string that causes an

instability with the & operator.

 

Thanks!

 

--

Brian Hays

 



--------------------------------------------------------------------------------


------------------------------------------------------------------------------



--------------------------------------------------------------------------------


_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers
------------------------------------------------------------------------------
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to