From 3227e918a98edccada87e4d6820039e5f7b00288 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 1 Nov 2012 15:15:58 +0000 Subject: [PATCH] 2012-11-01 16:04 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbexpat/core.c * minor change to avoid uncrustify formatting a tricky macro * contrib/hbfship/*.[c|h] * contrib/hbmysql/*.[c|h] * contrib/hbmzip/*.[c|h] * contrib/hbsqlit3/*.[c|h] * contrib/hbssl/*.[c|h] (with some exceptions) * contrib/hbxpp/*.[c|h] * contrib/xhb/*.[c|h] (with some exceptions) * uncrustified * minor manual corrections before and after --- harbour/ChangeLog | 14 + harbour/contrib/hbexpat/core.c | 2 +- harbour/contrib/hbfship/dbsetloc.c | 4 +- harbour/contrib/hbfship/exec.c | 6 +- harbour/contrib/hbfship/index.c | 6 +- harbour/contrib/hbfship/strpeek.c | 2 +- harbour/contrib/hbmysql/mysql.c | 69 +-- harbour/contrib/hbmzip/mzip.c | 311 ++++++------- harbour/contrib/hbsqlit3/core.c | 230 +++++----- harbour/contrib/hbssl/err.c | 30 +- harbour/contrib/hbssl/evp.c | 2 +- harbour/contrib/hbssl/evpenc.c | 10 +- harbour/contrib/hbssl/evppkey.c | 74 +-- harbour/contrib/hbssl/sslctx.c | 142 +++--- harbour/contrib/hbssl/sslsess.c | 26 +- harbour/contrib/hbxpp/binnumx.c | 12 +- harbour/contrib/hbxpp/dllx.c | 14 +- harbour/contrib/hbxpp/mousex.c | 2 +- harbour/contrib/hbxpp/oemansix.c | 12 +- harbour/contrib/hbxpp/wafuncx.c | 2 +- harbour/contrib/hbxpp/xppopc.c | 24 +- harbour/contrib/xhb/bkgtsks.c | 82 ++-- harbour/contrib/xhb/cstructc.c | 670 +++++++++++++-------------- harbour/contrib/xhb/datesxhb.c | 16 +- harbour/contrib/xhb/dbf2txt.c | 36 +- harbour/contrib/xhb/dbgfxc.c | 3 + harbour/contrib/xhb/filestat.c | 94 ++-- harbour/contrib/xhb/fparse.c | 124 ++--- harbour/contrib/xhb/freadlin.c | 46 +- harbour/contrib/xhb/hbcompat.h | 22 +- harbour/contrib/xhb/hbcrypt.c | 114 ++--- harbour/contrib/xhb/hbnxs.h | 26 +- harbour/contrib/xhb/hboutdbg.c | 34 +- harbour/contrib/xhb/hbserv.c | 20 +- harbour/contrib/xhb/hbxml.c | 715 +++++++++++++++-------------- harbour/contrib/xhb/hbxml.h | 93 ++-- harbour/contrib/xhb/txtline.c | 118 ++--- harbour/contrib/xhb/xhb.h | 2 +- harbour/contrib/xhb/xhbarr.c | 8 +- harbour/contrib/xhb/xhbarrex.c | 2 +- harbour/contrib/xhb/xhbat.c | 24 +- harbour/contrib/xhb/xhbenum.c | 1 + harbour/contrib/xhb/xhberrc.c | 6 +- harbour/contrib/xhb/xhbhasha.c | 38 +- harbour/contrib/xhb/xhbhashp.c | 6 +- harbour/contrib/xhb/xhbis.c | 62 +-- harbour/contrib/xhb/xhbmsgs.c | 140 +++--- harbour/contrib/xhb/xhbmvinf.c | 2 +- harbour/contrib/xhb/xhbsave.c | 12 +- harbour/contrib/xhb/xhbwin.c | 2 + harbour/contrib/xhb/xhbwith.c | 6 +- harbour/contrib/xhb/xstrdel.c | 18 +- 52 files changed, 1793 insertions(+), 1743 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1229472f06..878586944c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,20 @@ The license applies to all entries newer than 2009-04-28. */ +2012-11-01 16:04 UTC+0100 Viktor Szakats (harbour syenar.net) + * contrib/hbexpat/core.c + * minor change to avoid uncrustify formatting a tricky macro + + * contrib/hbfship/*.[c|h] + * contrib/hbmysql/*.[c|h] + * contrib/hbmzip/*.[c|h] + * contrib/hbsqlit3/*.[c|h] + * contrib/hbssl/*.[c|h] (with some exceptions) + * contrib/hbxpp/*.[c|h] + * contrib/xhb/*.[c|h] (with some exceptions) + * uncrustified + * minor manual corrections before and after + 2012-11-01 12:52 UTC+0100 Viktor Szakats (harbour syenar.net) * contrib/hbcups/*.[c|h] * contrib/hbcurl/*.[c|h] diff --git a/harbour/contrib/hbexpat/core.c b/harbour/contrib/hbexpat/core.c index 4f747aa74c..892253b15d 100644 --- a/harbour/contrib/hbexpat/core.c +++ b/harbour/contrib/hbexpat/core.c @@ -120,7 +120,7 @@ typedef struct _HB_EXPAT \ hb_expat_setvar( hb_expat, _VAR_b##_name_, hb_param( 2, HB_IT_BLOCK | HB_IT_SYMBOL ) ); \ \ - XML_Set##_name_ ( hb_expat->parser, hb_expat->pVar[ _VAR_b##_name_ ] ? hb_expat_##_name_ : NULL ); \ + XML_Set##_name_ /* do not delete this */ ( hb_expat->parser, hb_expat->pVar[ _VAR_b##_name_ ] ? hb_expat_##_name_ : NULL ); \ \ hb_ret(); \ } \ diff --git a/harbour/contrib/hbfship/dbsetloc.c b/harbour/contrib/hbfship/dbsetloc.c index 60f47b5d67..258df9cc85 100644 --- a/harbour/contrib/hbfship/dbsetloc.c +++ b/harbour/contrib/hbfship/dbsetloc.c @@ -56,8 +56,8 @@ HB_FUNC( DBSETLOCATE ) { - AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); - HB_BOOL fSet = HB_FALSE; + AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); + HB_BOOL fSet = HB_FALSE; if( pArea ) { diff --git a/harbour/contrib/hbfship/exec.c b/harbour/contrib/hbfship/exec.c index ebd07d57fc..638c3f3fb7 100644 --- a/harbour/contrib/hbfship/exec.c +++ b/harbour/contrib/hbfship/exec.c @@ -77,8 +77,10 @@ HB_FUNC( EXECNAME ) if( pFileName->szPath ) { hb_xfree( pszBaseName ); - pszBaseName = hb_xstrcpy( NULL, pFileName->szName, - pFileName->szExtension, NULL ); + pszBaseName = hb_xstrcpy( NULL, + pFileName->szName, + pFileName->szExtension, + NULL ); } hb_xfree( pFileName ); } diff --git a/harbour/contrib/hbfship/index.c b/harbour/contrib/hbfship/index.c index b80ee86185..c0bebd9a98 100644 --- a/harbour/contrib/hbfship/index.c +++ b/harbour/contrib/hbfship/index.c @@ -79,8 +79,8 @@ HB_FUNC( INDEXNAMES ) if( pArea ) { DBORDERINFO pOrderInfo; - PHB_ITEM pArray; - int iSize, i; + PHB_ITEM pArray; + int iSize, i; memset( &pOrderInfo, 0, sizeof( pOrderInfo ) ); pOrderInfo.itmResult = hb_itemPutNI( NULL, 0 ); @@ -90,7 +90,7 @@ HB_FUNC( INDEXNAMES ) pArray = hb_itemArrayNew( iSize ); for( i = 1; i <= iSize; ++i ) { - pOrderInfo.itmOrder = hb_itemPutNI( pOrderInfo.itmOrder, i ); + pOrderInfo.itmOrder = hb_itemPutNI( pOrderInfo.itmOrder, i ); pOrderInfo.itmResult = hb_itemPutC( pOrderInfo.itmResult, 0 ); if( SELF_ORDINFO( pArea, DBOI_NAME, &pOrderInfo ) != HB_SUCCESS ) break; diff --git a/harbour/contrib/hbfship/strpeek.c b/harbour/contrib/hbfship/strpeek.c index 150cd3170d..c2bead4a69 100644 --- a/harbour/contrib/hbfship/strpeek.c +++ b/harbour/contrib/hbfship/strpeek.c @@ -79,7 +79,7 @@ HB_FUNC( STRPOKE ) if( pText && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) ) { HB_SIZE ulPos = hb_parns( 2 ), ulLen; - char * pszText; + char * pszText; if( ulPos > 0 && hb_itemGetWriteCL( pText, &pszText, &ulLen ) && ulPos <= ulLen ) diff --git a/harbour/contrib/hbmysql/mysql.c b/harbour/contrib/hbmysql/mysql.c index 040515fd81..7940216290 100644 --- a/harbour/contrib/hbmysql/mysql.c +++ b/harbour/contrib/hbmysql/mysql.c @@ -67,8 +67,8 @@ #include "hbapiitm.h" #include "hbapifs.h" +/* NOTE: To satisfy MySQL headers. */ #if defined( HB_OS_WIN ) - /* NOTE: To satisfy MySQL headers. */ #include #endif @@ -85,13 +85,13 @@ static HB_GARBAGE_FUNC( MYSQL_release ) void ** ph = ( void ** ) Cargo; /* Check if pointer is not NULL to avoid multiple freeing */ - if( ph && * ph ) + if( ph && *ph ) { /* Destroy the object */ - mysql_close( ( MYSQL * ) * ph ); + mysql_close( ( MYSQL * ) *ph ); /* set pointer to NULL to avoid multiple freeing */ - * ph = NULL; + *ph = NULL; } } @@ -107,7 +107,7 @@ static void hb_MYSQL_ret( MYSQL * p ) { void ** ph = ( void ** ) hb_gcAllocate( sizeof( MYSQL * ), &s_gcMYSQLFuncs ); - * ph = p; + *ph = p; hb_retptrGC( ph ); } @@ -119,7 +119,7 @@ static MYSQL * hb_MYSQL_par( int iParam ) { void ** ph = ( void ** ) hb_parptrGC( &s_gcMYSQLFuncs, iParam ); - return ph ? ( MYSQL * ) * ph : NULL; + return ph ? ( MYSQL * ) *ph : NULL; } @@ -128,13 +128,13 @@ static HB_GARBAGE_FUNC( MYSQL_RES_release ) void ** ph = ( void ** ) Cargo; /* Check if pointer is not NULL to avoid multiple freeing */ - if( ph && * ph ) + if( ph && *ph ) { /* Destroy the object */ - mysql_free_result( ( MYSQL_RES * ) * ph ); + mysql_free_result( ( MYSQL_RES * ) *ph ); /* set pointer to NULL to avoid multiple freeing */ - * ph = NULL; + *ph = NULL; } } @@ -150,7 +150,7 @@ static void hb_MYSQL_RES_ret( MYSQL_RES * p ) { void ** ph = ( void ** ) hb_gcAllocate( sizeof( MYSQL_RES * ), &s_gcMYSQL_RESFuncs ); - * ph = p; + *ph = p; hb_retptrGC( ph ); } @@ -162,7 +162,7 @@ static MYSQL_RES * hb_MYSQL_RES_par( int iParam ) { void ** ph = ( void ** ) hb_parptrGC( &s_gcMYSQL_RESFuncs, iParam ); - return ph ? ( MYSQL_RES * ) * ph : NULL; + return ph ? ( MYSQL_RES * ) *ph : NULL; } @@ -175,7 +175,7 @@ HB_FUNC( MYSQL_REAL_CONNECT ) /* MYSQL * mysql_real_connect( MYSQL *, char * hos const char * szPass = hb_parc( 3 ); #if MYSQL_VERSION_ID > 32200 - MYSQL * mysql; + MYSQL * mysql; unsigned int port = ( unsigned int ) hb_parnidef( 4, MYSQL_PORT ); unsigned int flags = ( unsigned int ) hb_parnidef( 5, 0 ); @@ -208,7 +208,7 @@ HB_FUNC( MYSQL_GET_SERVER_VERSION ) /* long mysql_get_server_version( MYSQL * ) hb_retnl( ( long ) mysql_get_server_version( mysql ) ); #else const char * szVer = mysql_get_server_info( mysql ); - long lVer = 0; + long lVer = 0; while( *szVer ) { @@ -302,13 +302,13 @@ HB_FUNC( MYSQL_FETCH_ROW ) /* MYSQL_ROW * mysql_fetch_row( MYSQL_RES * ) */ if( mresult ) { unsigned int num_fields = mysql_num_fields( mresult ); - PHB_ITEM aRow = hb_itemArrayNew( num_fields ); - MYSQL_ROW mrow = mysql_fetch_row( mresult ); + PHB_ITEM aRow = hb_itemArrayNew( num_fields ); + MYSQL_ROW mrow = mysql_fetch_row( mresult ); if( mrow ) { unsigned long * lengths = mysql_fetch_lengths( mresult ); - unsigned int i; + unsigned int i; for( i = 0; i < num_fields; ++i ) hb_arraySetCL( aRow, i + 1, mrow[ i ], lengths[ i ] ); } @@ -344,7 +344,7 @@ HB_FUNC( MYSQL_FETCH_FIELD ) /* MYSQL_FIELD * mysql_fetch_field( MYSQL_RES * ) * if( mresult ) { /* NOTE: field structure of MySQL has 8 members as of MySQL 3.22.x */ - PHB_ITEM aField = hb_itemArrayNew( 8 ); + PHB_ITEM aField = hb_itemArrayNew( 8 ); MYSQL_FIELD * mfield = mysql_fetch_field( mresult ); if( mfield ) @@ -438,9 +438,9 @@ HB_FUNC( MYSQL_LIST_DBS ) /* MYSQL_RES * mysql_list_dbs( MYSQL *, char * wild ); if( mysql ) { MYSQL_RES * mresult = mysql_list_dbs( mysql, NULL ); - HB_SIZE nr = ( HB_SIZE ) mysql_num_rows( mresult ); - PHB_ITEM aDBs = hb_itemArrayNew( nr ); - HB_SIZE i; + HB_SIZE nr = ( HB_SIZE ) mysql_num_rows( mresult ); + PHB_ITEM aDBs = hb_itemArrayNew( nr ); + HB_SIZE i; for( i = 0; i < nr; ++i ) { @@ -461,11 +461,11 @@ HB_FUNC( MYSQL_LIST_TABLES ) /* MYSQL_RES * mysql_list_tables( MYSQL *, char * w if( mysql ) { - const char * cWild = hb_parc( 2 ); - MYSQL_RES * mresult = mysql_list_tables( mysql, cWild ); - long nr = ( long ) mysql_num_rows( mresult ); - PHB_ITEM aTables = hb_itemArrayNew( nr ); - long i; + const char * cWild = hb_parc( 2 ); + MYSQL_RES * mresult = mysql_list_tables( mysql, cWild ); + long nr = ( long ) mysql_num_rows( mresult ); + PHB_ITEM aTables = hb_itemArrayNew( nr ); + long i; for( i = 0; i < nr; ++i ) { @@ -536,9 +536,9 @@ HB_FUNC( MYSQL_REAL_ESCAPE_STRING ) /* unsigned long STDCALL mysql_real_escape_s if( mysql ) { - const char * from = hb_parcx( 2 ); - unsigned long nSize = ( unsigned long ) hb_parclen( 2 ); - char * buffer = ( char * ) hb_xgrab( nSize * 2 + 1 ); + const char * from = hb_parcx( 2 ); + unsigned long nSize = ( unsigned long ) hb_parclen( 2 ); + char * buffer = ( char * ) hb_xgrab( nSize * 2 + 1 ); nSize = mysql_real_escape_string( mysql, buffer, from, nSize ); hb_retclen_buffer( ( char * ) buffer, nSize ); } @@ -548,16 +548,17 @@ HB_FUNC( MYSQL_REAL_ESCAPE_STRING ) /* unsigned long STDCALL mysql_real_escape_s HB_FUNC( MYSQL_ESCAPE_STRING ) { - const char * from = hb_parcx( 1 ); - unsigned long nSize = ( unsigned long ) hb_parclen( 1 ); - char * buffer = ( char * ) hb_xgrab( nSize * 2 + 1 ); + const char * from = hb_parcx( 1 ); + unsigned long nSize = ( unsigned long ) hb_parclen( 1 ); + char * buffer = ( char * ) hb_xgrab( nSize * 2 + 1 ); + nSize = mysql_escape_string( buffer, from, nSize ); hb_retclen_buffer( ( char * ) buffer, nSize ); } static char * filetoBuff( const char * fname, unsigned long * size ) { - char * buffer = NULL; + char * buffer = NULL; HB_FHANDLE handle = hb_fsOpen( fname, FO_READWRITE ); if( handle != FS_ERROR ) @@ -565,7 +566,7 @@ static char * filetoBuff( const char * fname, unsigned long * size ) *size = hb_fsSeek( handle, 0, FS_END ); hb_fsSeek( handle, 0, FS_SET ); buffer = ( char * ) hb_xgrab( *size + 1 ); - *size = ( unsigned long ) hb_fsReadLarge( handle, buffer, *size ); + *size = ( unsigned long ) hb_fsReadLarge( handle, buffer, *size ); buffer[ *size ] = '\0'; hb_fsClose( handle ); } @@ -578,7 +579,7 @@ static char * filetoBuff( const char * fname, unsigned long * size ) HB_FUNC( MYSQL_ESCAPE_STRING_FROM_FILE ) { unsigned long nSize; - char * from = filetoBuff( hb_parc( 1 ), &nSize ); + char * from = filetoBuff( hb_parc( 1 ), &nSize ); if( from ) { diff --git a/harbour/contrib/hbmzip/mzip.c b/harbour/contrib/hbmzip/mzip.c index 9de0bc6f95..c9af40eac1 100644 --- a/harbour/contrib/hbmzip/mzip.c +++ b/harbour/contrib/hbmzip/mzip.c @@ -76,8 +76,8 @@ #endif #elif defined( HB_OS_WIN ) #include - #if !defined( INVALID_FILE_ATTRIBUTES ) - #define INVALID_FILE_ATTRIBUTES ( ( DWORD ) -1 ) + #if ! defined( INVALID_FILE_ATTRIBUTES ) + #define INVALID_FILE_ATTRIBUTES ( ( DWORD ) -1 ) #endif #include "hbwinuni.h" #elif defined( HB_OS_OS2 ) @@ -86,7 +86,7 @@ #include #endif -#define HB_Z_IOBUF_SIZE ( 1024 * 16 ) +#define HB_Z_IOBUF_SIZE ( 1024 * 16 ) static HB_GARBAGE_FUNC( hb_zipfile_destructor ) { @@ -184,9 +184,9 @@ HB_FUNC( HB_ZIPOPEN ) if( szFileName ) { zipcharpc pszGlobalComment = NULL; - char * pszFree; - zipFile hZip = zipOpen2( hb_fsNameConv( szFileName, &pszFree ), hb_parnidef( 2, APPEND_STATUS_CREATE ), - &pszGlobalComment, NULL ); + char * pszFree; + zipFile hZip = zipOpen2( hb_fsNameConv( szFileName, &pszFree ), hb_parnidef( 2, APPEND_STATUS_CREATE ), + &pszGlobalComment, NULL ); if( pszFree ) hb_xfree( pszFree ); @@ -238,10 +238,10 @@ HB_FUNC( HB_ZIPFILECREATE ) if( hZip ) { - int iMethod = hb_parnidef( 7, Z_DEFLATED ); - int iLevel = hb_parnidef( 8, Z_DEFAULT_COMPRESSION ); + int iMethod = hb_parnidef( 7, Z_DEFLATED ); + int iLevel = hb_parnidef( 8, Z_DEFAULT_COMPRESSION ); long lJulian, lMillisec; - int iYear, iMonth, iDay, iHour, iMinute, iSecond, iMSec; + int iYear, iMonth, iDay, iHour, iMinute, iSecond, iMSec; zip_fileinfo zfi; @@ -260,16 +260,16 @@ HB_FUNC( HB_ZIPFILECREATE ) } zfi.tmz_date.tm_hour = iHour; - zfi.tmz_date.tm_min = iMinute; - zfi.tmz_date.tm_sec = iSecond; + zfi.tmz_date.tm_min = iMinute; + zfi.tmz_date.tm_sec = iSecond; zfi.tmz_date.tm_year = iYear; - zfi.tmz_date.tm_mon = iMonth - 1; + zfi.tmz_date.tm_mon = iMonth - 1; zfi.tmz_date.tm_mday = iDay; zfi.internal_fa = hb_parnl( 5 ); zfi.external_fa = hb_parnl( 6 ); -#if !defined( HB_OS_UNIX ) +#if ! defined( HB_OS_UNIX ) if( ( zfi.external_fa & 0xFFFF0000 ) == 0 ) zfi.external_fa = hb_translateExtAttr( szZipName, zfi.external_fa ); #endif @@ -324,7 +324,7 @@ HB_FUNC( HB_UNZIPOPEN ) if( szFileName ) { - char * pszFree; + char * pszFree; unzFile hUnzip = unzOpen( hb_fsNameConv( szFileName, &pszFree ) ); if( pszFree ) @@ -350,7 +350,7 @@ HB_FUNC( HB_UNZIPCLOSE ) if( phUnzip && *phUnzip ) { - unzFile hUnzip = *phUnzip; + unzFile hUnzip = *phUnzip; *phUnzip = NULL; hb_retni( unzClose( hUnzip ) ); @@ -363,7 +363,7 @@ HB_FUNC( HB_UNZIPCLOSE ) /* HB_UnzipGlobalInfo( hUnzip, @nEntries, @cGlobalComment ) --> nError */ HB_FUNC( HB_UNZIPGLOBALINFO ) { - unzFile hUnzip = hb_unzipfileParam( 1 ); + unzFile hUnzip = hb_unzipfileParam( 1 ); if( hUnzip ) { @@ -393,7 +393,7 @@ HB_FUNC( HB_UNZIPGLOBALINFO ) else { pszComment[ iResult ] = '\0'; - if( !hb_storclen_buffer( pszComment, ugi.size_comment, 3 ) ) + if( ! hb_storclen_buffer( pszComment, ugi.size_comment, 3 ) ) hb_xfree( pszComment ); } } @@ -411,7 +411,7 @@ HB_FUNC( HB_UNZIPGLOBALINFO ) /* HB_UnzipFileFirst( hUnzip ) --> nError */ HB_FUNC( HB_UNZIPFILEFIRST ) { - unzFile hUnzip = hb_unzipfileParam( 1 ); + unzFile hUnzip = hb_unzipfileParam( 1 ); if( hUnzip ) hb_retni( unzGoToFirstFile( hUnzip ) ); @@ -421,7 +421,7 @@ HB_FUNC( HB_UNZIPFILEFIRST ) /* HB_UnzipFileNext( hUnzip ) --> nError */ HB_FUNC( HB_UNZIPFILENEXT ) { - unzFile hUnzip = hb_unzipfileParam( 1 ); + unzFile hUnzip = hb_unzipfileParam( 1 ); if( hUnzip ) hb_retni( unzGoToNextFile( hUnzip ) ); @@ -458,11 +458,11 @@ HB_FUNC( HB_UNZIPFILEINFO ) if( hUnzip ) { - char szFileName[ HB_PATH_MAX ]; - unz_file_info ufi; - int iResult; - char buf[ 16 ]; - long lJulian, lMillisec; + char szFileName[ HB_PATH_MAX ]; + unz_file_info ufi; + int iResult; + char buf[ 16 ]; + long lJulian, lMillisec; iResult = unzGetCurrentFileInfo( hUnzip, &ufi, szFileName, HB_PATH_MAX - 1, NULL, 0, NULL, 0 ); @@ -473,8 +473,8 @@ HB_FUNC( HB_UNZIPFILEINFO ) szFileName[ HB_PATH_MAX - 1 ] = '\0'; hb_storc( szFileName, 2 ); - lJulian = hb_dateEncode( ufi.tmu_date.tm_year, ufi.tmu_date.tm_mon + 1, - ufi.tmu_date.tm_mday ); + lJulian = hb_dateEncode( ufi.tmu_date.tm_year, ufi.tmu_date.tm_mon + 1, + ufi.tmu_date.tm_mday ); lMillisec = hb_timeEncode( ufi.tmu_date.tm_hour, ufi.tmu_date.tm_min, ufi.tmu_date.tm_sec, 0 ); @@ -506,7 +506,7 @@ HB_FUNC( HB_UNZIPFILEINFO ) hb_xfree( pszComment ); hb_storc( NULL, 11 ); } - else if( !hb_storclen_buffer( pszComment, ufi.size_file_comment, 11 ) ) + else if( ! hb_storclen_buffer( pszComment, ufi.size_file_comment, 11 ) ) hb_xfree( pszComment ); } } @@ -530,7 +530,7 @@ HB_FUNC( HB_UNZIPFILEINFO ) /* HB_UnzipFileOpen( hUnzip, [ cPassword ] ) --> nError */ HB_FUNC( HB_UNZIPFILEOPEN ) { - unzFile hUnzip = hb_unzipfileParam( 1 ); + unzFile hUnzip = hb_unzipfileParam( 1 ); if( hUnzip ) hb_retni( unzOpenCurrentFilePassword( hUnzip, hb_parc( 2 ) ) ); @@ -540,9 +540,9 @@ HB_FUNC( HB_UNZIPFILEOPEN ) /* HB_UnzipFileRead( hUnzip, @cBuf [, nLen ] ) --> nRead */ HB_FUNC( HB_UNZIPFILEREAD ) { - PHB_ITEM pBuffer = hb_param( 2, HB_IT_STRING ); - char * buffer; - HB_SIZE nSize; + PHB_ITEM pBuffer = hb_param( 2, HB_IT_STRING ); + char * buffer; + HB_SIZE nSize; if( pBuffer && HB_ISBYREF( 2 ) && hb_itemGetWriteCL( pBuffer, &buffer, &nSize ) ) @@ -585,12 +585,12 @@ HB_FUNC( HB_UNZIPFILECLOSE ) static HB_BOOL hb_zipGetFileInfoFromHandle( HB_FHANDLE hFile, HB_U32 * pulCRC, HB_BOOL * pfText ) { HB_BOOL fText = pfText != NULL, fResult = HB_FALSE; - HB_U32 ulCRC = 0; + HB_U32 ulCRC = 0; if( hFile != FS_ERROR ) { unsigned char * pString = ( unsigned char * ) hb_xgrab( HB_Z_IOBUF_SIZE ); - HB_SIZE nRead, u; + HB_SIZE nRead, u; do { @@ -635,9 +635,9 @@ static HB_BOOL hb_zipGetFileInfoFromHandle( HB_FHANDLE hFile, HB_U32 * pulCRC, H static HB_BOOL hb_zipGetFileInfo( const char * szFileName, HB_U32 * pulCRC, HB_BOOL * pfText ) { HB_FHANDLE hFile; - HB_BOOL fResult; + HB_BOOL fResult; - hFile = hb_fsOpen( szFileName, FO_READ ); + hFile = hb_fsOpen( szFileName, FO_READ ); fResult = hb_zipGetFileInfoFromHandle( hFile, pulCRC, pfText ); if( hFile != FS_ERROR ) hb_fsClose( hFile ); @@ -654,7 +654,7 @@ HB_FUNC( HB_ZIPFILECRC32 ) if( szFileName ) { HB_U32 ulCRC = 0; - if( !hb_zipGetFileInfo( szFileName, &ulCRC, NULL ) ) + if( ! hb_zipGetFileInfo( szFileName, &ulCRC, NULL ) ) ulCRC = 0; hb_retnint( ulCRC ); } @@ -664,22 +664,22 @@ HB_FUNC( HB_ZIPFILECRC32 ) static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * szName, const char * szPassword, const char * szComment ) { - char * szZipName, * pString; - HB_FHANDLE hFile; - HB_SIZE nLen; - HB_FATTR ulExtAttr; - zip_fileinfo zfi; - int iResult; - HB_BOOL fError; - HB_BOOL fText; - HB_U32 ulCRC; + char * szZipName, * pString; + HB_FHANDLE hFile; + HB_SIZE nLen; + HB_FATTR ulExtAttr; + zip_fileinfo zfi; + int iResult; + HB_BOOL fError; + HB_BOOL fText; + HB_U32 ulCRC; if( szName ) { /* change path separators to '/' */ szZipName = hb_strdup( szName ); - nLen = strlen( szZipName ); + nLen = strlen( szZipName ); pString = szZipName; while( nLen-- ) { @@ -692,7 +692,7 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * /* get file name */ szZipName = hb_strdup( szFileName ); - nLen = strlen( szZipName ); + nLen = strlen( szZipName ); pString = szZipName; while( nLen-- ) @@ -706,21 +706,21 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * } memset( &zfi, 0, sizeof( zfi ) ); - fError = HB_FALSE; + fError = HB_FALSE; ulExtAttr = 0; #if defined( HB_OS_WIN ) { - LPTSTR lpFileNameFree; + LPTSTR lpFileNameFree; LPCTSTR lpFileName = HB_FSNAMECONV( szFileName, &lpFileNameFree ); - DWORD attr = GetFileAttributes( lpFileName ); + DWORD attr = GetFileAttributes( lpFileName ); if( attr != INVALID_FILE_ATTRIBUTES ) { ulExtAttr = hb_translateExtAttr( szFileName, attr & - ( FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | - FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY | - FILE_ATTRIBUTE_ARCHIVE ) ); + ( FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | + FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY | + FILE_ATTRIBUTE_ARCHIVE ) ); } else fError = HB_TRUE; @@ -732,7 +732,7 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * { struct stat statbuf; struct tm st; - char * pszFree; + char * pszFree; if( stat( hb_fsNameConv( szFileName, &pszFree ), &statbuf ) == 0 ) { @@ -763,11 +763,11 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * st = *localtime( &statbuf.st_mtime ); # endif - zfi.tmz_date.tm_sec = st.tm_sec; - zfi.tmz_date.tm_min = st.tm_min; + zfi.tmz_date.tm_sec = st.tm_sec; + zfi.tmz_date.tm_min = st.tm_min; zfi.tmz_date.tm_hour = st.tm_hour; zfi.tmz_date.tm_mday = st.tm_mday; - zfi.tmz_date.tm_mon = st.tm_mon; + zfi.tmz_date.tm_mon = st.tm_mon; zfi.tmz_date.tm_year = st.tm_year; } else @@ -779,7 +779,7 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * #elif defined( HB_OS_DOS ) { # if defined( __DJGPP__ ) || defined( __RSX32__ ) || defined( __GNUC__ ) - int attr; + int attr; char * pszFree; attr = _chmod( hb_fsNameConv( szFileName, &pszFree ), 0, 0 ); @@ -805,9 +805,9 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * #elif defined( HB_OS_OS2 ) { FILESTATUS3 fs3; - APIRET ulrc; - HB_FATTR ulAttr; - char * pszFree; + APIRET ulrc; + HB_FATTR ulAttr; + char * pszFree; ulrc = DosQueryPathInfo( ( PCSZ ) hb_fsNameConv( szFileName, &pszFree ), FIL_STANDARD, &fs3, sizeof( fs3 ) ); @@ -830,11 +830,11 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * ulExtAttr = hb_translateExtAttr( szFileName, ulAttr ); - zfi.tmz_date.tm_sec = fs3.ftimeLastWrite.twosecs * 2; - zfi.tmz_date.tm_min = fs3.ftimeLastWrite.minutes; + zfi.tmz_date.tm_sec = fs3.ftimeLastWrite.twosecs * 2; + zfi.tmz_date.tm_min = fs3.ftimeLastWrite.minutes; zfi.tmz_date.tm_hour = fs3.ftimeLastWrite.hours; zfi.tmz_date.tm_mday = fs3.fdateLastWrite.day; - zfi.tmz_date.tm_mon = fs3.fdateLastWrite.month; + zfi.tmz_date.tm_mon = fs3.fdateLastWrite.month; zfi.tmz_date.tm_year = fs3.fdateLastWrite.year + 1980; } else @@ -844,12 +844,12 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * { HB_FATTR attr; - if( !hb_fsGetAttr( szFileName, &attr ) ) + if( ! hb_fsGetAttr( szFileName, &attr ) ) ulExtAttr = 0x81B60020; /* FILE_ATTRIBUTE_ARCHIVE | rw-rw-rw- */ else { ulExtAttr = attr & ( HB_FA_READONLY | HB_FA_HIDDEN | HB_FA_SYSTEM | - HB_FA_DIRECTORY | HB_FA_ARCHIVE ); + HB_FA_DIRECTORY | HB_FA_ARCHIVE ); ulExtAttr = hb_translateExtAttr( szFileName, ulExtAttr ); } @@ -887,18 +887,18 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * { #if defined( HB_OS_WIN ) { - FILETIME ftutc, ft; - SYSTEMTIME st; + FILETIME ftutc, ft; + SYSTEMTIME st; if( GetFileTime( ( HANDLE ) hb_fsGetOsHandle( hFile ), NULL, NULL, &ftutc ) && FileTimeToLocalFileTime( &ftutc, &ft ) && FileTimeToSystemTime( &ft, &st ) ) { - zfi.tmz_date.tm_sec = st.wSecond; - zfi.tmz_date.tm_min = st.wMinute; + zfi.tmz_date.tm_sec = st.wSecond; + zfi.tmz_date.tm_min = st.wMinute; zfi.tmz_date.tm_hour = st.wHour; zfi.tmz_date.tm_mday = st.wDay; - zfi.tmz_date.tm_mon = st.wMonth - 1; + zfi.tmz_date.tm_mon = st.wMonth - 1; zfi.tmz_date.tm_year = st.wYear; } } @@ -952,12 +952,12 @@ HB_FUNC( HB_ZIPSTOREFILE ) static int hb_zipStoreFileHandle( zipFile hZip, HB_FHANDLE hFile, const char * szName, const char * szPassword, const char * szComment ) { - char * szZipName; - HB_SIZE nLen; - zip_fileinfo zfi; - int iResult; - HB_BOOL fText; - HB_U32 ulCRC; + char * szZipName; + HB_SIZE nLen; + zip_fileinfo zfi; + int iResult; + HB_BOOL fText; + HB_U32 ulCRC; if( hFile == FS_ERROR || szName == NULL ) return -200; @@ -974,12 +974,12 @@ static int hb_zipStoreFileHandle( zipFile hZip, HB_FHANDLE hFile, const char * s memset( &zfi, 0, sizeof( zfi ) ); - zfi.external_fa = 0x81B60020; - zfi.tmz_date.tm_sec = 0; - zfi.tmz_date.tm_min = 0; + zfi.external_fa = 0x81B60020; + zfi.tmz_date.tm_sec = 0; + zfi.tmz_date.tm_min = 0; zfi.tmz_date.tm_hour = 0; zfi.tmz_date.tm_mday = 1; - zfi.tmz_date.tm_mon = 0; + zfi.tmz_date.tm_mon = 0; zfi.tmz_date.tm_year = 0; ulCRC = 0; @@ -1030,12 +1030,12 @@ HB_FUNC( HB_ZIPSTOREFILEHANDLE ) static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, const char * szPassword ) { - char szName[ HB_PATH_MAX ]; - HB_SIZE nPos, nLen; - char cSep, * pString; - unz_file_info ufi; - int iResult; - HB_FHANDLE hFile; + char szName[ HB_PATH_MAX ]; + HB_SIZE nPos, nLen; + char cSep, * pString; + unz_file_info ufi; + int iResult; + HB_FHANDLE hFile; iResult = unzGetCurrentFileInfo( hUnzip, &ufi, szName, HB_PATH_MAX - 1, NULL, 0, NULL, 0 ); @@ -1090,15 +1090,15 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, #if defined( HB_OS_WIN ) { - FILETIME ftutc, ft; - SYSTEMTIME st; + FILETIME ftutc, ft; + SYSTEMTIME st; - st.wSecond = ( WORD ) ufi.tmu_date.tm_sec; - st.wMinute = ( WORD ) ufi.tmu_date.tm_min; - st.wHour = ( WORD ) ufi.tmu_date.tm_hour; - st.wDay = ( WORD ) ufi.tmu_date.tm_mday; - st.wMonth = ( WORD ) ufi.tmu_date.tm_mon + 1; - st.wYear = ( WORD ) ufi.tmu_date.tm_year; + st.wSecond = ( WORD ) ufi.tmu_date.tm_sec; + st.wMinute = ( WORD ) ufi.tmu_date.tm_min; + st.wHour = ( WORD ) ufi.tmu_date.tm_hour; + st.wDay = ( WORD ) ufi.tmu_date.tm_mday; + st.wMonth = ( WORD ) ufi.tmu_date.tm_mon + 1; + st.wYear = ( WORD ) ufi.tmu_date.tm_year; st.wMilliseconds = 0; if( SystemTimeToFileTime( &st, &ft ) && @@ -1118,7 +1118,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, #if defined( HB_OS_WIN ) { - LPTSTR lpFileNameFree; + LPTSTR lpFileNameFree; LPCTSTR lpFileName = HB_FSNAMECONV( szName, &lpFileNameFree ); SetFileAttributes( ( LPCTSTR ) lpFileName, ufi.external_fa & 0xFF ); @@ -1128,11 +1128,11 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, } #elif defined( HB_OS_UNIX ) || defined( __DJGPP__ ) { - struct utimbuf utim; - struct tm st; - time_t tim; + struct utimbuf utim; + struct tm st; + time_t tim; - char * pszFree; + char * pszFree; const char * szNameOS = hb_fsNameConv( szName, &pszFree ); # if defined( __DJGPP__ ) @@ -1143,23 +1143,24 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, if( ( ulAttr & 0xFFFF0000 ) == 0 ) ulAttr = hb_translateExtAttr( szName, ulAttr ); - chmod( szNameOS, ( ( ulAttr & 0x00010000 ) ? S_IXOTH : 0 ) | - ( ( ulAttr & 0x00020000 ) ? S_IWOTH : 0 ) | - ( ( ulAttr & 0x00040000 ) ? S_IROTH : 0 ) | - ( ( ulAttr & 0x00080000 ) ? S_IXGRP : 0 ) | - ( ( ulAttr & 0x00100000 ) ? S_IWGRP : 0 ) | - ( ( ulAttr & 0x00200000 ) ? S_IRGRP : 0 ) | - ( ( ulAttr & 0x00400000 ) ? S_IXUSR : 0 ) | - ( ( ulAttr & 0x00800000 ) ? S_IWUSR : 0 ) | - ( ( ulAttr & 0x01000000 ) ? S_IRUSR : 0 ) ); + chmod( szNameOS, + ( ( ulAttr & 0x00010000 ) ? S_IXOTH : 0 ) | + ( ( ulAttr & 0x00020000 ) ? S_IWOTH : 0 ) | + ( ( ulAttr & 0x00040000 ) ? S_IROTH : 0 ) | + ( ( ulAttr & 0x00080000 ) ? S_IXGRP : 0 ) | + ( ( ulAttr & 0x00100000 ) ? S_IWGRP : 0 ) | + ( ( ulAttr & 0x00200000 ) ? S_IRGRP : 0 ) | + ( ( ulAttr & 0x00400000 ) ? S_IXUSR : 0 ) | + ( ( ulAttr & 0x00800000 ) ? S_IWUSR : 0 ) | + ( ( ulAttr & 0x01000000 ) ? S_IRUSR : 0 ) ); # endif memset( &st, 0, sizeof( st ) ); - st.tm_sec = ufi.tmu_date.tm_sec; - st.tm_min = ufi.tmu_date.tm_min; + st.tm_sec = ufi.tmu_date.tm_sec; + st.tm_min = ufi.tmu_date.tm_min; st.tm_hour = ufi.tmu_date.tm_hour; st.tm_mday = ufi.tmu_date.tm_mday; - st.tm_mon = ufi.tmu_date.tm_mon; + st.tm_mon = ufi.tmu_date.tm_mon; st.tm_year = ufi.tmu_date.tm_year - 1900; tim = mktime( &st ); @@ -1192,11 +1193,11 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, #elif defined( HB_OS_OS2 ) { FILESTATUS3 fs3; - APIRET ulrc; - HB_FATTR ulAttr = FILE_NORMAL; - int iAttr = ufi.external_fa & 0xFF; + APIRET ulrc; + HB_FATTR ulAttr = FILE_NORMAL; + int iAttr = ufi.external_fa & 0xFF; - char * pszFree; + char * pszFree; const char * szNameOS = hb_fsNameConv( szName, &pszFree ); if( iAttr & HB_FA_READONLY ) @@ -1215,10 +1216,10 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, FDATE fdate; FTIME ftime; - fdate.year = ufi.tmu_date.tm_year - 1980; - fdate.month = ufi.tmu_date.tm_mon; - fdate.day = ufi.tmu_date.tm_mday; - ftime.hours = ufi.tmu_date.tm_hour; + fdate.year = ufi.tmu_date.tm_year - 1980; + fdate.month = ufi.tmu_date.tm_mon; + fdate.day = ufi.tmu_date.tm_mday; + ftime.hours = ufi.tmu_date.tm_hour; ftime.minutes = ufi.tmu_date.tm_min; ftime.twosecs = ufi.tmu_date.tm_sec / 2; @@ -1256,8 +1257,8 @@ HB_FUNC( HB_UNZIPEXTRACTCURRENTFILE ) static int hb_unzipExtractCurrentFileToHandle( unzFile hUnzip, HB_FHANDLE hFile, const char * szPassword ) { - unz_file_info ufi; - int iResult; + unz_file_info ufi; + int iResult; if( hFile == FS_ERROR ) return -200; @@ -1272,7 +1273,7 @@ static int hb_unzipExtractCurrentFileToHandle( unzFile hUnzip, HB_FHANDLE hFile, if( iResult != UNZ_OK ) return iResult; - if( !( ufi.external_fa & 0x40000000 ) ) /* DIRECTORY */ + if( ! ( ufi.external_fa & 0x40000000 ) ) /* DIRECTORY */ { if( hFile != FS_ERROR ) { @@ -1285,15 +1286,15 @@ static int hb_unzipExtractCurrentFileToHandle( unzFile hUnzip, HB_FHANDLE hFile, #if defined( HB_OS_WIN ) { - FILETIME ftutc, ft; - SYSTEMTIME st; + FILETIME ftutc, ft; + SYSTEMTIME st; - st.wSecond = ( WORD ) ufi.tmu_date.tm_sec; - st.wMinute = ( WORD ) ufi.tmu_date.tm_min; - st.wHour = ( WORD ) ufi.tmu_date.tm_hour; - st.wDay = ( WORD ) ufi.tmu_date.tm_mday; - st.wMonth = ( WORD ) ufi.tmu_date.tm_mon + 1; - st.wYear = ( WORD ) ufi.tmu_date.tm_year; + st.wSecond = ( WORD ) ufi.tmu_date.tm_sec; + st.wMinute = ( WORD ) ufi.tmu_date.tm_min; + st.wHour = ( WORD ) ufi.tmu_date.tm_hour; + st.wDay = ( WORD ) ufi.tmu_date.tm_mday; + st.wMonth = ( WORD ) ufi.tmu_date.tm_mon + 1; + st.wYear = ( WORD ) ufi.tmu_date.tm_year; st.wMilliseconds = 0; if( SystemTimeToFileTime( &st, &ft ) && @@ -1325,25 +1326,25 @@ HB_FUNC( HB_UNZIPEXTRACTCURRENTFILETOHANDLE ) static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask ) { - char szTempFile[ HB_PATH_MAX ]; - char szCurrFile[ HB_PATH_MAX ]; - PHB_FNAME pFileName; - HB_FHANDLE hFile; - unzFile hUnzip; - zipFile hZip; + char szTempFile[ HB_PATH_MAX ]; + char szCurrFile[ HB_PATH_MAX ]; + PHB_FNAME pFileName; + HB_FHANDLE hFile; + unzFile hUnzip; + zipFile hZip; unz_global_info ugi; - unz_file_info ufi; - zip_fileinfo zfi; - char * pszGlobalComment = NULL; - char * pszFileComment = NULL; - void * pExtraField = NULL; - void * pLocalExtraField = NULL; - int iFilesLeft = 0; - int iFilesDel = 0; - int iExtraFieldLen; - int method; - int level; - int iResult; + unz_file_info ufi; + zip_fileinfo zfi; + char * pszGlobalComment = NULL; + char * pszFileComment = NULL; + void * pExtraField = NULL; + void * pLocalExtraField = NULL; + int iFilesLeft = 0; + int iFilesDel = 0; + int iExtraFieldLen; + int method; + int level; + int iResult; char * pszFree; /* open source file */ @@ -1356,8 +1357,8 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask ) return UNZ_ERRNO; pFileName = hb_fsFNameSplit( szZipFile ); - hFile = hb_fsCreateTemp( pFileName->szPath, NULL, FC_NORMAL, szTempFile ); - hZip = NULL; + hFile = hb_fsCreateTemp( pFileName->szPath, NULL, FC_NORMAL, szTempFile ); + hZip = NULL; if( hFile != FS_ERROR ) { hb_fsClose( hFile ); @@ -1378,7 +1379,7 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask ) { pszGlobalComment = ( char * ) hb_xgrab( ugi.size_comment + 1 ); if( ( uLong ) unzGetGlobalComment( hUnzip, pszGlobalComment, - ugi.size_comment ) != ugi.size_comment ) + ugi.size_comment ) != ugi.size_comment ) iResult = UNZ_ERRNO; pszGlobalComment[ ugi.size_comment ] = '\0'; } @@ -1431,7 +1432,7 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask ) memset( &zfi, 0, sizeof( zfi ) ); memcpy( &zfi.tmz_date, &ufi.tmu_date, sizeof( tm_unz ) ); - zfi.dosDate = ufi.dosDate; + zfi.dosDate = ufi.dosDate; zfi.internal_fa = ufi.internal_fa; zfi.external_fa = ufi.external_fa; @@ -1442,7 +1443,7 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask ) if( ufi.compressed_size ) { void * buffer = hb_xgrab( HB_Z_IOBUF_SIZE ); - uLong ulLeft = ufi.compressed_size; + uLong ulLeft = ufi.compressed_size; while( ulLeft > 0 ) { @@ -1521,7 +1522,7 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask ) if( iFilesLeft == 0 ) hb_fsDelete( szTempFile ); - else if( !hb_fsRename( szTempFile, szZipFile ) ) + else if( ! hb_fsRename( szTempFile, szZipFile ) ) iResult = UNZ_ERRNO; } diff --git a/harbour/contrib/hbsqlit3/core.c b/harbour/contrib/hbsqlit3/core.c index 34a80c2578..4a41562cf8 100644 --- a/harbour/contrib/hbsqlit3/core.c +++ b/harbour/contrib/hbsqlit3/core.c @@ -63,15 +63,15 @@ /* TOFIX: verify the exact SQLITE3 version */ #if SQLITE_VERSION_NUMBER <= 3004001 -#define sqlite3_int64 HB_LONGLONG -#define sqlite3_uint64 HB_ULONGLONG +#define sqlite3_int64 HB_LONGLONG +#define sqlite3_uint64 HB_ULONGLONG #endif -#define HB_SQLITE3_DB 6000001 +#define HB_SQLITE3_DB 6000001 -#define HB_ERR_MEMSTRU_NOT_MEM_BLOCK 4001 -#define HB_ERR_MEMSTRU_WRONG_MEMSTRU_BLOCK 4002 -#define HB_ERR_MEMSTRU_DESTROYED 4003 +#define HB_ERR_MEMSTRU_NOT_MEM_BLOCK 4001 +#define HB_ERR_MEMSTRU_WRONG_MEMSTRU_BLOCK 4002 +#define HB_ERR_MEMSTRU_DESTROYED 4003 #ifdef SQLITE3_DYNLIB extern char * sqlite3_temp_directory; @@ -93,12 +93,12 @@ static void func( sqlite3_context *, int, sqlite3_value ** ); typedef struct { sqlite3 * db; - PHB_ITEM cbAuthorizer; - PHB_ITEM cbBusyHandler; - PHB_ITEM cbProgressHandler; - PHB_ITEM cbHookCommit; - PHB_ITEM cbHookRollback; - PHB_ITEM cbFunc; + PHB_ITEM cbAuthorizer; + PHB_ITEM cbBusyHandler; + PHB_ITEM cbProgressHandler; + PHB_ITEM cbHookCommit; + PHB_ITEM cbHookRollback; + PHB_ITEM cbFunc; } HB_SQLITE3, * PHB_SQLITE3; typedef struct @@ -214,16 +214,16 @@ static PHB_ITEM hb_sqlite3_itemPut( PHB_ITEM pItem, void * pMemAddr, int iType ) pStructHolder = ( PHB_SQLITE3_HOLDER ) hb_gcAllocate( sizeof( HB_SQLITE3_HOLDER ), &s_gcSqlite3Funcs ); pStructHolder->hbsqlite3 = ( HB_SQLITE3 * ) pMemAddr; - pStructHolder->type = iType; + pStructHolder->type = iType; return hb_itemPutPtrGC( pItem, pStructHolder ); } static void * hb_sqlite3_itemGet( PHB_ITEM pItem, int iType, HB_BOOL fError ) { - PHB_SQLITE3_HOLDER pStructHolder = ( PHB_SQLITE3_HOLDER ) hb_itemGetPtrGC( pItem, - &s_gcSqlite3Funcs ); - int iError = 0; + PHB_SQLITE3_HOLDER pStructHolder = ( PHB_SQLITE3_HOLDER ) hb_itemGetPtrGC( pItem, + &s_gcSqlite3Funcs ); + int iError = 0; HB_SYMBOL_UNUSED( iError ); @@ -266,7 +266,7 @@ static int callback( void * Cargo, int argc, char ** argv, char ** azColName ) if( pCallback && hb_vmRequestReenter() ) { - PHB_ITEM pArrayValue = hb_itemArrayNew( argc ); + PHB_ITEM pArrayValue = hb_itemArrayNew( argc ); PHB_ITEM pArrayColName = hb_itemArrayNew( argc ); int iRes, i; @@ -434,35 +434,35 @@ static void func( sqlite3_context * ctx, int argc, sqlite3_value ** argv ) { switch( sqlite3_value_type( argv[ i ] ) ) { - case SQLITE_NULL: - hb_vmPushNil(); - break; + case SQLITE_NULL: + hb_vmPushNil(); + break; - case SQLITE_TEXT: - hb_itemPutStrUTF8( hb_stackAllocItem(), - ( const char * ) sqlite3_value_text( argv[ i ] ) ); - break; + case SQLITE_TEXT: + hb_itemPutStrUTF8( hb_stackAllocItem(), + ( const char * ) sqlite3_value_text( argv[ i ] ) ); + break; - case SQLITE_FLOAT: - hb_vmPushDouble( sqlite3_value_double( argv[ i ] ), HB_DEFAULT_DECIMALS ); - break; + case SQLITE_FLOAT: + hb_vmPushDouble( sqlite3_value_double( argv[ i ] ), HB_DEFAULT_DECIMALS ); + break; - case SQLITE_INTEGER: + case SQLITE_INTEGER: #if HB_VMLONG_MAX == INT32_MAX || defined( HB_LONG_LONG_OFF ) - hb_vmPushInteger( sqlite3_value_int( argv[ i ] ) ); + hb_vmPushInteger( sqlite3_value_int( argv[ i ] ) ); #else - hb_vmPushNumInt( sqlite3_value_int64( argv[ i ] ) ); + hb_vmPushNumInt( sqlite3_value_int64( argv[ i ] ) ); #endif - break; + break; - case SQLITE_BLOB: - hb_vmPushString( ( const char * ) sqlite3_value_blob( argv[ i ] ), - sqlite3_value_bytes( argv[ i ] ) ); - break; + case SQLITE_BLOB: + hb_vmPushString( ( const char * ) sqlite3_value_blob( argv[ i ] ), + sqlite3_value_bytes( argv[ i ] ) ); + break; - default: - hb_itemPutCConst( hb_stackAllocItem(), ":default:" ); - break; + default: + hb_itemPutCConst( hb_stackAllocItem(), ":default:" ); + break; } } } @@ -472,38 +472,38 @@ static void func( sqlite3_context * ctx, int argc, sqlite3_value ** argv ) switch( hb_itemType( pResult ) ) { - case HB_IT_NIL: - sqlite3_result_null( ctx ); - break; + case HB_IT_NIL: + sqlite3_result_null( ctx ); + break; - case HB_IT_INTEGER: - case HB_IT_LONG: + case HB_IT_INTEGER: + case HB_IT_LONG: #if HB_VMLONG_MAX == INT32_MAX || defined( HB_LONG_LONG_OFF ) - sqlite3_result_int( ctx, hb_itemGetNI( pResult ) ); + sqlite3_result_int( ctx, hb_itemGetNI( pResult ) ); #else - sqlite3_result_int64( ctx, hb_itemGetNInt( pResult ) ); + sqlite3_result_int64( ctx, hb_itemGetNInt( pResult ) ); #endif - break; + break; - case HB_IT_DOUBLE: - sqlite3_result_double( ctx, hb_itemGetND( pResult ) ); - break; + case HB_IT_DOUBLE: + sqlite3_result_double( ctx, hb_itemGetND( pResult ) ); + break; - case HB_IT_STRING: - { - void * hText; - HB_SIZE nText; - const char * pszText = hb_itemGetStrUTF8( pResult, &hText, &nText ); + case HB_IT_STRING: + { + void * hText; + HB_SIZE nText; + const char * pszText = hb_itemGetStrUTF8( pResult, &hText, &nText ); - sqlite3_result_text( ctx, pszText, ( int ) nText, SQLITE_TRANSIENT ); + sqlite3_result_text( ctx, pszText, ( int ) nText, SQLITE_TRANSIENT ); - hb_strfree( hText ); - break; - } + hb_strfree( hText ); + break; + } - default: - sqlite3_result_error_code( ctx, -1 ); - break; + default: + sqlite3_result_error_code( ctx, -1 ); + break; } hb_vmRequestRestore(); @@ -663,8 +663,8 @@ HB_FUNC( SQLITE3_TEMP_DIRECTORY ) #ifdef SQLITE3_DYNLIB { - char * pszFree; - const char * pszDirName = hb_fsNameConv( hb_parcx( 1 ), &pszFree ); + char * pszFree; + const char * pszDirName = hb_fsNameConv( hb_parcx( 1 ), &pszFree ); if( hb_fsIsDirectory( pszDirName ) ) { @@ -709,9 +709,9 @@ HB_FUNC( SQLITE3_TEMP_DIRECTORY ) HB_FUNC( SQLITE3_OPEN ) { - sqlite3 * db; - char * pszFree; - const char * pszdbName = hb_fsNameConv( hb_parcx( 1 ), &pszFree ); + sqlite3 * db; + char * pszFree; + const char * pszdbName = hb_fsNameConv( hb_parcx( 1 ), &pszFree ); if( hb_fsFileExists( pszdbName ) || hb_parl( 2 ) ) { @@ -745,9 +745,9 @@ HB_FUNC( SQLITE3_OPEN ) HB_FUNC( SQLITE3_OPEN_V2 ) { #if SQLITE_VERSION_NUMBER >= 3005000 - sqlite3 * db; - char * pszFree; - const char * pszdbName = hb_fsNameConv( hb_parcx( 1 ), &pszFree ); + sqlite3 * db; + char * pszFree; + const char * pszdbName = hb_fsNameConv( hb_parcx( 1 ), &pszFree ); if( sqlite3_open_v2( pszdbName, &db, hb_parni( 2 ), NULL ) == SQLITE_OK ) { @@ -784,9 +784,9 @@ HB_FUNC( SQLITE3_EXEC ) if( pHbSqlite3 && pHbSqlite3->db ) { - void * hSQLText; - char * pszErrMsg = NULL; - int rc; + void * hSQLText; + char * pszErrMsg = NULL; + int rc; if( HB_ISBLOCK( 3 ) || HB_ISSYMBOL( 3 ) ) { @@ -833,10 +833,10 @@ HB_FUNC( SQLITE3_PREPARE ) if( SQL ) { - const char * pSQL = hb_itemGetCPtr( SQL ); - int ulLen = ( int ) hb_itemGetCLen( SQL ); - psqlite3_stmt pStmt; - const char * pszTail; + const char * pSQL = hb_itemGetCPtr( SQL ); + int ulLen = ( int ) hb_itemGetCLen( SQL ); + psqlite3_stmt pStmt; + const char * pszTail; if( sqlite3_prepare_v2( pHbSqlite3->db, pSQL, ulLen, &pStmt, &pszTail ) == SQLITE_OK ) { @@ -939,19 +939,19 @@ HB_FUNC( SQLITE3_STMT_READONLY ) sqlite3_db_handle( pStmt ) -> pHbSqlite3 */ -/* +#if 0 HB_FUNC( SQLITE3_DB_HANDLE ) { - psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 ); + psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 ); if( pStmt ) { ; } else - hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError(1) ); + hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) ); } - */ +#endif /** Evaluate An Prepared SQL Statement @@ -1076,8 +1076,8 @@ HB_FUNC( SQLITE3_BIND_INT ) HB_FUNC( SQLITE3_BIND_INT64 ) { - psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 ); - sqlite3_int64 int64 = hb_parnint( 3 ); + psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 ); + sqlite3_int64 int64 = hb_parnint( 3 ); if( pStmt ) hb_retni( sqlite3_bind_int64( pStmt, hb_parni( 2 ), int64 ) ); @@ -1101,10 +1101,10 @@ HB_FUNC( SQLITE3_BIND_TEXT ) if( pStmt ) { - void * hSQLText; - HB_SIZE nSQLText; + void * hSQLText; + HB_SIZE nSQLText; - const char * pszSQLText = hb_parstr_utf8( 3, &hSQLText, &nSQLText ); + const char * pszSQLText = hb_parstr_utf8( 3, &hSQLText, &nSQLText ); hb_retni( sqlite3_bind_text( pStmt, hb_parni( 2 ), pszSQLText, ( int ) nSQLText, SQLITE_TRANSIENT ) ); @@ -1484,15 +1484,15 @@ HB_FUNC( SQLITE3_TABLE_COLUMN_METADATA ) if( pHbSqlite3 && pHbSqlite3->db ) { - char const * pzDataType = NULL; - char const * pzCollSeq = NULL; - int iNotNull = 0; - int iPrimaryKey = 0; - int iAutoinc = 0; + char const * pzDataType = NULL; + char const * pzCollSeq = NULL; + int iNotNull = 0; + int iPrimaryKey = 0; + int iAutoinc = 0; - void * hDbName; - void * hTableName; - void * hColumnName; + void * hDbName; + void * hTableName; + void * hColumnName; if ( @@ -1603,9 +1603,9 @@ HB_FUNC( SQLITE3_BLOB_OPEN ) { sqlite3_blob * ppBlob = NULL; - void * hDbName; - void * hTableName; - void * hColumnName; + void * hDbName; + void * hTableName; + void * hColumnName; if ( @@ -1690,8 +1690,8 @@ HB_FUNC( SQLITE3_BLOB_READ ) if( pBlob ) { - int iLen = hb_parni( 2 ); - char * buffer; + int iLen = hb_parni( 2 ); + char * buffer; if( iLen == 0 ) iLen = sqlite3_blob_bytes( pBlob ); @@ -1827,13 +1827,13 @@ HB_FUNC( SQLITE3_FILE_TO_BUFF ) if( handle != FS_ERROR ) { - char * buffer; - HB_SIZE nSize; + char * buffer; + HB_SIZE nSize; nSize = hb_fsSeek( handle, 0, FS_END ); hb_fsSeek( handle, 0, FS_SET ); buffer = ( char * ) hb_xgrab( nSize + 1 ); - nSize = hb_fsReadLarge( handle, buffer, nSize ); + nSize = hb_fsReadLarge( handle, buffer, nSize ); buffer[ nSize ] = '\0'; hb_fsClose( handle ); @@ -1845,8 +1845,8 @@ HB_FUNC( SQLITE3_FILE_TO_BUFF ) HB_FUNC( SQLITE3_BUFF_TO_FILE ) { - HB_FHANDLE handle = hb_fsCreate( hb_parcx( 1 ), FC_NORMAL ); - HB_SIZE nSize = hb_parcsiz( 2 ) - 1; + HB_FHANDLE handle = hb_fsCreate( hb_parcx( 1 ), FC_NORMAL ); + HB_SIZE nSize = hb_parcsiz( 2 ) - 1; if( handle != FS_ERROR && nSize > 0 ) { @@ -2040,10 +2040,10 @@ HB_FUNC( SQLITE3_SET_AUTHORIZER ) HB_FUNC( SQLITE3_BACKUP_INIT ) { #if SQLITE_VERSION_NUMBER >= 3006011 - HB_SQLITE3 * pHbSqlite3Dest = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE ); - HB_SQLITE3 * pHbSqlite3Source = ( HB_SQLITE3 * ) hb_sqlite3_param( 3, HB_SQLITE3_DB, - HB_TRUE ); - sqlite3_backup * pBackup; + HB_SQLITE3 * pHbSqlite3Dest = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE ); + HB_SQLITE3 * pHbSqlite3Source = ( HB_SQLITE3 * ) hb_sqlite3_param( 3, HB_SQLITE3_DB, + HB_TRUE ); + sqlite3_backup * pBackup; if( pHbSqlite3Dest && pHbSqlite3Dest->db && pHbSqlite3Source && pHbSqlite3Source->db && HB_ISCHAR( 2 ) && HB_ISCHAR( 4 ) ) @@ -2052,13 +2052,13 @@ HB_FUNC( SQLITE3_BACKUP_INIT ) 2 ), pHbSqlite3Source->db, hb_parcx( 4 ) ); if( pBackup ) - hb_retptr( pBackup ); /* TOFIX: Create GC collected pointer */ + hb_retptr( pBackup ); /* TOFIX: Create GC collected pointer */ else hb_retptr( NULL ); } else #endif /* SQLITE_VERSION_NUMBER >= 3006011 */ - hb_retptr( NULL ); + hb_retptr( NULL ); } HB_FUNC( SQLITE3_BACKUP_STEP ) @@ -2071,7 +2071,7 @@ HB_FUNC( SQLITE3_BACKUP_STEP ) hb_retni( sqlite3_backup_step( pBackup, hb_parni( 2 ) ) ); else #endif /* SQLITE_VERSION_NUMBER >= 3006011 */ - hb_retni( -1 ); + hb_retni( -1 ); } HB_FUNC( SQLITE3_BACKUP_FINISH ) @@ -2084,7 +2084,7 @@ HB_FUNC( SQLITE3_BACKUP_FINISH ) hb_retni( sqlite3_backup_finish( pBackup ) ); else #endif /* SQLITE_VERSION_NUMBER >= 3006011 */ - hb_retni( -1 ); + hb_retni( -1 ); } HB_FUNC( SQLITE3_BACKUP_REMAINING ) @@ -2097,7 +2097,7 @@ HB_FUNC( SQLITE3_BACKUP_REMAINING ) hb_retni( sqlite3_backup_remaining( pBackup ) ); else #endif /* SQLITE_VERSION_NUMBER >= 3006011 */ - hb_retni( -1 ); + hb_retni( -1 ); } HB_FUNC( SQLITE3_BACKUP_PAGECOUNT ) @@ -2110,7 +2110,7 @@ HB_FUNC( SQLITE3_BACKUP_PAGECOUNT ) hb_retni( sqlite3_backup_pagecount( pBackup ) ); else #endif /* SQLITE_VERSION_NUMBER >= 3006011 */ - hb_retni( -1 ); + hb_retni( -1 ); } /** @@ -2188,8 +2188,8 @@ HB_FUNC( SQLITE3_STATUS ) HB_FUNC( SQLITE3_DB_STATUS ) { #if SQLITE_VERSION_NUMBER >= 3006001 - int iCurrent, iHighwater; - HB_SQLITE3 * pHbSqlite3 = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE ); + int iCurrent, iHighwater; + HB_SQLITE3 * pHbSqlite3 = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE ); if( pHbSqlite3 && pHbSqlite3->db && ( hb_pcount() > 4 ) && ( HB_ISNUM( 3 ) && HB_ISBYREF( 3 ) ) && ( HB_ISNUM( 4 ) && HB_ISBYREF( 4 ) ) ) diff --git a/harbour/contrib/hbssl/err.c b/harbour/contrib/hbssl/err.c index d0851fb8a4..e038011ccb 100644 --- a/harbour/contrib/hbssl/err.c +++ b/harbour/contrib/hbssl/err.c @@ -116,7 +116,7 @@ HB_FUNC( ERR_REASON_ERROR_STRING ) HB_FUNC( ERR_GET_ERROR_LINE ) { const char * file = NULL; - int line = 0; + int line = 0; hb_retnint( ERR_get_error_line( &file, &line ) ); @@ -127,7 +127,7 @@ HB_FUNC( ERR_GET_ERROR_LINE ) HB_FUNC( ERR_PEEK_ERROR_LINE ) { const char * file = NULL; - int line = 0; + int line = 0; hb_retnint( ERR_peek_error_line( &file, &line ) ); @@ -138,7 +138,7 @@ HB_FUNC( ERR_PEEK_ERROR_LINE ) HB_FUNC( ERR_PEEK_LAST_ERROR_LINE ) { const char * file = NULL; - int line = 0; + int line = 0; hb_retnint( ERR_peek_last_error_line( &file, &line ) ); @@ -148,10 +148,10 @@ HB_FUNC( ERR_PEEK_LAST_ERROR_LINE ) HB_FUNC( ERR_GET_ERROR_LINE_DATA ) { - const char * file = NULL; - int line = 0; - const char * data = NULL; - int flags = 0; + const char * file = NULL; + int line = 0; + const char * data = NULL; + int flags = 0; hb_retnint( ERR_get_error_line_data( &file, &line, &data, &flags ) ); @@ -163,10 +163,10 @@ HB_FUNC( ERR_GET_ERROR_LINE_DATA ) HB_FUNC( ERR_PEEK_ERROR_LINE_DATA ) { - const char * file = NULL; - int line = 0; - const char * data = NULL; - int flags = 0; + const char * file = NULL; + int line = 0; + const char * data = NULL; + int flags = 0; hb_retnint( ERR_peek_error_line_data( &file, &line, &data, &flags ) ); @@ -178,10 +178,10 @@ HB_FUNC( ERR_PEEK_ERROR_LINE_DATA ) HB_FUNC( ERR_PEEK_LAST_ERROR_LINE_DATA ) { - const char * file = NULL; - int line = 0; - const char * data = NULL; - int flags = 0; + const char * file = NULL; + int line = 0; + const char * data = NULL; + int flags = 0; hb_retnint( ERR_peek_last_error_line_data( &file, &line, &data, &flags ) ); diff --git a/harbour/contrib/hbssl/evp.c b/harbour/contrib/hbssl/evp.c index 3d576a8deb..163eff4bd0 100644 --- a/harbour/contrib/hbssl/evp.c +++ b/harbour/contrib/hbssl/evp.c @@ -96,7 +96,7 @@ HB_FUNC( EVP_PKEY_FREE ) HB_FUNC( EVP_BYTESTOKEY ) { const EVP_CIPHER * cipher = hb_EVP_CIPHER_par( 1 ); - const EVP_MD * md = hb_EVP_MD_par( 2 ); + const EVP_MD * md = hb_EVP_MD_par( 2 ); if( cipher && md && ( ! HB_ISCHAR( 3 ) || hb_parclen( 3 ) == 8 ) ) { diff --git a/harbour/contrib/hbssl/evpenc.c b/harbour/contrib/hbssl/evpenc.c index 784e5843d1..cc13663935 100644 --- a/harbour/contrib/hbssl/evpenc.c +++ b/harbour/contrib/hbssl/evpenc.c @@ -63,13 +63,13 @@ static HB_GARBAGE_FUNC( EVP_ENCODE_CTX_release ) void ** ph = ( void ** ) Cargo; /* Check if pointer is not NULL to avoid multiple freeing */ - if( ph && * ph ) + if( ph && *ph ) { /* Destroy the object */ - hb_xfree( * ph ); + hb_xfree( *ph ); /* set pointer to NULL just in case */ - * ph = NULL; + *ph = NULL; } } @@ -88,7 +88,7 @@ static EVP_ENCODE_CTX * hb_EVP_ENCODE_CTX_par( int iParam ) { void ** ph = ( void ** ) hb_parptrGC( &s_gcEVP_ENCODE_CTX_funcs, iParam ); - return ph ? ( EVP_ENCODE_CTX * ) * ph : NULL; + return ph ? ( EVP_ENCODE_CTX * ) *ph : NULL; } HB_FUNC( HB_EVP_ENCODE_CTX_CREATE ) @@ -97,7 +97,7 @@ HB_FUNC( HB_EVP_ENCODE_CTX_CREATE ) EVP_ENCODE_CTX * ctx = ( EVP_ENCODE_CTX * ) hb_xgrab( sizeof( EVP_ENCODE_CTX ) ); - * ph = ctx; + *ph = ctx; hb_retptrGC( ph ); } diff --git a/harbour/contrib/hbssl/evppkey.c b/harbour/contrib/hbssl/evppkey.c index 15f90f2f4f..c0945cf79d 100644 --- a/harbour/contrib/hbssl/evppkey.c +++ b/harbour/contrib/hbssl/evppkey.c @@ -63,13 +63,13 @@ static HB_GARBAGE_FUNC( EVP_PKEY_release ) void ** ph = ( void ** ) Cargo; /* Check if pointer is not NULL to avoid multiple freeing */ - if( ph && * ph ) + if( ph && *ph ) { /* Destroy the object */ - EVP_PKEY_free( ( EVP_PKEY * ) * ph ); + EVP_PKEY_free( ( EVP_PKEY * ) *ph ); /* set pointer to NULL just in case */ - * ph = NULL; + *ph = NULL; } } @@ -88,7 +88,7 @@ EVP_PKEY * hb_EVP_PKEY_par( int iParam ) { void ** ph = ( void ** ) hb_parptrGC( &s_gcEVP_PKEY_funcs, iParam ); - return ph ? ( EVP_PKEY * ) * ph : NULL; + return ph ? ( EVP_PKEY * ) *ph : NULL; } HB_FUNC( EVP_PKEY_NEW ) @@ -97,7 +97,7 @@ HB_FUNC( EVP_PKEY_NEW ) EVP_PKEY * ctx = EVP_PKEY_new(); - * ph = ctx; + *ph = ctx; hb_retptrGC( ph ); } @@ -153,7 +153,7 @@ HB_FUNC( EVP_PKEY_ASSIGN_RSA ) if( hb_EVP_PKEY_is( 1 ) && HB_ISPOINTER( 2 ) ) { EVP_PKEY * pkey = hb_EVP_PKEY_par( 1 ); - RSA * key = ( RSA * ) hb_parptr( 2 ); + RSA * key = ( RSA * ) hb_parptr( 2 ); if( pkey && key ) hb_retni( EVP_PKEY_assign_RSA( pkey, key ) ); @@ -171,7 +171,7 @@ HB_FUNC( EVP_PKEY_ASSIGN_DSA ) if( hb_EVP_PKEY_is( 1 ) && HB_ISPOINTER( 2 ) ) { EVP_PKEY * pkey = hb_EVP_PKEY_par( 1 ); - DSA * key = ( DSA * ) hb_parptr( 2 ); + DSA * key = ( DSA * ) hb_parptr( 2 ); if( pkey && key ) hb_retni( EVP_PKEY_assign_DSA( pkey, key ) ); @@ -189,7 +189,7 @@ HB_FUNC( EVP_PKEY_ASSIGN_DH ) if( hb_EVP_PKEY_is( 1 ) && HB_ISPOINTER( 2 ) ) { EVP_PKEY * pkey = hb_EVP_PKEY_par( 1 ); - DH * key = ( DH * ) hb_parptr( 2 ); + DH * key = ( DH * ) hb_parptr( 2 ); if( pkey && key ) hb_retni( EVP_PKEY_assign_DH( pkey, key ) ); @@ -203,44 +203,44 @@ HB_FUNC( EVP_PKEY_ASSIGN_DH ) #if 0 -int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,RSA *key); -int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,DSA *key); -int EVP_PKEY_set1_DH(EVP_PKEY *pkey,DH *key); -int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,EC_KEY *key); +int EVP_PKEY_set1_RSA( EVP_PKEY * pkey, RSA * key ); +int EVP_PKEY_set1_DSA( EVP_PKEY * pkey, DSA * key ); +int EVP_PKEY_set1_DH( EVP_PKEY * pkey, DH * key ); +int EVP_PKEY_set1_EC_KEY( EVP_PKEY * pkey, EC_KEY * key ); -RSA * EVP_PKEY_get1_RSA(EVP_PKEY *pkey); -DSA * EVP_PKEY_get1_DSA(EVP_PKEY *pkey); -DH * EVP_PKEY_get1_DH(EVP_PKEY *pkey); -EC_KEY * EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); +RSA * EVP_PKEY_get1_RSA( EVP_PKEY * pkey ); +DSA * EVP_PKEY_get1_DSA( EVP_PKEY * pkey ); +DH * EVP_PKEY_get1_DH( EVP_PKEY * pkey ); +EC_KEY * EVP_PKEY_get1_EC_KEY( EVP_PKEY * pkey ); /* These changed in 0.9.9 to something different, they weren't probably documented before. */ int EVP_PKEY_decrypt( unsigned char * dec_key, const unsigned char * enc_key, int enc_key_len, EVP_PKEY * private_key ); -int EVP_PKEY_encrypt( unsigned char * enc_key, const unsigned char * key , int key_len , EVP_PKEY * pub_key ); +int EVP_PKEY_encrypt( unsigned char * enc_key, const unsigned char * key, int key_len, EVP_PKEY * pub_key ); /* 1.0.0 */ -int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, - unsigned char *sig, size_t *siglen, - const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_sign_init( EVP_PKEY_CTX * ctx ); +int EVP_PKEY_sign( EVP_PKEY_CTX * ctx, + unsigned char * sig, size_t * siglen, + const unsigned char * tbs, size_t tbslen ); -int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, - const unsigned char *sig, size_t siglen, - const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_verify_init( EVP_PKEY_CTX * ctx ); +int EVP_PKEY_verify( EVP_PKEY_CTX * ctx, + const unsigned char * sig, size_t siglen, + const unsigned char * tbs, size_t tbslen ); -int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, - unsigned char *rout, size_t *routlen, - const unsigned char *sig, size_t siglen); +int EVP_PKEY_verify_recover_init( EVP_PKEY_CTX * ctx ); +int EVP_PKEY_verify_recover( EVP_PKEY_CTX * ctx, + unsigned char * rout, size_t * routlen, + const unsigned char * sig, size_t siglen ); -int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); +int EVP_PKEY_encrypt_init( EVP_PKEY_CTX * ctx ); +int EVP_PKEY_encrypt( EVP_PKEY_CTX * ctx, + unsigned char * out, size_t * outlen, + const unsigned char * in, size_t inlen ); -int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); -int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); +int EVP_PKEY_decrypt_init( EVP_PKEY_CTX * ctx ); +int EVP_PKEY_decrypt( EVP_PKEY_CTX * ctx, + unsigned char * out, size_t * outlen, + const unsigned char * in, size_t inlen ); #endif diff --git a/harbour/contrib/hbssl/sslctx.c b/harbour/contrib/hbssl/sslctx.c index 07853538aa..baa9393df4 100644 --- a/harbour/contrib/hbssl/sslctx.c +++ b/harbour/contrib/hbssl/sslctx.c @@ -66,13 +66,13 @@ static HB_GARBAGE_FUNC( SSL_CTX_release ) void ** ph = ( void ** ) Cargo; /* Check if pointer is not NULL to avoid multiple freeing */ - if( ph && * ph ) + if( ph && *ph ) { /* Destroy the object */ - SSL_CTX_free( ( SSL_CTX * ) * ph ); + SSL_CTX_free( ( SSL_CTX * ) *ph ); /* set pointer to NULL just in case */ - * ph = NULL; + *ph = NULL; } } @@ -91,7 +91,7 @@ SSL_CTX * hb_SSL_CTX_par( int iParam ) { void ** ph = ( void ** ) hb_parptrGC( &s_gcSSL_CTX_funcs, iParam ); - return ph ? ( SSL_CTX * ) * ph : NULL; + return ph ? ( SSL_CTX * ) *ph : NULL; } const SSL_METHOD * hb_ssl_method_id_to_ptr( int n ) @@ -101,20 +101,20 @@ const SSL_METHOD * hb_ssl_method_id_to_ptr( int n ) switch( n ) { #if OPENSSL_VERSION_NUMBER < 0x10000000L - case HB_SSL_CTX_NEW_METHOD_SSLV2 : p = SSLv2_method(); break; - case HB_SSL_CTX_NEW_METHOD_SSLV2_SERVER : p = SSLv2_server_method(); break; - case HB_SSL_CTX_NEW_METHOD_SSLV2_CLIENT : p = SSLv2_client_method(); break; + case HB_SSL_CTX_NEW_METHOD_SSLV2: p = SSLv2_method(); break; + case HB_SSL_CTX_NEW_METHOD_SSLV2_SERVER: p = SSLv2_server_method(); break; + case HB_SSL_CTX_NEW_METHOD_SSLV2_CLIENT: p = SSLv2_client_method(); break; #endif - case HB_SSL_CTX_NEW_METHOD_SSLV3 : p = SSLv3_method(); break; - case HB_SSL_CTX_NEW_METHOD_SSLV3_SERVER : p = SSLv3_server_method(); break; - case HB_SSL_CTX_NEW_METHOD_SSLV3_CLIENT : p = SSLv3_client_method(); break; - case HB_SSL_CTX_NEW_METHOD_TLSV1 : p = TLSv1_method(); break; - case HB_SSL_CTX_NEW_METHOD_TLSV1_SERVER : p = TLSv1_server_method(); break; - case HB_SSL_CTX_NEW_METHOD_TLSV1_CLIENT : p = TLSv1_client_method(); break; - case HB_SSL_CTX_NEW_METHOD_SSLV23 : p = SSLv23_method(); break; - case HB_SSL_CTX_NEW_METHOD_SSLV23_SERVER : p = SSLv23_server_method(); break; - case HB_SSL_CTX_NEW_METHOD_SSLV23_CLIENT : p = SSLv23_client_method(); break; - default : p = SSLv23_method(); + case HB_SSL_CTX_NEW_METHOD_SSLV3: p = SSLv3_method(); break; + case HB_SSL_CTX_NEW_METHOD_SSLV3_SERVER: p = SSLv3_server_method(); break; + case HB_SSL_CTX_NEW_METHOD_SSLV3_CLIENT: p = SSLv3_client_method(); break; + case HB_SSL_CTX_NEW_METHOD_TLSV1: p = TLSv1_method(); break; + case HB_SSL_CTX_NEW_METHOD_TLSV1_SERVER: p = TLSv1_server_method(); break; + case HB_SSL_CTX_NEW_METHOD_TLSV1_CLIENT: p = TLSv1_client_method(); break; + case HB_SSL_CTX_NEW_METHOD_SSLV23: p = SSLv23_method(); break; + case HB_SSL_CTX_NEW_METHOD_SSLV23_SERVER: p = SSLv23_server_method(); break; + case HB_SSL_CTX_NEW_METHOD_SSLV23_CLIENT: p = SSLv23_client_method(); break; + default: p = SSLv23_method(); } return p; @@ -130,7 +130,7 @@ HB_FUNC( SSL_CTX_NEW ) SSL_CTX * ctx = SSL_CTX_new( hb_ssl_method_id_to_ptr( hb_parnidef( 1, HB_SSL_CTX_NEW_METHOD_DEFAULT ) ) ); #endif - * ph = ( void * ) ctx; + *ph = ( void * ) ctx; hb_retptrGC( ph ); } @@ -195,7 +195,7 @@ HB_FUNC( SSL_CTX_ADD_SESSION ) { if( hb_SSL_CTX_is( 1 ) && hb_SSL_SESSION_is( 2 ) ) { - SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); + SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); SSL_SESSION * session = hb_SSL_SESSION_par( 2 ); if( ctx && session ) @@ -209,7 +209,7 @@ HB_FUNC( SSL_CTX_REMOVE_SESSION ) { if( hb_SSL_CTX_is( 1 ) && hb_SSL_SESSION_is( 2 ) ) { - SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); + SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); SSL_SESSION * session = hb_SSL_SESSION_par( 2 ); if( ctx && session ) @@ -574,8 +574,8 @@ HB_FUNC( SSL_CTX_USE_CERTIFICATE ) { if( hb_SSL_CTX_is( 1 ) && hb_X509_is( 2 ) ) { - SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); - X509 * x509 = hb_X509_par( 2 ); + SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); + X509 * x509 = hb_X509_par( 2 ); if( ctx && x509 ) hb_retni( SSL_CTX_use_certificate( ctx, x509 ) ); @@ -588,8 +588,8 @@ HB_FUNC( SSL_CTX_ADD_CLIENT_CA ) { if( hb_SSL_CTX_is( 1 ) && hb_X509_is( 2 ) ) { - SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); - X509 * x509 = hb_X509_par( 2 ); + SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); + X509 * x509 = hb_X509_par( 2 ); if( ctx && x509 ) hb_retni( SSL_CTX_add_client_CA( ctx, x509 ) ); @@ -613,7 +613,7 @@ HB_FUNC( SSL_CTX_GET_CLIENT_CA_LIST ) if( len > 0 ) { PHB_ITEM pArray = hb_itemArrayNew( sk_X509_NAME_num( stack ) ); - int tmp; + int tmp; for( tmp = 0; tmp < len; tmp++ ) hb_arraySetPtr( pArray, tmp + 1, sk_X509_NAME_value( stack, tmp ) ); @@ -622,7 +622,7 @@ HB_FUNC( SSL_CTX_GET_CLIENT_CA_LIST ) } else #endif - hb_reta( 0 ); + hb_reta( 0 ); } } else @@ -633,8 +633,8 @@ HB_FUNC( SSL_CTX_ADD_EXTRA_CHAIN_CERT ) { if( hb_SSL_CTX_is( 1 ) && hb_X509_is( 2 ) ) { - SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); - X509 * x509 = hb_X509_par( 2 ); + SSL_CTX * ctx = hb_SSL_CTX_par( 1 ); + X509 * x509 = hb_X509_par( 2 ); if( ctx && x509 ) hb_retnl( SSL_CTX_add_extra_chain_cert( ctx, x509 ) ); @@ -786,49 +786,49 @@ HB_FUNC( SSL_CTX_SET_DEFAULT_VERIFY_PATHS ) /* -#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) -#define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val)) -#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st)) + #define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) + #define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val)) + #define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st)) -X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); -void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); -void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *cs); -int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); -long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, char *parg); + X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); + void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); + void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *cs); + int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); + long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, char *parg); -void SSL_CTX_set_app_data(SSL_CTX *ctx, void *arg); -int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, char *arg); -char * SSL_CTX_get_app_data( ctx ); -char * SSL_CTX_get_ex_data( ctx, int ); + void SSL_CTX_set_app_data(SSL_CTX *ctx, void *arg); + int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, char *arg); + char * SSL_CTX_get_app_data( ctx ); + char * SSL_CTX_get_ex_data( ctx, int ); -int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); -int SSL_CTX_get_ex_new_index(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) -void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); -int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); -SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy); -int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess); -void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess); -void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)); -void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess)); -void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)); -LHASH *SSL_CTX_sessions(SSL_CTX *ctx); -void SSL_CTX_set_cert_verify_cb(SSL_CTX *ctx, int (*cb)(), char *arg) -void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK *list); -void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); -void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, int (*cb);(void)) -void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); -void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); -void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg); -long SSL_CTX_set_tmp_dh(SSL_CTX* ctx, DH *dh); -long SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*cb)(void)); -long SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, RSA *rsa); -SSL_CTX_set_tmp_rsa_callback -long SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, RSA *(*cb)(SSL *ssl, int export, int keylength)); -Sets the callback which will be called when a temporary private key is required. The export flag will be set if the reason for needing a temp key is that an export ciphersuite is in use, in which case, keylength will contain the required keylength in bits. Generate a key of appropriate size (using ???) and return it. -SSL_set_tmp_rsa_callback -long SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength)); -The same as SSL_CTX_set_tmp_rsa_callback, except it operates on an SSL session instead of a context. -void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*cb);(void)) -void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); -void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)); -*/ + int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); + int SSL_CTX_get_ex_new_index(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) + void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); + int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); + SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy); + int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess); + void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess); + void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)); + void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess)); + void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)); + LHASH *SSL_CTX_sessions(SSL_CTX *ctx); + void SSL_CTX_set_cert_verify_cb(SSL_CTX *ctx, int (*cb)(), char *arg) + void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK *list); + void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); + void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, int (*cb);(void)) + void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); + void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); + void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg); + long SSL_CTX_set_tmp_dh(SSL_CTX* ctx, DH *dh); + long SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*cb)(void)); + long SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, RSA *rsa); + SSL_CTX_set_tmp_rsa_callback + long SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, RSA *(*cb)(SSL *ssl, int export, int keylength)); + Sets the callback which will be called when a temporary private key is required. The export flag will be set if the reason for needing a temp key is that an export ciphersuite is in use, in which case, keylength will contain the required keylength in bits. Generate a key of appropriate size (using ???) and return it. + SSL_set_tmp_rsa_callback + long SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength)); + The same as SSL_CTX_set_tmp_rsa_callback, except it operates on an SSL session instead of a context. + void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*cb);(void)) + void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); + void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)); + */ diff --git a/harbour/contrib/hbssl/sslsess.c b/harbour/contrib/hbssl/sslsess.c index 9bcca5c096..cab946c856 100644 --- a/harbour/contrib/hbssl/sslsess.c +++ b/harbour/contrib/hbssl/sslsess.c @@ -60,13 +60,13 @@ static HB_GARBAGE_FUNC( SSL_SESSION_release ) void ** ph = ( void ** ) Cargo; /* Check if pointer is not NULL to avoid multiple freeing */ - if( ph && * ph ) + if( ph && *ph ) { /* Destroy the object */ - SSL_SESSION_free( ( SSL_SESSION * ) * ph ); + SSL_SESSION_free( ( SSL_SESSION * ) *ph ); /* set pointer to NULL just in case */ - * ph = NULL; + *ph = NULL; } } @@ -85,7 +85,7 @@ SSL_SESSION * hb_SSL_SESSION_par( int iParam ) { void ** ph = ( void ** ) hb_parptrGC( &s_gcSSL_SESSION_funcs, iParam ); - return ph ? ( SSL_SESSION * ) * ph : NULL; + return ph ? ( SSL_SESSION * ) *ph : NULL; } HB_FUNC( SSL_SESSION_NEW ) @@ -94,7 +94,7 @@ HB_FUNC( SSL_SESSION_NEW ) SSL_SESSION * session = SSL_SESSION_new(); - * ph = ( void * ) session; + *ph = ( void * ) session; hb_retptrGC( ph ); } @@ -183,12 +183,12 @@ HB_FUNC( SSL_SESSION_HASH ) } /* -char *SSL_SESSION_get_app_data(SSL_SESSION *s); -char *SSL_SESSION_get_ex_data(const SSL_SESSION *s, int idx); -void SSL_SESSION_set_app_data(SSL_SESSION *s, char *a); -int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, char *arg); + char *SSL_SESSION_get_app_data(SSL_SESSION *s); + char *SSL_SESSION_get_ex_data(const SSL_SESSION *s, int idx); + void SSL_SESSION_set_app_data(SSL_SESSION *s, char *a); + int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, char *arg); -int SSL_SESSION_get_ex_new_index(long argl, char *argp, int (*new_func)(void), int (*dup_func)(void), void (*free_func)(void)) -int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x); -int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x); -*/ + int SSL_SESSION_get_ex_new_index(long argl, char *argp, int (*new_func)(void), int (*dup_func)(void), void (*free_func)(void)) + int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x); + int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x); + */ diff --git a/harbour/contrib/hbxpp/binnumx.c b/harbour/contrib/hbxpp/binnumx.c index 6d0a6211ff..ef2e0430e5 100644 --- a/harbour/contrib/hbxpp/binnumx.c +++ b/harbour/contrib/hbxpp/binnumx.c @@ -56,8 +56,8 @@ HB_FUNC( BIN2U ) { - PHB_ITEM pItem = hb_param( 1, HB_IT_STRING ); - HB_U32 uiResult = 0; + PHB_ITEM pItem = hb_param( 1, HB_IT_STRING ); + HB_U32 uiResult = 0; if( pItem ) { @@ -76,23 +76,25 @@ HB_FUNC( BIN2U ) HB_FUNC( U2BIN ) { - char szResult[ 4 ]; + char szResult[ 4 ]; HB_U32 uiValue = ( HB_U32 ) hb_parnint( 1 ); + HB_PUT_LE_UINT32( szResult, uiValue ); hb_retclen( szResult, 4 ); } HB_FUNC( W2BIN ) { - char szResult[ 2 ]; + char szResult[ 2 ]; HB_U16 uiValue = ( HB_U16 ) hb_parni( 1 ); + HB_PUT_LE_UINT16( szResult, uiValue ); hb_retclen( szResult, 2 ); } HB_FUNC( F2BIN ) { - char buf[ sizeof( double ) ]; + char buf[ sizeof( double ) ]; double d = hb_parnd( 1 ); HB_PUT_LE_DOUBLE( buf, d ); diff --git a/harbour/contrib/hbxpp/dllx.c b/harbour/contrib/hbxpp/dllx.c index 1fec42ad19..a1725126f6 100644 --- a/harbour/contrib/hbxpp/dllx.c +++ b/harbour/contrib/hbxpp/dllx.c @@ -66,7 +66,7 @@ typedef struct { PHB_ITEM pLibraryHandle; - HB_BOOL bFreeLibrary; /* Free library handle on destroy? */ + HB_BOOL bFreeLibrary; /* Free library handle on destroy? */ int iFuncFlags; void * pFunctionPtr; /* Function Address */ } HB_DLLEXEC, * PHB_DLLEXEC; @@ -105,9 +105,9 @@ HB_FUNC_TRANSLATE( DLLUNLOAD, HB_LIBFREE ) HB_FUNC( DLLCALL ) { - PHB_ITEM pLibrary = hb_param( 1, HB_IT_ANY ); + PHB_ITEM pLibrary = hb_param( 1, HB_IT_ANY ); PHB_ITEM pLibraryHandle = NULL; - HB_BOOL bFreeLibrary = HB_FALSE; + HB_BOOL bFreeLibrary = HB_FALSE; if( HB_IS_STRING( pLibrary ) ) { @@ -120,8 +120,8 @@ HB_FUNC( DLLCALL ) if( pLibraryHandle ) { - int iXPPFlags = hb_parni( 2 ); - int iFuncFlags = 0; + int iXPPFlags = hb_parni( 2 ); + int iFuncFlags = 0; void * pFunctionPtr = hb_libSymAddr( pLibraryHandle, hb_parcx( 3 ) ); if( ( iXPPFlags & DLL_CDECL ) != 0 ) @@ -147,8 +147,8 @@ HB_FUNC( DLLCALL ) HB_FUNC( DLLPREPARECALL ) { - PHB_DLLEXEC xec = ( PHB_DLLEXEC ) hb_gcAllocate( sizeof( HB_DLLEXEC ), &s_gcDllFuncs ); - PHB_ITEM pLibrary = hb_param( 1, HB_IT_ANY ); + PHB_DLLEXEC xec = ( PHB_DLLEXEC ) hb_gcAllocate( sizeof( HB_DLLEXEC ), &s_gcDllFuncs ); + PHB_ITEM pLibrary = hb_param( 1, HB_IT_ANY ); const char * pszErrorText; memset( xec, 0, sizeof( HB_DLLEXEC ) ); diff --git a/harbour/contrib/hbxpp/mousex.c b/harbour/contrib/hbxpp/mousex.c index 6d0221a94e..64fe604f13 100644 --- a/harbour/contrib/hbxpp/mousex.c +++ b/harbour/contrib/hbxpp/mousex.c @@ -75,7 +75,7 @@ HB_FUNC( SETMOUSE ) { int iRow = 0, iCol = 0; - if( !fRow || !fCol ) + if( ! fRow || ! fCol ) hb_mouseGetPos( &iRow, &iCol ); if( fRow ) diff --git a/harbour/contrib/hbxpp/oemansix.c b/harbour/contrib/hbxpp/oemansix.c index 60eedcea8f..8ea2fb0153 100644 --- a/harbour/contrib/hbxpp/oemansix.c +++ b/harbour/contrib/hbxpp/oemansix.c @@ -67,14 +67,14 @@ HB_FUNC( CONVTOOEMCP ) int nLen = ( int ) hb_itemGetCLen( pString ); const char * pszSrc = hb_itemGetCPtr( pString ); - int nWideLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszSrc, nLen, NULL, 0 ); - LPWSTR pszWide = ( LPWSTR ) hb_xgrab( ( nWideLen + 1 ) * sizeof( wchar_t ) ); + int nWideLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszSrc, nLen, NULL, 0 ); + LPWSTR pszWide = ( LPWSTR ) hb_xgrab( ( nWideLen + 1 ) * sizeof( wchar_t ) ); char * pszDst; MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszSrc, nLen, pszWide, nWideLen ); - nLen = WideCharToMultiByte( CP_OEMCP, 0, pszWide, nWideLen, NULL, 0, NULL, NULL ); + nLen = WideCharToMultiByte( CP_OEMCP, 0, pszWide, nWideLen, NULL, 0, NULL, NULL ); pszDst = ( char * ) hb_xgrab( nLen + 1 ); WideCharToMultiByte( CP_OEMCP, 0, pszWide, nWideLen, pszDst, nLen, NULL, NULL ); @@ -99,14 +99,14 @@ HB_FUNC( CONVTOANSICP ) int nLen = ( int ) hb_itemGetCLen( pString ); const char * pszSrc = hb_itemGetCPtr( pString ); - int nWideLen = MultiByteToWideChar( CP_OEMCP, MB_PRECOMPOSED, pszSrc, nLen, NULL, 0 ); - LPWSTR pszWide = ( LPWSTR ) hb_xgrab( ( nWideLen + 1 ) * sizeof( wchar_t ) ); + int nWideLen = MultiByteToWideChar( CP_OEMCP, MB_PRECOMPOSED, pszSrc, nLen, NULL, 0 ); + LPWSTR pszWide = ( LPWSTR ) hb_xgrab( ( nWideLen + 1 ) * sizeof( wchar_t ) ); char * pszDst; MultiByteToWideChar( CP_OEMCP, MB_PRECOMPOSED, pszSrc, nLen, pszWide, nWideLen ); - nLen = WideCharToMultiByte( CP_ACP, 0, pszWide, nWideLen, NULL, 0, NULL, NULL ); + nLen = WideCharToMultiByte( CP_ACP, 0, pszWide, nWideLen, NULL, 0, NULL, NULL ); pszDst = ( char * ) hb_xgrab( nLen + 1 ); WideCharToMultiByte( CP_ACP, 0, pszWide, nWideLen, pszDst, nLen, NULL, NULL ); diff --git a/harbour/contrib/hbxpp/wafuncx.c b/harbour/contrib/hbxpp/wafuncx.c index 6bcfa60f35..da91aea201 100644 --- a/harbour/contrib/hbxpp/wafuncx.c +++ b/harbour/contrib/hbxpp/wafuncx.c @@ -59,7 +59,7 @@ static HB_ERRCODE s_waList( AREAP pArea, void * Cargo ) { PHB_ITEM pArray = ( PHB_ITEM ) Cargo; - HB_SIZE nLen = hb_arrayLen( pArray ) + 1; + HB_SIZE nLen = hb_arrayLen( pArray ) + 1; hb_arraySize( pArray, nLen ); hb_arraySetC( pArray, nLen, hb_dynsymName( ( PHB_DYNS ) pArea->atomAlias ) ); diff --git a/harbour/contrib/hbxpp/xppopc.c b/harbour/contrib/hbxpp/xppopc.c index 4aaa4140cd..b4d23596e4 100644 --- a/harbour/contrib/hbxpp/xppopc.c +++ b/harbour/contrib/hbxpp/xppopc.c @@ -61,15 +61,15 @@ * data from tail */ #undef HB_IS_VALID_INDEX -#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) (idx) < 0 ? (idx) += (max) + 1 : (idx) ) > 0 && ( HB_SIZE ) (idx) <= (max) ) +#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) ( idx ) < 0 ? ( idx ) += ( max ) + 1 : ( idx ) ) > 0 && ( HB_SIZE ) ( idx ) <= ( max ) ) HB_FUNC( XPP_INDEX ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pIndex = hb_param( 1, HB_IT_ANY ); - if( hb_pcount() == 2 ) - { /* ASSIGN */ + if( hb_pcount() == 2 ) /* ASSIGN */ + { PHB_ITEM pValue = hb_param( 2, HB_IT_ANY ); if( HB_IS_NUMERIC( pIndex ) ) { @@ -103,15 +103,15 @@ HB_FUNC( XPP_INDEX ) hb_errRT_BASE( EG_BOUND, 1012, "Error in array index", hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); } else - hb_errRT_BASE( EG_ARG, 1069, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); /* TODO: Emulate exact XPP error msg */ + hb_errRT_BASE( EG_ARG, 1069, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); /* TODO: Emulate exact XPP error msg */ } else - hb_errRT_BASE( EG_ARG, 1069, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); /* TODO: Emulate exact XPP error msg */ + hb_errRT_BASE( EG_ARG, 1069, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); /* TODO: Emulate exact XPP error msg */ hb_itemReturn( pSelf ); } - else - { /* ACCESS */ + else /* ACCESS */ + { if( HB_IS_NUMERIC( pIndex ) ) { HB_SIZE nIndex = hb_itemGetNS( pIndex ); @@ -121,7 +121,7 @@ HB_FUNC( XPP_INDEX ) if( HB_IS_VALID_INDEX( nIndex, nLen ) ) hb_itemReturn( hb_arrayGetItemPtr( pSelf, nIndex ) ); else - hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */ + hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */ } else if( HB_IS_STRING( pSelf ) ) { @@ -129,10 +129,10 @@ HB_FUNC( XPP_INDEX ) if( HB_IS_VALID_INDEX( nIndex, nLen ) ) hb_retclen( hb_itemGetCPtr( pSelf ) + nIndex - 1, 1 ); else - hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */ + hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */ } else - hb_errRT_BASE( EG_ARG, 1068, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */ + hb_errRT_BASE( EG_ARG, 1068, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */ } else { @@ -146,7 +146,7 @@ HB_FUNC( XPP_INDEX ) HB_FUNC( XPP_INCLUDE ) { PHB_ITEM pSelf = hb_stackSelfItem(); - PHB_ITEM pKey = hb_param( 1, HB_IT_ANY ); + PHB_ITEM pKey = hb_param( 1, HB_IT_ANY ); if( HB_IS_ARRAY( pSelf ) ) { diff --git a/harbour/contrib/xhb/bkgtsks.c b/harbour/contrib/xhb/bkgtsks.c index f18ddf2670..c29edfab03 100644 --- a/harbour/contrib/xhb/bkgtsks.c +++ b/harbour/contrib/xhb/bkgtsks.c @@ -72,9 +72,9 @@ typedef struct HB_BACKGROUNDTASK_ { HB_ULONG ulTaskID; /* task identifier */ PHB_ITEM pTask; /* pointer to the task item */ - double dSeconds; /* internal - last time this task has gone */ - int millisec; /* milliseconds after this task must run */ - HB_BOOL bActive; /* task is active ? */ + double dSeconds; /* internal - last time this task has gone */ + int millisec; /* milliseconds after this task must run */ + HB_BOOL bActive; /* task is active ? */ } HB_BACKGROUNDTASK, * PHB_BACKGROUNDTASK; extern void hb_backgroundRunSingle( HB_ULONG ulID ); /* run a single background routine */ @@ -98,25 +98,25 @@ static HB_ULONG s_ulBackgroundID = 0; /* list of background tasks * A pointer into an array of pointers to items with a codeblock */ -static PHB_BACKGROUNDTASK * s_pBackgroundTasks = NULL; +static PHB_BACKGROUNDTASK * s_pBackgroundTasks = NULL; -static HB_BOOL s_bEnabled = HB_FALSE; +static HB_BOOL s_bEnabled = HB_FALSE; /* flag to prevent recursive calls of hb_backgroundRun() */ -static HB_BOOL s_bIamBackground = HB_FALSE; +static HB_BOOL s_bIamBackground = HB_FALSE; /* current task to be executed */ -static HB_USHORT s_uiBackgroundTask = 0; +static HB_USHORT s_uiBackgroundTask = 0; /* number of tasks in the list */ -static HB_USHORT s_uiBackgroundMaxTask = 0; +static HB_USHORT s_uiBackgroundMaxTask = 0; #else -#define s_ulBackgroundID HB_VM_STACK.ulBackgroundID -#define s_pBackgroundTasks ( HB_VM_STACK.pBackgroundTasks ) -#define s_bIamBackground HB_VM_STACK.bIamBackground -#define s_uiBackgroundTask HB_VM_STACK.uiBackgroundTask -#define s_uiBackgroundMaxTask HB_VM_STACK.uiBackgroundMaxTask +#define s_ulBackgroundID HB_VM_STACK.ulBackgroundID +#define s_pBackgroundTasks ( HB_VM_STACK.pBackgroundTasks ) +#define s_bIamBackground HB_VM_STACK.bIamBackground +#define s_uiBackgroundTask HB_VM_STACK.uiBackgroundTask +#define s_uiBackgroundMaxTask HB_VM_STACK.uiBackgroundMaxTask #endif @@ -129,17 +129,17 @@ HB_ULONG hb_backgroundAddFunc( PHB_ITEM pBlock, int nMillisec, HB_BOOL bActive ) /* store a copy of passed codeblock */ - pBkgTask = ( PHB_BACKGROUNDTASK ) hb_xgrab( sizeof( HB_BACKGROUNDTASK ) ); + pBkgTask = ( PHB_BACKGROUNDTASK ) hb_xgrab( sizeof( HB_BACKGROUNDTASK ) ); - pBkgTask->pTask = hb_itemNew( pBlock ); - pBkgTask->dSeconds = hb_dateSeconds(); - pBkgTask->millisec = nMillisec; - pBkgTask->bActive = bActive; + pBkgTask->pTask = hb_itemNew( pBlock ); + pBkgTask->dSeconds = hb_dateSeconds(); + pBkgTask->millisec = nMillisec; + pBkgTask->bActive = bActive; if( ! s_pBackgroundTasks ) { - pBkgTask->ulTaskID = s_ulBackgroundID = 1; - s_pBackgroundTasks = ( PHB_BACKGROUNDTASK * ) hb_xgrab( sizeof( HB_BACKGROUNDTASK ) ); + pBkgTask->ulTaskID = s_ulBackgroundID = 1; + s_pBackgroundTasks = ( PHB_BACKGROUNDTASK * ) hb_xgrab( sizeof( HB_BACKGROUNDTASK ) ); } else { @@ -234,7 +234,7 @@ void hb_backgroundRunSingle( HB_ULONG ulID ) { s_bIamBackground = HB_TRUE; - pBkgTask = hb_backgroundFind( ulID ); + pBkgTask = hb_backgroundFind( ulID ); if( pBkgTask ) hb_itemRelease( hb_itemDo( pBkgTask->pTask, 0 ) ); @@ -257,9 +257,9 @@ void hb_backgroundShutDown( void ) do { PHB_BACKGROUNDTASK pBkgTask; - pBkgTask = s_pBackgroundTasks[ --s_uiBackgroundMaxTask ]; + pBkgTask = s_pBackgroundTasks[ --s_uiBackgroundMaxTask ]; hb_itemRelease( pBkgTask->pTask ); - pBkgTask->pTask = NULL; + pBkgTask->pTask = NULL; hb_xfree( pBkgTask ); } while( s_uiBackgroundMaxTask ); @@ -272,14 +272,14 @@ void hb_backgroundShutDown( void ) /* caller have to free return ITEM by hb_itemRelease() if it's not NULL */ PHB_ITEM hb_backgroundDelFunc( HB_ULONG ulID ) { - int iTask; - PHB_BACKGROUNDTASK pBkgTask; - PHB_ITEM pItem = NULL; - HB_BOOL bOldSet = s_bEnabled; + int iTask; + PHB_BACKGROUNDTASK pBkgTask; + PHB_ITEM pItem = NULL; + HB_BOOL bOldSet = s_bEnabled; s_bEnabled = HB_FALSE; - iTask = 0; + iTask = 0; while( iTask < s_uiBackgroundMaxTask ) { pBkgTask = s_pBackgroundTasks[ iTask ]; @@ -317,8 +317,8 @@ PHB_ITEM hb_backgroundDelFunc( HB_ULONG ulID ) /* Find a task */ PHB_BACKGROUNDTASK hb_backgroundFind( HB_ULONG ulID ) { - int iTask; - PHB_BACKGROUNDTASK pBkgTask; + int iTask; + PHB_BACKGROUNDTASK pBkgTask; iTask = 0; while( iTask < s_uiBackgroundMaxTask ) @@ -336,15 +336,15 @@ PHB_BACKGROUNDTASK hb_backgroundFind( HB_ULONG ulID ) /* Set task as active */ HB_BOOL hb_backgroundActive( HB_ULONG ulID, HB_BOOL bActive ) { - PHB_BACKGROUNDTASK pBkgTask; - HB_BOOL bOldState = HB_FALSE; + PHB_BACKGROUNDTASK pBkgTask; + HB_BOOL bOldState = HB_FALSE; pBkgTask = hb_backgroundFind( ulID ); if( pBkgTask ) { - bOldState = pBkgTask->bActive; - pBkgTask->bActive = bActive; + bOldState = pBkgTask->bActive; + pBkgTask->bActive = bActive; } return bOldState; @@ -353,15 +353,15 @@ HB_BOOL hb_backgroundActive( HB_ULONG ulID, HB_BOOL bActive ) /* Set task time */ int hb_backgroundTime( HB_ULONG ulID, int nMillisec ) { - PHB_BACKGROUNDTASK pBkgTask; - int nOldState = 0; + PHB_BACKGROUNDTASK pBkgTask; + int nOldState = 0; pBkgTask = hb_backgroundFind( ulID ); if( pBkgTask ) { - nOldState = pBkgTask->millisec; - pBkgTask->millisec = nMillisec; + nOldState = pBkgTask->millisec; + pBkgTask->millisec = nMillisec; } return nOldState; } @@ -403,9 +403,9 @@ HB_FUNC( HB_BACKGROUNDRESET ) /* add a new background task and return its handle */ HB_FUNC( HB_BACKGROUNDADD ) { - PHB_ITEM pBlock = hb_param( 1, HB_IT_ANY ); - PHB_ITEM pMillisec = hb_param( 2, HB_IT_NUMERIC ); - PHB_ITEM pActive = hb_param( 3, HB_IT_LOGICAL ); + PHB_ITEM pBlock = hb_param( 1, HB_IT_ANY ); + PHB_ITEM pMillisec = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pActive = hb_param( 3, HB_IT_LOGICAL ); if( HB_IS_BLOCK( pBlock ) || HB_IS_ARRAY( pBlock ) ) { diff --git a/harbour/contrib/xhb/cstructc.c b/harbour/contrib/xhb/cstructc.c index f812d12238..bf5b1119dc 100644 --- a/harbour/contrib/xhb/cstructc.c +++ b/harbour/contrib/xhb/cstructc.c @@ -63,7 +63,7 @@ static PHB_ITEM hb_itemPutCRaw( PHB_ITEM pItem, const char * szText, HB_SIZE nLen ) { - HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCRaw(%p, %s, %" HB_PFS "u)", pItem, szText, nLen)); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCRaw(%p, %s, %" HB_PFS "u)", pItem, szText, nLen ) ); if( pItem ) { @@ -90,7 +90,7 @@ static PHB_ITEM hb_itemPutCRaw( PHB_ITEM pItem, const char * szText, HB_SIZE nLe #undef hb_itemPutCRawStatic static PHB_ITEM hb_itemPutCRawStatic( PHB_ITEM pItem, const char * szText, HB_SIZE nLen ) { - HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCRawStatic(%p, %s, %" HB_PFS "u)", pItem, szText, nLen)); + HB_TRACE( HB_TR_DEBUG, ( "hb_itemPutCRawStatic(%p, %s, %" HB_PFS "u)", pItem, szText, nLen ) ); if( pItem ) { @@ -108,7 +108,8 @@ static PHB_ITEM hb_itemPutCRawStatic( PHB_ITEM pItem, const char * szText, HB_SI return pItem; } -/* +#if 0 + #undef hb_retclenAdoptRaw void hb_retclenAdoptRaw( const char * szText, HB_SIZE nLen ) { @@ -120,16 +121,17 @@ void hb_retclenStatic( const char * szText, HB_SIZE nLen ) { hb_itemPutCRawStatic( hb_stackReturnItem(), szText, nLen ); } -*/ + +#endif static HB_UINT SizeOfCStructure( PHB_ITEM aDef, HB_UINT uiAlign ) { PHB_BASEARRAY pBaseDef = aDef->item.asArray.value; - HB_SIZE nLen = pBaseDef->nLen; - HB_SIZE nIndex; - HB_UINT uiSize = 0, uiMemberSize; - HB_BYTE cShift; - HB_UINT uiPad; + HB_SIZE nLen = pBaseDef->nLen; + HB_SIZE nIndex; + HB_UINT uiSize = 0, uiMemberSize; + HB_BYTE cShift; + HB_UINT uiPad; for( nIndex = 0; nIndex < nLen; nIndex++ ) { @@ -141,75 +143,74 @@ static HB_UINT SizeOfCStructure( PHB_ITEM aDef, HB_UINT uiAlign ) switch( ( pBaseDef->pItems + nIndex )->item.asInteger.value ) { - case CTYPE_CHAR : /* char */ - case CTYPE_UNSIGNED_CHAR : /* unsigned char */ + case CTYPE_CHAR: /* char */ + case CTYPE_UNSIGNED_CHAR: /* unsigned char */ uiMemberSize = sizeof( char ); break; - case CTYPE_CHAR_PTR : /* char * */ - case CTYPE_UNSIGNED_CHAR_PTR : /* unsigned char * */ + case CTYPE_CHAR_PTR: /* char * */ + case CTYPE_UNSIGNED_CHAR_PTR: /* unsigned char * */ uiMemberSize = sizeof( char * ); break; - case CTYPE_SHORT : /* short */ - case CTYPE_UNSIGNED_SHORT : /* unsigned short */ + case CTYPE_SHORT: /* short */ + case CTYPE_UNSIGNED_SHORT: /* unsigned short */ uiMemberSize = sizeof( short ); break; - case CTYPE_SHORT_PTR : /* short */ - case CTYPE_UNSIGNED_SHORT_PTR : /* unsigned short */ + case CTYPE_SHORT_PTR: /* short */ + case CTYPE_UNSIGNED_SHORT_PTR: /* unsigned short */ uiMemberSize = sizeof( short * ); break; - case CTYPE_INT : /* int */ - case CTYPE_UNSIGNED_INT : /* unsigned int */ + case CTYPE_INT: /* int */ + case CTYPE_UNSIGNED_INT: /* unsigned int */ uiMemberSize = sizeof( int ); break; - case CTYPE_INT_PTR : /* int * */ - case CTYPE_UNSIGNED_INT_PTR : /* unsigned int * */ + case CTYPE_INT_PTR: /* int * */ + case CTYPE_UNSIGNED_INT_PTR: /* unsigned int * */ uiMemberSize = sizeof( int * ); break; - case CTYPE_LONG : /* long */ - case CTYPE_UNSIGNED_LONG : /* unsigned long */ + case CTYPE_LONG: /* long */ + case CTYPE_UNSIGNED_LONG: /* unsigned long */ uiMemberSize = sizeof( long ); break; - case CTYPE_LONG_PTR : /* long * */ - case CTYPE_UNSIGNED_LONG_PTR : /* unsigned long * */ + case CTYPE_LONG_PTR: /* long * */ + case CTYPE_UNSIGNED_LONG_PTR: /* unsigned long * */ uiMemberSize = sizeof( long * ); break; - case CTYPE_FLOAT : /* float */ + case CTYPE_FLOAT: /* float */ uiMemberSize = sizeof( float ); break; - case CTYPE_FLOAT_PTR : /* float * */ + case CTYPE_FLOAT_PTR: /* float * */ uiMemberSize = sizeof( float * ); break; - case CTYPE_DOUBLE : /* double */ + case CTYPE_DOUBLE: /* double */ uiMemberSize = sizeof( double ); break; - case CTYPE_DOUBLE_PTR : /* double * */ + case CTYPE_DOUBLE_PTR: /* double * */ uiMemberSize = sizeof( double * ); break; - case CTYPE_VOID_PTR : /* void * (pointer) */ + case CTYPE_VOID_PTR: /* void * (pointer) */ uiMemberSize = sizeof( void * ); break; default: - { if( ( pBaseDef->pItems + nIndex )->item.asInteger.value >= CTYPE_STRUCTURE_PTR ) { uiMemberSize = sizeof( void * ); } else if( ( pBaseDef->pItems + nIndex )->item.asInteger.value >= CTYPE_STRUCTURE ) { - PHB_ITEM pID = hb_itemPutNI( NULL, ( pBaseDef->pItems + nIndex )->item.asInteger.value ); + PHB_ITEM pID = hb_itemPutNI( NULL, ( pBaseDef->pItems + nIndex )->item.asInteger.value ); PHB_ITEM pStructure = hb_itemDoC( "HB_CSTRUCTUREFROMID", 1, pID ); hb_itemRelease( pID ); @@ -232,7 +233,6 @@ static HB_UINT SizeOfCStructure( PHB_ITEM aDef, HB_UINT uiAlign ) hb_errRT_BASE( EG_ARG, 2023, NULL, "SizeOfCStructure", 1, hb_paramError( 1 ) ); return 0; } - } } if( uiSize ) @@ -263,9 +263,9 @@ static HB_UINT SizeOfCStructure( PHB_ITEM aDef, HB_UINT uiAlign ) HB_FUNC( HB_SIZEOFCSTRUCTURE ) { - PHB_ITEM aDef = hb_param( 1, HB_IT_ARRAY ); + PHB_ITEM aDef = hb_param( 1, HB_IT_ARRAY ); PHB_ITEM pAlign = hb_param( 2, HB_IT_INTEGER ); - HB_UINT uiAlign; + HB_UINT uiAlign; if( aDef ) { @@ -290,11 +290,11 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign { PHB_BASEARRAY pBaseVar = aVar->item.asArray.value; PHB_BASEARRAY pBaseDef = aDef->item.asArray.value; - HB_SIZE nLen = pBaseDef->nLen; - HB_SIZE nIndex; - HB_BYTE * Buffer; - HB_UINT uiOffset = 0, uiMemberSize; - HB_BYTE cShift; + HB_SIZE nLen = pBaseDef->nLen; + HB_SIZE nIndex; + HB_BYTE * Buffer; + HB_UINT uiOffset = 0, uiMemberSize; + HB_BYTE cShift; *puiSize = SizeOfCStructure( aDef, uiAlign ); @@ -308,134 +308,142 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign switch( ( pBaseDef->pItems + nIndex )->item.asInteger.value ) { - case CTYPE_CHAR : /* char */ - case CTYPE_UNSIGNED_CHAR : /* unsigned char */ - if( ( pBaseVar->pItems + nIndex )->type && ! HB_IS_NUMERIC( pBaseVar->pItems + nIndex ) ) + case CTYPE_CHAR: /* char */ + case CTYPE_UNSIGNED_CHAR: /* unsigned char */ + if( ( pBaseVar->pItems + nIndex )->type && ! HB_IS_NUMERIC( pBaseVar->pItems + nIndex ) ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } uiMemberSize = sizeof( char ); break; - case CTYPE_CHAR_PTR : /* char * */ - case CTYPE_UNSIGNED_CHAR_PTR : /* unsigned char * */ - if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_STRING - && ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER - && ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) + case CTYPE_CHAR_PTR: /* char * */ + case CTYPE_UNSIGNED_CHAR_PTR: /* unsigned char * */ + if( ( pBaseVar->pItems + nIndex )->type && + ( pBaseVar->pItems + nIndex )->type != HB_IT_STRING && + ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER && + ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } uiMemberSize = sizeof( char * ); break; - case CTYPE_SHORT : /* short */ - case CTYPE_UNSIGNED_SHORT : /* unsigned short */ + case CTYPE_SHORT: /* short */ + case CTYPE_UNSIGNED_SHORT: /* unsigned short */ /* Type check performed in actual translation... */ uiMemberSize = sizeof( short ); break; - case CTYPE_SHORT_PTR : /* short * */ - case CTYPE_UNSIGNED_SHORT_PTR : /* unsigned short * */ - if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER - && ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) + case CTYPE_SHORT_PTR: /* short * */ + case CTYPE_UNSIGNED_SHORT_PTR: /* unsigned short * */ + if( ( pBaseVar->pItems + nIndex )->type && + ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER && + ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } uiMemberSize = sizeof( short * ); break; - case CTYPE_INT : /* int */ - case CTYPE_UNSIGNED_INT : /* unsigned int */ + case CTYPE_INT: /* int */ + case CTYPE_UNSIGNED_INT: /* unsigned int */ /* Type check performed in actual translation... */ uiMemberSize = sizeof( int ); break; - case CTYPE_INT_PTR : /* int * */ - case CTYPE_UNSIGNED_INT_PTR : /* unsigned int * */ - if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER - && ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) + case CTYPE_INT_PTR: /* int * */ + case CTYPE_UNSIGNED_INT_PTR: /* unsigned int * */ + if( ( pBaseVar->pItems + nIndex )->type && + ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER && + ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } uiMemberSize = sizeof( int * ); break; - case CTYPE_LONG : /* long */ - case CTYPE_UNSIGNED_LONG : /* unsigned long */ + case CTYPE_LONG: /* long */ + case CTYPE_UNSIGNED_LONG: /* unsigned long */ /* Type check performed in actual translation... */ uiMemberSize = sizeof( long ); break; - case CTYPE_LONG_PTR : /* long * */ - case CTYPE_UNSIGNED_LONG_PTR : /* unsigned long * */ - if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER - && ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) + case CTYPE_LONG_PTR: /* long * */ + case CTYPE_UNSIGNED_LONG_PTR: /* unsigned long * */ + if( ( pBaseVar->pItems + nIndex )->type && + ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER && + ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } uiMemberSize = sizeof( long * ); break; - case CTYPE_FLOAT : /* float */ - if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_DOUBLE ) + case CTYPE_FLOAT: /* float */ + if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_DOUBLE ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } uiMemberSize = sizeof( float ); break; - case CTYPE_FLOAT_PTR : /* float * */ - if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_DOUBLE - && ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER - && ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) + case CTYPE_FLOAT_PTR: /* float * */ + if( ( pBaseVar->pItems + nIndex )->type && + ( pBaseVar->pItems + nIndex )->type != HB_IT_DOUBLE && + ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER && + ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } uiMemberSize = sizeof( float * ); break; - case CTYPE_DOUBLE : /* double */ - if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_DOUBLE ) + case CTYPE_DOUBLE: /* double */ + if( ( pBaseVar->pItems + nIndex )->type && + ( pBaseVar->pItems + nIndex )->type != HB_IT_DOUBLE ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } uiMemberSize = sizeof( double ); break; - case CTYPE_DOUBLE_PTR : /* double * */ - if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_DOUBLE - && ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER - && ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) + case CTYPE_DOUBLE_PTR: /* double * */ + if( ( pBaseVar->pItems + nIndex )->type && + ( pBaseVar->pItems + nIndex )->type != HB_IT_DOUBLE && + ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER && + ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } uiMemberSize = sizeof( double * ); break; - case CTYPE_VOID_PTR : /* void * (pointer) */ - if( ( pBaseVar->pItems + nIndex )->type && ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER - && ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG - && ( pBaseVar->pItems + nIndex )->type != HB_IT_STRING ) + case CTYPE_VOID_PTR: /* void * (pointer) */ + if( ( pBaseVar->pItems + nIndex )->type && + ( pBaseVar->pItems + nIndex )->type != HB_IT_POINTER && + ( pBaseVar->pItems + nIndex )->type != HB_IT_LONG && + ( pBaseVar->pItems + nIndex )->type != HB_IT_STRING ) { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } @@ -443,14 +451,13 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign break; default: - { if( ( pBaseDef->pItems + nIndex )->item.asInteger.value >= CTYPE_STRUCTURE_PTR ) { uiMemberSize = sizeof( void * ); } else if( ( pBaseDef->pItems + nIndex )->item.asInteger.value >= CTYPE_STRUCTURE ) { - PHB_ITEM pID = hb_itemPutNI( NULL, ( pBaseDef->pItems + nIndex )->item.asInteger.value ); + PHB_ITEM pID = hb_itemPutNI( NULL, ( pBaseDef->pItems + nIndex )->item.asInteger.value ); PHB_ITEM pStructure = hb_itemDoC( "HB_CSTRUCTUREFROMID", 1, pID ); hb_itemRelease( pID ); @@ -464,16 +471,15 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign else { hb_itemRelease( pStructure ); - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } - } } if( uiOffset ) @@ -490,10 +496,10 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign switch( ( pBaseDef->pItems + nIndex )->item.asInteger.value ) { - case CTYPE_CHAR : /* char */ - if( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_CHAR: /* char */ + if( ( pBaseVar->pItems + nIndex )->type ) { - *( ( char * ) ( Buffer + uiOffset ) ) = (char) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( char * ) ( Buffer + uiOffset ) ) = ( char ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); } else { @@ -501,10 +507,10 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign } break; - case CTYPE_UNSIGNED_CHAR : /* unsigned char */ - if( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_UNSIGNED_CHAR: /* unsigned char */ + if( ( pBaseVar->pItems + nIndex )->type ) { - *( ( HB_BYTE * ) ( Buffer + uiOffset ) ) = ( HB_BYTE ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( HB_BYTE * ) ( Buffer + uiOffset ) ) = ( HB_BYTE ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); } else { @@ -512,338 +518,338 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign } break; - case CTYPE_CHAR_PTR : /* char * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_CHAR_PTR: /* char * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_STRING: - *( ( char ** ) ( Buffer + uiOffset ) ) = ( pBaseVar->pItems + nIndex )->item.asString.value; + *( ( char ** ) ( Buffer + uiOffset ) ) = ( pBaseVar->pItems + nIndex )->item.asString.value; break; case HB_IT_POINTER: - *( ( char ** ) ( Buffer + uiOffset ) ) = ( char * ) ( pBaseVar->pItems + nIndex )->item.asPointer.value; + *( ( char ** ) ( Buffer + uiOffset ) ) = ( char * ) ( pBaseVar->pItems + nIndex )->item.asPointer.value; break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( char ** ) ( Buffer + uiOffset ) ) = ( char * ) ( HB_PTRDIFF ) ( pBaseVar->pItems + nIndex )->item.asInteger.value; + *( ( char ** ) ( Buffer + uiOffset ) ) = ( char * ) ( HB_PTRDIFF ) ( pBaseVar->pItems + nIndex )->item.asInteger.value; break; #endif case HB_IT_LONG: - *( ( char ** ) ( Buffer + uiOffset ) ) = ( char * ) ( HB_PTRDIFF ) ( pBaseVar->pItems + nIndex )->item.asLong.value; + *( ( char ** ) ( Buffer + uiOffset ) ) = ( char * ) ( HB_PTRDIFF ) ( pBaseVar->pItems + nIndex )->item.asLong.value; break; default: - *( ( char ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( char ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_UNSIGNED_CHAR_PTR : /* unsigned char * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_UNSIGNED_CHAR_PTR: /* unsigned char * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_STRING: - *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = ( HB_BYTE * ) ( ( pBaseVar->pItems + nIndex )->item.asString.value ); + *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = ( HB_BYTE * ) ( ( pBaseVar->pItems + nIndex )->item.asString.value ); break; case HB_IT_POINTER: - *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = ( HB_BYTE * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = ( HB_BYTE * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = ( HB_BYTE * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = ( HB_BYTE * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = ( HB_BYTE * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = ( HB_BYTE * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; default: - *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( HB_BYTE ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_SHORT : /* short */ - if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) + case CTYPE_SHORT: /* short */ + if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) { - *( ( short * ) ( Buffer + uiOffset ) ) = ( short ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( short * ) ( Buffer + uiOffset ) ) = ( short ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) { - *( ( short * ) ( Buffer + uiOffset ) ) = ( short ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( short * ) ( Buffer + uiOffset ) ) = ( short ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) { - *( ( short * ) ( Buffer + uiOffset ) ) = ( short ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); + *( ( short * ) ( Buffer + uiOffset ) ) = ( short ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) { *( ( short * ) ( Buffer + uiOffset ) ) = 0; } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } break; - case CTYPE_UNSIGNED_SHORT : /* unsigned short */ - if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) + case CTYPE_UNSIGNED_SHORT: /* unsigned short */ + if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) { - *( ( unsigned short * ) ( Buffer + uiOffset ) ) = ( unsigned short ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( unsigned short * ) ( Buffer + uiOffset ) ) = ( unsigned short ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) { - *( ( unsigned short * ) ( Buffer + uiOffset ) ) = ( unsigned short ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( unsigned short * ) ( Buffer + uiOffset ) ) = ( unsigned short ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) { - *( ( unsigned short * ) ( Buffer + uiOffset ) ) = ( unsigned short ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); + *( ( unsigned short * ) ( Buffer + uiOffset ) ) = ( unsigned short ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) { *( ( unsigned short * ) ( Buffer + uiOffset ) ) = 0; } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } break; - case CTYPE_SHORT_PTR : /* short * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_SHORT_PTR: /* short * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_POINTER: - *( ( short ** ) ( Buffer + uiOffset ) ) = ( short * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( short ** ) ( Buffer + uiOffset ) ) = ( short * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( short ** ) ( Buffer + uiOffset ) ) = ( short * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( short ** ) ( Buffer + uiOffset ) ) = ( short * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( short ** ) ( Buffer + uiOffset ) ) = ( short * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( short ** ) ( Buffer + uiOffset ) ) = ( short * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; default: - *( ( short ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( short ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_UNSIGNED_SHORT_PTR : /* unsigned short * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_UNSIGNED_SHORT_PTR: /* unsigned short * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_POINTER: - *( ( unsigned short ** ) ( Buffer + uiOffset ) ) = ( unsigned short * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( unsigned short ** ) ( Buffer + uiOffset ) ) = ( unsigned short * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( unsigned short ** ) ( Buffer + uiOffset ) ) = ( unsigned short * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( unsigned short ** ) ( Buffer + uiOffset ) ) = ( unsigned short * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( unsigned short ** ) ( Buffer + uiOffset ) ) = ( unsigned short * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( unsigned short ** ) ( Buffer + uiOffset ) ) = ( unsigned short * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; default: - *( ( unsigned short ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( unsigned short ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_INT : /* int */ - if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) + case CTYPE_INT: /* int */ + if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) { - *( ( int * ) ( Buffer + uiOffset ) ) = ( int ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( int * ) ( Buffer + uiOffset ) ) = ( int ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) { - *( ( int * ) ( Buffer + uiOffset ) ) = ( int ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( int * ) ( Buffer + uiOffset ) ) = ( int ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) { - *( ( int * ) ( Buffer + uiOffset ) ) = ( int ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); + *( ( int * ) ( Buffer + uiOffset ) ) = ( int ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) { *( ( int * ) ( Buffer + uiOffset ) ) = 0; } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } break; - case CTYPE_UNSIGNED_INT : /* unsigned int */ - if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) + case CTYPE_UNSIGNED_INT: /* unsigned int */ + if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) { - *( ( unsigned int * ) ( Buffer + uiOffset ) ) = ( unsigned int ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( unsigned int * ) ( Buffer + uiOffset ) ) = ( unsigned int ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) { - *( ( unsigned int * ) ( Buffer + uiOffset ) ) = ( unsigned int ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( unsigned int * ) ( Buffer + uiOffset ) ) = ( unsigned int ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) { - *( ( unsigned int * ) ( Buffer + uiOffset ) ) = ( unsigned int ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); + *( ( unsigned int * ) ( Buffer + uiOffset ) ) = ( unsigned int ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) { *( ( unsigned int * ) ( Buffer + uiOffset ) ) = 0; } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } break; - case CTYPE_INT_PTR : /* int * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_INT_PTR: /* int * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_POINTER: - *( ( int ** ) ( Buffer + uiOffset ) ) = ( int * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( int ** ) ( Buffer + uiOffset ) ) = ( int * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( int ** ) ( Buffer + uiOffset ) ) = ( int * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( int ** ) ( Buffer + uiOffset ) ) = ( int * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( int ** ) ( Buffer + uiOffset ) ) = ( int * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( int ** ) ( Buffer + uiOffset ) ) = ( int * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; default: - *( ( int ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( int ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_UNSIGNED_INT_PTR : /* unsigned int * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_UNSIGNED_INT_PTR: /* unsigned int * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_POINTER: - *( ( unsigned int ** ) ( Buffer + uiOffset ) ) = ( unsigned int * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( unsigned int ** ) ( Buffer + uiOffset ) ) = ( unsigned int * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( unsigned int ** ) ( Buffer + uiOffset ) ) = ( unsigned int * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( unsigned int ** ) ( Buffer + uiOffset ) ) = ( unsigned int * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( unsigned int ** ) ( Buffer + uiOffset ) ) = ( unsigned int * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( unsigned int ** ) ( Buffer + uiOffset ) ) = ( unsigned int * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; default: - *( ( unsigned int ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( unsigned int ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_LONG : /* long */ - if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) + case CTYPE_LONG: /* long */ + if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) { - *( ( long * ) ( Buffer + uiOffset ) ) = (long) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( long * ) ( Buffer + uiOffset ) ) = ( long ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) { - *( ( long * ) ( Buffer + uiOffset ) ) = (long) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( long * ) ( Buffer + uiOffset ) ) = ( long ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) { - *( ( long * ) ( Buffer + uiOffset ) ) = (long) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); + *( ( long * ) ( Buffer + uiOffset ) ) = ( long ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) { *( ( long * ) ( Buffer + uiOffset ) ) = 0; } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } break; - case CTYPE_UNSIGNED_LONG : /* unsigned long */ - if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) + case CTYPE_UNSIGNED_LONG: /* unsigned long */ + if( ( pBaseVar->pItems + nIndex )->type == HB_IT_INTEGER ) { - *( ( unsigned long * ) ( Buffer + uiOffset ) ) = (unsigned long) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( unsigned long * ) ( Buffer + uiOffset ) ) = ( unsigned long ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_LONG ) { - *( ( unsigned long * ) ( Buffer + uiOffset ) ) = (unsigned long) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( unsigned long * ) ( Buffer + uiOffset ) ) = ( unsigned long ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_DOUBLE ) { - *( ( unsigned long * ) ( Buffer + uiOffset ) ) = (unsigned long) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); + *( ( unsigned long * ) ( Buffer + uiOffset ) ) = ( unsigned long ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); } - else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) + else if( ( pBaseVar->pItems + nIndex )->type == HB_IT_NIL ) { *( ( unsigned long * ) ( Buffer + uiOffset ) ) = 0; } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return NULL; } break; - case CTYPE_LONG_PTR : /* long * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_LONG_PTR: /* long * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_POINTER: - *( ( long ** ) ( Buffer + uiOffset ) ) = ( long * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( long ** ) ( Buffer + uiOffset ) ) = ( long * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( long ** ) ( Buffer + uiOffset ) ) = ( long * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( long ** ) ( Buffer + uiOffset ) ) = ( long * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( long ** ) ( Buffer + uiOffset ) ) = ( long * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( long ** ) ( Buffer + uiOffset ) ) = ( long * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; default: - *( ( long ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( long ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_UNSIGNED_LONG_PTR : /* unsigned long * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_UNSIGNED_LONG_PTR: /* unsigned long * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_POINTER: - *( ( unsigned long ** ) ( Buffer + uiOffset ) ) = ( unsigned long * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( unsigned long ** ) ( Buffer + uiOffset ) ) = ( unsigned long * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( unsigned long ** ) ( Buffer + uiOffset ) ) = ( unsigned long * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( unsigned long ** ) ( Buffer + uiOffset ) ) = ( unsigned long * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( unsigned long ** ) ( Buffer + uiOffset ) ) = ( unsigned long * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( unsigned long ** ) ( Buffer + uiOffset ) ) = ( unsigned long * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; default: - *( ( unsigned long ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( unsigned long ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_FLOAT : /* float */ - if( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_FLOAT: /* float */ + if( ( pBaseVar->pItems + nIndex )->type ) { - *( ( float * ) ( Buffer + uiOffset ) ) = ( float ) ( pBaseVar->pItems + nIndex )->item.asDouble.value; + *( ( float * ) ( Buffer + uiOffset ) ) = ( float ) ( pBaseVar->pItems + nIndex )->item.asDouble.value; } else { @@ -851,37 +857,37 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign } break; - case CTYPE_FLOAT_PTR : /* float * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_FLOAT_PTR: /* float * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_POINTER: - *( ( float ** ) ( Buffer + uiOffset ) ) = ( float * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( float ** ) ( Buffer + uiOffset ) ) = ( float * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( float ** ) ( Buffer + uiOffset ) ) = ( float * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( float ** ) ( Buffer + uiOffset ) ) = ( float * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( float ** ) ( Buffer + uiOffset ) ) = ( float * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( float ** ) ( Buffer + uiOffset ) ) = ( float * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; /* Is this correct??? IMHO It's a bug */ case HB_IT_DOUBLE: - **( ( float ** ) ( Buffer + uiOffset ) ) = ( float ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); + **( ( float ** ) ( Buffer + uiOffset ) ) = ( float ) ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); break; default: - *( ( float ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( float ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_DOUBLE : /* double */ - if( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_DOUBLE: /* double */ + if( ( pBaseVar->pItems + nIndex )->type ) { - *( ( double * ) ( Buffer + uiOffset ) ) = ( pBaseVar->pItems + nIndex )->item.asDouble.value; + *( ( double * ) ( Buffer + uiOffset ) ) = ( pBaseVar->pItems + nIndex )->item.asDouble.value; } else { @@ -889,57 +895,56 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign } break; - case CTYPE_DOUBLE_PTR : /* double * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_DOUBLE_PTR: /* double * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_POINTER: - *( ( double ** ) ( Buffer + uiOffset ) ) = ( double * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( double ** ) ( Buffer + uiOffset ) ) = ( double * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( double ** ) ( Buffer + uiOffset ) ) = ( double * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( double ** ) ( Buffer + uiOffset ) ) = ( double * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( double ** ) ( Buffer + uiOffset ) ) = ( double * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( double ** ) ( Buffer + uiOffset ) ) = ( double * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; /* Is this correct??? IMHO It's a bug */ case HB_IT_DOUBLE: - **( ( double ** ) ( Buffer + uiOffset ) ) = ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); + **( ( double ** ) ( Buffer + uiOffset ) ) = ( ( pBaseVar->pItems + nIndex )->item.asDouble.value ); break; default: - *( ( double ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( double ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; - case CTYPE_VOID_PTR : /* void * */ - switch( ( pBaseVar->pItems + nIndex )->type ) + case CTYPE_VOID_PTR: /* void * */ + switch( ( pBaseVar->pItems + nIndex )->type ) { case HB_IT_POINTER: - *( ( void ** ) ( Buffer + uiOffset ) ) = ( void * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); + *( ( void ** ) ( Buffer + uiOffset ) ) = ( void * ) ( ( pBaseVar->pItems + nIndex )->item.asPointer.value ); break; #if UINT_MAX == ULONG_MAX case HB_IT_INTEGER: - *( ( void ** ) ( Buffer + uiOffset ) ) = ( void * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); + *( ( void ** ) ( Buffer + uiOffset ) ) = ( void * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asInteger.value ); break; #endif case HB_IT_LONG: - *( ( void ** ) ( Buffer + uiOffset ) ) = ( void * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); + *( ( void ** ) ( Buffer + uiOffset ) ) = ( void * ) ( HB_PTRDIFF ) ( ( pBaseVar->pItems + nIndex )->item.asLong.value ); break; default: - *( ( void ** ) ( Buffer + uiOffset ) ) = NULL; + *( ( void ** ) ( Buffer + uiOffset ) ) = NULL; break; } break; default: - { if( ( pBaseDef->pItems + nIndex )->item.asInteger.value > CTYPE_STRUCTURE ) { PHB_ITEM pStructure = pBaseVar->pItems + nIndex; @@ -982,8 +987,8 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign } else if( strncmp( hb_objGetClsName( pStructure ), "C Structure", 11 ) == 0 ) { - PHB_BASEARRAY pBaseStructure = pStructure->item.asArray.value; - PHB_ITEM pInternalBuffer = pBaseStructure->pItems + pBaseStructure->nLen - 1; + PHB_BASEARRAY pBaseStructure = pStructure->item.asArray.value; + PHB_ITEM pInternalBuffer = pBaseStructure->pItems + pBaseStructure->nLen - 1; hb_objSendMsg( pStructure, "VALUE", 0 ); @@ -998,14 +1003,13 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); } } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); } - } } /* printf( "Wrote %i bytes at Offset %i\n", uiMemberSize, uiOffset ); */ @@ -1018,15 +1022,15 @@ static HB_BYTE * ArrayToStructure( PHB_ITEM aVar, PHB_ITEM aDef, HB_UINT uiAlign HB_FUNC( HB_ARRAYTOSTRUCTURE ) { - PHB_ITEM aVar = hb_param( 1, HB_IT_ARRAY ); - PHB_ITEM aDef = hb_param( 2, HB_IT_ARRAY ); + PHB_ITEM aVar = hb_param( 1, HB_IT_ARRAY ); + PHB_ITEM aDef = hb_param( 2, HB_IT_ARRAY ); PHB_ITEM pAlign = hb_param( 3, HB_IT_INTEGER ); if( aVar && aDef ) { - HB_UINT uiSize; - HB_UINT uiAlign; - HB_BYTE *Buffer; + HB_UINT uiSize; + HB_UINT uiAlign; + HB_BYTE * Buffer; if( pAlign ) { @@ -1042,17 +1046,17 @@ HB_FUNC( HB_ARRAYTOSTRUCTURE ) } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "ArrayToStructure", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); } } -static PHB_ITEM StructureToArray( HB_BYTE* Buffer, HB_SIZE nBufferLen, PHB_ITEM aDef, HB_UINT uiAlign, HB_BOOL bAdoptNested, PHB_ITEM pRet ) +static PHB_ITEM StructureToArray( HB_BYTE * Buffer, HB_SIZE nBufferLen, PHB_ITEM aDef, HB_UINT uiAlign, HB_BOOL bAdoptNested, PHB_ITEM pRet ) { PHB_BASEARRAY pBaseDef = aDef->item.asArray.value; - HB_SIZE nLen = pBaseDef->nLen; - HB_SIZE nIndex; - HB_UINT uiOffset, uiMemberSize; - HB_BYTE cShift; + HB_SIZE nLen = pBaseDef->nLen; + HB_SIZE nIndex; + HB_UINT uiOffset, uiMemberSize; + HB_BYTE cShift; /* PHB_ITEM pRet = hb_itemNew( NULL ); */ PHB_BASEARRAY pBaseVar; @@ -1066,75 +1070,74 @@ static PHB_ITEM StructureToArray( HB_BYTE* Buffer, HB_SIZE nBufferLen, PHB_ITEM { switch( ( pBaseDef->pItems + nIndex )->item.asInteger.value ) { - case CTYPE_CHAR : /* char */ - case CTYPE_UNSIGNED_CHAR : /* unsigned char */ + case CTYPE_CHAR: /* char */ + case CTYPE_UNSIGNED_CHAR: /* unsigned char */ uiMemberSize = sizeof( char ); break; - case CTYPE_CHAR_PTR : /* char * */ - case CTYPE_UNSIGNED_CHAR_PTR : /* unsigned char * */ + case CTYPE_CHAR_PTR: /* char * */ + case CTYPE_UNSIGNED_CHAR_PTR: /* unsigned char * */ uiMemberSize = sizeof( char * ); break; - case CTYPE_SHORT : /* short */ - case CTYPE_UNSIGNED_SHORT : /* unsigned short */ + case CTYPE_SHORT: /* short */ + case CTYPE_UNSIGNED_SHORT: /* unsigned short */ uiMemberSize = sizeof( short ); break; - case CTYPE_SHORT_PTR : /* short * */ - case CTYPE_UNSIGNED_SHORT_PTR : /* unsigned short * */ + case CTYPE_SHORT_PTR: /* short * */ + case CTYPE_UNSIGNED_SHORT_PTR: /* unsigned short * */ uiMemberSize = sizeof( short * ); break; - case CTYPE_INT : /* int */ - case CTYPE_UNSIGNED_INT : /* unsigned int */ + case CTYPE_INT: /* int */ + case CTYPE_UNSIGNED_INT: /* unsigned int */ uiMemberSize = sizeof( int ); break; - case CTYPE_INT_PTR : /* int * */ - case CTYPE_UNSIGNED_INT_PTR : /* unsigned int * */ + case CTYPE_INT_PTR: /* int * */ + case CTYPE_UNSIGNED_INT_PTR: /* unsigned int * */ uiMemberSize = sizeof( int * ); break; - case CTYPE_LONG : /* long */ - case CTYPE_UNSIGNED_LONG : /* unsigned long */ + case CTYPE_LONG: /* long */ + case CTYPE_UNSIGNED_LONG: /* unsigned long */ uiMemberSize = sizeof( long ); break; - case CTYPE_LONG_PTR : /* long * */ - case CTYPE_UNSIGNED_LONG_PTR : /* unsigned long * */ + case CTYPE_LONG_PTR: /* long * */ + case CTYPE_UNSIGNED_LONG_PTR: /* unsigned long * */ uiMemberSize = sizeof( long * ); break; - case CTYPE_FLOAT : /* float */ + case CTYPE_FLOAT: /* float */ uiMemberSize = sizeof( float ); break; - case CTYPE_FLOAT_PTR : /* float * */ + case CTYPE_FLOAT_PTR: /* float * */ uiMemberSize = sizeof( float * ); break; - case CTYPE_DOUBLE : /* double */ + case CTYPE_DOUBLE: /* double */ uiMemberSize = sizeof( double ); break; - case CTYPE_DOUBLE_PTR : /* double * */ + case CTYPE_DOUBLE_PTR: /* double * */ uiMemberSize = sizeof( double * ); break; - case CTYPE_VOID_PTR : /* void * (pointer) */ + case CTYPE_VOID_PTR: /* void * (pointer) */ uiMemberSize = sizeof( void * ); break; default: - { if( ( pBaseDef->pItems + nIndex )->item.asInteger.value > CTYPE_STRUCTURE_PTR ) { uiMemberSize = sizeof( void * ); } else if( ( pBaseDef->pItems + nIndex )->item.asInteger.value > CTYPE_STRUCTURE ) { - PHB_ITEM pID = hb_itemPutNI( NULL, ( pBaseDef->pItems + nIndex )->item.asInteger.value ); + PHB_ITEM pID = hb_itemPutNI( NULL, ( pBaseDef->pItems + nIndex )->item.asInteger.value ); PHB_ITEM pStructure = hb_itemDoC( "HB_CSTRUCTUREFROMID", 1, pID ); hb_itemRelease( pID ); @@ -1154,10 +1157,9 @@ static PHB_ITEM StructureToArray( HB_BYTE* Buffer, HB_SIZE nBufferLen, PHB_ITEM } else { - hb_errRT_BASE( EG_ARG, 2023, NULL, "StructureToArray", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError(3) ); + hb_errRT_BASE( EG_ARG, 2023, NULL, "StructureToArray", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) ); return pRet; } - } } if( uiOffset ) @@ -1183,108 +1185,108 @@ static PHB_ITEM StructureToArray( HB_BYTE* Buffer, HB_SIZE nBufferLen, PHB_ITEM switch( ( pBaseDef->pItems + nIndex )->item.asInteger.value ) { - case CTYPE_CHAR : /* char */ - hb_itemPutNI( pBaseVar->pItems + nIndex , ( int ) *( ( char * ) ( Buffer + uiOffset ) ) ); + case CTYPE_CHAR: /* char */ + hb_itemPutNI( pBaseVar->pItems + nIndex, ( int ) *( ( char * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_UNSIGNED_CHAR : /* unsigned char */ - hb_itemPutNI( pBaseVar->pItems + nIndex , ( int ) *( ( HB_BYTE * ) ( Buffer + uiOffset ) ) ); + case CTYPE_UNSIGNED_CHAR: /* unsigned char */ + hb_itemPutNI( pBaseVar->pItems + nIndex, ( int ) *( ( HB_BYTE * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_CHAR_PTR : /* char * */ + case CTYPE_CHAR_PTR: /* char * */ if( HB_IS_STRING( pBaseVar->pItems + nIndex ) && ( pBaseVar->pItems + nIndex )->item.asString.value == *( ( char ** ) ( Buffer + uiOffset ) ) ) { /* TraceLog( NULL, "IDENTICAL: %s\n", *( ( char ** ) ( Buffer + uiOffset ) ) ); */ } - else if( !bAdoptNested ) + else if( ! bAdoptNested ) { /* TraceLog( NULL, "Static: %s\n", *( ( char ** ) ( Buffer + uiOffset ) ) ); */ - hb_itemPutCConst( pBaseVar->pItems + nIndex , *( ( char ** ) ( Buffer + uiOffset ) ) ); + hb_itemPutCConst( pBaseVar->pItems + nIndex, *( ( char ** ) ( Buffer + uiOffset ) ) ); } else { /* TraceLog( NULL, "Adopt: %s\n", *( ( char ** ) ( Buffer + uiOffset ) ) ); */ - hb_itemPutC( pBaseVar->pItems + nIndex , *( ( char ** ) ( Buffer + uiOffset ) ) ); + hb_itemPutC( pBaseVar->pItems + nIndex, *( ( char ** ) ( Buffer + uiOffset ) ) ); } break; - case CTYPE_UNSIGNED_CHAR_PTR : /* unsigned char * */ + case CTYPE_UNSIGNED_CHAR_PTR: /* unsigned char * */ if( HB_IS_STRING( pBaseVar->pItems + nIndex ) && ( pBaseVar->pItems + nIndex )->item.asString.value == *( ( char ** ) ( Buffer + uiOffset ) ) ) { /* TraceLog( NULL, "IDENTICAL: %s\n", *( ( char ** ) ( Buffer + uiOffset ) ) ); */ } - else if( !bAdoptNested ) + else if( ! bAdoptNested ) { /* TraceLog( NULL, "Static: %s\n", *( ( char ** ) ( Buffer + uiOffset ) ) ); */ - hb_itemPutCConst( pBaseVar->pItems + nIndex , *( ( char ** ) ( Buffer + uiOffset ) ) ); + hb_itemPutCConst( pBaseVar->pItems + nIndex, *( ( char ** ) ( Buffer + uiOffset ) ) ); } else { /* TraceLog( NULL, "Adopt: %s\n", *( ( char ** ) ( Buffer + uiOffset ) ) ); */ - hb_itemPutC( pBaseVar->pItems + nIndex , *( ( char ** ) ( Buffer + uiOffset ) ) ); + hb_itemPutC( pBaseVar->pItems + nIndex, *( ( char ** ) ( Buffer + uiOffset ) ) ); } break; - case CTYPE_SHORT : /* short */ - hb_itemPutNI( pBaseVar->pItems + nIndex , *( ( short * ) ( Buffer + uiOffset ) ) ); + case CTYPE_SHORT: /* short */ + hb_itemPutNI( pBaseVar->pItems + nIndex, *( ( short * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_UNSIGNED_SHORT : /* unsigned short */ - hb_itemPutNI( pBaseVar->pItems + nIndex , ( short ) *( ( unsigned short * ) ( Buffer + uiOffset ) ) ); + case CTYPE_UNSIGNED_SHORT: /* unsigned short */ + hb_itemPutNI( pBaseVar->pItems + nIndex, ( short ) *( ( unsigned short * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_SHORT_PTR : /* short * */ - case CTYPE_UNSIGNED_SHORT_PTR : /* unsigned short * */ - hb_itemPutPtr( pBaseVar->pItems + nIndex , ( void * ) ( Buffer + uiOffset ) ); + case CTYPE_SHORT_PTR: /* short * */ + case CTYPE_UNSIGNED_SHORT_PTR: /* unsigned short * */ + hb_itemPutPtr( pBaseVar->pItems + nIndex, ( void * ) ( Buffer + uiOffset ) ); break; - case CTYPE_INT : /* int */ - hb_itemPutNI( pBaseVar->pItems + nIndex , *( ( int * ) ( Buffer + uiOffset ) ) ); + case CTYPE_INT: /* int */ + hb_itemPutNI( pBaseVar->pItems + nIndex, *( ( int * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_UNSIGNED_INT : /* unsigned int */ - hb_itemPutNI( pBaseVar->pItems + nIndex , ( int ) *( ( unsigned int * ) ( Buffer + uiOffset ) ) ); + case CTYPE_UNSIGNED_INT: /* unsigned int */ + hb_itemPutNI( pBaseVar->pItems + nIndex, ( int ) *( ( unsigned int * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_INT_PTR : /* int * */ - case CTYPE_UNSIGNED_INT_PTR : /* unsigned int * */ - hb_itemPutPtr( pBaseVar->pItems + nIndex , ( void * ) ( Buffer + uiOffset ) ); + case CTYPE_INT_PTR: /* int * */ + case CTYPE_UNSIGNED_INT_PTR: /* unsigned int * */ + hb_itemPutPtr( pBaseVar->pItems + nIndex, ( void * ) ( Buffer + uiOffset ) ); break; - case CTYPE_LONG : /* long */ - hb_itemPutNL( pBaseVar->pItems + nIndex , *( ( long * ) ( Buffer + uiOffset ) ) ); + case CTYPE_LONG: /* long */ + hb_itemPutNL( pBaseVar->pItems + nIndex, *( ( long * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_UNSIGNED_LONG : /* unsigned long */ - hb_itemPutNL( pBaseVar->pItems + nIndex , ( long ) *( ( unsigned long * ) ( Buffer + uiOffset ) ) ); + case CTYPE_UNSIGNED_LONG: /* unsigned long */ + hb_itemPutNL( pBaseVar->pItems + nIndex, ( long ) *( ( unsigned long * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_LONG_PTR : /* long * */ - case CTYPE_UNSIGNED_LONG_PTR : /* unsigned long * */ - hb_itemPutPtr( pBaseVar->pItems + nIndex , ( void * ) ( Buffer + uiOffset ) ); + case CTYPE_LONG_PTR: /* long * */ + case CTYPE_UNSIGNED_LONG_PTR: /* unsigned long * */ + hb_itemPutPtr( pBaseVar->pItems + nIndex, ( void * ) ( Buffer + uiOffset ) ); break; - case CTYPE_FLOAT : /* float */ - hb_itemPutND( pBaseVar->pItems + nIndex , ( double ) *( ( float * ) ( Buffer + uiOffset ) ) ); + case CTYPE_FLOAT: /* float */ + hb_itemPutND( pBaseVar->pItems + nIndex, ( double ) *( ( float * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_FLOAT_PTR : /* float * */ - hb_itemPutPtr( pBaseVar->pItems + nIndex , ( void * ) ( Buffer + uiOffset ) ); + case CTYPE_FLOAT_PTR: /* float * */ + hb_itemPutPtr( pBaseVar->pItems + nIndex, ( void * ) ( Buffer + uiOffset ) ); break; - case CTYPE_DOUBLE : /* double */ - hb_itemPutND( pBaseVar->pItems + nIndex , *( ( double * ) ( Buffer + uiOffset ) ) ); + case CTYPE_DOUBLE: /* double */ + hb_itemPutND( pBaseVar->pItems + nIndex, *( ( double * ) ( Buffer + uiOffset ) ) ); break; - case CTYPE_DOUBLE_PTR : /* double * */ - case CTYPE_VOID_PTR : /* void * */ - hb_itemPutPtr( pBaseVar->pItems + nIndex , ( void * ) ( Buffer + uiOffset ) ); + case CTYPE_DOUBLE_PTR: /* double * */ + case CTYPE_VOID_PTR: /* void * */ + hb_itemPutPtr( pBaseVar->pItems + nIndex, ( void * ) ( Buffer + uiOffset ) ); break; default: { - HB_UINT uiNestedSize /*, uiNestedAlign */; - PHB_ITEM pID = hb_itemPutNI( NULL, ( pBaseDef->pItems + nIndex )->item.asInteger.value ); + HB_UINT uiNestedSize /*, uiNestedAlign */; + PHB_ITEM pID = hb_itemPutNI( NULL, ( pBaseDef->pItems + nIndex )->item.asInteger.value ); PHB_ITEM pStructure = hb_itemDoC( "HB_CSTRUCTUREFROMID", 1, pID ); hb_itemRelease( pID ); @@ -1306,18 +1308,18 @@ static PHB_ITEM StructureToArray( HB_BYTE* Buffer, HB_SIZE nBufferLen, PHB_ITEM { /* printf( "Offset %i Pointer: %p\n", uiOffset, *( char ** ) ( (long ** )( Buffer + uiOffset ) ) ); */ - if( *( char ** ) ( (long ** )( Buffer + uiOffset ) ) ) + if( *( char ** ) ( ( long ** ) ( Buffer + uiOffset ) ) ) { - PHB_BASEARRAY pBaseStructure = pStructure->item.asArray.value; - PHB_ITEM pInternalBuffer = pBaseStructure->pItems + pBaseStructure->nLen - 1; + PHB_BASEARRAY pBaseStructure = pStructure->item.asArray.value; + PHB_ITEM pInternalBuffer = pBaseStructure->pItems + pBaseStructure->nLen - 1; - if( !bAdoptNested ) + if( ! bAdoptNested ) { - hb_itemPutCRawStatic( pInternalBuffer, *( char ** ) ( ( long ** )( Buffer + uiOffset ) ), uiNestedSize ); + hb_itemPutCRawStatic( pInternalBuffer, *( char ** ) ( ( long ** ) ( Buffer + uiOffset ) ), uiNestedSize ); } else { - hb_itemPutCRaw( pInternalBuffer, *( char ** ) ( ( long ** )( Buffer + uiOffset ) ), uiNestedSize ); + hb_itemPutCRaw( pInternalBuffer, *( char ** ) ( ( long ** ) ( Buffer + uiOffset ) ), uiNestedSize ); } hb_objSendMsg( pStructure, "DEVALUE", 0 ); @@ -1330,16 +1332,16 @@ static PHB_ITEM StructureToArray( HB_BYTE* Buffer, HB_SIZE nBufferLen, PHB_ITEM } else { - PHB_BASEARRAY pBaseStructure = pStructure->item.asArray.value; - PHB_ITEM pInternalBuffer = pBaseStructure->pItems + pBaseStructure->nLen - 1; - HB_ITEM Adopt; + PHB_BASEARRAY pBaseStructure = pStructure->item.asArray.value; + PHB_ITEM pInternalBuffer = pBaseStructure->pItems + pBaseStructure->nLen - 1; + HB_ITEM Adopt; Adopt.type = HB_IT_LOGICAL; Adopt.item.asLogical.value = bAdoptNested; /* TraceLog( NULL, "Before Devalue\n" ); */ - hb_itemPutCRawStatic( pInternalBuffer, ( char * ) ( HB_BYTE * )( Buffer + uiOffset ), uiNestedSize ); + hb_itemPutCRawStatic( pInternalBuffer, ( char * ) ( HB_BYTE * ) ( Buffer + uiOffset ), uiNestedSize ); hb_objSendMsg( pStructure, "DEVALUE", 1, &Adopt ); @@ -1367,12 +1369,12 @@ HB_FUNC( HB_STRUCTURETOARRAY ) PHB_ITEM pAlign = hb_param( 3, HB_IT_INTEGER ); PHB_ITEM pAdopt = hb_param( 4, HB_IT_LOGICAL ); PHB_ITEM pRet = hb_param( 5, HB_IT_ARRAY ); - HB_BOOL bAdopt; + HB_BOOL bAdopt; if( Structure && aDef ) { HB_BYTE * Buffer = ( HB_BYTE * ) Structure->item.asString.value; - HB_UINT uiAlign; + HB_UINT uiAlign; if( pAlign ) uiAlign = ( HB_BYTE ) pAlign->item.asInteger.value; @@ -1425,9 +1427,9 @@ HB_FUNC( HB_STRING2POINTER ) HB_FUNC( __CSTR_COPYTO ) { static PHB_DYNS s_pVALUE = NULL; - PHB_ITEM pTarget = hb_param( 1, HB_IT_ANY ); - PHB_ITEM pStructure; - void * pPointer; + PHB_ITEM pTarget = hb_param( 1, HB_IT_ANY ); + PHB_ITEM pStructure; + void * pPointer; if( s_pVALUE == NULL ) s_pVALUE = hb_dynsymGetCase( "VALUE" ); diff --git a/harbour/contrib/xhb/datesxhb.c b/harbour/contrib/xhb/datesxhb.c index d227bb47e7..e0eb74b505 100644 --- a/harbour/contrib/xhb/datesxhb.c +++ b/harbour/contrib/xhb/datesxhb.c @@ -60,10 +60,10 @@ static HB_ULONG hb_TimeStrToSec( const char * pszTime ) { - HB_SIZE nLen; + HB_SIZE nLen; HB_ULONG ulTime = 0; - HB_TRACE(HB_TR_DEBUG, ("hb_TimeStrToSec(%s)", pszTime)); + HB_TRACE( HB_TR_DEBUG, ( "hb_TimeStrToSec(%s)", pszTime ) ); nLen = strlen( pszTime ); @@ -94,19 +94,19 @@ HB_FUNC( TIMEOFDAY ) } else { - int iSeconds = hb_parni(1); - iSeconds %= 3600*24; + int iSeconds = hb_parni( 1 ); + iSeconds %= 3600 * 24; hb_snprintf( szResult, sizeof( szResult ), "%02d:%02d:%02d", - iSeconds/3600 , (iSeconds % 3600)/60, iSeconds % 60 ); + iSeconds / 3600, ( iSeconds % 3600 ) / 60, iSeconds % 60 ); } hb_retclen( szResult, 8 ); } HB_FUNC( HMS2D ) { - int iHour = hb_parni( 1 ); - int iMin = hb_parni( 2 ); - double dSec = hb_parnd( 3 ); + int iHour = hb_parni( 1 ); + int iMin = hb_parni( 2 ); + double dSec = hb_parnd( 3 ); hb_retnd( hb_timeEncode( iHour, iMin, ( int ) dSec, ( int ) ( ( ( double ) ( dSec - ( double ) ( ( int ) dSec ) ) ) * 1000 ) ) ); } diff --git a/harbour/contrib/xhb/dbf2txt.c b/harbour/contrib/xhb/dbf2txt.c index 84b6a1740e..9be2d8b954 100644 --- a/harbour/contrib/xhb/dbf2txt.c +++ b/harbour/contrib/xhb/dbf2txt.c @@ -61,10 +61,10 @@ /* Escaping delimited strings. Need to be cleaned/optimized/improved */ static char * hb_strescape( const char * szInput, HB_ISIZ nLen, const char * cDelim ) { - HB_ISIZ nCnt = 0; + HB_ISIZ nCnt = 0; const char * szChr; - char * szEscape; - char * szReturn; + char * szEscape; + char * szReturn; szReturn = szEscape = ( char * ) hb_xgrab( nLen * 2 + 4 ); @@ -123,10 +123,8 @@ static HB_BOOL hb_ExportVar( HB_FHANDLE handle, PHB_ITEM pValue, const char * cD } /* an "L" field */ case HB_IT_LOGICAL: - { hb_fsWriteLarge( handle, ( hb_itemGetL( pValue ) ? "T" : "F" ), 1 ); break; - } /* an "N" field */ case HB_IT_INTEGER: case HB_IT_LONG: @@ -136,7 +134,7 @@ static HB_BOOL hb_ExportVar( HB_FHANDLE handle, PHB_ITEM pValue, const char * cD if( szResult ) { - HB_SIZE nLen = strlen( szResult ); + HB_SIZE nLen = strlen( szResult ); const char * szTrimmed = hb_strLTrim( szResult, &nLen ); hb_fsWriteLarge( handle, szTrimmed, strlen( szTrimmed ) ); @@ -146,7 +144,7 @@ static HB_BOOL hb_ExportVar( HB_FHANDLE handle, PHB_ITEM pValue, const char * cD } /* an "M" field or the other, might be a "V" in SixDriver */ default: - /* We do not want MEMO contents */ + /* We do not want MEMO contents */ return HB_FALSE; } return HB_TRUE; @@ -154,25 +152,25 @@ static HB_BOOL hb_ExportVar( HB_FHANDLE handle, PHB_ITEM pValue, const char * cD HB_FUNC( DBF2TEXT ) { - PHB_ITEM pWhile = hb_param( 1, HB_IT_BLOCK ); - PHB_ITEM pFor = hb_param( 2, HB_IT_BLOCK ); - PHB_ITEM pFields = hb_param( 3, HB_IT_ARRAY ); + PHB_ITEM pWhile = hb_param( 1, HB_IT_BLOCK ); + PHB_ITEM pFor = hb_param( 2, HB_IT_BLOCK ); + PHB_ITEM pFields = hb_param( 3, HB_IT_ARRAY ); const char * cDelim = hb_parc( 4 ); - HB_FHANDLE handle = ( HB_FHANDLE ) hb_parnint( 5 ); - const char * cSep = hb_parc( 6 ); - int nCount = hb_parni( 7 ); - PHB_CODEPAGE cdp = hb_cdpFind( hb_parcx( 8 ) ); + HB_FHANDLE handle = ( HB_FHANDLE ) hb_parnint( 5 ); + const char * cSep = hb_parc( 6 ); + int nCount = hb_parni( 7 ); + PHB_CODEPAGE cdp = hb_cdpFind( hb_parcx( 8 ) ); AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer(); /* Export DBF content to text file */ - HB_ISIZ nSepLen; + HB_ISIZ nSepLen; HB_USHORT uiFields = 0; HB_USHORT ui; - PHB_ITEM pTmp; - HB_BOOL bWriteSep = HB_FALSE; + PHB_ITEM pTmp; + HB_BOOL bWriteSep = HB_FALSE; HB_BOOL bEof = HB_TRUE; HB_BOOL bBof = HB_TRUE; @@ -203,7 +201,7 @@ HB_FUNC( DBF2TEXT ) nSepLen = hb_parclen( 6 ); else { - cSep = ","; + cSep = ","; nSepLen = 1; } @@ -226,7 +224,7 @@ HB_FUNC( DBF2TEXT ) /* User does not request fields, copy all fields */ if( bNoFieldPassed ) { - for( ui = 1; ui <= uiFields; ui ++ ) + for( ui = 1; ui <= uiFields; ui++ ) { if( bWriteSep ) hb_fsWriteLarge( handle, cSep, nSepLen ); diff --git a/harbour/contrib/xhb/dbgfxc.c b/harbour/contrib/xhb/dbgfxc.c index a9d841bad9..5f90789f88 100644 --- a/harbour/contrib/xhb/dbgfxc.c +++ b/harbour/contrib/xhb/dbgfxc.c @@ -64,6 +64,7 @@ static HB_BOOL s_bEmptyLogFile = HB_TRUE; HB_BOOL hb_ToOutDebugOnOff( HB_BOOL bOnOff ) { HB_BOOL bOld = s_bToOutputDebug; + s_bToOutputDebug = bOnOff; return bOld; } @@ -86,6 +87,7 @@ void hb_ToOutDebug( const char * sTraceMsg, ... ) HB_BOOL hb_ToLogFileOnOff( HB_BOOL bOnOff ) { HB_BOOL bOld = s_bToLogFile; + s_bToLogFile = bOnOff; return bOld; } @@ -93,6 +95,7 @@ HB_BOOL hb_ToLogFileOnOff( HB_BOOL bOnOff ) HB_BOOL hb_EmptyLogFile( HB_BOOL bOnOff ) { HB_BOOL bOld = s_bEmptyLogFile; + s_bEmptyLogFile = bOnOff; return bOld; } diff --git a/harbour/contrib/xhb/filestat.c b/harbour/contrib/xhb/filestat.c index f39cd0dca2..3a09b52ffb 100644 --- a/harbour/contrib/xhb/filestat.c +++ b/harbour/contrib/xhb/filestat.c @@ -65,17 +65,17 @@ #elif defined( HB_OS_WIN ) #include #if ! defined( INVALID_FILE_ATTRIBUTES ) - #define INVALID_FILE_ATTRIBUTES ( ( DWORD ) ( -1 ) ) + #define INVALID_FILE_ATTRIBUTES ( ( DWORD ) ( -1 ) ) #endif #include "hbwinuni.h" #endif HB_FUNC( FILESTATS ) { - HB_BOOL fResult = HB_FALSE; - char szAttr[ 21 ]; - HB_FOFFSET llSize = 0; - long lcDate = 0, lcTime = 0, lmDate = 0, lmTime = 0; + HB_BOOL fResult = HB_FALSE; + char szAttr[ 21 ]; + HB_FOFFSET llSize = 0; + long lcDate = 0, lcTime = 0, lmDate = 0, lmTime = 0; /* Parameter checking */ if( hb_parclen( 1 ) == 0 ) @@ -92,10 +92,10 @@ HB_FUNC( FILESTATS ) if( stat( hb_parc( 1 ), &statbuf ) == 0 ) { // determine if we can read/write/execute the file - HB_FATTR usAttr, ushbAttr = 0; - time_t ftime; + HB_FATTR usAttr, ushbAttr = 0; + time_t ftime; #if defined( HB_HAS_LOCALTIME_R ) - struct tm tms; + struct tm tms; #endif struct tm * ptms; char * pszAttr = szAttr; @@ -155,28 +155,28 @@ HB_FUNC( FILESTATS ) else if( S_ISREG( statbuf.st_mode ) && ushbAttr == 0 ) ushbAttr |= HB_FA_ARCHIVE; - llSize = ( HB_FOFFSET ) statbuf.st_size; + llSize = ( HB_FOFFSET ) statbuf.st_size; - ftime = statbuf.st_mtime; + ftime = statbuf.st_mtime; #if defined( HB_HAS_LOCALTIME_R ) - ptms = localtime_r( &ftime, &tms ); + ptms = localtime_r( &ftime, &tms ); #else - ptms = localtime( &ftime ); + ptms = localtime( &ftime ); #endif - lcDate = hb_dateEncode( ptms->tm_year + 1900, - ptms->tm_mon + 1, ptms->tm_mday ); - lcTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec; + lcDate = hb_dateEncode( ptms->tm_year + 1900, + ptms->tm_mon + 1, ptms->tm_mday ); + lcTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec; - ftime = statbuf.st_atime; + ftime = statbuf.st_atime; #if defined( HB_HAS_LOCALTIME_R ) - ptms = localtime_r( &ftime, &tms ); + ptms = localtime_r( &ftime, &tms ); #else - ptms = localtime( &ftime ); + ptms = localtime( &ftime ); #endif - lmDate = hb_dateEncode( ptms->tm_year + 1900, - ptms->tm_mon + 1, ptms->tm_mday ); - lmTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec; + lmDate = hb_dateEncode( ptms->tm_year + 1900, + ptms->tm_mon + 1, ptms->tm_mday ); + lmTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec; hb_fsAttrDecode( ushbAttr, szAttr ); @@ -187,13 +187,13 @@ HB_FUNC( FILESTATS ) #elif defined( HB_OS_WIN ) { - void * hFileName; - LPCTSTR lpFileName = HB_PARSTR( 1, &hFileName, NULL ); - DWORD dwAttribs; - WIN32_FIND_DATA ffind; - HANDLE hFind; - FILETIME filetime; - SYSTEMTIME time; + void * hFileName; + LPCTSTR lpFileName = HB_PARSTR( 1, &hFileName, NULL ); + DWORD dwAttribs; + WIN32_FIND_DATA ffind; + HANDLE hFind; + FILETIME filetime; + SYSTEMTIME time; /* Get attributes... */ dwAttribs = GetFileAttributes( lpFileName ); @@ -213,25 +213,25 @@ HB_FUNC( FILESTATS ) if( FileTimeToLocalFileTime( &ffind.ftCreationTime, &filetime ) && FileTimeToSystemTime( &filetime, &time ) ) { - lcDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay ); - lcTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond; + lcDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay ); + lcTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond; } else { - lcDate = hb_dateEncode( 0, 0, 0 ); - lcTime = 0; + lcDate = hb_dateEncode( 0, 0, 0 ); + lcTime = 0; } if( FileTimeToLocalFileTime( &ffind.ftLastAccessTime, &filetime ) && FileTimeToSystemTime( &filetime, &time ) ) { - lmDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay ); - lmTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond; + lmDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay ); + lmTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond; } else { - lcDate = hb_dateEncode( 0, 0, 0 ); - lcTime = 0; + lcDate = hb_dateEncode( 0, 0, 0 ); + lcTime = 0; } fResult = HB_TRUE; } @@ -248,18 +248,18 @@ HB_FUNC( FILESTATS ) if( findinfo ) { hb_fsAttrDecode( findinfo->attr, szAttr ); - llSize = ( HB_FOFFSET ) findinfo->size; - lcDate = findinfo->lDate; - lcTime = ( findinfo->szTime[ 0 ] - '0' ) * 36000 + - ( findinfo->szTime[ 1 ] - '0' ) * 3600 + - ( findinfo->szTime[ 3 ] - '0' ) * 600 + - ( findinfo->szTime[ 4 ] - '0' ) * 60 + - ( findinfo->szTime[ 6 ] - '0' ) * 10 + - ( findinfo->szTime[ 7 ] - '0' ); - lmDate = hb_dateEncode( 0, 0, 0 ); - lmTime = 0; + llSize = ( HB_FOFFSET ) findinfo->size; + lcDate = findinfo->lDate; + lcTime = ( findinfo->szTime[ 0 ] - '0' ) * 36000 + + ( findinfo->szTime[ 1 ] - '0' ) * 3600 + + ( findinfo->szTime[ 3 ] - '0' ) * 600 + + ( findinfo->szTime[ 4 ] - '0' ) * 60 + + ( findinfo->szTime[ 6 ] - '0' ) * 10 + + ( findinfo->szTime[ 7 ] - '0' ); + lmDate = hb_dateEncode( 0, 0, 0 ); + lmTime = 0; hb_fsFindClose( findinfo ); - fResult = HB_TRUE; + fResult = HB_TRUE; } } diff --git a/harbour/contrib/xhb/fparse.c b/harbour/contrib/xhb/fparse.c index 0976b50871..b8dc74a3cf 100644 --- a/harbour/contrib/xhb/fparse.c +++ b/harbour/contrib/xhb/fparse.c @@ -57,7 +57,7 @@ */ /* -FPARSE( cFile, cDelimiter ) -> array + FPARSE( cFile, cDelimiter ) -> array Purpose: Parse a delimited text file. @@ -70,7 +70,7 @@ FPARSE( cFile, cDelimiter ) -> array Upon success -> Two dimensional array, of which each element contains the results of parsing Upon error -> An empty array -*/ + */ #include "hbapi.h" #include "hbapifs.h" @@ -78,7 +78,7 @@ FPARSE( cFile, cDelimiter ) -> array #include "hbfast.h" /* adjustable, but this should be sufficient in normal situation */ -#define MAX_READ 4096 +#define MAX_READ 4096 static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, int * iWord ) { @@ -88,9 +88,9 @@ static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, if( nLen > 0 ) { - PHB_ITEM pTemp = hb_itemNew( NULL ); - HB_ISIZ i = 0; - int word_count = 0; + PHB_ITEM pTemp = hb_itemNew( NULL ); + HB_ISIZ i = 0; + int word_count = 0; /* booked enough memory */ char * szResult = ( char * ) hb_xgrab( nLen + 1 ); @@ -145,7 +145,7 @@ static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, } } word_count++; - hb_arrayAddForward( pReturn, hb_itemPutC( pTemp, szResult )); + hb_arrayAddForward( pReturn, hb_itemPutC( pTemp, szResult ) ); } /* delimiter found */ else if( szText[ i ] == iDelimiter ) @@ -262,10 +262,10 @@ static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, static char ** hb_tokensplit( const char * string, HB_BYTE delimiter, int iCharCount, int * iWord ) { - char * buffer, * bufptr; + char * buffer, * bufptr; char ** token_list; - char last_char = '\0'; - int word_count = 0, word_nbr; + char last_char = '\0'; + int word_count = 0, word_nbr; buffer = ( char * ) hb_xgrab( iCharCount + 1 ); @@ -299,13 +299,13 @@ static char ** hb_tokensplit( const char * string, HB_BYTE delimiter, int iCharC *bufptr = '\0'; - token_list = ( char ** ) hb_xgrab( sizeof( char * ) * ( word_count + 2 ) ); + token_list = ( char ** ) hb_xgrab( sizeof( char * ) * ( word_count + 2 ) ); token_list[ 0 ] = buffer; token_list++; bufptr = buffer; - for(word_nbr = 0; word_nbr < word_count; word_nbr++) + for( word_nbr = 0; word_nbr < word_count; word_nbr++ ) { token_list[ word_nbr ] = bufptr; bufptr += strlen( bufptr ) + 1; @@ -318,7 +318,7 @@ static char ** hb_tokensplit( const char * string, HB_BYTE delimiter, int iCharC return token_list; } -static HB_BOOL file_read( FILE *stream, char *string, int *iCharCount ) +static HB_BOOL file_read( FILE * stream, char * string, int * iCharCount ) { int ch, cnbr = 0; @@ -330,7 +330,7 @@ static HB_BOOL file_read( FILE *stream, char *string, int *iCharCount ) if( ( ch == '\n' ) || ( ch == EOF ) || ( ch == 26 ) ) { - *iCharCount = cnbr; + *iCharCount = cnbr; string[ cnbr ] = '\0'; return ch == '\n' || cnbr; } @@ -344,7 +344,7 @@ static HB_BOOL file_read( FILE *stream, char *string, int *iCharCount ) if( cnbr >= MAX_READ ) { - *iCharCount = cnbr; + *iCharCount = cnbr; string[ MAX_READ ] = '\0'; return HB_TRUE; } @@ -353,18 +353,18 @@ static HB_BOOL file_read( FILE *stream, char *string, int *iCharCount ) HB_FUNC( FPARSE ) { - FILE * inFile; - PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); + FILE * inFile; + PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); PHB_ITEM pDelim = hb_param( 2, HB_IT_STRING ); PHB_ITEM pArray; PHB_ITEM pItem; - char * string; - char ** tokens; - int iToken, iCharCount = 0; - HB_BYTE nByte; + char * string; + char ** tokens; + int iToken, iCharCount = 0; + HB_BYTE nByte; /* file parameter correctly passed */ - if( !pSrc ) + if( ! pSrc ) { hb_reta( 0 ); return; @@ -380,7 +380,7 @@ HB_FUNC( FPARSE ) inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" ); /* return empty array on failure */ - if( !inFile ) + if( ! inFile ) { hb_reta( 0 ); return; @@ -391,7 +391,7 @@ HB_FUNC( FPARSE ) /* the main array */ pArray = hb_itemArrayNew( 0 ); - pItem = hb_itemNew( NULL ); + pItem = hb_itemNew( NULL ); /* book memory for line to read */ string = ( char * ) hb_xgrab( MAX_READ + 1 ); @@ -431,17 +431,17 @@ HB_FUNC( FPARSE ) HB_FUNC( FPARSEEX ) { - FILE * inFile; - PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); + FILE * inFile; + PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); PHB_ITEM pDelim = hb_param( 2, HB_IT_STRING ); PHB_ITEM pArray; PHB_ITEM pSubArray; - char * string; - int iCharCount = 0; - HB_BYTE nByte; + char * string; + int iCharCount = 0; + HB_BYTE nByte; /* file parameter correctly passed */ - if( !pSrc ) + if( ! pSrc ) { hb_reta( 0 ); return; @@ -457,7 +457,7 @@ HB_FUNC( FPARSEEX ) inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" ); /* return empty array on failure */ - if( !inFile ) + if( ! inFile ) { hb_reta( 0 ); return; @@ -467,7 +467,7 @@ HB_FUNC( FPARSEEX ) nByte = pDelim ? ( HB_BYTE ) hb_itemGetCPtr( pDelim )[ 0 ] : ( HB_BYTE ) ','; /* the main array */ - pArray = hb_itemArrayNew( 0 ); + pArray = hb_itemArrayNew( 0 ); pSubArray = hb_itemNew( NULL ); /* book memory for line to read */ @@ -497,16 +497,16 @@ HB_FUNC( FPARSEEX ) HB_FUNC( FWORDCOUNT ) { - FILE * inFile; + FILE * inFile; PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); - char *string; - char **tokens; - int iCharCount = 0; - HB_BYTE nByte = ' '; - HB_SIZE nWordCount = 0; + char * string; + char ** tokens; + int iCharCount = 0; + HB_BYTE nByte = ' '; + HB_SIZE nWordCount = 0; /* file parameter correctly passed */ - if( !pSrc ) + if( ! pSrc ) { hb_retns( 0 ); return; @@ -522,7 +522,7 @@ HB_FUNC( FWORDCOUNT ) inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" ); /* return 0 on failure */ - if( !inFile ) + if( ! inFile ) { hb_retns( 0 ); return; @@ -556,13 +556,13 @@ HB_FUNC( FWORDCOUNT ) HB_FUNC( FLINECOUNT ) { - FILE * inFile; - PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); - HB_SIZE nLineCount = 0; - int ch; + FILE * inFile; + PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); + HB_SIZE nLineCount = 0; + int ch; /* file parameter correctly passed */ - if( !pSrc ) + if( ! pSrc ) { hb_retns( 0 ); return; @@ -578,7 +578,7 @@ HB_FUNC( FLINECOUNT ) inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" ); /* return 0 on failure */ - if( !inFile ) + if( ! inFile ) { hb_retns( 0 ); return; @@ -602,13 +602,13 @@ HB_FUNC( FLINECOUNT ) HB_FUNC( FCHARCOUNT ) { - FILE * inFile; - PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); - HB_SIZE nResult = 0; - int ch; + FILE * inFile; + PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING ); + HB_SIZE nResult = 0; + int ch; /* file parameter correctly passed */ - if( !pSrc ) + if( ! pSrc ) { hb_retns( 0 ); return; @@ -624,7 +624,7 @@ HB_FUNC( FCHARCOUNT ) inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" ); /* return 0 on failure */ - if( !inFile ) + if( ! inFile ) { hb_retns( 0 ); return; @@ -635,13 +635,13 @@ HB_FUNC( FCHARCOUNT ) { switch( ch ) { - case '\n': - case '\r': - case ' ': - case '\t': - break; - default: - nResult++; + case '\n': + case '\r': + case ' ': + case '\t': + break; + default: + nResult++; } } @@ -654,8 +654,8 @@ HB_FUNC( FCHARCOUNT ) HB_FUNC( FPARSELINE ) { - PHB_ITEM pArray; - HB_ISIZ nWords = 0; + PHB_ITEM pArray; + HB_ISIZ nWords = 0; const char * szText; pArray = hb_itemArrayNew( 0 ); @@ -664,7 +664,7 @@ HB_FUNC( FPARSELINE ) if( szText ) { const char * szDelim = hb_parc( 2 ); - int iWords = 0; + int iWords = 0; hb_ParseLine( pArray, szText, szDelim ? ( unsigned char ) *szDelim : ',', &iWords ); nWords = iWords; } diff --git a/harbour/contrib/xhb/freadlin.c b/harbour/contrib/xhb/freadlin.c index 1dd18acfe3..e3e40e167b 100644 --- a/harbour/contrib/xhb/freadlin.c +++ b/harbour/contrib/xhb/freadlin.c @@ -56,16 +56,16 @@ #include "hbapiitm.h" #include "hbapierr.h" -#define READING_BLOCK 4096 +#define READING_BLOCK 4096 static char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const char ** pTerm, HB_ISIZ * pnTermSizes, HB_ISIZ nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF ) { HB_ISIZ nPosTerm = 0, nPos, nPosition; - int nTries; + int nTries; HB_ISIZ nRead = 0, nOffset, nSize; - char * pBuff; + char * pBuff; - HB_TRACE(HB_TR_DEBUG, ("hb_fsReadLine(%p, %" HB_PFS "d, %p, %p, %" HB_PFS "d, %p, %p)", ( void * ) ( HB_PTRDIFF ) hFileHandle, *plBuffLen, pTerm, pnTermSizes, nTerms, pbFound, pbEOF )); + HB_TRACE( HB_TR_DEBUG, ( "hb_fsReadLine(%p, %" HB_PFS "d, %p, %p, %" HB_PFS "d, %p, %p)", ( void * ) ( HB_PTRDIFF ) hFileHandle, *plBuffLen, pTerm, pnTermSizes, nTerms, pbFound, pbEOF ) ); *pbFound = HB_FALSE; *pbEOF = HB_FALSE; @@ -83,8 +83,8 @@ static char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const if( nTries > 0 ) { /* pBuff can be enlarged to hold the line as needed.. */ - nSize = ( *plBuffLen * ( nTries + 1 ) ) + 1; - pBuff = ( char * ) hb_xrealloc( pBuff, nSize ); + nSize = ( *plBuffLen * ( nTries + 1 ) ) + 1; + pBuff = ( char * ) hb_xrealloc( pBuff, nSize ); nOffset += nRead; } @@ -164,22 +164,22 @@ static char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const HB_FUNC( HB_FREADLINE ) { - PHB_ITEM pTerm1; - HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnint( 1 ); + PHB_ITEM pTerm1; + HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnint( 1 ); const char ** Term; - char * pBuffer; - HB_ISIZ * pnTermSizes; - HB_ISIZ nSize = hb_parns( 4 ); - HB_ISIZ i, nTerms; - HB_BOOL bFound, bEOF; + char * pBuffer; + HB_ISIZ * pnTermSizes; + HB_ISIZ nSize = hb_parns( 4 ); + HB_ISIZ i, nTerms; + HB_BOOL bFound, bEOF; - if( ( !HB_ISBYREF( 2 ) ) || ( !HB_ISNUM( 1 ) ) ) + if( ( ! HB_ISBYREF( 2 ) ) || ( ! HB_ISNUM( 1 ) ) ) { hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 4, - hb_paramError( 1 ), - hb_paramError( 2 ), - hb_paramError( 3 ), - hb_paramError( 4 ) ); + hb_paramError( 1 ), + hb_paramError( 2 ), + hb_paramError( 3 ), + hb_paramError( 4 ) ); return; } @@ -193,14 +193,14 @@ HB_FUNC( HB_FREADLINE ) if( nTerms <= 0 ) { hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 4, - hb_paramError( 1 ), - hb_paramError( 2 ), - hb_paramError( 3 ), - hb_paramError( 4 ) ); + hb_paramError( 1 ), + hb_paramError( 2 ), + hb_paramError( 3 ), + hb_paramError( 4 ) ); return; } - Term = ( const char ** ) hb_xgrab( sizeof( char * ) * nTerms ); + Term = ( const char ** ) hb_xgrab( sizeof( char * ) * nTerms ); pnTermSizes = ( HB_ISIZ * ) hb_xgrab( sizeof( HB_ISIZ ) * nTerms ); for( i = 0; i < nTerms; i++ ) diff --git a/harbour/contrib/xhb/hbcompat.h b/harbour/contrib/xhb/hbcompat.h index a063260bfa..4b3c211a83 100644 --- a/harbour/contrib/xhb/hbcompat.h +++ b/harbour/contrib/xhb/hbcompat.h @@ -60,19 +60,21 @@ #ifdef __XHARBOUR__ - #define hb_retc_buffer( szText ) hb_retcAdopt( (szText) ) - #define hb_retclen_buffer( szText, ulLen ) hb_retclenAdopt( (szText), (ulLen) ) - #define hb_retc_const( szText ) hb_retcStatic( (szText) ) - #define hb_storclen_buffer hb_storclenAdopt - #define hb_itemPutCLConst hb_itemPutCRawStatic + #define hb_retc_buffer( szText ) hb_retcAdopt( ( szText ) ) + #define hb_retclen_buffer( szText, ulLen ) hb_retclenAdopt( ( szText ), ( ulLen ) ) + #define hb_retc_const( szText ) hb_retcStatic( ( szText ) ) + + #define hb_storclen_buffer hb_storclenAdopt + #define hb_itemPutCLConst hb_itemPutCRawStatic #else - #define hb_retcAdopt( szText ) hb_retc_buffer( (szText) ) - #define hb_retclenAdopt( szText, ulLen ) hb_retclen_buffer( (szText), (ulLen) ) - #define hb_retcStatic( szText ) hb_retc_const( (szText) ) - #define hb_storclenAdopt hb_storclen_buffer - #define hb_itemPutCRawStatic hb_itemPutCLConst + #define hb_retcAdopt( szText ) hb_retc_buffer( ( szText ) ) + #define hb_retclenAdopt( szText, ulLen ) hb_retclen_buffer( ( szText ), ( ulLen ) ) + #define hb_retcStatic( szText ) hb_retc_const( ( szText ) ) + + #define hb_storclenAdopt hb_storclen_buffer + #define hb_itemPutCRawStatic hb_itemPutCLConst #endif diff --git a/harbour/contrib/xhb/hbcrypt.c b/harbour/contrib/xhb/hbcrypt.c index e155bc57da..519f150493 100644 --- a/harbour/contrib/xhb/hbcrypt.c +++ b/harbour/contrib/xhb/hbcrypt.c @@ -52,15 +52,15 @@ */ /*************************************************************** -* NXS aglorithm is FREE SOFTWARE. It can be reused for any -* purpose, provided that this copyright notice is still present -* in the software. -* -* This program is distributed WITHOUT ANY WARRANTY that it can -* fit any particular need. -* -* NXS author is Giancarlo Niccolai -**************************************************************/ + * NXS aglorithm is FREE SOFTWARE. It can be reused for any + * purpose, provided that this copyright notice is still present + * in the software. + * + * This program is distributed WITHOUT ANY WARRANTY that it can + * fit any particular need. + * + * NXS author is Giancarlo Niccolai + **************************************************************/ #include "hbapi.h" @@ -69,15 +69,15 @@ #include "hbchksum.h" #include "hbnxs.h" -#define BASE 65521L /* largest prime smaller than 65536 */ +#define BASE 65521L /* largest prime smaller than 65536 */ /* Giancarlo Niccolai's x scrambler algorithm -* Prerequisites: -* 1) source must be at least 8 bytes long. -* 2) key must be at least 6 characters long. -* Optimal lenght is about 12 to 16 bytes. Maximum keylen is 512 bytes -* 3) cipher must be preallocated with srclen bytes -*/ + * Prerequisites: + * 1) source must be at least 8 bytes long. + * 2) key must be at least 6 characters long. + * Optimal lenght is about 12 to 16 bytes. Maximum keylen is 512 bytes + * 3) cipher must be preallocated with srclen bytes + */ void nxs_crypt( const unsigned char * source, HB_SIZE srclen, @@ -127,7 +127,7 @@ void nxs_decrypt( } /* This function scrambles the source using the letter ordering in the -* key. */ + * key. */ void nxs_scramble( const unsigned char * source, HB_SIZE srclen, const unsigned char * key, HB_SIZE keylen, @@ -160,10 +160,10 @@ void nxs_partial_scramble( HB_ISIZ * scramble, HB_SIZE len, HB_SIZE keylen ) { - HB_SIZE pos; + HB_SIZE pos; HB_USHORT kpos; - pos = 0; + pos = 0; kpos = 0; while( pos + kpos < len ) { @@ -179,8 +179,8 @@ void nxs_partial_scramble( /* Reversing scramble process */ void nxs_unscramble( - unsigned char * cipher, HB_SIZE cipherlen, - const unsigned char * key, HB_SIZE keylen ) + unsigned char * cipher, HB_SIZE cipherlen, + const unsigned char * key, HB_SIZE keylen ) { HB_ISIZ scramble[ NXS_MAX_KEYLEN ]; HB_SIZE len; @@ -209,11 +209,11 @@ void nxs_partial_unscramble( HB_ISIZ * scramble, HB_SIZE len, HB_SIZE keylen ) { - HB_SIZE pos; - HB_USHORT kpos; + HB_SIZE pos; + HB_USHORT kpos; unsigned char buf[ NXS_MAX_KEYLEN ]; - pos = 0; + pos = 0; kpos = 0; while( pos + kpos < len ) { @@ -234,8 +234,8 @@ void nxs_xorcode( unsigned char * cipher, HB_SIZE cipherlen, const unsigned char * key, HB_SIZE keylen ) { - HB_SIZE pos = 0; - HB_USHORT keypos = 0; + HB_SIZE pos = 0; + HB_USHORT keypos = 0; unsigned char c_bitrest; c_bitrest = cipher[ 0 ] >> 5; @@ -255,7 +255,7 @@ void nxs_xorcode( if( keypos == ( HB_USHORT ) keylen ) { - keypos = 0; + keypos = 0; c_bitrest = cipher[ pos ] >> 5; } } @@ -265,8 +265,8 @@ void nxs_xordecode( unsigned char * cipher, HB_SIZE cipherlen, const unsigned char * key, HB_SIZE keylen ) { - HB_SIZE pos = 0; - HB_USHORT keypos = 0; + HB_SIZE pos = 0; + HB_USHORT keypos = 0; unsigned char c_bitrest, c_bitleft; /* A very short block? */ @@ -279,10 +279,10 @@ void nxs_xordecode( { cipher[ pos ] ^= key[ keypos ]; - c_bitrest = cipher[ pos ] << 5; + c_bitrest = cipher[ pos ] << 5; cipher[ pos ] >>= 3; - cipher[ pos ] |= c_bitleft; - c_bitleft = c_bitrest; + cipher[ pos ] |= c_bitleft; + c_bitleft = c_bitrest; keypos++; pos++; @@ -307,8 +307,8 @@ void nxs_xorcyclic( const unsigned char * key, HB_SIZE keylen ) { HB_SIZE pos = 0, crcpos = 0; - HB_U32 crc1, crc2, crc3; - HB_U32 crc1l, crc2l, crc3l; + HB_U32 crc1, crc2, crc3; + HB_U32 crc1l, crc2l, crc3l; /* Build the cyclic key seed */ crc1 = keylen >= 2 ? hb_adler32( 0, ( const char * ) key + 0, keylen - 2 ) : 1; @@ -325,17 +325,17 @@ void nxs_xorcyclic( { /* this ensures portability across platforms */ cipher[ pos ] ^= ( unsigned char ) ( crc1l % 256 ); - crc1l /= 256L; + crc1l /= 256L; } else if( crcpos < 8 ) { cipher[ pos ] ^= ( unsigned char ) ( crc2l % 256 ); - crc2l /= 256L; + crc2l /= 256L; } else { cipher[ pos ] ^= ( unsigned char ) ( crc3l % 256 ); - crc3l /= 256L; + crc3l /= 256L; } crcpos++; pos++; @@ -343,19 +343,19 @@ void nxs_xorcyclic( if( crcpos == 12 ) { crcpos = 0; - crc1l = crc1 = nxs_cyclic_sequence( crc1 ); - crc2l = crc2 = nxs_cyclic_sequence( crc2 ); - crc3l = crc3 = nxs_cyclic_sequence( crc3 ); + crc1l = crc1 = nxs_cyclic_sequence( crc1 ); + crc2l = crc2 = nxs_cyclic_sequence( crc2 ); + crc3l = crc3 = nxs_cyclic_sequence( crc3 ); } } } HB_U32 nxs_cyclic_sequence( HB_U32 input ) { - HB_U32 first = input & 0xffff; + HB_U32 first = input & 0xffff; HB_U32 second = input >> 16; - HB_U32 ret = ( ( second * BASE * BASE ) & 0xffff ) | - ( ( first * BASE * BASE ) & 0xffff0000 ); + HB_U32 ret = ( ( second * BASE * BASE ) & 0xffff ) | + ( ( first * BASE * BASE ) & 0xffff0000 ); return ret; } @@ -384,23 +384,23 @@ void nxs_make_scramble( HB_ISIZ * scramble, const unsigned char * key, HB_SIZE k } /* -* END OF NXS -*/ + * END OF NXS + */ /*********************************** -* XHarbour implementation -************************************/ + * XHarbour implementation + ************************************/ /***** -* Encrypt a text using a key -* Usage: -* HB_Crypt( cSource, cKey ) --> cCipher -*/ + * Encrypt a text using a key + * Usage: + * HB_Crypt( cSource, cKey ) --> cCipher + */ HB_FUNC( HB_CRYPT ) { PHB_ITEM pSource = hb_param( 1, HB_IT_ANY ); - PHB_ITEM pKey = hb_param( 2, HB_IT_ANY ); + PHB_ITEM pKey = hb_param( 2, HB_IT_ANY ); unsigned char * cRes = ( unsigned char * ) hb_xgrab( hb_itemGetCLen( pSource ) + 8 ); @@ -413,15 +413,15 @@ HB_FUNC( HB_CRYPT ) } /***** -* Decrypt a text using a key -* Usage: -* HB_Decrypt( cCrypt, cKey ) --> cSource -*/ + * Decrypt a text using a key + * Usage: + * HB_Decrypt( cCrypt, cKey ) --> cSource + */ HB_FUNC( HB_DECRYPT ) { PHB_ITEM pSource = hb_param( 1, HB_IT_ANY ); - PHB_ITEM pKey = hb_param( 2, HB_IT_ANY ); + PHB_ITEM pKey = hb_param( 2, HB_IT_ANY ); unsigned char * cRes = ( unsigned char * ) hb_xgrab( hb_itemGetCLen( pSource ) + 8 ); diff --git a/harbour/contrib/xhb/hbnxs.h b/harbour/contrib/xhb/hbnxs.h index 825be7db70..cd3aef2e98 100644 --- a/harbour/contrib/xhb/hbnxs.h +++ b/harbour/contrib/xhb/hbnxs.h @@ -52,24 +52,24 @@ */ /*************************************************************** -* NXS aglorithm is FREE SOFTWARE. It can be reused for any -* purpose, provided that this copiright notice is still present -* in the software. -* -* This program is distributed WITHOUT ANY WARRANTY that it can -* fit any particular need. -* -* NXS author is Giancarlo Niccolai -* -* Adler 32 CRC is copyrighted by Martin Adler -**************************************************************/ + * NXS aglorithm is FREE SOFTWARE. It can be reused for any + * purpose, provided that this copiright notice is still present + * in the software. + * + * This program is distributed WITHOUT ANY WARRANTY that it can + * fit any particular need. + * + * NXS author is Giancarlo Niccolai + * + * Adler 32 CRC is copyrighted by Martin Adler + **************************************************************/ #ifndef HBNXS_H #define HBNXS_H #include "hbdefs.h" -#define NXS_MAX_KEYLEN 256 +#define NXS_MAX_KEYLEN 256 void nxs_crypt( const unsigned char * source, HB_SIZE srclen, @@ -98,7 +98,7 @@ void nxs_partial_unscramble( void nxs_unscramble( unsigned char * cipher, HB_SIZE cypherlen, - const unsigned char * key, HB_SIZE keylen); + const unsigned char * key, HB_SIZE keylen ); void nxs_xorcode( unsigned char * cipher, HB_SIZE cipherlen, diff --git a/harbour/contrib/xhb/hboutdbg.c b/harbour/contrib/xhb/hboutdbg.c index 3c6a92fe8b..c9b25b3a62 100644 --- a/harbour/contrib/xhb/hboutdbg.c +++ b/harbour/contrib/xhb/hboutdbg.c @@ -54,7 +54,7 @@ to be managed from the main thread. Every thread may use it, but only the main thread should be allowed to activate the debug window. -*/ + */ #include "hbapi.h" #include "hbapiitm.h" @@ -67,7 +67,7 @@ #include "hbwinuni.h" #endif -#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) +#if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS ) #include #include @@ -77,17 +77,17 @@ #include #include -static int s_iDebugFd = 0; +static int s_iDebugFd = 0; static char s_szDebugName[ 128 ]; -static int s_iUseDebugName = 0; -static int s_iXtermPid = 0; +static int s_iUseDebugName = 0; +static int s_iXtermPid = 0; static void debugInit( void ) { - int iPid, iFifoResult; - char szDebugTitle[ 30 ]; + int iPid, iFifoResult; + char szDebugTitle[ 30 ]; PHB_FNAME pFileName = NULL; - char szDebugName[ 128 ]; + char szDebugName[ 128 ]; if( ! s_iUseDebugName ) { @@ -112,7 +112,7 @@ static void debugInit( void ) iPid = fork(); if( iPid != 0 ) { - s_iDebugFd = open( szDebugName, O_WRONLY ); + s_iDebugFd = open( szDebugName, O_WRONLY ); s_iXtermPid = iPid; } else @@ -142,15 +142,15 @@ HB_BOOL hb_OutDebugName( PHB_ITEM pName ) { HB_BOOL bRet; -#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) - if( s_iDebugFd == 0 && pName != NULL) +#if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS ) + if( s_iDebugFd == 0 && pName != NULL ) { hb_strncpy( s_szDebugName, hb_itemGetCPtr( pName ), sizeof( s_szDebugName ) - 1 ); s_iUseDebugName = 1; bRet = HB_TRUE; } - else if( pName == NULL) + else if( pName == NULL ) { s_iUseDebugName = 0; bRet = HB_TRUE; @@ -169,7 +169,7 @@ HB_BOOL hb_OutDebugName( PHB_ITEM pName ) void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen ) { -#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS ) +#if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS ) int iStatus, iPid; /* Are we under X? */ @@ -185,7 +185,7 @@ void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen ) /* Chech if display process has terminated in the meanwhile */ if( ! s_iUseDebugName ) { - iPid = waitpid( s_iXtermPid, &iStatus, WNOHANG ); + iPid = waitpid( s_iXtermPid, &iStatus, WNOHANG ); if( iPid == s_iXtermPid || iPid == -1 ) { s_iXtermPid = 0; @@ -206,13 +206,15 @@ void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen ) { if( ( HB_SIZE ) write( s_iDebugFd, szMsg, nMsgLen ) == nMsgLen ) { - tv.tv_sec = 0; + tv.tv_sec = 0; tv.tv_usec = 100000; FD_ZERO( &wrds ); FD_SET( s_iDebugFd, &wrds ); if( select( s_iDebugFd + 1, NULL, &wrds, NULL, &tv ) > 0 ) { - if( write( s_iDebugFd, "\n", 1 ) != 1 ) {} + if( write( s_iDebugFd, "\n", 1 ) != 1 ) + { + } } } } diff --git a/harbour/contrib/xhb/hbserv.c b/harbour/contrib/xhb/hbserv.c index ac2d8b00fc..861b251a50 100644 --- a/harbour/contrib/xhb/hbserv.c +++ b/harbour/contrib/xhb/hbserv.c @@ -254,7 +254,7 @@ static void s_signalHandler( int sig, siginfo_t * info, void * v ) bSignalEnabled = HB_TRUE; /*s_serviceSetHBSig();*/ - /* TODO + #if 0 if( uiSig != HB_SIGNAL_UNKNOWN ) { if( sa_oldAction[ sig ].sa_flags & SA_SIGINFO ) @@ -262,7 +262,7 @@ static void s_signalHandler( int sig, siginfo_t * info, void * v ) else sa_oldAction[ sig ].sa_handler( sig ); } - */ + #endif } /* 2003 - @@ -1107,13 +1107,13 @@ HB_FUNC( HB_SERVICEGENERATEFPE ) #else -HB_FUNC( HB_STARTSERVICE ) {;} -HB_FUNC( HB_ISSERVICE ) {;} -HB_FUNC( HB_SERVICELOOP ) {;} -HB_FUNC( HB_PUSHSIGNALHANDLER ) {;} -HB_FUNC( HB_POPSIGNALHANDLER ) {;} -HB_FUNC( HB_SIGNALDESC ) {;} -HB_FUNC( HB_SERVICEGENERATEFAULT ) {;} -HB_FUNC( HB_SERVICEGENERATEFPE ) {;} +HB_FUNC( HB_STARTSERVICE ) {} +HB_FUNC( HB_ISSERVICE ) {} +HB_FUNC( HB_SERVICELOOP ) {} +HB_FUNC( HB_PUSHSIGNALHANDLER ) {} +HB_FUNC( HB_POPSIGNALHANDLER ) {} +HB_FUNC( HB_SIGNALDESC ) {} +HB_FUNC( HB_SERVICEGENERATEFAULT ) {} +HB_FUNC( HB_SERVICEGENERATEFPE ) {} #endif diff --git a/harbour/contrib/xhb/hbxml.c b/harbour/contrib/xhb/hbxml.c index 5667757d3a..8d77e98655 100644 --- a/harbour/contrib/xhb/hbxml.c +++ b/harbour/contrib/xhb/hbxml.c @@ -53,20 +53,20 @@ */ /* -* MXML (Mini XML) Library related copyright notice. -* (referring to Harbour/xHarbour version). -* -* This source file contains a modified version of MXML (Mini XML) -* library, developed by Giancarlo Niccolai. MXML is released under -* LGPL license; this modified version (called HBXML) is released under -* GPL with HARBOUR exception. HBXML license does not extends into -* MXML; HBXML and any modification to HBXML is to be considered as -* a part of Harbour or xHarbour projects, as it is modified to -* be specifically working in the context of the compiler's RTL. -* -* Original MXML lib can be obtained requesting it at -* Giancarlo Niccolai -*/ + * MXML (Mini XML) Library related copyright notice. + * (referring to Harbour/xHarbour version). + * + * This source file contains a modified version of MXML (Mini XML) + * library, developed by Giancarlo Niccolai. MXML is released under + * LGPL license; this modified version (called HBXML) is released under + * GPL with HARBOUR exception. HBXML license does not extends into + * MXML; HBXML and any modification to HBXML is to be considered as + * a part of Harbour or xHarbour projects, as it is modified to + * be specifically working in the context of the compiler's RTL. + * + * Original MXML lib can be obtained requesting it at + * Giancarlo Niccolai + */ #include "hbapi.h" #include "hbapierr.h" @@ -80,7 +80,7 @@ /******************************************* Static declarations -********************************************/ + ********************************************/ /* Node oriented operations */ static PHB_ITEM mxml_node_new( PHB_ITEM pDoc ); @@ -102,29 +102,29 @@ static MXML_STATUS mxml_attribute_write( MXML_OUTPUT * out, PHBXML_ATTRIBUTE att /* Refil routines */ /* Currently not used -static MXML_REFIL * mxml_refil_new( MXML_REFIL_FUNC func, char * buf, HB_ISIZ buflen, HB_ISIZ bufsize ); -static void mxml_refil_destory( MXML_REFIL * ref ); -*/ + static MXML_REFIL * mxml_refil_new( MXML_REFIL_FUNC func, char * buf, HB_ISIZ buflen, HB_ISIZ bufsize ); + static void mxml_refil_destory( MXML_REFIL * ref ); + */ static MXML_STATUS mxml_refil_setup( MXML_REFIL * ref, MXML_REFIL_FUNC func, - char * buf, HB_ISIZ buflen, HB_ISIZ bufsize ); + char * buf, HB_ISIZ buflen, HB_ISIZ bufsize ); static int mxml_refil_getc( MXML_REFIL * ref ); #define mxml_refil_ungetc( ref, ch ) ref->sparechar = ch /* Currently not used -static void mxml_refill_from_stream_func( MXML_REFIL * ref ); -*/ + static void mxml_refill_from_stream_func( MXML_REFIL * ref ); + */ static void mxml_refill_from_handle_func( MXML_REFIL * ref ); /* Output routines */ /* Currently not used -static MXML_OUTPUT *mxml_output_new( MXML_OUTPUT_FUNC func, int node_count); -static void mxml_output_destroy( MXML_OUTPUT * out ); -static MXML_STATUS mxml_output_string( MXML_OUTPUT * out, const char * s ); -*/ + static MXML_OUTPUT *mxml_output_new( MXML_OUTPUT_FUNC func, int node_count); + static void mxml_output_destroy( MXML_OUTPUT * out ); + static MXML_STATUS mxml_output_string( MXML_OUTPUT * out, const char * s ); + */ -static MXML_STATUS mxml_output_setup( MXML_OUTPUT * out, MXML_OUTPUT_FUNC func, int node_count); +static MXML_STATUS mxml_output_setup( MXML_OUTPUT * out, MXML_OUTPUT_FUNC func, int node_count ); static MXML_STATUS mxml_output_char( MXML_OUTPUT * out, int c ); static MXML_STATUS mxml_output_string_len( MXML_OUTPUT * out, const char * s, HB_ISIZ len ); static MXML_STATUS mxml_output_string_escape( MXML_OUTPUT * out, const char * s ); @@ -134,24 +134,24 @@ static void mxml_output_func_to_handle( MXML_OUTPUT * out, const char * s, HB_IS static void mxml_output_func_to_sgs( MXML_OUTPUT * out, const char * s, HB_ISIZ len ); /* Self growing string routines */ -static MXML_SGS *mxml_sgs_new( void ); +static MXML_SGS * mxml_sgs_new( void ); static void mxml_sgs_destroy( MXML_SGS * sgs ); -static char *mxml_sgs_extract( MXML_SGS * sgs ); +static char * mxml_sgs_extract( MXML_SGS * sgs ); static MXML_STATUS mxml_sgs_append_char( MXML_SGS * sgs, char c ); static MXML_STATUS mxml_sgs_append_string_len( MXML_SGS * sgs, const char * s, HB_ISIZ slen ); /* Currently not used -static MXML_STATUS mxml_sgs_append_string( MXML_SGS * sgs, char * s ); -*/ + static MXML_STATUS mxml_sgs_append_string( MXML_SGS * sgs, char * s ); + */ /* Error description */ -static const char *mxml_error_desc( MXML_ERROR_CODE code ); +static const char * mxml_error_desc( MXML_ERROR_CODE code ); /******************************************** HB-MXML glue code -*********************************************/ + *********************************************/ /* This is just a shortcut */ static void hbxml_set_doc_status( MXML_REFIL * ref, PHB_ITEM doc, PHB_ITEM pNode, int status, int error ) @@ -166,7 +166,7 @@ static void hbxml_set_doc_status( MXML_REFIL * ref, PHB_ITEM doc, PHB_ITEM pNode /* ref->status is often used as an error marker even if the error wasn't from i/o */ ref->status = ( MXML_STATUS ) status; - ref->error = ( MXML_ERROR_CODE ) error; + ref->error = ( MXML_ERROR_CODE ) error; } static void hbxml_doc_new_line( PHB_ITEM pDoc ) @@ -175,7 +175,7 @@ static void hbxml_doc_new_line( PHB_ITEM pDoc ) hb_objSendMsg( pDoc, "NLINE", 0 ); pNumber = hb_itemPutNI( NULL, hb_parni( -1 ) + 1 ); - hb_objSendMsg( pDoc, "_NLINE", 1 , pNumber ); + hb_objSendMsg( pDoc, "_NLINE", 1, pNumber ); hb_itemRelease( pNumber ); } @@ -185,7 +185,7 @@ static void hbxml_doc_new_node( PHB_ITEM pDoc, int amount ) hb_objSendMsg( pDoc, "NNODECOUNT", 0 ); pNumber = hb_itemPutNI( NULL, hb_parni( -1 ) + amount ); - hb_objSendMsg( pDoc, "_NNODECOUNT", 1 , pNumber ); + hb_objSendMsg( pDoc, "_NNODECOUNT", 1, pNumber ); hb_itemRelease( pNumber ); /* TODO: launch a callback */ @@ -194,19 +194,19 @@ static void hbxml_doc_new_node( PHB_ITEM pDoc, int amount ) /*********************************************************** HBXML lib Attribute oriented routines -************************************************************/ + ************************************************************/ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITEM pNode, PHBXML_ATTRIBUTE pDest, int style ) { - int chr, quotechr = '"'; - MXML_SGS *buf_name; - MXML_SGS *buf_attrib; - int iStatus = 0; - HB_ISIZ iPosAmper = 0; - HB_ISIZ iLenName, iLenAttrib; + int chr, quotechr = '"'; + MXML_SGS * buf_name; + MXML_SGS * buf_attrib; + int iStatus = 0; + HB_ISIZ iPosAmper = 0; + HB_ISIZ iLenName, iLenAttrib; - buf_name = mxml_sgs_new(); + buf_name = mxml_sgs_new(); buf_attrib = mxml_sgs_new(); HB_SYMBOL_UNUSED( style ); @@ -238,7 +238,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE if( mxml_sgs_append_char( buf_name, ( char ) chr ) != MXML_STATUS_OK ) { hbxml_set_doc_status( ref, pDoc, pNode, - MXML_STATUS_MALFORMED, MXML_ERROR_NAMETOOLONG ); + MXML_STATUS_MALFORMED, MXML_ERROR_NAMETOOLONG ); return MXML_STATUS_MALFORMED; } iStatus = 1; @@ -249,7 +249,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE return MXML_STATUS_MALFORMED; } } - break; + break; /* scanning for a name */ case 1: @@ -258,7 +258,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE if( mxml_sgs_append_char( buf_name, ( char ) chr ) != MXML_STATUS_OK ) { hbxml_set_doc_status( ref, pDoc, pNode, - MXML_STATUS_MALFORMED, MXML_ERROR_NAMETOOLONG ); + MXML_STATUS_MALFORMED, MXML_ERROR_NAMETOOLONG ); return MXML_STATUS_MALFORMED; } } @@ -281,7 +281,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE hbxml_set_doc_status( ref, pDoc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_MALFATT ); return MXML_STATUS_MALFORMED; } - break; + break; /* waiting for '=' */ case 2: @@ -302,17 +302,17 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE hbxml_set_doc_status( ref, pDoc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_MALFATT ); return MXML_STATUS_MALFORMED; } - break; + break; /* waiting for ' or " */ case 3: if( chr == '\'' || chr == '"' ) { - iStatus = 4; + iStatus = 4; quotechr = chr; } else if( chr == MXML_LINE_TERMINATOR ) - { + { hbxml_doc_new_line( pDoc ); } /* We repeat line terminator here for portability */ @@ -324,7 +324,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE hbxml_set_doc_status( ref, pDoc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_MALFATT ); return MXML_STATUS_MALFORMED; } - break; + break; /* scanning the attribute content ( until next quotechr ) */ case 4: @@ -332,9 +332,9 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE { iStatus = 6; } - else if( chr == '&' && !( style & MXML_STYLE_NOESCAPE ) ) + else if( chr == '&' && ! ( style & MXML_STYLE_NOESCAPE ) ) { - iStatus = 5; + iStatus = 5; iPosAmper = buf_attrib->length; mxml_sgs_append_char( buf_attrib, ( char ) chr ); /* we'll need it */ } @@ -344,7 +344,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE if( mxml_sgs_append_char( buf_attrib, ( char ) chr ) != MXML_STATUS_OK ) { hbxml_set_doc_status( ref, pDoc, pNode, - MXML_STATUS_MALFORMED, MXML_ERROR_ATTRIBTOOLONG ); + MXML_STATUS_MALFORMED, MXML_ERROR_ATTRIBTOOLONG ); return MXML_STATUS_MALFORMED; } } @@ -357,14 +357,14 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE return MXML_STATUS_MALFORMED; } } - break; + break; case 5: if( chr == ';' ) { HB_ISIZ iAmpLen = buf_attrib->length - iPosAmper - 2; /* Taking the address of a sgs buffer is legal */ - char *bp = buf_attrib->buffer + iPosAmper + 1; + char * bp = buf_attrib->buffer + iPosAmper + 1; if( iAmpLen <= 0 ) { @@ -376,23 +376,28 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE iStatus = 4; /* we see if we have a predef entity (also known as escape) */ - if( strncmp( bp, "amp", iAmpLen ) == 0 ) chr = '&'; - else if( strncmp( bp, "lt", iAmpLen ) == 0 ) chr = '<'; - else if( strncmp( bp, "gt", iAmpLen ) == 0 ) chr = '>'; - else if( strncmp( bp, "quot", iAmpLen ) == 0 ) chr = '"'; - else if( strncmp( bp, "apos", iAmpLen ) == 0 ) chr = '\''; + if( strncmp( bp, "amp", iAmpLen ) == 0 ) + chr = '&'; + else if( strncmp( bp, "lt", iAmpLen ) == 0 ) + chr = '<'; + else if( strncmp( bp, "gt", iAmpLen ) == 0 ) + chr = '>'; + else if( strncmp( bp, "quot", iAmpLen ) == 0 ) + chr = '"'; + else if( strncmp( bp, "apos", iAmpLen ) == 0 ) + chr = '\''; else if( *bp == '#' ) { - if( *( ++bp ) == 'x' ) /* Hexadecimal */ + if( *( ++bp ) == 'x' ) /* Hexadecimal */ chr = ( ( *( bp + 1 ) - '0' ) << 4 ) + ( *( bp + 2 ) - '0' ); - else /* Decimal */ + else /* Decimal */ chr = atoi( bp ); } /** Reducing an SGS length is legal */ buf_attrib->length = iPosAmper; mxml_sgs_append_char( buf_attrib, ( char ) chr ); } - else if( !( HB_ISALPHA( chr ) || HB_ISDIGIT( chr ) || chr == '#' ) ) + else if( ! ( HB_ISALPHA( chr ) || HB_ISDIGIT( chr ) || chr == '#' ) ) { /* error - we have something like & & */ hbxml_set_doc_status( ref, pDoc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_WRONGENTITY ); @@ -406,7 +411,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE return MXML_STATUS_MALFORMED; } } - break; + break; } } @@ -418,17 +423,17 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE if( iStatus < 6 ) { - hbxml_set_doc_status( ref, pDoc, pNode, MXML_STATUS_MALFORMED,MXML_ERROR_MALFATT); + hbxml_set_doc_status( ref, pDoc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_MALFATT ); mxml_sgs_destroy( buf_name ); mxml_sgs_destroy( buf_attrib ); return MXML_STATUS_MALFORMED; } /* time to create the attribute */ - iLenName = buf_name->length; + iLenName = buf_name->length; iLenAttrib = buf_attrib->length; - pDest->pName = hb_itemPutCL( pDest->pName, mxml_sgs_extract( buf_name ), iLenName ); + pDest->pName = hb_itemPutCL( pDest->pName, mxml_sgs_extract( buf_name ), iLenName ); pDest->pValue = hb_itemPutCL( pDest->pValue, mxml_sgs_extract( buf_attrib ), iLenAttrib ); return MXML_STATUS_OK; @@ -436,7 +441,7 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE static MXML_STATUS mxml_attribute_write( MXML_OUTPUT * out, PHBXML_ATTRIBUTE pAttr, int style ) { - const char *name = hb_itemGetCPtr( pAttr->pName ); + const char * name = hb_itemGetCPtr( pAttr->pName ); mxml_output_string_len( out, name, hb_itemGetCLen( pAttr->pName ) ); mxml_output_char( out, '=' ); @@ -449,7 +454,7 @@ static MXML_STATUS mxml_attribute_write( MXML_OUTPUT * out, PHBXML_ATTRIBUTE pAt else { mxml_output_string_len( out, hb_itemGetCPtr( pAttr->pValue ), - hb_itemGetCLen( pAttr->pValue ) ); + hb_itemGetCLen( pAttr->pValue ) ); } mxml_output_char( out, '"' ); @@ -491,13 +496,13 @@ static PHB_ITEM mxml_node_new( PHB_ITEM pDoc ) /** -* The unlink function is used to detach a node from the UPPER and PARENT hyerarcy. -* The node is "removed" so that siblings node are "squished", and possible parents -* are informed of the changes, so that they are able to get a new child to start -* the tree structure under them. The childs of the unlinked nodes are NOT unlinked, -* thus remains attached to the node: is like removing a branch with all its leaves. -* -*/ + * The unlink function is used to detach a node from the UPPER and PARENT hyerarcy. + * The node is "removed" so that siblings node are "squished", and possible parents + * are informed of the changes, so that they are able to get a new child to start + * the tree structure under them. The childs of the unlinked nodes are NOT unlinked, + * thus remains attached to the node: is like removing a branch with all its leaves. + * + */ static void mxml_node_unlink( PHB_ITEM pNode ) { @@ -533,7 +538,7 @@ static void mxml_node_unlink( PHB_ITEM pNode ) { /* Eventually set the next node as first child */ if( HB_IS_NIL( pPrev ) ) /* was I the first node? */ - hb_objSendMsg( pParent , "_OCHILD", 1, pNext ); + hb_objSendMsg( pParent, "_OCHILD", 1, pNext ); hb_objSendMsg( pNode, "_OPARENT", 1, pNil ); } @@ -610,9 +615,9 @@ HB_FUNC( HBXML_NODE_INSERT_AFTER ) } /** -* Creates a new tree level, so that the given node is added between -* tg and its former children. Former children of pNode are discarded -*/ + * Creates a new tree level, so that the given node is added between + * tg and its former children. Former children of pNode are discarded + */ static void mxml_node_insert_below( PHB_ITEM pTg, PHB_ITEM pNode ) { @@ -642,8 +647,8 @@ HB_FUNC( HBXML_NODE_INSERT_BELOW ) mxml_node_insert_below( hb_param( 1, HB_IT_OBJECT ), hb_param( 2, HB_IT_OBJECT ) ); } /** -* Adds a node to the bottom of the children list of tg. -*/ + * Adds a node to the bottom of the children list of tg. + */ static void mxml_node_add_below( PHB_ITEM pTg, PHB_ITEM pNode ) { @@ -661,7 +666,7 @@ static void mxml_node_add_below( PHB_ITEM pTg, PHB_ITEM pNode ) /* Scanning up to the last child */ for( ;; ) { - hb_objSendMsg( pChild, "ONEXT", 0); + hb_objSendMsg( pChild, "ONEXT", 0 ); if( HB_IS_NIL( hb_param( -1, HB_IT_ANY ) ) ) break; hb_itemMove( pChild, hb_param( -1, HB_IT_ANY ) ); @@ -683,9 +688,9 @@ HB_FUNC( HBXML_NODE_ADD_BELOW ) mxml_node_add_below( hb_param( 1, HB_IT_OBJECT ), hb_param( 2, HB_IT_OBJECT ) ); } /** -* Clones a node, but it does not sets the parent, nor the siblings; -* this clone is "floating" out of the tree hierarcy. -*/ + * Clones a node, but it does not sets the parent, nor the siblings; + * this clone is "floating" out of the tree hierarcy. + */ static PHB_ITEM mxml_node_clone( PHB_ITEM pTg ) { @@ -720,9 +725,9 @@ HB_FUNC( HBXML_NODE_CLONE ) } /** -* Clones a node and all its subtree, but it does not sets the parent, nor the siblings; -* this clone is "floating" out of the tree hierarcy. -*/ + * Clones a node and all its subtree, but it does not sets the parent, nor the siblings; + * this clone is "floating" out of the tree hierarcy. + */ static PHB_ITEM mxml_node_clone_tree( PHB_ITEM pTg ) { @@ -761,12 +766,12 @@ HB_FUNC( HBXML_NODE_CLONE_TREE ) /* reads a data node */ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, int iStyle ) { - char * buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); - int iAllocated = MXML_ALLOC_BLOCK; - int iPos = 0; - int chr; + char * buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); + int iAllocated = MXML_ALLOC_BLOCK; + int iPos = 0; + int chr; PHB_ITEM pItem; - int iStatus = 0, iPosAmper = 0; + int iStatus = 0, iPosAmper = 0; chr = mxml_refil_getc( ref ); while( chr != MXML_EOF ) @@ -781,7 +786,7 @@ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, { if( iStatus == 0 ) { - iStatus = 1; + iStatus = 1; iPosAmper = iPos; } else @@ -789,7 +794,7 @@ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, /* error - we have something like & & */ MXML_DELETOR( buf ); hbxml_set_doc_status( ref, doc, pNode, - MXML_STATUS_MALFORMED, MXML_ERROR_UNCLOSEDENTITY ); + MXML_STATUS_MALFORMED, MXML_ERROR_UNCLOSEDENTITY ); return; } } @@ -797,26 +802,31 @@ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, /* rightful closing of an entity */ if( chr == ';' && iStatus == 1 ) { - int iAmpLen = iPos - iPosAmper - 2; - char *bp = buf + iPosAmper + 1; + int iAmpLen = iPos - iPosAmper - 2; + char * bp = buf + iPosAmper + 1; if( iAmpLen <= 0 ) { /* error! - we have "&;" */ MXML_DELETOR( buf ); hbxml_set_doc_status( ref, doc, pNode, - MXML_STATUS_MALFORMED, MXML_ERROR_WRONGENTITY ); + MXML_STATUS_MALFORMED, MXML_ERROR_WRONGENTITY ); return; } iStatus = 0; /* we see if we have a predef entity (also known as escape) */ - if( strncmp( bp, "amp", iAmpLen ) == 0 ) chr = '&'; - else if( strncmp( bp, "lt", iAmpLen ) == 0 ) chr = '<'; - else if( strncmp( bp, "gt", iAmpLen ) == 0 ) chr = '>'; - else if( strncmp( bp, "quot", iAmpLen ) == 0 ) chr = '"'; - else if( strncmp( bp, "apos", iAmpLen ) == 0 ) chr = '\''; + if( strncmp( bp, "amp", iAmpLen ) == 0 ) + chr = '&'; + else if( strncmp( bp, "lt", iAmpLen ) == 0 ) + chr = '<'; + else if( strncmp( bp, "gt", iAmpLen ) == 0 ) + chr = '>'; + else if( strncmp( bp, "quot", iAmpLen ) == 0 ) + chr = '"'; + else if( strncmp( bp, "apos", iAmpLen ) == 0 ) + chr = '\''; /* if yes, we must put it at the place of the amper, and restart from there */ @@ -834,7 +844,7 @@ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, if( iPos >= iAllocated ) { iAllocated += MXML_ALLOC_BLOCK; - buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); + buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); } } @@ -847,7 +857,7 @@ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, chr = mxml_refil_getc( ref ); } - if( iStatus != 0 ) + if( iStatus != 0 ) { MXML_DELETOR( buf ); hbxml_set_doc_status( ref, doc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_UNCLOSEDENTITY ); @@ -885,13 +895,13 @@ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) { PHB_ITEM pItem; - char * buf; - int iAllocated; - int iPos = 0; - int chr; - int iStatus = 0; + char * buf; + int iAllocated; + int iPos = 0; + int chr; + int iStatus = 0; - buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); + buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); iAllocated = MXML_ALLOC_BLOCK; while( iStatus < 2 ) @@ -909,7 +919,7 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_IT { /* can't cause reallocations */ buf[ iPos++ ] = ( char ) chr; - iStatus = 1; + iStatus = 1; } else { @@ -917,7 +927,7 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_IT hbxml_set_doc_status( ref, doc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_INVNODE ); return MXML_STATUS_MALFORMED; } - break; + break; case 1: if( HB_ISALNUM( chr ) || chr == '_' || chr == '-' || chr == ':' ) @@ -937,20 +947,20 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_IT hbxml_set_doc_status( ref, doc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_INVNODE ); return MXML_STATUS_MALFORMED; } - break; + break; } if( iPos >= iAllocated ) { iAllocated += MXML_ALLOC_BLOCK; - buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); + buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); if( ! buf ) { hbxml_set_doc_status( ref, doc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_NAMETOOLONG ); return MXML_STATUS_MALFORMED; } } - } + } if( ref->status != MXML_STATUS_OK ) { @@ -972,19 +982,19 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_IT } static MXML_STATUS mxml_node_read_attributes( MXML_REFIL * ref, - PHB_ITEM pNode, PHB_ITEM doc, int style ) + PHB_ITEM pNode, PHB_ITEM doc, int style ) { HBXML_ATTRIBUTE hbAttr; - PHB_ITEM attributes; - PHB_ITEM hbName; - PHB_ITEM hbValue; - MXML_STATUS ret; + PHB_ITEM attributes; + PHB_ITEM hbName; + PHB_ITEM hbValue; + MXML_STATUS ret; - hbName = hb_itemNew( NULL ); - hbValue = hb_itemNew( NULL ); + hbName = hb_itemNew( NULL ); + hbValue = hb_itemNew( NULL ); attributes = hb_hashNew( NULL ); - hbAttr.pName = hbName; + hbAttr.pName = hbName; hbAttr.pValue = hbValue; ret = mxml_attribute_read( ref, doc, pNode, &hbAttr, style ); @@ -996,10 +1006,10 @@ static MXML_STATUS mxml_node_read_attributes( MXML_REFIL * ref, hb_objSendMsg( pNode, "_AATTRIBUTES", 1, attributes ); /* Error already set. - if( ref->status != MXML_STATUS_OK ) - { + if( ref->status != MXML_STATUS_OK ) + { hbxml_set_doc_status( ref, doc, pNode, ref->status, ref->error ); - } */ + } */ hb_itemRelease( attributes ); hb_itemRelease( hbValue ); hb_itemRelease( hbName ); @@ -1009,10 +1019,10 @@ static MXML_STATUS mxml_node_read_attributes( MXML_REFIL * ref, static void mxml_node_read_directive( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) { - char * buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); - int iAllocated = MXML_ALLOC_BLOCK; - int iPos = 0; - int chr; + char * buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); + int iAllocated = MXML_ALLOC_BLOCK; + int iPos = 0; + int chr; if( mxml_node_read_name( ref, pNode, doc ) == MXML_STATUS_OK ) { @@ -1025,7 +1035,7 @@ static void mxml_node_read_directive( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM if( iPos >= iAllocated ) { iAllocated += MXML_ALLOC_BLOCK; - buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); + buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); } if( chr == MXML_LINE_TERMINATOR ) @@ -1064,10 +1074,10 @@ static void mxml_node_read_directive( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM static void mxml_node_read_pi( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) { - int iPos = 0, iAllocated; - int chr; + int iPos = 0, iAllocated; + int chr; char * buf; - int iStatus = 0; + int iStatus = 0; /* let's read the xml PI instruction */ if( mxml_node_read_name( ref, pNode, doc ) != MXML_STATUS_OK ) @@ -1077,13 +1087,14 @@ static void mxml_node_read_pi( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) /* and then we'll put all the "data" into the data member, up to ?> */ - buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); + buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); iAllocated = MXML_ALLOC_BLOCK; while( iStatus < 2 ) { chr = mxml_refil_getc( ref ); - if( chr == MXML_EOF ) break; + if( chr == MXML_EOF ) + break; switch( iStatus ) { @@ -1092,7 +1103,7 @@ static void mxml_node_read_pi( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) if( chr == MXML_LINE_TERMINATOR ) { hbxml_doc_new_line( doc ); - buf[ iPos ++ ] = ( char ) chr; + buf[ iPos++ ] = ( char ) chr; } else if( chr == '?' ) iStatus = 1; @@ -1101,25 +1112,25 @@ static void mxml_node_read_pi( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) if( iPos > 0 || ( chr != ' ' && chr != '\n' ) ) buf[ iPos++ ] = ( char ) chr; } - break; + break; case 1: if( chr == '>' ) iStatus = 2; else { - iStatus = 0; + iStatus = 0; buf[ iPos++ ] = '?'; mxml_refil_ungetc( ref, chr ); } - break; + break; } if( iPos == iAllocated ) { iAllocated += MXML_ALLOC_BLOCK; - buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); + buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); } } @@ -1144,9 +1155,9 @@ static void mxml_node_read_pi( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) } static void mxml_node_read_tag( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, - int style ) + int style ) { - char chr; + char chr; PHB_ITEM pItem; pItem = hb_itemPutNI( NULL, MXML_TYPE_TAG ); @@ -1183,10 +1194,10 @@ static void mxml_node_read_tag( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, static void mxml_node_read_comment( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) { - int iPos = 0, iAllocated; - int chr; - char * buf; - int iStatus = 0; + int iPos = 0, iAllocated; + int chr; + char * buf; + int iStatus = 0; PHB_ITEM pItem; pItem = hb_itemPutNI( NULL, MXML_TYPE_COMMENT ); @@ -1194,13 +1205,14 @@ static void mxml_node_read_comment( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM d /* we'll put all the comment into the data member, up to -> */ - buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); + buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); iAllocated = MXML_ALLOC_BLOCK; while( iStatus < 3 ) { chr = mxml_refil_getc( ref ); - if( chr == MXML_EOF ) break; + if( chr == MXML_EOF ) + break; switch( iStatus ) { @@ -1209,42 +1221,42 @@ static void mxml_node_read_comment( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM d if( chr == MXML_LINE_TERMINATOR ) { hbxml_doc_new_line( doc ); - buf[ iPos ++ ] = ( char ) chr; + buf[ iPos++ ] = ( char ) chr; } else if( chr == '-' ) iStatus = 1; else buf[ iPos++ ] = ( char ) chr; - break; + break; case 1: if( chr == '-' ) iStatus = 2; else { - iStatus = 0; + iStatus = 0; buf[ iPos++ ] = '-'; mxml_refil_ungetc( ref, chr ); } - break; + break; case 2: if( chr == '>' ) iStatus = 3; else { - iStatus = 0; + iStatus = 0; buf[ iPos++ ] = '-'; mxml_refil_ungetc( ref, chr ); } - break; + break; } if( iPos == iAllocated ) { iAllocated += MXML_ALLOC_BLOCK; - buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); + buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); } } @@ -1268,10 +1280,10 @@ static void mxml_node_read_comment( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM d static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDoc ) { - int iPos = 0, iAllocated; - int chr; - char * buf; - int iStatus = 0; + int iPos = 0, iAllocated; + int chr; + char * buf; + int iStatus = 0; PHB_ITEM pItem; pItem = hb_itemPutNI( NULL, MXML_TYPE_CDATA ); @@ -1284,7 +1296,8 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo while( iStatus < 6 ) { chr = mxml_refil_getc( ref ); - if( chr == MXML_EOF ) break; + if( chr == MXML_EOF ) + break; if( chr == MXML_LINE_TERMINATOR ) { @@ -1305,7 +1318,7 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo { iStatus = 100; /* error */ } - break; + break; case 1: if( chr == 'D' ) @@ -1316,7 +1329,7 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo { iStatus = 100; } - break; + break; case 2: if( chr == 'A' ) @@ -1327,7 +1340,7 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo { iStatus = 100; } - break; + break; case 3: if( chr == 'T' ) @@ -1338,7 +1351,7 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo { iStatus = 100; } - break; + break; case 4: if( chr == 'A' ) @@ -1349,7 +1362,7 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo { iStatus = 100; } - break; + break; case 5: if( chr == '[' ) @@ -1360,7 +1373,7 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo { iStatus = 100; } - break; + break; } } @@ -1368,20 +1381,21 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo if( iStatus == 100 ) { hbxml_set_doc_status( ref, pDoc, pNode, - MXML_STATUS_MALFORMED, MXML_ERROR_INVNODE ); + MXML_STATUS_MALFORMED, MXML_ERROR_INVNODE ); } else { iStatus = 0; - buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); + buf = ( char * ) MXML_ALLOCATOR( MXML_ALLOC_BLOCK ); iAllocated = MXML_ALLOC_BLOCK; /* now we can read the node */ while( iStatus < 3 ) { chr = mxml_refil_getc( ref ); - if( chr == MXML_EOF ) break; + if( chr == MXML_EOF ) + break; switch( iStatus ) { @@ -1390,42 +1404,42 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo if( chr == MXML_LINE_TERMINATOR ) { hbxml_doc_new_line( pDoc ); - buf[ iPos ++ ] = ( char ) chr; + buf[ iPos++ ] = ( char ) chr; } else if( chr == ']' ) iStatus = 1; else buf[ iPos++ ] = ( char ) chr; - break; + break; case 1: if( chr == ']' ) iStatus = 2; else { - iStatus = 0; + iStatus = 0; buf[ iPos++ ] = ']'; mxml_refil_ungetc( ref, chr ); } - break; + break; case 2: if( chr == '>' ) iStatus = 3; else { - iStatus = 0; + iStatus = 0; buf[ iPos++ ] = ']'; mxml_refil_ungetc( ref, chr ); } - break; + break; } if( iPos == iAllocated ) { iAllocated += MXML_ALLOC_BLOCK; - buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); + buf = ( char * ) MXML_REALLOCATOR( buf, iAllocated ); } } @@ -1451,14 +1465,14 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo /* checking closing tag */ static int mxml_node_read_closing( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) { - char * buf; + char * buf; HB_ISIZ iPos = 0; - int chr; + int chr; HB_ISIZ iLen; - hb_objSendMsg( pNode,"CNAME", 0 ); + hb_objSendMsg( pNode, "CNAME", 0 ); iLen = hb_parclen( -1 ) + 1; - buf = ( char * ) MXML_ALLOCATOR( iLen ); + buf = ( char * ) MXML_ALLOCATOR( iLen ); chr = mxml_refil_getc( ref ); while( chr != MXML_EOF && chr != '>' && iPos < iLen ) @@ -1474,7 +1488,7 @@ static int mxml_node_read_closing( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM do return ref->status; } - if( chr != '>' || iPos == iLen || (strncmp( hb_parcx( -1 ), buf, iLen-1 ) != 0) ) + if( chr != '>' || iPos == iLen || ( strncmp( hb_parcx( -1 ), buf, iLen - 1 ) != 0 ) ) { MXML_DELETOR( buf ); hbxml_set_doc_status( ref, doc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_UNCLOSED ); @@ -1485,7 +1499,7 @@ static int mxml_node_read_closing( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM do return MXML_STATUS_OK; } -static MXML_STATUS mxml_node_read( MXML_REFIL * ref, PHB_ITEM pNode,PHB_ITEM doc, int style ) +static MXML_STATUS mxml_node_read( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, int style ) { PHB_ITEM node; @@ -1525,7 +1539,7 @@ static MXML_STATUS mxml_node_read( MXML_REFIL * ref, PHB_ITEM pNode,PHB_ITEM doc node = mxml_node_new( doc ); mxml_node_read_data( ref, node, doc, style ); } - break; + break; case 1: /* inside a node, first character */ if( chr == '/' ) @@ -1553,10 +1567,10 @@ static MXML_STATUS mxml_node_read( MXML_REFIL * ref, PHB_ITEM pNode,PHB_ITEM doc hbxml_set_doc_status( ref, doc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_INVNODE ); return MXML_STATUS_MALFORMED; } - break; + break; case 2: /* inside a possible comment (' ); mxml_output_string( out, hb_conNewLine() ); } - break; + break; case MXML_TYPE_COMMENT: - mxml_output_string_len( out, "", 4 ); - mxml_output_string( out, hb_conNewLine() ); - break; + mxml_output_string_len( out, "", 4 ); + mxml_output_string( out, hb_conNewLine() ); + break; case MXML_TYPE_CDATA: - mxml_output_string_len( out, "", 4 ); - mxml_output_string( out, hb_conNewLine() ); - break; + mxml_output_string_len( out, "", 4 ); + mxml_output_string( out, hb_conNewLine() ); + break; case MXML_TYPE_DATA: hb_objSendMsg( pNode, "CDATA", 0 ); - if( ! (style & MXML_STYLE_NOESCAPE) ) + if( ! ( style & MXML_STYLE_NOESCAPE ) ) { mxml_output_string_escape( out, hb_parcx( -1 ) ); } @@ -1825,7 +1839,7 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style mxml_output_string_len( out, hb_parcx( -1 ), hb_parclen( -1 ) ); } mxml_output_string( out, hb_conNewLine() ); - break; + break; case MXML_TYPE_DIRECTIVE: mxml_output_string_len( out, "' ); mxml_output_string( out, hb_conNewLine() ); - break; + break; case MXML_TYPE_PI: mxml_output_string_len( out, "", 2 ); mxml_output_string( out, hb_conNewLine() ); - break; + break; case MXML_TYPE_DOCUMENT: hb_objSendMsg( pNode, "OCHILD", 0 ); @@ -1869,7 +1883,7 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style hb_itemMove( pChild, hb_param( -1, HB_IT_ANY ) ); } mxml_output_string( out, hb_conNewLine() ); - break; + break; } @@ -1895,13 +1909,13 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style ***********************************************************/ /** -* Creates a new output object -* In this case, the func member is required. -* Node count is optional, but highly wanted for progress indicators. -*/ + * Creates a new output object + * In this case, the func member is required. + * Node count is optional, but highly wanted for progress indicators. + */ /* Currently not used -static MXML_OUTPUT *mxml_output_new( MXML_OUTPUT_FUNC func, int node_count) -{ + static MXML_OUTPUT *mxml_output_new( MXML_OUTPUT_FUNC func, int node_count) + { MXML_OUTPUT * ret = ( MXML_OUTPUT * ) MXML_ALLOCATOR( sizeof( MXML_OUTPUT ) ); if( ret == NULL ) @@ -1912,16 +1926,16 @@ static MXML_OUTPUT *mxml_output_new( MXML_OUTPUT_FUNC func, int node_count) MXML_DELETOR( ret ); return NULL; -} -*/ + } + */ /** -* Sets up output parameters. -* In this case, the func member is required. -* Node count is optional, but highly wanted for progress indicators. -*/ + * Sets up output parameters. + * In this case, the func member is required. + * Node count is optional, but highly wanted for progress indicators. + */ -static MXML_STATUS mxml_output_setup( MXML_OUTPUT * out, MXML_OUTPUT_FUNC func, int node_count) +static MXML_STATUS mxml_output_setup( MXML_OUTPUT * out, MXML_OUTPUT_FUNC func, int node_count ) { if( func == NULL ) { @@ -1929,27 +1943,28 @@ static MXML_STATUS mxml_output_setup( MXML_OUTPUT * out, MXML_OUTPUT_FUNC func, } out->output_func = func; - out->node_count = node_count; - out->node_done = 0; + out->node_count = node_count; + out->node_done = 0; out->status = MXML_STATUS_OK; - out->error = MXML_ERROR_NONE; + out->error = MXML_ERROR_NONE; return MXML_STATUS_ERROR; } /* Currently not used -static void mxml_output_destroy( MXML_OUTPUT * out ) -{ + static void mxml_output_destroy( MXML_OUTPUT * out ) + { MXML_DELETOR( out ); -} -*/ + } + */ /**********************************************/ /* output functions */ static MXML_STATUS mxml_output_char( MXML_OUTPUT * out, int c ) { - char chr = (char) c; + char chr = ( char ) c; + out->output_func( out, &chr, 1 ); return out->status; } @@ -1961,15 +1976,15 @@ static MXML_STATUS mxml_output_string_len( MXML_OUTPUT * out, const char * s, HB } /* Currently not used + static MXML_STATUS mxml_output_string( MXML_OUTPUT * out, const char * s ) + { + return mxml_output_string_len( out, s, strlen( s ) ); + } + */ + static MXML_STATUS mxml_output_string( MXML_OUTPUT * out, const char * s ) { - return mxml_output_string_len( out, s, strlen( s ) ); -} -*/ - -static MXML_STATUS mxml_output_string( MXML_OUTPUT * out, const char * s) -{ - out->output_func( out, s, strlen(s) ); + out->output_func( out, s, strlen( s ) ); return out->status; } @@ -1988,7 +2003,8 @@ static MXML_STATUS mxml_output_string_escape( MXML_OUTPUT * out, const char * s default: mxml_output_char( out, *s ); } - if( out->status != MXML_STATUS_OK ) break; + if( out->status != MXML_STATUS_OK ) + break; s++; } @@ -1996,25 +2012,25 @@ static MXML_STATUS mxml_output_string_escape( MXML_OUTPUT * out, const char * s } /** -* Useful function to output to file handles -*/ + * Useful function to output to file handles + */ static void mxml_output_func_to_handle( MXML_OUTPUT * out, const char * s, HB_ISIZ len ) { HB_FHANDLE fh = out->u.hFile; - HB_ISIZ olen; + HB_ISIZ olen; olen = hb_fsWriteLarge( fh, s, len ); if( olen < len ) { out->status = MXML_STATUS_ERROR; - out->error = MXML_ERROR_IO; + out->error = MXML_ERROR_IO; } } /** -* Useful function to output to self growing strings -*/ + * Useful function to output to self growing strings + */ static void mxml_output_func_to_sgs( MXML_OUTPUT * out, const char * s, HB_ISIZ len ) { MXML_SGS * sgs = ( MXML_SGS * ) out->u.vPtr; @@ -2029,7 +2045,7 @@ static void mxml_output_func_to_sgs( MXML_OUTPUT * out, const char * s, HB_ISIZ if( stat != MXML_STATUS_OK ) { out->status = MXML_STATUS_ERROR; - out->error = MXML_ERROR_NOMEM; + out->error = MXML_ERROR_NOMEM; } } @@ -2041,17 +2057,17 @@ static void mxml_output_func_to_sgs( MXML_OUTPUT * out, const char * s, HB_ISIZ /** -* Creates a new refiller object. -* If buf is null, then buflen is ignored and set to 0; the first retrival -* of a character will then lead to refil func calling. -* If the function is null, once the data has been read the reader returns -* eof. If both func and buf are NULL, the creation fails, and the function -* retunrs NULL. -*/ + * Creates a new refiller object. + * If buf is null, then buflen is ignored and set to 0; the first retrival + * of a character will then lead to refil func calling. + * If the function is null, once the data has been read the reader returns + * eof. If both func and buf are NULL, the creation fails, and the function + * retunrs NULL. + */ /* Currently unused -static MXML_REFIL * mxml_refil_new( MXML_REFIL_FUNC func, char * buf, HB_ISIZ buflen, + static MXML_REFIL * mxml_refil_new( MXML_REFIL_FUNC func, char * buf, HB_ISIZ buflen, HB_ISIZ bufsize ) -{ + { MXML_REFIL * ret = ( MXML_REFIL * ) MXML_ALLOCATOR( sizeof( MXML_REFIL ) ); if( ret == NULL ) @@ -2062,39 +2078,39 @@ static MXML_REFIL * mxml_refil_new( MXML_REFIL_FUNC func, char * buf, HB_ISIZ bu MXML_DELETOR( ret ); return NULL; -}*/ + }*/ /** -* Sets up refiller parameters. -* If buf is null, then buflen is ignored and set to 0; the first retrival -* of a character will then lead to refil func calling. Bufsize is the size -* of the allocated memory, while buflen is the count of currently valid -* characters in that buffer. -* If the function is null, once the data has been read the reader returns -* eof. If both func and buf are NULL, the function fails and returns -* MXML_STATUS_ERROR. On success, returns MXML_STATUS_OK. -* Notice: ref->data member is left to fill to the -* calling program, if this is needed. -*/ + * Sets up refiller parameters. + * If buf is null, then buflen is ignored and set to 0; the first retrival + * of a character will then lead to refil func calling. Bufsize is the size + * of the allocated memory, while buflen is the count of currently valid + * characters in that buffer. + * If the function is null, once the data has been read the reader returns + * eof. If both func and buf are NULL, the function fails and returns + * MXML_STATUS_ERROR. On success, returns MXML_STATUS_OK. + * Notice: ref->data member is left to fill to the + * calling program, if this is needed. + */ static MXML_STATUS mxml_refil_setup( MXML_REFIL * ref, MXML_REFIL_FUNC func, - char * buf, HB_ISIZ buflen, HB_ISIZ bufsize ) + char * buf, HB_ISIZ buflen, HB_ISIZ bufsize ) { if( buf == NULL && func == NULL ) return MXML_STATUS_ERROR; ref->refil_func = func; - ref->buffer = ( HB_BYTE * ) buf; + ref->buffer = ( HB_BYTE * ) buf; ref->status = MXML_STATUS_OK; - ref->error = MXML_ERROR_NONE; + ref->error = MXML_ERROR_NONE; if( buf == NULL ) ref->buflen = ref->bufsize = 0; else { - ref->buflen = buflen; + ref->buflen = buflen; ref->bufsize = bufsize; } @@ -2112,11 +2128,11 @@ static MXML_STATUS mxml_refil_setup( MXML_REFIL * ref, MXML_REFIL_FUNC func, } /* Currently not used. -static void mxml_refil_destroy ( MXML_REFIL * ref ) -{ + static void mxml_refil_destroy ( MXML_REFIL * ref ) + { MXML_DELETOR( ref ); -} -*/ + } + */ static int mxml_refil_getc( MXML_REFIL * ref ) { @@ -2144,27 +2160,27 @@ static int mxml_refil_getc( MXML_REFIL * ref ) /* implemented as a macro -void mxml_refil_ungetc( MXML_REFIL * ref, int chr ) -{ + void mxml_refil_ungetc( MXML_REFIL * ref, int chr ) + { ref->sparechar = chr; -} -*/ + } + */ /** -* Useful "fill" function that reads from a file handle -*/ + * Useful "fill" function that reads from a file handle + */ static void mxml_refill_from_handle_func( MXML_REFIL * ref ) { HB_FHANDLE fh = ( HB_FHANDLE ) ref->u.hFile; - HB_ISIZ len; + HB_ISIZ len; len = hb_fsReadLarge( fh, ref->buffer, ref->bufsize ); if( len == -1 ) { ref->status = MXML_STATUS_ERROR; - ref->error = MXML_ERROR_IO; + ref->error = MXML_ERROR_IO; } else { @@ -2178,12 +2194,12 @@ static void mxml_refill_from_handle_func( MXML_REFIL * ref ) /******************************************************** HBXML lib Self growing string routines -*********************************************************/ + *********************************************************/ /** -* Creates a new self growing string, with buffer set to -* minimal buffer length -*/ + * Creates a new self growing string, with buffer set to + * minimal buffer length + */ static MXML_SGS * mxml_sgs_new() { MXML_SGS * ret = ( MXML_SGS * ) MXML_ALLOCATOR( sizeof( MXML_SGS ) ); @@ -2199,7 +2215,7 @@ static MXML_SGS * mxml_sgs_new() } ret->allocated = MXML_ALLOC_BLOCK; - ret->length = 0; + ret->length = 0; return ret; } @@ -2217,6 +2233,7 @@ static void mxml_sgs_destroy( MXML_SGS * sgs ) static MXML_STATUS mxml_sgs_append_char( MXML_SGS * sgs, char c ) { char * buf; + sgs->buffer[ sgs->length++ ] = c; if( sgs->length >= sgs->allocated ) @@ -2227,7 +2244,7 @@ static MXML_STATUS mxml_sgs_append_char( MXML_SGS * sgs, char c ) return MXML_STATUS_ERROR; } sgs->allocated += MXML_ALLOC_BLOCK; - sgs->buffer = buf; + sgs->buffer = buf; } return MXML_STATUS_OK; @@ -2248,10 +2265,10 @@ static MXML_STATUS mxml_sgs_append_string_len( MXML_SGS * sgs, const char * s, H return MXML_STATUS_ERROR; sgs->allocated = blklen; - sgs->buffer = buf; + sgs->buffer = buf; } - memcpy( sgs->buffer + sgs->length , s, slen + 1 ); /* include also the trailing space */ + memcpy( sgs->buffer + sgs->length, s, slen + 1 ); /* include also the trailing space */ sgs->length += slen; } @@ -2260,15 +2277,16 @@ static MXML_STATUS mxml_sgs_append_string_len( MXML_SGS * sgs, const char * s, H /* Currently not used -static MXML_STATUS mxml_sgs_append_string( MXML_SGS * sgs, char * s ) -{ + static MXML_STATUS mxml_sgs_append_string( MXML_SGS * sgs, char * s ) + { return mxml_sgs_append_string_len( sgs, s, strlen( s ) ); -} -*/ + } + */ static char * mxml_sgs_extract( MXML_SGS * sgs ) { - char *ret; + char * ret; + sgs->buffer[ sgs->length ] = 0; if( sgs->allocated > sgs->length + 1 ) @@ -2290,7 +2308,7 @@ static char * mxml_sgs_extract( MXML_SGS * sgs ) Error code routines ***********************************************************/ -static const char *edesc[] = +static const char * edesc[] = { "Input/output error", "Not enough memory", @@ -2307,9 +2325,10 @@ static const char *edesc[] = "Escape/entity '&;' found" }; -static const char *mxml_error_desc( MXML_ERROR_CODE code ) +static const char * mxml_error_desc( MXML_ERROR_CODE code ) { int iCode = ( ( int ) code ) - 1; + if( iCode < 0 || iCode > ( signed ) ( sizeof( edesc ) / sizeof( char * ) ) ) return NULL; @@ -2326,21 +2345,21 @@ static const char *mxml_error_desc( MXML_ERROR_CODE code ) /** -* HB_XmlCreate( [xData] ) --> xmlDocument -* xData can be a file handle from which an XML can be read, -* a string containing an XML tree or NIL, in which case the -* document is created empty. -*/ + * HB_XmlCreate( [xData] ) --> xmlDocument + * xData can be a file handle from which an XML can be read, + * a string containing an XML tree or NIL, in which case the + * document is created empty. + */ HB_FUNC( HBXML_DATAREAD ) { - PHB_ITEM pParam = hb_param( 2, HB_IT_ANY ); - PHB_ITEM pDoc = hb_param( 1, HB_IT_OBJECT ); - int iStyle = hb_parni( 3 ); - PHB_ITEM pRoot; + PHB_ITEM pParam = hb_param( 2, HB_IT_ANY ); + PHB_ITEM pDoc = hb_param( 1, HB_IT_OBJECT ); + int iStyle = hb_parni( 3 ); + PHB_ITEM pRoot; MXML_REFIL refil; - char buffer[ 512 ], * buf; - HB_SIZE ulLen; + char buffer[ 512 ], * buf; + HB_SIZE ulLen; if( pDoc == NULL || pParam == NULL || ( ! HB_IS_STRING( pParam ) && ! HB_IS_NUMERIC( pParam ) ) ) @@ -2356,8 +2375,8 @@ HB_FUNC( HBXML_DATAREAD ) else /* can only be an integer, that is, a file handle */ { mxml_refil_setup( &refil, - mxml_refill_from_handle_func, - buffer, 0, 512 ); + mxml_refill_from_handle_func, + buffer, 0, 512 ); refil.u.vPtr = ( void * ) ( HB_PTRUINT ) hb_itemGetNInt( pParam ); } @@ -2371,9 +2390,9 @@ HB_FUNC( HBXML_DATAREAD ) /** -* HB_XmlErrorDesc( nErrorNumber ) --> cErrorDesc -* Returns a descriptive string telling what the error number is meaning. -*/ + * HB_XmlErrorDesc( nErrorNumber ) --> cErrorDesc + * Returns a descriptive string telling what the error number is meaning. + */ HB_FUNC( HB_XMLERRORDESC ) { PHB_ITEM pNum = hb_param( 1, HB_IT_NUMERIC ); @@ -2387,18 +2406,18 @@ HB_FUNC( HB_XMLERRORDESC ) /** -* HB_XmlToString( xmlDocument [, nStyle] ) --> cXml | NIL -* -* Writes an XML document to a string. -*/ + * HB_XmlToString( xmlDocument [, nStyle] ) --> cXml | NIL + * + * Writes an XML document to a string. + */ HB_FUNC( HBXML_NODE_TO_STRING ) { - PHB_ITEM pNode = hb_param( 1, HB_IT_OBJECT ); - PHB_ITEM pStyle = hb_param( 2, HB_IT_NUMERIC ); - MXML_SGS * sgs; + PHB_ITEM pNode = hb_param( 1, HB_IT_OBJECT ); + PHB_ITEM pStyle = hb_param( 2, HB_IT_NUMERIC ); + MXML_SGS * sgs; MXML_OUTPUT out; - int iStyle; + int iStyle; if( pNode == NULL ) { @@ -2412,13 +2431,13 @@ HB_FUNC( HBXML_NODE_TO_STRING ) iStyle = hb_itemGetNI( pStyle ); sgs = mxml_sgs_new(); - mxml_output_setup( &out, mxml_output_func_to_sgs , 0 ); + mxml_output_setup( &out, mxml_output_func_to_sgs, 0 ); out.u.vPtr = ( void * ) sgs; if( mxml_node_write( &out, pNode, iStyle ) == MXML_STATUS_OK ) { - HB_ISIZ iLen = sgs->length; - char * buffer = mxml_sgs_extract( sgs ); + HB_ISIZ iLen = sgs->length; + char * buffer = mxml_sgs_extract( sgs ); hb_retclen_buffer( buffer, iLen ); } else @@ -2426,18 +2445,18 @@ HB_FUNC( HBXML_NODE_TO_STRING ) } /** -* HB_XmlWrite( xmlDocument, nFileHandle, nStyle ) --> nStatus -* -* Writes an XML document to a file; returns the HB_XML status. -*/ + * HB_XmlWrite( xmlDocument, nFileHandle, nStyle ) --> nStatus + * + * Writes an XML document to a file; returns the HB_XML status. + */ HB_FUNC( HBXML_NODE_WRITE ) { - PHB_ITEM pNode = hb_param( 1, HB_IT_OBJECT ); - PHB_ITEM pHandle = hb_param( 2, HB_IT_NUMERIC ); - PHB_ITEM pStyle = hb_param( 3, HB_IT_NUMERIC ); + PHB_ITEM pNode = hb_param( 1, HB_IT_OBJECT ); + PHB_ITEM pHandle = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pStyle = hb_param( 3, HB_IT_NUMERIC ); MXML_OUTPUT out; - int iStyle, iRet; + int iStyle, iRet; if( pNode == NULL || pHandle == NULL ) { @@ -2450,7 +2469,7 @@ HB_FUNC( HBXML_NODE_WRITE ) else iStyle = hb_itemGetNI( pStyle ); - mxml_output_setup( &out, mxml_output_func_to_handle , 0 ); + mxml_output_setup( &out, mxml_output_func_to_handle, 0 ); out.u.hFile = ( HB_FHANDLE ) hb_itemGetNInt( pHandle ); iRet = mxml_node_write( &out, pNode, iStyle ); diff --git a/harbour/contrib/xhb/hbxml.h b/harbour/contrib/xhb/hbxml.h index 457db48929..45ab921577 100644 --- a/harbour/contrib/xhb/hbxml.h +++ b/harbour/contrib/xhb/hbxml.h @@ -53,51 +53,51 @@ */ /* -* MXML (Mini XML) Library related copyright notice. -* (referring to Harbour/xHarbour version). -* -* This source file contains a modified version of MXML (Mini XML) -* library, developed by Giancarlo Niccolai. MXML is released under -* LGPL license; this modified version (called HBXML) is released under -* GPL with HARBOUR exception. HBXML license does not extends into -* MXML; HBXML and any modification to HBXML is to be considered as -* a part of Harbour or xHarbour projects, as it is modified to -* be specifically working in the context of the compiler's RTL. -* -* Original MXML lib can be obtained requesting it at -* Giancarlo Niccolai -*/ + * MXML (Mini XML) Library related copyright notice. + * (referring to Harbour/xHarbour version). + * + * This source file contains a modified version of MXML (Mini XML) + * library, developed by Giancarlo Niccolai. MXML is released under + * LGPL license; this modified version (called HBXML) is released under + * GPL with HARBOUR exception. HBXML license does not extends into + * MXML; HBXML and any modification to HBXML is to be considered as + * a part of Harbour or xHarbour projects, as it is modified to + * be specifically working in the context of the compiler's RTL. + * + * Original MXML lib can be obtained requesting it at + * Giancarlo Niccolai + */ #ifndef HB_XML_H #define HB_XML_H /* Standard definitions */ #ifdef HB_OS_MAC - #define MXML_LINE_TERMINATOR '\r' - #define MXML_SOFT_LINE_TERMINATOR '\n' + #define MXML_LINE_TERMINATOR '\r' + #define MXML_SOFT_LINE_TERMINATOR '\n' #else - /*Notice, this works for unix AND windows */ - #define MXML_LINE_TERMINATOR '\n' - #define MXML_SOFT_LINE_TERMINATOR '\r' +/*Notice, this works for unix AND windows */ + #define MXML_LINE_TERMINATOR '\n' + #define MXML_SOFT_LINE_TERMINATOR '\r' #endif -#define MXML_EOF -256 +#define MXML_EOF -256 -#define MXML_ALLOC_BLOCK 128 -#define MXML_MAX_DEPTH 64 +#define MXML_ALLOC_BLOCK 128 +#define MXML_MAX_DEPTH 64 /* Styles */ -#define MXML_STYLE_INDENT 0x0001 -#define MXML_STYLE_TAB 0x0002 -#define MXML_STYLE_THREESPACES 0x0004 -#define MXML_STYLE_NOESCAPE 0x0008 +#define MXML_STYLE_INDENT 0x0001 +#define MXML_STYLE_TAB 0x0002 +#define MXML_STYLE_THREESPACES 0x0004 +#define MXML_STYLE_NOESCAPE 0x0008 /* Status vaules */ typedef enum { - MXML_STATUS_ERROR=0, - MXML_STATUS_OK=1, + MXML_STATUS_ERROR = 0, + MXML_STATUS_OK = 1, MXML_STATUS_MORE, MXML_STATUS_DONE, MXML_STATUS_UNDEFINED, @@ -108,7 +108,7 @@ typedef enum typedef enum { MXML_ERROR_NONE = 0, - MXML_ERROR_IO = 1, + MXML_ERROR_IO = 1, MXML_ERROR_NOMEM, MXML_ERROR_OUTCHAR, @@ -128,7 +128,7 @@ typedef enum typedef enum { - MXML_TYPE_TAG=0, + MXML_TYPE_TAG = 0, MXML_TYPE_COMMENT, MXML_TYPE_PI, MXML_TYPE_DIRECTIVE, @@ -141,12 +141,12 @@ typedef enum struct tag_mxml_refil; struct tag_mxml_output; -typedef void (*MXML_REFIL_FUNC)( struct tag_mxml_refil *ref ); -typedef void (*MXML_OUTPUT_FUNC)( struct tag_mxml_output *out, const char *data, HB_ISIZ len ); +typedef void ( *MXML_REFIL_FUNC )( struct tag_mxml_refil * ref ); +typedef void ( *MXML_OUTPUT_FUNC )( struct tag_mxml_output * out, const char * data, HB_ISIZ len ); /************************************************* Structures holding the XML data -**************************************************/ + **************************************************/ /* Refiller */ @@ -154,14 +154,14 @@ typedef void (*MXML_OUTPUT_FUNC)( struct tag_mxml_output *out, const char *data, typedef struct tag_mxml_refil { /* status variables */ - MXML_STATUS status; + MXML_STATUS status; MXML_ERROR_CODE error; /* buffer for reading data */ - unsigned char *buffer; - HB_ISIZ bufsize; /* size of the whole buffer */ - HB_ISIZ buflen; /* valid characters in the current buffer */ - HB_ISIZ bufpos; /* current position */ + unsigned char * buffer; + HB_ISIZ bufsize; /* size of the whole buffer */ + HB_ISIZ buflen; /* valid characters in the current buffer */ + HB_ISIZ bufpos; /* current position */ /* lenght of the stream for implementing progress indicators */ HB_ISIZ streampos; @@ -186,11 +186,11 @@ typedef struct tag_mxml_refil typedef struct tag_mxml_output { /* status variables */ - MXML_STATUS status; + MXML_STATUS status; MXML_ERROR_CODE error; /* output operation */ - MXML_OUTPUT_FUNC output_func; + MXML_OUTPUT_FUNC output_func; /* data to implement progress indicators */ int node_count; @@ -208,28 +208,29 @@ typedef struct tag_mxml_output typedef struct tag_mxml_self_growing_string { - char * buffer; + char * buffer; HB_ISIZ allocated; HB_ISIZ length; } MXML_SGS; -typedef struct _hbxml_attribute { +typedef struct _hbxml_attribute +{ PHB_ITEM pName; PHB_ITEM pValue; -} HBXML_ATTRIBUTE, *PHBXML_ATTRIBUTE; +} HBXML_ATTRIBUTE, * PHBXML_ATTRIBUTE; /* Allocator and deletor functions are meant to be redeclared by includers */ #ifndef MXML_ALLOCATOR - #define MXML_ALLOCATOR hb_xgrab + #define MXML_ALLOCATOR hb_xgrab #endif #ifndef MXML_DELETOR - #define MXML_DELETOR hb_xfree + #define MXML_DELETOR hb_xfree #endif #ifndef MXML_REALLOCATOR - #define MXML_REALLOCATOR hb_xrealloc + #define MXML_REALLOCATOR hb_xrealloc #endif #endif diff --git a/harbour/contrib/xhb/txtline.c b/harbour/contrib/xhb/txtline.c index 068e831b7b..b4d3cec365 100644 --- a/harbour/contrib/xhb/txtline.c +++ b/harbour/contrib/xhb/txtline.c @@ -58,23 +58,23 @@ static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SIZE nTabLen, HB_BOOL bWrap, const char ** pTerm, HB_SIZE * pnTermSizes, HB_SIZE nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF, HB_ISIZ * pnEnd, HB_SIZE * pnEndOffset ) { - HB_SIZE nPosTerm, nPosition; - HB_SIZE nPos, nCurrCol, nLastBlk; - HB_BOOL bBreak = HB_FALSE; + HB_SIZE nPosTerm, nPosition; + HB_SIZE nPos, nCurrCol, nLastBlk; + HB_BOOL bBreak = HB_FALSE; HB_TRACE( HB_TR_DEBUG, ( "hb_readLine(%p, %" HB_PFS "u, %" HB_PFS "u, %" HB_PFS "u, %d, %p, %p, %" HB_PFS "u, %p, %p, %p, %p)", szText, nTextLen, nLineLen, nTabLen, bWrap, pTerm, pnTermSizes, nTerms, pbFound, pbEOF, pnEnd, pnEndOffset ) ); - *pbFound = HB_FALSE; - *pbEOF = HB_FALSE; - *pnEnd = 0; - *pnEndOffset = 0; - nCurrCol = 0; - nLastBlk = 0; + *pbFound = HB_FALSE; + *pbEOF = HB_FALSE; + *pnEnd = 0; + *pnEndOffset = 0; + nCurrCol = 0; + nLastBlk = 0; if( nTextLen == 0 ) { - *pnEnd = -1; - *pbEOF = HB_TRUE; + *pnEnd = -1; + *pbEOF = HB_TRUE; return; } @@ -103,13 +103,13 @@ static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen { if( nPos == 0 ) { - *pnEnd = -1; - *pnEndOffset = pnTermSizes[ nPosTerm ]; + *pnEnd = -1; + *pnEndOffset = pnTermSizes[ nPosTerm ]; } else { - *pnEnd = nPos - 1; - *pnEndOffset = nPos + pnTermSizes[ nPosTerm ]; + *pnEnd = nPos - 1; + *pnEndOffset = nPos + pnTermSizes[ nPosTerm ]; } break; } @@ -145,16 +145,16 @@ static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen { if( ! bWrap || nLastBlk == 0 ) { - *pnEnd = nPos - 1; - *pnEndOffset = nPos; - bBreak = 1; + *pnEnd = nPos - 1; + *pnEndOffset = nPos; + bBreak = 1; break; } else if( bWrap && nLastBlk != 0 ) { - *pnEnd = nLastBlk; - *pnEndOffset = nLastBlk + 1; - bBreak = 1; + *pnEnd = nLastBlk; + *pnEndOffset = nLastBlk + 1; + bBreak = 1; break; } } @@ -162,9 +162,9 @@ static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen if( ! *pbFound && ! bBreak ) { - *pnEnd = nTextLen - 1; - *pnEndOffset = nTextLen - 1; - *pbEOF = HB_TRUE; + *pnEnd = nTextLen - 1; + *pnEndOffset = nTextLen - 1; + *pbEOF = HB_TRUE; } } @@ -193,12 +193,12 @@ static HB_ISIZ hb_tabexpand( const char * szString, char * szRet, HB_ISIZ nEnd, HB_FUNC( HB_TABEXPAND ) { - const char * szText = hb_parcx( 1 ); - HB_ISIZ nStrLen = hb_parclen( 1 ); - HB_SIZE nTabLen = hb_parns( 2 ); - HB_SIZE nTabCount = 0; - HB_ISIZ nPos, nSize; - char * szRet; + const char * szText = hb_parcx( 1 ); + HB_ISIZ nStrLen = hb_parclen( 1 ); + HB_SIZE nTabLen = hb_parns( 2 ); + HB_SIZE nTabCount = 0; + HB_ISIZ nPos, nSize; + char * szRet; for( nPos = 0; nPos < nStrLen; nPos++ ) { @@ -212,10 +212,10 @@ HB_FUNC( HB_TABEXPAND ) } else { - nSize = nStrLen + nTabCount * ( nTabLen - 1 ); - szRet = ( char * ) hb_xgrab( nSize + 1 ); + nSize = nStrLen + nTabCount * ( nTabLen - 1 ); + szRet = ( char * ) hb_xgrab( nSize + 1 ); memset( szRet, ' ', nSize ); - nStrLen = hb_tabexpand( szText, szRet, nStrLen, nTabLen ); + nStrLen = hb_tabexpand( szText, szRet, nStrLen, nTabLen ); hb_retclen_buffer( szRet, nStrLen ); } } @@ -223,20 +223,20 @@ HB_FUNC( HB_TABEXPAND ) /* HB_READLINE( , [], , , , [], @nOffSet, @nEnd, @lFound, @lEOF ) */ HB_FUNC( HB_READLINE ) { - PHB_ITEM pTerm1; - const char * szText = hb_parcx( 1 ); - const char ** pTerm; - HB_SIZE * pnTermSizes; - HB_SIZE nTabLen, nTerms; - HB_SIZE nLineSize = hb_parni( 3 ); - HB_SIZE i; - HB_BOOL bWrap = hb_parl( 5 ); - HB_BOOL bFound, bEOF; - HB_SIZE nStartOffset; - HB_SIZE nEndOffset, nTextLen; - HB_ISIZ nEnd; - PHB_ITEM pOpt; - HB_BOOL bAlloc_Term1 = HB_FALSE; + PHB_ITEM pTerm1; + const char * szText = hb_parcx( 1 ); + const char ** pTerm; + HB_SIZE * pnTermSizes; + HB_SIZE nTabLen, nTerms; + HB_SIZE nLineSize = hb_parni( 3 ); + HB_SIZE i; + HB_BOOL bWrap = hb_parl( 5 ); + HB_BOOL bFound, bEOF; + HB_SIZE nStartOffset; + HB_SIZE nEndOffset, nTextLen; + HB_ISIZ nEnd; + PHB_ITEM pOpt; + HB_BOOL bAlloc_Term1 = HB_FALSE; if( ! HB_ISCHAR( 1 ) ) { @@ -244,10 +244,10 @@ HB_FUNC( HB_READLINE ) return; } - nTextLen = hb_parclen( 1 ); - nTabLen = hb_parclen( 4 ); + nTextLen = hb_parclen( 1 ); + nTabLen = hb_parclen( 4 ); - nStartOffset = hb_parns( 6 ); + nStartOffset = hb_parns( 6 ); if( ! ( HB_ISARRAY( 2 ) || HB_ISCHAR( 2 ) ) ) { @@ -259,8 +259,8 @@ HB_FUNC( HB_READLINE ) hb_itemRelease( pEOL ); } - pTerm1 = hb_itemPutC( NULL, hb_setGetCPtr( HB_SET_EOL ) ); - bAlloc_Term1 = HB_TRUE; + pTerm1 = hb_itemPutC( NULL, hb_setGetCPtr( HB_SET_EOL ) ); + bAlloc_Term1 = HB_TRUE; } else pTerm1 = hb_param( 2, HB_IT_ANY ); @@ -276,17 +276,17 @@ HB_FUNC( HB_READLINE ) for( i = 0; i < nTerms; i++ ) { hb_arrayGet( pTerm1, i + 1, pOpt ); - pTerm[ i ] = hb_itemGetCPtr( pOpt ); - pnTermSizes[ i ] = hb_itemGetCLen( pOpt ); + pTerm[ i ] = hb_itemGetCPtr( pOpt ); + pnTermSizes[ i ] = hb_itemGetCLen( pOpt ); } } else { - pTerm = ( const char ** ) hb_xgrab( sizeof( char * ) ); - pnTermSizes = ( HB_SIZE * ) hb_xgrab( sizeof( HB_SIZE ) * 1 ); - pTerm[ 0 ] = hb_itemGetCPtr( pTerm1 ); - pnTermSizes[ 0 ] = hb_itemGetCLen( pTerm1 ); - nTerms = 1; + pTerm = ( const char ** ) hb_xgrab( sizeof( char * ) ); + pnTermSizes = ( HB_SIZE * ) hb_xgrab( sizeof( HB_SIZE ) * 1 ); + pTerm[ 0 ] = hb_itemGetCPtr( pTerm1 ); + pnTermSizes[ 0 ] = hb_itemGetCLen( pTerm1 ); + nTerms = 1; } hb_itemRelease( pOpt ); diff --git a/harbour/contrib/xhb/xhb.h b/harbour/contrib/xhb/xhb.h index e76076bd2f..de08e53f98 100644 --- a/harbour/contrib/xhb/xhb.h +++ b/harbour/contrib/xhb/xhb.h @@ -69,7 +69,7 @@ extern HB_EXPORT HB_BOOL hb_ToLogFileOnOff( HB_BOOL bOnOff ); extern HB_EXPORT HB_BOOL hb_EmptyLogFile( HB_BOOL bOnOff ); extern HB_EXPORT void hb_ToLogFile( const char * sFile, const char * sTraceMsg, ... ); -#define hb_seconds() hb_dateSeconds() +#define hb_seconds() hb_dateSeconds() HB_EXTERN_END diff --git a/harbour/contrib/xhb/xhbarr.c b/harbour/contrib/xhb/xhbarr.c index 2f386ad4b2..6f13ade2bf 100644 --- a/harbour/contrib/xhb/xhbarr.c +++ b/harbour/contrib/xhb/xhbarr.c @@ -63,8 +63,8 @@ HB_FUNC( ASPLICE ) if( pArray ) { - HB_SIZE nStart, nRemove, nIndex; - HB_SIZE nLen = hb_arrayLen( pArray ); + HB_SIZE nStart, nRemove, nIndex; + HB_SIZE nLen = hb_arrayLen( pArray ); PHB_ITEM pReturn = hb_stackReturnItem(); if( nLen == 0 ) @@ -76,7 +76,7 @@ HB_FUNC( ASPLICE ) if( HB_ISNUM( 2 ) ) nStart = hb_parns( 2 ); else - nStart = nLen + ( hb_pcount() > 3 && !HB_ISNUM( 3 ) ? 1 : 0 ); + nStart = nLen + ( hb_pcount() > 3 && ! HB_ISNUM( 3 ) ? 1 : 0 ); if( HB_ISNUM( 3 ) ) nRemove = hb_parns( 3 ); @@ -111,7 +111,7 @@ HB_FUNC( ASPLICE ) if( ( HB_SIZE ) nAdd > nRemove ) { - HB_SIZE nMore = nAdd - nRemove; + HB_SIZE nMore = nAdd - nRemove; HB_SIZE nShift = nLen - ( nStart + nRemove ); hb_arraySize( pArray, nLen + nMore ); diff --git a/harbour/contrib/xhb/xhbarrex.c b/harbour/contrib/xhb/xhbarrex.c index 56c95ea73c..2ebec44a60 100644 --- a/harbour/contrib/xhb/xhbarrex.c +++ b/harbour/contrib/xhb/xhbarrex.c @@ -55,7 +55,7 @@ /* ASIZEALLOC( , ) -> - Set the pre-alloc step. */ HB_FUNC( ASIZEALLOC ) { - PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY ); + PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY ); PHB_ITEM pPreAlloc = hb_param( 2, HB_IT_NUMERIC ); if( pArray && pPreAlloc ) diff --git a/harbour/contrib/xhb/xhbat.c b/harbour/contrib/xhb/xhbat.c index e1c3094d29..8680b456e0 100644 --- a/harbour/contrib/xhb/xhbat.c +++ b/harbour/contrib/xhb/xhbat.c @@ -61,11 +61,11 @@ static HB_SIZE hb_AtSkipStrings( const char * szSub, HB_SIZE nSubLen, const char { char cLastChar = ' '; - HB_TRACE(HB_TR_DEBUG, ("hb_AtSkipStrings(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen)); + HB_TRACE( HB_TR_DEBUG, ( "hb_AtSkipStrings(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen ) ); if( nSubLen > 0 && nLen >= nSubLen ) { - HB_SIZE nPos = 0; + HB_SIZE nPos = 0; HB_SIZE nSubPos = 0; while( nPos < nLen && nSubPos < nSubLen ) @@ -132,7 +132,7 @@ static HB_SIZE hb_AtSkipStrings( const char * szSub, HB_SIZE nSubLen, const char { /* Go back to the first character after the first match, or else tests like "22345" $ "012223456789" will fail. */ - nPos -= ( nSubPos - 1 ); + nPos -= ( nSubPos - 1 ); nSubPos = 0; } else @@ -178,11 +178,11 @@ HB_FUNC( ATSKIPSTRINGS ) /* cFind, cWhere, nStart */ /* Case insensitive hb_strAt() function */ static HB_SIZE hb_strAtI( const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen ) { - HB_TRACE(HB_TR_DEBUG, ("hb_strAtI(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen)); + HB_TRACE( HB_TR_DEBUG, ( "hb_strAtI(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen ) ); if( nSubLen > 0 && nLen >= nSubLen ) { - HB_SIZE nPos = 0; + HB_SIZE nPos = 0; HB_SIZE nSubPos = 0; while( nPos < nLen && nSubPos < nSubLen ) @@ -196,7 +196,7 @@ static HB_SIZE hb_strAtI( const char * szSub, HB_SIZE nSubLen, const char * szTe { /* Go back to the first character after the first match, or else tests like "22345" $ "012223456789" will fail. */ - nPos -= ( nSubPos - 1 ); + nPos -= ( nSubPos - 1 ); nSubPos = 0; } else @@ -211,17 +211,17 @@ static HB_SIZE hb_strAtI( const char * szSub, HB_SIZE nSubLen, const char * szTe /* Case insensitive At() function */ HB_FUNC( ATI ) { - PHB_ITEM pSub = hb_param( 1, HB_IT_STRING ); + PHB_ITEM pSub = hb_param( 1, HB_IT_STRING ); PHB_ITEM pText = hb_param( 2, HB_IT_STRING ); if( pText && pSub ) { PHB_ITEM pStart = hb_param( 3, HB_IT_NUMERIC ); - PHB_ITEM pEnd = hb_param( 4, HB_IT_NUMERIC ); - HB_ISIZ nLen = hb_itemGetCLen( pText ); - HB_ISIZ nStart = pStart ? hb_itemGetNS( pStart ) : 1; - HB_ISIZ nEnd = pEnd ? hb_itemGetNS( pEnd ) : nLen; - HB_SIZE nPos; + PHB_ITEM pEnd = hb_param( 4, HB_IT_NUMERIC ); + HB_ISIZ nLen = hb_itemGetCLen( pText ); + HB_ISIZ nStart = pStart ? hb_itemGetNS( pStart ) : 1; + HB_ISIZ nEnd = pEnd ? hb_itemGetNS( pEnd ) : nLen; + HB_SIZE nPos; if( nStart < 0 ) { diff --git a/harbour/contrib/xhb/xhbenum.c b/harbour/contrib/xhb/xhbenum.c index 262ae84ad0..896dccc4ce 100644 --- a/harbour/contrib/xhb/xhbenum.c +++ b/harbour/contrib/xhb/xhbenum.c @@ -58,6 +58,7 @@ HB_FUNC( HB_ENUMINDEX ) { HB_ISIZ nFuncOffset = hb_stackBaseOffset() - 1, nIndex = 0; + while( --nFuncOffset > 0 ) { PHB_ITEM pItem = hb_stackItem( nFuncOffset ); diff --git a/harbour/contrib/xhb/xhberrc.c b/harbour/contrib/xhb/xhberrc.c index 5c5122221c..4def3ad1b4 100644 --- a/harbour/contrib/xhb/xhberrc.c +++ b/harbour/contrib/xhb/xhberrc.c @@ -65,11 +65,11 @@ static PHB_SYMB s_xHbFunc = NULL; -LONG WINAPI PRGUnhandledExceptionFilter( EXCEPTION_POINTERS *ExceptionInfo ) +LONG WINAPI PRGUnhandledExceptionFilter( EXCEPTION_POINTERS * ExceptionInfo ) { if( s_xHbFunc ) { - HB_ITEM Exception; + HB_ITEM Exception; PHB_DYNS pDyn = hb_dynsymFind( "HB_CSTRUCTURE" ); Exception.type = HB_IT_NIL; @@ -89,7 +89,7 @@ LONG WINAPI PRGUnhandledExceptionFilter( EXCEPTION_POINTERS *ExceptionInfo ) hb_itemMove( &Exception, hb_stackReturnItem() ); - hb_itemPutCLStatic( &Buffer, (char *) ExceptionInfo, sizeof( EXCEPTION_POINTERS ) ); + hb_itemPutCLStatic( &Buffer, ( char * ) ExceptionInfo, sizeof( EXCEPTION_POINTERS ) ); Adopt.type = HB_IT_LOGICAL; Adopt.item.asLogical.value = HB_FALSE; diff --git a/harbour/contrib/xhb/xhbhasha.c b/harbour/contrib/xhb/xhbhasha.c index 0d825f54b1..9036227f1a 100644 --- a/harbour/contrib/xhb/xhbhasha.c +++ b/harbour/contrib/xhb/xhbhasha.c @@ -89,11 +89,11 @@ static HB_BOOL s_isHashAA( PHB_ITEM pHash ) HB_FUNC( HAAGETKEYAT ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC ); - if( !pHash || !pPos ) + if( ! pHash || ! pPos ) s_errRT_hashArg(); - else if( !s_isHashAA( pHash ) ) + else if( ! s_isHashAA( pHash ) ) s_errRT_hashAA(); else { @@ -109,11 +109,11 @@ HB_FUNC( HAAGETKEYAT ) HB_FUNC( HAAGETVALUEAT ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC ); - if( !pHash || !pPos ) + if( ! pHash || ! pPos ) s_errRT_hashArg(); - else if( !s_isHashAA( pHash ) ) + else if( ! s_isHashAA( pHash ) ) s_errRT_hashAA(); else { @@ -128,13 +128,13 @@ HB_FUNC( HAAGETVALUEAT ) /* HAASETVALUEAT( , , ) -> NIL */ HB_FUNC( HAASETVALUEAT ) { - PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); + PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC ); PHB_ITEM pValue = hb_param( 3, HB_IT_ANY ); - if( !pHash || !pPos || !pValue ) + if( ! pHash || ! pPos || ! pValue ) s_errRT_hashArg(); - else if( !s_isHashAA( pHash ) ) + else if( ! s_isHashAA( pHash ) ) s_errRT_hashAA(); else { @@ -150,13 +150,13 @@ HB_FUNC( HAASETVALUEAT ) HB_FUNC( HAADELAT ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC ); + PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC ); - if( !pHash || !pPos ) + if( ! pHash || ! pPos ) s_errRT_hashArg(); - else if( !s_isHashAA( pHash ) ) + else if( ! s_isHashAA( pHash ) ) s_errRT_hashAA(); - else if( !hb_hashDelAt( pHash, hb_itemGetNS( pPos ) ) ) + else if( ! hb_hashDelAt( pHash, hb_itemGetNS( pPos ) ) ) s_errRT_hashBound(); } @@ -164,11 +164,11 @@ HB_FUNC( HAADELAT ) HB_FUNC( HAAGETPOS ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pKey = hb_param( 2, HB_IT_HASHKEY ); + PHB_ITEM pKey = hb_param( 2, HB_IT_HASHKEY ); - if( !pHash || !pKey ) + if( ! pHash || ! pKey ) s_errRT_hashArg(); - else if( !s_isHashAA( pHash ) ) + else if( ! s_isHashAA( pHash ) ) s_errRT_hashAA(); else { @@ -201,7 +201,7 @@ HB_FUNC( HGETVAAPOS ) if( pHash ) { - HB_SIZE n, nLen = hb_hashLen( pHash ); + HB_SIZE n, nLen = hb_hashLen( pHash ); PHB_ITEM pArray = hb_itemArrayNew( nLen ); for( n = 1; n <= nLen; ++n ) @@ -215,7 +215,7 @@ HB_FUNC( HGETVAAPOS ) /* HSETAACOMPATIBILITY( , ) -> */ HB_FUNC( HSETAACOMPATIBILITY ) { - PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); + PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL ); if( pHash && pValue && hb_hashLen( pHash ) == 0 ) diff --git a/harbour/contrib/xhb/xhbhashp.c b/harbour/contrib/xhb/xhbhashp.c index d90059384c..fe232160b3 100644 --- a/harbour/contrib/xhb/xhbhashp.c +++ b/harbour/contrib/xhb/xhbhashp.c @@ -59,9 +59,9 @@ HB_FUNC( HSETPARTITION ) { - PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); - PHB_ITEM pLevel = hb_param( 3, HB_IT_NUMERIC ); - HB_UINT uiLevel = pLevel ? hb_itemGetNI( pLevel ) : 1; + PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); + PHB_ITEM pLevel = hb_param( 3, HB_IT_NUMERIC ); + HB_UINT uiLevel = pLevel ? hb_itemGetNI( pLevel ) : 1; if( ! pHash ) hb_errRT_BASE( EG_ARG, 2017, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); diff --git a/harbour/contrib/xhb/xhbis.c b/harbour/contrib/xhb/xhbis.c index 974b063fba..e1a19ee82a 100644 --- a/harbour/contrib/xhb/xhbis.c +++ b/harbour/contrib/xhb/xhbis.c @@ -71,25 +71,25 @@ #undef tolower #undef toupper -#define isalnum(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISALNUM) -#define isalpha(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISALPHA) -#define iscntrl(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISCNTRL) -#define isdigit(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISDIGIT) -#define isgraph(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISGRAPH) -#define islower(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISLOWER) -#define isprint(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISPRINT) -#define ispunct(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISPUNCT) -#define isspace(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISSPACE) -#define isupper(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISUPPER) -#define isxdigit(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISXDIGIT) +#define isalnum( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISALNUM ) +#define isalpha( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISALPHA ) +#define iscntrl( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISCNTRL ) +#define isdigit( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISDIGIT ) +#define isgraph( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISGRAPH ) +#define islower( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISLOWER ) +#define isprint( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISPRINT ) +#define ispunct( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISPUNCT ) +#define isspace( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISSPACE ) +#define isupper( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISUPPER ) +#define isxdigit( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISXDIGIT ) -#define tolower(c) (__dj_ctype_tolower[(unsigned char)(c)+1]) -#define toupper(c) (__dj_ctype_toupper[(unsigned char)(c)+1]) +#define tolower( c ) ( __dj_ctype_tolower[ ( unsigned char ) ( c ) + 1 ] ) +#define toupper( c ) ( __dj_ctype_toupper[ ( unsigned char ) ( c ) + 1 ] ) #endif /* __dj_include_inline_ctype_ha_ */ -#if !defined( isascii ) - #define isascii( c ) ( ( unsigned ) ( c ) <= 0x7F ) +#if ! defined( isascii ) + #define isascii( c ) ( ( unsigned ) ( c ) <= 0x7F ) #endif /* determines if first char of a string is an alphanumeric character */ @@ -99,7 +99,7 @@ HB_FUNC( ISALNUM ) const char * szString = hb_parc( 1 ); if( szString != NULL ) - hb_retl( HB_ISALNUM( ( HB_BYTE ) * szString ) ); + hb_retl( HB_ISALNUM( ( HB_BYTE ) *szString ) ); else hb_retl( HB_FALSE ); } @@ -107,82 +107,82 @@ HB_FUNC( ISALNUM ) /* determines if first char of a string is a white-space character; that is, a horizontal tab, a new-line, a vertical tab, a form-feed, a carriage-return or a space. -*/ + */ HB_FUNC( ISSPACE ) { const char * szString = hb_parc( 1 ); if( szString != NULL ) - hb_retl( HB_ISSPACE( ( HB_BYTE ) * szString ) ); + hb_retl( HB_ISSPACE( ( HB_BYTE ) *szString ) ); else hb_retl( HB_FALSE ); } /* determines if first char of a string is a hexadecimal digit - ('A' - 'F', 'a' - 'f', or '0' -'9'). -*/ + ('A' - 'F', 'a' - 'f', or '0' -'9'). + */ HB_FUNC( ISXDIGIT ) { const char * szString = hb_parc( 1 ); - hb_retl( szString && HB_ISXDIGIT( ( HB_BYTE ) * szString ) ); + hb_retl( szString && HB_ISXDIGIT( ( HB_BYTE ) *szString ) ); } /* determines if first char of a string is a control character; that is, if it is in the range 0 - 31 or 127 (0x00 - 0x1f or 0x7f). -*/ + */ HB_FUNC( ISCNTRL ) { const char * szString = hb_parc( 1 ); - hb_retl( szString && iscntrl( ( HB_BYTE ) * szString ) ); + hb_retl( szString && iscntrl( ( HB_BYTE ) *szString ) ); } /* determines if first char of a string is a printable character. The space character (' ') is not considered a printable character. -*/ + */ HB_FUNC( ISGRAPH ) { const char * szString = hb_parc( 1 ); - hb_retl( szString && isgraph( ( HB_BYTE ) * szString ) ); + hb_retl( szString && isgraph( ( HB_BYTE ) *szString ) ); } /* determines if first char of a string is a printable character. Printable characters have an ASCII value between 32 - 126, (0x20 - 0x7e), a space and the tilde, inclusive. -*/ + */ HB_FUNC( ISPRINT ) { const char * szString = hb_parc( 1 ); - hb_retl( szString && isprint( ( HB_BYTE ) * szString ) ); + hb_retl( szString && isprint( ( HB_BYTE ) *szString ) ); } /* determines if first char of a string is a punctuation character. A punctuation character is one that is not alphabetic, not numeric, not a control character, and not a white space. -*/ + */ HB_FUNC( ISPUNCT ) { const char * szString = hb_parc( 1 ); - hb_retl( szString && ispunct( ( HB_BYTE ) * szString ) ); + hb_retl( szString && ispunct( ( HB_BYTE ) *szString ) ); } /* determines if first char of a string is a member of the 7-bit ASCII character set; that is, if: 0 <= c <= 127 -*/ + */ HB_FUNC( ISASCII ) { const char * szString = hb_parc( 1 ); - hb_retl( szString && isascii( ( HB_BYTE ) * szString ) ); + hb_retl( szString && isascii( ( HB_BYTE ) *szString ) ); } diff --git a/harbour/contrib/xhb/xhbmsgs.c b/harbour/contrib/xhb/xhbmsgs.c index 59a1b422ec..566b5a5076 100644 --- a/harbour/contrib/xhb/xhbmsgs.c +++ b/harbour/contrib/xhb/xhbmsgs.c @@ -59,14 +59,14 @@ HB_FUNC( XHB_HASHERROR ) { const char * szMessage = hb_itemGetSymbol( hb_stackBaseItem() )->szName; - int iPCount = hb_pcount(); + int iPCount = hb_pcount(); if( iPCount == 1 ) { - if( szMessage[ 0 ] == '_' ) - { /* ASSIGN */ + if( szMessage[ 0 ] == '_' ) /* ASSIGN */ + { PHB_ITEM pIndex = hb_itemPutCConst( hb_stackAllocItem(), szMessage + 1 ); - PHB_ITEM pDest = hb_hashGetItemPtr( hb_stackSelfItem(), pIndex, HB_HASH_AUTOADD_ASSIGN ); + PHB_ITEM pDest = hb_hashGetItemPtr( hb_stackSelfItem(), pIndex, HB_HASH_AUTOADD_ASSIGN ); hb_stackPop(); if( pDest ) { @@ -77,8 +77,8 @@ HB_FUNC( XHB_HASHERROR ) } } } - else if( iPCount == 0 ) - { /* ACCESS */ + else if( iPCount == 0 ) /* ACCESS */ + { PHB_ITEM pIndex = hb_itemPutCConst( hb_stackAllocItem(), szMessage ); PHB_ITEM pValue = hb_hashGetItemPtr( hb_stackSelfItem(), pIndex, HB_HASH_AUTOADD_ACCESS ); hb_stackPop(); @@ -98,7 +98,7 @@ HB_FUNC( XHB_HASHERROR ) HB_FUNC( XHB_INCLUDE ) { PHB_ITEM pSelf = hb_stackSelfItem(); - PHB_ITEM pKey = hb_param( 1, HB_IT_ANY ); + PHB_ITEM pKey = hb_param( 1, HB_IT_ANY ); if( HB_IS_ARRAY( pSelf ) ) { @@ -118,19 +118,19 @@ HB_FUNC( XHB_INCLUDE ) HB_FUNC( XHB_EEQUAL ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - double dValue = hb_itemGetND( pSelf ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; + double dValue = hb_itemGetND( pSelf ); hb_retl( dValue == ( double ) uc ); } else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - double dValue = hb_itemGetND( pValue ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; + double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc == dValue ); } else if( HB_IS_BLOCK( pSelf ) && HB_IS_BLOCK( pValue ) ) @@ -147,19 +147,19 @@ HB_FUNC( XHB_EEQUAL ) HB_FUNC( XHB_EQUAL ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - double dValue = hb_itemGetND( pSelf ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; + double dValue = hb_itemGetND( pSelf ); hb_retl( dValue == ( double ) uc ); } else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - double dValue = hb_itemGetND( pValue ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; + double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc == dValue ); } else if( HB_IS_HASH( pSelf ) && HB_IS_HASH( pValue ) ) @@ -176,19 +176,19 @@ HB_FUNC( XHB_EQUAL ) HB_FUNC( XHB_NOTEQUAL ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - double dValue = hb_itemGetND( pSelf ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; + double dValue = hb_itemGetND( pSelf ); hb_retl( dValue != ( double ) uc ); } else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - double dValue = hb_itemGetND( pValue ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; + double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc != dValue ); } else if( HB_IS_HASH( pSelf ) && HB_IS_HASH( pValue ) ) @@ -205,19 +205,19 @@ HB_FUNC( XHB_NOTEQUAL ) HB_FUNC( XHB_LESS ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - double dValue = hb_itemGetND( pSelf ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; + double dValue = hb_itemGetND( pSelf ); hb_retl( dValue < ( double ) uc ); } else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - double dValue = hb_itemGetND( pValue ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; + double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc < dValue ); } else @@ -230,19 +230,19 @@ HB_FUNC( XHB_LESS ) HB_FUNC( XHB_LESSEQ ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - double dValue = hb_itemGetND( pSelf ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; + double dValue = hb_itemGetND( pSelf ); hb_retl( dValue <= ( double ) uc ); } else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - double dValue = hb_itemGetND( pValue ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; + double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc <= dValue ); } else @@ -255,19 +255,19 @@ HB_FUNC( XHB_LESSEQ ) HB_FUNC( XHB_GREATER ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - double dValue = hb_itemGetND( pSelf ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; + double dValue = hb_itemGetND( pSelf ); hb_retl( dValue > ( double ) uc ); } else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - double dValue = hb_itemGetND( pValue ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; + double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc > dValue ); } else @@ -280,19 +280,19 @@ HB_FUNC( XHB_GREATER ) HB_FUNC( XHB_GREATEREQ ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - double dValue = hb_itemGetND( pSelf ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; + double dValue = hb_itemGetND( pSelf ); hb_retl( dValue >= ( double ) uc ); } else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - double dValue = hb_itemGetND( pValue ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; + double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc >= dValue ); } else @@ -309,15 +309,15 @@ HB_FUNC( XHB_GREATEREQ ) * data from tail */ #undef HB_IS_VALID_INDEX -#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) (idx) < 0 ? (idx) += (max) + 1 : (idx) ) > 0 && ( HB_SIZE ) (idx) <= (max) ) +#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) ( idx ) < 0 ? ( idx ) += ( max ) + 1 : ( idx ) ) > 0 && ( HB_SIZE ) ( idx ) <= ( max ) ) HB_FUNC( XHB_INDEX ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pIndex = hb_param( 1, HB_IT_ANY ); - if( hb_pcount() == 2 ) - { /* ASSIGN */ + if( hb_pcount() == 2 ) /* ASSIGN */ + { PHB_ITEM pValue = hb_param( 2, HB_IT_ANY ); if( HB_IS_NUMERIC( pIndex ) ) { @@ -358,8 +358,8 @@ HB_FUNC( XHB_INDEX ) hb_itemReturn( pSelf ); } - else - { /* ACCESS */ + else /* ACCESS */ + { if( HB_IS_NUMERIC( pIndex ) ) { HB_SIZE nIndex = hb_itemGetNS( pIndex ); @@ -393,14 +393,14 @@ HB_FUNC( XHB_INDEX ) HB_FUNC( XHB_PLUS ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - int iDec; - double dValue = hb_itemGetNDDec( pSelf, &iDec ); + int iDec; + double dValue = hb_itemGetNDDec( pSelf, &iDec ); hb_retnlen( dValue + uc, 0, iDec ); } else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 && @@ -426,14 +426,14 @@ HB_FUNC( XHB_PLUS ) HB_FUNC( XHB_MINUS ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - int iDec; - double dValue = hb_itemGetNDDec( pSelf, &iDec ); + int iDec; + double dValue = hb_itemGetNDDec( pSelf, &iDec ); hb_retnlen( dValue - uc, 0, iDec ); } else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 && @@ -497,29 +497,29 @@ HB_FUNC( XHB_DEC ) HB_FUNC( XHB_MULT ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) { HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; - int iDec; - double dValue = hb_itemGetNDDec( pSelf, &iDec ); + int iDec; + double dValue = hb_itemGetNDDec( pSelf, &iDec ); hb_retndlen( dValue * uc, 0, iDec ); } else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) ) { HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - int iDec; - double dValue = hb_itemGetNDDec( pValue, &iDec ); + int iDec; + double dValue = hb_itemGetNDDec( pValue, &iDec ); hb_retndlen( ( double ) uc * dValue, 0, iDec ); } else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 && hb_itemGetCLen( pValue ) == 1 ) { HB_UCHAR uc1 = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ], - uc2 = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; + uc2 = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; hb_retnint( uc1 * uc2 ); } else @@ -532,7 +532,7 @@ HB_FUNC( XHB_MULT ) HB_FUNC( XHB_DIV ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) @@ -550,9 +550,9 @@ HB_FUNC( XHB_DIV ) else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 && pValue && ( HB_IS_NUMERIC( pValue ) || hb_itemGetCLen( pValue ) == 1 ) ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - double dDivisor = HB_IS_NUMERIC( pValue ) ? hb_itemGetND( pValue ) : - ( double ) ( ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ] ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; + double dDivisor = HB_IS_NUMERIC( pValue ) ? hb_itemGetND( pValue ) : + ( double ) ( ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ] ); if( dDivisor == 0 ) { @@ -573,7 +573,7 @@ HB_FUNC( XHB_DIV ) HB_FUNC( XHB_MOD ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) @@ -591,9 +591,9 @@ HB_FUNC( XHB_MOD ) else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 && pValue && ( HB_IS_NUMERIC( pValue ) || hb_itemGetCLen( pValue ) == 1 ) ) { - HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; - double dDivisor = HB_IS_NUMERIC( pValue ) ? hb_itemGetND( pValue ) : - ( double ) ( ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ] ); + HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ]; + double dDivisor = HB_IS_NUMERIC( pValue ) ? hb_itemGetND( pValue ) : + ( double ) ( ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ] ); if( dDivisor == 0 ) { @@ -614,7 +614,7 @@ HB_FUNC( XHB_MOD ) HB_FUNC( XHB_POW ) { - PHB_ITEM pSelf = hb_stackSelfItem(); + PHB_ITEM pSelf = hb_stackSelfItem(); PHB_ITEM pValue = hb_param( 1, HB_IT_ANY ); if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 ) @@ -632,7 +632,7 @@ HB_FUNC( XHB_POW ) hb_itemGetCLen( pValue ) == 1 ) { HB_UCHAR uc1 = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ], - uc2 = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; + uc2 = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ]; hb_retnd( pow( ( double ) uc1, ( double ) uc2 ) ); } else diff --git a/harbour/contrib/xhb/xhbmvinf.c b/harbour/contrib/xhb/xhbmvinf.c index 65a28e2383..f01b0c1df3 100644 --- a/harbour/contrib/xhb/xhbmvinf.c +++ b/harbour/contrib/xhb/xhbmvinf.c @@ -65,7 +65,7 @@ HB_FUNC( __MVSYMBOLINFO ) for( n = 1; n <= nLen; ++n ) { PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, n ); - PHB_SYMB pSym = hb_arrayGetSymbol( pItem, 1 ); + PHB_SYMB pSym = hb_arrayGetSymbol( pItem, 1 ); hb_arraySetC( pItem, 1, pSym->szName ); } hb_itemReturnRelease( pArray ); diff --git a/harbour/contrib/xhb/xhbsave.c b/harbour/contrib/xhb/xhbsave.c index cd38db2c56..d4b1fb2af6 100644 --- a/harbour/contrib/xhb/xhbsave.c +++ b/harbour/contrib/xhb/xhbsave.c @@ -66,19 +66,19 @@ static void hb_getScreenRange( int * piMin, int * piMax, } else { - iMax = hb_gtMaxCol(); + iMax = hb_gtMaxCol(); iFrom = hb_parni( 2 ); iTo = hb_parnidef( 4, iMax ); } if( iFrom < 0 ) iFrom = 0; - else if( iFrom > iMax && !fNoCheck ) + else if( iFrom > iMax && ! fNoCheck ) iFrom = iMax; if( iTo < 0 ) iTo = 0; - else if( iTo > iMax && !fNoCheck ) + else if( iTo > iMax && ! fNoCheck ) iTo = iMax; if( iFrom > iTo ) @@ -95,9 +95,9 @@ static void hb_getScreenRange( int * piMin, int * piMax, HB_FUNC( XHB_SAVESCREEN ) { - int iTop, iLeft, iBottom, iRight; + int iTop, iLeft, iBottom, iRight; HB_SIZE nSize; - void * pBuffer; + void * pBuffer; HB_BOOL fNoCheck = hb_parl( 5 ); hb_getScreenRange( &iTop, &iBottom, fNoCheck, HB_TRUE ); @@ -114,7 +114,7 @@ HB_FUNC( XHB_RESTSCREEN ) { if( HB_ISCHAR( 5 ) ) { - int iTop, iLeft, iBottom, iRight; + int iTop, iLeft, iBottom, iRight; HB_BOOL fNoCheck = hb_parl( 6 ); hb_getScreenRange( &iTop, &iBottom, fNoCheck, HB_TRUE ); diff --git a/harbour/contrib/xhb/xhbwin.c b/harbour/contrib/xhb/xhbwin.c index 516dcb388d..7008f833e4 100644 --- a/harbour/contrib/xhb/xhbwin.c +++ b/harbour/contrib/xhb/xhbwin.c @@ -72,7 +72,9 @@ HB_FUNC( MESSAGEBOX ) void * hStr2; HWND hWnd = HB_ISNUM( 1 ) ? ( HWND ) ( HB_PTRUINT ) hb_parnint( 1 ) : ( HWND ) hb_parptr( 1 ); + hb_retni( MessageBox( hWnd, HB_PARSTR( 2, &hStr1, NULL ), HB_PARSTR( 3, &hStr2, NULL ), hb_parni( 4 ) ) ); + hb_strfree( hStr1 ); hb_strfree( hStr2 ); } diff --git a/harbour/contrib/xhb/xhbwith.c b/harbour/contrib/xhb/xhbwith.c index a742465fe0..519d80c9aa 100644 --- a/harbour/contrib/xhb/xhbwith.c +++ b/harbour/contrib/xhb/xhbwith.c @@ -63,13 +63,13 @@ static PHB_ITEM hb_vmWithObjectItem( HB_ISIZ nLevel ) while( nOffset && nLevel > 0 ) { HB_ISIZ * pnOffset = ( HB_ISIZ * ) hb_itemGetPtr( hb_stackItem( nOffset + 1 ) ); - if( !pnOffset ) + if( ! pnOffset ) break; --nLevel; nOffset = *pnOffset; } - return ( nOffset && !nLevel ) ? hb_stackItem( nOffset ) : NULL; + return ( nOffset && ! nLevel ) ? hb_stackItem( nOffset ) : NULL; } static HB_ISIZ hb_vmWithObjectCount( void ) @@ -79,7 +79,7 @@ static HB_ISIZ hb_vmWithObjectCount( void ) while( nOffset ) { HB_ISIZ * pnOffset = ( HB_ISIZ * ) hb_itemGetPtr( hb_stackItem( nOffset + 1 ) ); - if( !pnOffset ) + if( ! pnOffset ) break; ++nCount; nOffset = *pnOffset; diff --git a/harbour/contrib/xhb/xstrdel.c b/harbour/contrib/xhb/xstrdel.c index e7de2b438f..204ff87580 100644 --- a/harbour/contrib/xhb/xstrdel.c +++ b/harbour/contrib/xhb/xstrdel.c @@ -58,24 +58,24 @@ HB_FUNC( STRDEL ) if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) ) { const char * szText = hb_parcx( 1 ); - HB_SIZE nText = hb_parclen( 1 ); - HB_SIZE nDel = hb_parclen( 2 ); + HB_SIZE nText = hb_parclen( 1 ); + HB_SIZE nDel = hb_parclen( 2 ); if( nDel > 0 && nText > 0 ) { - const char * szDel = hb_parcx( 2 ); - HB_SIZE nPosTxt = 0; - HB_SIZE nResult = 0; - HB_SIZE nPosDel = 0; - char * szResult = ( char * ) hb_xgrab( nText + 1 ); + const char * szDel = hb_parcx( 2 ); + HB_SIZE nPosTxt = 0; + HB_SIZE nResult = 0; + HB_SIZE nPosDel = 0; + char * szResult = ( char * ) hb_xgrab( nText + 1 ); - for( ; ( nPosDel < nText && nPosDel < nDel ); nPosDel++ ) + for(; ( nPosDel < nText && nPosDel < nDel ); nPosDel++ ) { if( szDel[ nPosDel ] != ' ' ) { hb_xmemcpy( szResult + nResult, szText + nPosTxt, nPosDel - nPosTxt ); nResult += nPosDel - nPosTxt; - nPosTxt = nPosDel + 1; + nPosTxt = nPosDel + 1; } } hb_xmemcpy( szResult + nResult, szText + nPosTxt, nText - nPosTxt );