diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9cb1bf5f57..65244b0cf7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,18 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2004-04-09 15:00 UTC-0500 David G. Holm + * source/rdd/dbfntx/dbfntx1.c + ! Converted first parameter in the call to hb_fsCreateTemp from "" to + NULL in order to avoid having to provide a (BYTE *) type conversion + like the one that I added for the second parameter. + * source/rtl/fstemp.c + * Reformatted the code to match the Harbour coding style (in particular, + to use spaces instead of Tabs for indenting and to always use braces + for a code block that follows an if statement, even if only one line). + ! Added a null pointer check in the non-Unix code that checks the size + of the input arguments. + 2004-04-09 11:45 UTC+0100 Ryszard Glab * source/debug/debugger.prg * removed diagnostic ALERT call diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index f0f99cbcda..610b618244 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -2524,7 +2524,7 @@ static ERRCODE hb_ntxIndexCreate( LPNTXINDEX pIndex ) if( nParts == 1 ) { BYTE TempName[ _POSIX_PATH_MAX ]; - sortInfo.tempHandle = hb_fsCreateTemp( "", "SORT-TMP", FC_NORMAL, TempName ); + sortInfo.tempHandle = hb_fsCreateTemp( NULL, ( BYTE * ) "SORT-TMP", FC_NORMAL, TempName ); if( sortInfo.tempHandle == FS_ERROR ) hb_errInternal( HB_EI_ERRUNRECOV, "Cannot create temp file", "hb_ntxIndexCreate", NULL ); } diff --git a/harbour/source/rtl/fstemp.c b/harbour/source/rtl/fstemp.c index b037f1c793..e2e4150613 100644 --- a/harbour/source/rtl/fstemp.c +++ b/harbour/source/rtl/fstemp.c @@ -113,16 +113,16 @@ FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, USHORT uiA } } #else - if( (strlen(pszDir)+strlen(pszPrefix)+6) < _POSIX_PATH_MAX ) - { - FHANDLE fhnd; - char cTemplate[_POSIX_PATH_MAX]; + if( ( ( pszDir ? strlen( pszDir ) : 0 ) + ( pszPrefix ? strlen( pszPrefix ) : 0 ) + 6 ) < _POSIX_PATH_MAX ) + { + FHANDLE fhnd; + char cTemplate[_POSIX_PATH_MAX]; pszName[0] = '\0'; - cTemplate[0] = '\0'; + cTemplate[0] = '\0'; if( pszDir ) { int nLen; - strcpy( cTemplate, pszDir ); + strcpy( cTemplate, pszDir ); nLen = strlen( cTemplate ); if( cTemplate[nLen] != hb_set.HB_SET_DIRSEPARATOR ) { @@ -131,18 +131,20 @@ FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefix, USHORT uiA } } if( pszPrefix ) - strcat( cTemplate, pszPrefix ); - strcat( cTemplate, "XXXXXX" ); /* required by mkstemp */ - while( --nAttemptLeft ) - { - fhnd = mkstemp( cTemplate ); - if( fhnd >= 0 ) + { + strcat( cTemplate, pszPrefix ); + } + strcat( cTemplate, "XXXXXX" ); /* required by mkstemp */ + while( --nAttemptLeft ) + { + fhnd = mkstemp( cTemplate ); + if( fhnd >= 0 ) { strcpy( pszName, cTemplate ); - return fhnd; + return fhnd; } - } - } + } + } #endif hb_fsSetError( FS_ERROR );