From 2a4e728aa92ab917c5b65165dc0ef65a2e5c40f8 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 10 Jul 2009 02:31:59 +0000 Subject: [PATCH] 2009-07-10 04:31 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * include/hbapi.h * source/vm/fm.c * source/rtl/fstemp.c * source/rtl/ampm.c * source/rtl/fkmax.c * source/rtl/isprint.c * source/rtl/samples.c * source/rtl/inkey.c * source/rtl/fmhb.c * source/rtl/colorind.c * source/rtl/hbffind.c * USHORT -> int. --- harbour/ChangeLog | 14 +++++++ harbour/include/hbapi.h | 2 +- harbour/source/rtl/ampm.c | 16 +++---- harbour/source/rtl/colorind.c | 8 ++-- harbour/source/rtl/fkmax.c | 6 +-- harbour/source/rtl/fmhb.c | 2 +- harbour/source/rtl/fstemp.c | 4 +- harbour/source/rtl/hbffind.c | 78 +++++++++++++++++------------------ harbour/source/rtl/inkey.c | 4 +- harbour/source/rtl/isprint.c | 6 +-- harbour/source/rtl/samples.c | 20 ++++----- harbour/source/vm/fm.c | 6 +-- 12 files changed, 90 insertions(+), 76 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 85b29f644f..14e6f8c256 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,20 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-10 04:31 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * include/hbapi.h + * source/vm/fm.c + * source/rtl/fstemp.c + * source/rtl/ampm.c + * source/rtl/fkmax.c + * source/rtl/isprint.c + * source/rtl/samples.c + * source/rtl/inkey.c + * source/rtl/fmhb.c + * source/rtl/colorind.c + * source/rtl/hbffind.c + * USHORT -> int. + 2009-07-10 03:43 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * source/rtl/gtwin/gtwin.c * source/rtl/gtwvt/gtwvt.h diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 8bd6fe8d85..e9e417e5be 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -492,7 +492,7 @@ extern HB_EXPORT void * hb_xgrab( ULONG ulSize ) HB_MALLOC_ATTR HB_ALLOC_SIZE_AT extern HB_EXPORT void hb_xfree( void * pMem ); /* frees memory */ extern HB_EXPORT void * hb_xrealloc( void * pMem, ULONG ulSize ) HB_ALLOC_SIZE_ATTR( 2 ); /* reallocates memory */ extern HB_EXPORT ULONG hb_xsize( void * pMem ); /* returns the size of an allocated memory block */ -extern HB_EXPORT ULONG hb_xquery( USHORT uiMode ); /* Query different types of memory information */ +extern HB_EXPORT ULONG hb_xquery( int iMode ); /* Query different types of memory information */ extern HB_EXPORT void hb_xsetfilename( const char * szValue ); extern HB_EXPORT void hb_xsetinfo( const char * szValue ); #ifdef _HB_API_INTERNAL_ diff --git a/harbour/source/rtl/ampm.c b/harbour/source/rtl/ampm.c index 52b7f5e208..2f5493091e 100644 --- a/harbour/source/rtl/ampm.c +++ b/harbour/source/rtl/ampm.c @@ -56,17 +56,17 @@ HB_FUNC( AMPM ) { ULONG ulTimeLen = hb_parclen( 1 ); char * pszResult = ( char * ) hb_xgrab( HB_MAX( ulTimeLen, 2 ) + 3 + 1 ); - USHORT uiHour = 0; + int iHour = 0; BOOL bAM; if( ulTimeLen ) { const char * pszTime = hb_parc( 1 ); memcpy( pszResult, pszTime, ulTimeLen ); - uiHour = ( USHORT ) hb_strVal( pszTime, ulTimeLen ); + iHour = ( int ) hb_strVal( pszTime, ulTimeLen ); } - if( uiHour == 0 || uiHour == 24 ) + if( iHour == 0 || iHour == 24 ) { if( ulTimeLen < 2 ) ulTimeLen = 2; @@ -75,14 +75,14 @@ HB_FUNC( AMPM ) pszResult[ 1 ] = '2'; bAM = TRUE; } - else if( uiHour > 12 ) + else if( iHour > 12 ) { if( ulTimeLen < 2 ) ulTimeLen = 2; - uiHour -= 12; - pszResult[ 0 ] = ( char ) ( uiHour / 10 ) + '0'; - pszResult[ 1 ] = ( char ) ( uiHour % 10 ) + '0'; + iHour -= 12; + pszResult[ 0 ] = ( char ) ( iHour / 10 ) + '0'; + pszResult[ 1 ] = ( char ) ( iHour % 10 ) + '0'; if( pszResult[ 0 ] == '0' ) pszResult[ 0 ] = ' '; @@ -90,7 +90,7 @@ HB_FUNC( AMPM ) bAM = FALSE; } else - bAM = ( uiHour != 12 ); + bAM = ( iHour != 12 ); memcpy( pszResult + ulTimeLen, bAM ? " am" : " pm", 4 ); diff --git a/harbour/source/rtl/colorind.c b/harbour/source/rtl/colorind.c index 8daa93e20c..f1fd125639 100644 --- a/harbour/source/rtl/colorind.c +++ b/harbour/source/rtl/colorind.c @@ -59,17 +59,17 @@ HB_FUNC( HB_COLORINDEX ) const char * pszColor = hb_parc( 1 ); ULONG ulColorPos; ULONG ulColorLen; - USHORT uiColorIndex = ( USHORT ) hb_parni( 2 ); + int iColorIndex = hb_parni( 2 ); /* Skip the given number of commas */ - for( ulColorPos = 0; pszColor[ ulColorPos ] != '\0' && uiColorIndex > 0; ulColorPos++ ) + for( ulColorPos = 0; pszColor[ ulColorPos ] != '\0' && iColorIndex > 0; ulColorPos++ ) { if( pszColor[ ulColorPos ] == ',' ) - uiColorIndex--; + iColorIndex--; } /* if found, continue */ - if( uiColorIndex == 0 ) + if( iColorIndex == 0 ) { /* Skip the spaces after the comma */ while( pszColor[ ulColorPos ] == ' ' ) diff --git a/harbour/source/rtl/fkmax.c b/harbour/source/rtl/fkmax.c index c80386ecc0..a5fd107e50 100644 --- a/harbour/source/rtl/fkmax.c +++ b/harbour/source/rtl/fkmax.c @@ -68,13 +68,13 @@ HB_FUNC( FKLABEL ) if( pPar1 ) { - USHORT uiFKey = ( USHORT ) hb_itemGetNI( pPar1 ); + int iFKey = hb_itemGetNI( pPar1 ); - if( uiFKey > 0 && uiFKey <= 40 ) + if( iFKey > 0 && iFKey <= 40 ) { char szName[ 4 ]; - hb_snprintf( szName, sizeof( szName ), "F%i", uiFKey ); + hb_snprintf( szName, sizeof( szName ), "F%d", iFKey ); hb_retc( szName ); return; } diff --git a/harbour/source/rtl/fmhb.c b/harbour/source/rtl/fmhb.c index 21458996f2..0841b7d0ac 100644 --- a/harbour/source/rtl/fmhb.c +++ b/harbour/source/rtl/fmhb.c @@ -54,5 +54,5 @@ HB_FUNC( MEMORY ) { - hb_retnint( hb_xquery( ( USHORT ) hb_parni( 1 ) ) ); + hb_retnint( hb_xquery( hb_parni( 1 ) ) ); } diff --git a/harbour/source/rtl/fstemp.c b/harbour/source/rtl/fstemp.c index f1e8eeaacc..edafd10e19 100644 --- a/harbour/source/rtl/fstemp.c +++ b/harbour/source/rtl/fstemp.c @@ -261,9 +261,9 @@ static BOOL hb_fsTempName( char * pszBuffer, const char * pszDir, const char * p HB_FHANDLE hb_fsCreateTemp( const char * pszDir, const char * pszPrefix, ULONG ulAttr, char * pszName ) { - USHORT nAttemptLeft = 999; + int iAttemptLeft = 999; - while( --nAttemptLeft ) + while( --iAttemptLeft ) { if( hb_fsTempName( pszName, pszDir, pszPrefix ) ) { diff --git a/harbour/source/rtl/hbffind.c b/harbour/source/rtl/hbffind.c index de38d740f8..ce8cac48f7 100644 --- a/harbour/source/rtl/hbffind.c +++ b/harbour/source/rtl/hbffind.c @@ -385,13 +385,13 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) { BOOL bFound; - USHORT nYear = 0; - USHORT nMonth = 0; - USHORT nDay = 0; + int iYear = 0; + int iMonth = 0; + int iDay = 0; - USHORT nHour = 0; - USHORT nMin = 0; - USHORT nSec = 0; + int iHour = 0; + int iMin = 0; + int iSec = 0; ULONG raw_attr = 0; @@ -453,13 +453,13 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) ftime = sStat.st_mtime; ft = localtime( &ftime ); - nYear = ft->tm_year + 1900; - nMonth = ft->tm_mon + 1; - nDay = ft->tm_mday; + iYear = ft->tm_year + 1900; + iMonth = ft->tm_mon + 1; + iDay = ft->tm_mday; - nHour = ft->tm_hour; - nMin = ft->tm_min; - nSec = ft->tm_sec; + iHour = ft->tm_hour; + iMin = ft->tm_min; + iSec = ft->tm_sec; } } hb_fsSetIOError( bFound, 0 ); @@ -503,13 +503,13 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) ffind->size = info->entry.cbFile; raw_attr = info->entry.attrFile; - nYear = info->entry.fdateLastWrite.year + 1980; - nMonth = info->entry.fdateLastWrite.month; - nDay = info->entry.fdateLastWrite.day; + iYear = info->entry.fdateLastWrite.year + 1980; + iMonth = info->entry.fdateLastWrite.month; + iDay = info->entry.fdateLastWrite.day; - nHour = info->entry.ftimeLastWrite.hours; - nMin = info->entry.ftimeLastWrite.minutes; - nSec = info->entry.ftimeLastWrite.twosecs; + iHour = info->entry.ftimeLastWrite.hours; + iMin = info->entry.ftimeLastWrite.minutes; + iSec = info->entry.ftimeLastWrite.twosecs; } hb_fsSetIOError( bFound, 0 ); @@ -590,12 +590,12 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) if( FileTimeToLocalFileTime( &info->pFindFileData.ftLastWriteTime, &ft ) && FileTimeToSystemTime( &ft, &time ) ) { - nYear = time.wYear; - nMonth = time.wMonth; - nDay = time.wDay; - nHour = time.wHour; - nMin = time.wMinute; - nSec = time.wSecond; + iYear = time.wYear; + iMonth = time.wMonth; + iDay = time.wDay; + iHour = time.wHour; + iMin = time.wMinute; + iSec = time.wSecond; } } } @@ -681,13 +681,13 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) lt = *localtime( &ftime ); # endif - nYear = lt.tm_year + 1900; - nMonth = lt.tm_mon + 1; - nDay = lt.tm_mday; + iYear = lt.tm_year + 1900; + iMonth = lt.tm_mon + 1; + iDay = lt.tm_mday; - nHour = lt.tm_hour; - nMin = lt.tm_min; - nSec = lt.tm_sec; + iHour = lt.tm_hour; + iMin = lt.tm_min; + iSec = lt.tm_sec; } else bFound = FALSE; @@ -703,12 +703,12 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) /* HB_SYMBOL_UNUSED( ffind ); */ - HB_SYMBOL_UNUSED( nYear ); - HB_SYMBOL_UNUSED( nMonth ); - HB_SYMBOL_UNUSED( nDay ); - HB_SYMBOL_UNUSED( nHour ); - HB_SYMBOL_UNUSED( nMin ); - HB_SYMBOL_UNUSED( nSec ); + HB_SYMBOL_UNUSED( iYear ); + HB_SYMBOL_UNUSED( iMonth ); + HB_SYMBOL_UNUSED( iDay ); + HB_SYMBOL_UNUSED( iHour ); + HB_SYMBOL_UNUSED( iMin ); + HB_SYMBOL_UNUSED( iSec ); HB_SYMBOL_UNUSED( raw_attr ); bFound = FALSE; @@ -739,11 +739,11 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) ffind->attr = hb_fsAttrFromRaw( raw_attr ); - ffind->lDate = hb_dateEncode( nYear, nMonth, nDay ); - hb_dateStrPut( ffind->szDate, nYear, nMonth, nDay ); + ffind->lDate = hb_dateEncode( iYear, iMonth, iDay ); + hb_dateStrPut( ffind->szDate, iYear, iMonth, iDay ); ffind->szDate[ 8 ] = '\0'; - hb_snprintf( ffind->szTime, sizeof( ffind->szTime ), "%02d:%02d:%02d", nHour, nMin, nSec ); + hb_snprintf( ffind->szTime, sizeof( ffind->szTime ), "%02d:%02d:%02d", iHour, iMin, iSec ); } hb_vmLock(); diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 13741a7629..3ec5b697f8 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -98,7 +98,7 @@ static HB_TSD_NEW( s_inkeyBlock, sizeof( HB_INKEYBLOCK ), NULL, hb_inkeyBlockRel HB_FUNC( INKEY ) { PHB_INKEYBLOCK pInkeyBlock = ( PHB_INKEYBLOCK ) hb_stackTestTSD( &s_inkeyBlock ); - USHORT uiPCount = ( USHORT ) hb_pcount(); + int iPCount = hb_pcount(); PHB_ITEM pKey = NULL; int iKey; @@ -107,7 +107,7 @@ HB_FUNC( INKEY ) do { - iKey = hb_inkey( uiPCount == 1 || ( uiPCount > 1 && HB_ISNUM( 1 ) ), + iKey = hb_inkey( iPCount == 1 || ( iPCount > 1 && HB_ISNUM( 1 ) ), hb_parnd( 1 ), HB_ISNUM( 2 ) ? hb_parni( 2 ) : hb_setGetEventMask() ); diff --git a/harbour/source/rtl/isprint.c b/harbour/source/rtl/isprint.c index 3d9f3a66be..1f3e5e9b42 100644 --- a/harbour/source/rtl/isprint.c +++ b/harbour/source/rtl/isprint.c @@ -62,7 +62,7 @@ BOOL hb_printerIsReady( const char * pszPrinterName ) /* NOTE: DOS specific solution, using BIOS interrupt */ { - USHORT uiPort; + int iPort; if( pszPrinterName == NULL ) pszPrinterName = "LPT1"; @@ -80,12 +80,12 @@ BOOL hb_printerIsReady( const char * pszPrinterName ) } else if( strlen( pszPrinterName ) >= 4 && hb_strnicmp( pszPrinterName, "LPT", 3 ) == 0 && - ( uiPort = atoi( pszPrinterName + 3 ) ) > 0 ) + ( iPort = atoi( pszPrinterName + 3 ) ) > 0 ) { union REGS regs; regs.h.ah = 2; - regs.HB_XREGS.dx = uiPort - 1; + regs.HB_XREGS.dx = iPort - 1; HB_DOS_INT86( 0x17, ®s, ®s ); diff --git a/harbour/source/rtl/samples.c b/harbour/source/rtl/samples.c index 9d4fc3710e..958854e954 100644 --- a/harbour/source/rtl/samples.c +++ b/harbour/source/rtl/samples.c @@ -56,21 +56,21 @@ static char * hb_SecToTimeStr( char * pszTime, ULONG ulTime ) { - USHORT uiValue; + int iValue; HB_TRACE(HB_TR_DEBUG, ("hb_SecToTimeStr(%s, %lu)", pszTime, ulTime)); - uiValue = ( USHORT ) ( ( ulTime / 3600 ) % 24 ); - pszTime[ 0 ] = ( char ) ( uiValue / 10 ) + '0'; - pszTime[ 1 ] = ( char ) ( uiValue % 10 ) + '0'; + iValue = ( int ) ( ( ulTime / 3600 ) % 24 ); + pszTime[ 0 ] = ( char ) ( iValue / 10 ) + '0'; + pszTime[ 1 ] = ( char ) ( iValue % 10 ) + '0'; pszTime[ 2 ] = ':'; - uiValue = ( USHORT ) ( ( ulTime / 60 ) % 60 ); - pszTime[ 3 ] = ( char ) ( uiValue / 10 ) + '0'; - pszTime[ 4 ] = ( char ) ( uiValue % 10 ) + '0'; + iValue = ( int ) ( ( ulTime / 60 ) % 60 ); + pszTime[ 3 ] = ( char ) ( iValue / 10 ) + '0'; + pszTime[ 4 ] = ( char ) ( iValue % 10 ) + '0'; pszTime[ 5 ] = ':'; - uiValue = ( USHORT ) ( ulTime % 60 ); - pszTime[ 6 ] = ( char ) ( uiValue / 10 ) + '0'; - pszTime[ 7 ] = ( char ) ( uiValue % 10 ) + '0'; + iValue = ( int ) ( ulTime % 60 ); + pszTime[ 6 ] = ( char ) ( iValue / 10 ) + '0'; + pszTime[ 7 ] = ( char ) ( iValue % 10 ) + '0'; pszTime[ 8 ] = '\0'; return pszTime; diff --git a/harbour/source/vm/fm.c b/harbour/source/vm/fm.c index f9a304e533..e9a5adeba4 100644 --- a/harbour/source/vm/fm.c +++ b/harbour/source/vm/fm.c @@ -1080,15 +1080,15 @@ void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ #endif -ULONG hb_xquery( USHORT uiMode ) +ULONG hb_xquery( int iMode ) { ULONG ulResult; - HB_TRACE(HB_TR_DEBUG, ("hb_xquery(%hu)", uiMode)); + HB_TRACE(HB_TR_DEBUG, ("hb_xquery(%d)", iMode)); /* TODO: Return the correct values instead of 9999 [vszakats] */ - switch( uiMode ) + switch( iMode ) { case HB_MEM_CHAR: /* (Free Variable Space [KB]) */ #if defined( HB_OS_WIN )