diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ad3edf1efa..0f347ea1be 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,18 @@ The license applies to all entries newer than 2009-04-28. */ +2010-06-22 11:14 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbdefs.h + + added HB_VMUINT_MAX macro + + * harbour/src/vm/hvm.c + * harbour/src/vm/itemapi.c + % use conditional #if compilation for code which depends on + HB_SIZE range. It should eliminate dummy code and pacify + warnings in some compilers. + NOTE: do not forget to update such #if conditions when we + switch to signed HB_SIZE type. + 2010-06-22 09:58 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/macro/macro.y * harbour/src/macro/macro.yyh diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 8f5ec7c5d4..644a54638d 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -462,6 +462,7 @@ typedef HB_UCHAR HB_U8; #if defined( HB_CLIPPER_INT_ITEMS ) # define HB_VMINT_MAX SHRT_MAX # define HB_VMINT_MIN SHRT_MIN +# define HB_VMUINT_MAX USHRT_MAX # define HB_VMLONG_MAX LONG_MAX # define HB_VMLONG_MIN LONG_MIN # define HB_VMULONG_MAX ULONG_MAX @@ -471,6 +472,7 @@ typedef HB_UCHAR HB_U8; #elif !defined( HB_LONG_LONG_OFF ) && ULONG_MAX == UINT_MAX # define HB_VMINT_MAX INT_MAX # define HB_VMINT_MIN INT_MIN +# define HB_VMUINT_MAX UINT_MAX # define HB_VMLONG_MAX LONGLONG_MAX # define HB_VMLONG_MIN LONGLONG_MIN # define HB_VMULONG_MAX ULONGLONG_MAX @@ -479,6 +481,7 @@ typedef HB_UCHAR HB_U8; #else # define HB_VMINT_MAX INT_MAX # define HB_VMINT_MIN INT_MIN +# define HB_VMUINT_MAX UINT_MAX # define HB_VMLONG_MAX LONG_MAX # define HB_VMLONG_MIN LONG_MIN # define HB_VMULONG_MAX ULONG_MAX diff --git a/harbour/src/vm/hvm.c b/harbour/src/vm/hvm.c index 7195f50635..cf8f6cd3d5 100644 --- a/harbour/src/vm/hvm.c +++ b/harbour/src/vm/hvm.c @@ -6661,10 +6661,14 @@ void hb_vmPushLong( long lNumber ) void hb_vmPushSize( HB_ISIZ nNumber ) { +#if HB_SIZE_MAX <= HB_VMUINT_MAX + hb_vmPushInteger( ( int ) nNumber ); +#else if( HB_LIM_INT( nNumber ) ) hb_vmPushInteger( ( int ) nNumber ); else hb_vmPushHBLong( nNumber ); +#endif } static void hb_vmPushHBLong( HB_MAXINT lNumber ) diff --git a/harbour/src/vm/itemapi.c b/harbour/src/vm/itemapi.c index 6b44ff5218..f3ec4c3344 100644 --- a/harbour/src/vm/itemapi.c +++ b/harbour/src/vm/itemapi.c @@ -990,6 +990,12 @@ PHB_ITEM hb_itemPutNS( PHB_ITEM pItem, HB_ISIZ nNumber ) else pItem = hb_itemNew( NULL ); +#if HB_SIZE_MAX <= HB_VMUINT_MAX + pItem->type = HB_IT_INTEGER; + pItem->item.asInteger.value = nNumber; + /* EXP limit used intentionally */ + pItem->item.asInteger.length = HB_INT_EXPLENGTH( nNumber ); +#else if( HB_LIM_INT( nNumber ) ) { pItem->type = HB_IT_INTEGER; @@ -1003,6 +1009,7 @@ PHB_ITEM hb_itemPutNS( PHB_ITEM pItem, HB_ISIZ nNumber ) pItem->item.asLong.value = nNumber; pItem->item.asLong.length = HB_LONG_LENGTH( nNumber ); } +#endif return pItem; }