Miguel:

I found the problem.

In previous code, that last call in adsGetValue sets the ITEM with:

 

         hb_itemPutCL( pItem, ( char * ) pBuffer, pField->uiLen );

NOW, it uses:

         hb_itemPutCL( pItem, ( char * ) pBuffer, u32Length );

 

For a 50-byte field (for example), u32Length is set to 51 to include the
trailing NULL,

so for normal fields this code is wrong. It's strange that the bad behavior

doesn't show up more dramatically.

 

Shouldn't this line be reverted to the original

         hb_itemPutCL( pItem, ( char * ) pBuffer, pField->uiLen );

?

Is there any reason why the item would ever be set to anything  other than

the field length?  If the new HB_FT_VARLENGTH types need to be different,

then I suggest setting u32Length back to pField->uiLen for HB_FT_STRING.

It *might* be OK to use u32Length - 1, BUT the other code has been stable

for years, and we can't know for sure what might happen for data that
contains

nulls, or if ADS guarantees there's always a NULL that can be omitted.

 

Thanks,

 

--

Brian Hays

Abacus Data Systems, Inc.

 

From: bhays [mailto:bh...@abacuslaw.com] 
Sent: Saturday, July 11, 2009 12:22 AM
To: 'xharbour developer list'
Subject: [xHarbour-developers] rddads

 

Miguel:

 

I'm trying to look over the changes to ads1.c to help with the character
field length problem.

There are a few changes I don't understand.

 

Why was the explicit NUMERIC test

   else if( hb_itemType( pKey ) & HB_IT_NUMERIC )

changed to

   else if( HB_IS_NUMERIC( pKey ) )

?

 

Is this your change?

 

HB_IS_NUMERIC( pKey ) includes DATES and single-byte strings.

I have lots of single character fields, some with indexes on them, and

I would expect errors to occur if these are treated like numbers at the 

C level when interacting with ADS index keys and scopes.

Was this change done explicitly to include these other types, or was 

someone perhaps thinking it was functionally the same but cleaner code?

 

Thanks,

 

--

Brian Hays

Abacus Data Systems, Inc.

 

Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.12.94/2208 - Release Date: 07/10/09
07:05:00

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to