2010-10-04 13:22 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/src/rtl/fstemp.c
    * disabled using tmpnam() in OS2 builds
    % small code cleanup
This commit is contained in:
Przemyslaw Czerpak
2010-10-04 11:22:45 +00:00
parent 8c5e539d71
commit bb14033f3a
2 changed files with 23 additions and 21 deletions

View File

@@ -16,6 +16,11 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-10-04 13:22 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/fstemp.c
* disabled using tmpnam() in OS2 builds
% small code cleanup
2010-10-04 12:43 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/sddpg/sddpg.c
! fixed access to uninitialized pItem variable

View File

@@ -120,15 +120,17 @@ static HB_BOOL fsGetTempDirByCase( char * pszName, const char * pszTempDir )
}
}
# if defined( __DJGPP__ )
if( fOK )
{
# if defined( __DJGPP__ )
/* convert '/' to '\' */
char * pszDelim;
while( ( pszDelim = strchr( pszName, '/' ) ) != NULL )
*pszDelim = '\\';
}
# endif
if( ! hb_fsDirExists( pszTempDir ) )
fOK = HB_FALSE;
}
return fOK;
}
@@ -365,7 +367,7 @@ HB_ERRCODE hb_fsTempDir( char * pszTempDir )
if( pszTempDirEnv )
hb_xfree( pszTempDirEnv );
if( pszTempDir[ 0 ] != '\0' )
if( nResult == 0 && pszTempDir[ 0 ] != '\0' )
{
int len = ( int ) strlen( pszTempDir );
if( pszTempDir[ len - 1 ] != HB_OS_PATH_DELIM_CHR )
@@ -373,6 +375,12 @@ HB_ERRCODE hb_fsTempDir( char * pszTempDir )
pszTempDir[ len ] = HB_OS_PATH_DELIM_CHR;
pszTempDir[ len + 1 ] = '\0';
}
else
{
pszTempDir[ 0 ] = '.';
pszTempDir[ 1 ] = HB_OS_PATH_DELIM_CHR;
pszTempDir[ 2 ] = '\0';
}
}
}
#elif defined( HB_OS_WIN )
@@ -388,29 +396,18 @@ HB_ERRCODE hb_fsTempDir( char * pszTempDir )
}
#else
{
#elif !defined( HB_OS_OS2 )
char szBuffer[ L_tmpnam ];
if( tmpnam( szBuffer ) != NULL )
{
# if defined( __DJGPP__ )
{
/* convert '/' to '\' */
char * pszDelim;
while( ( pszDelim = strchr( szBuffer, '/' ) ) != NULL )
*pszDelim = '\\';
}
# endif
{
PHB_FNAME pTempName = hb_fsFNameSplit( szBuffer );
hb_strncpy( pszTempDir, pTempName->szPath, HB_PATH_MAX - 1 );
hb_xfree( pTempName );
if( hb_fsDirExists( pszTempDir ) )
nResult = 0;
}
PHB_FNAME pTempName = hb_fsFNameSplit( szBuffer );
if( fsGetTempDirByCase( pszTempDir, pTempName->szPath ) )
nResult = 0;
hb_xfree( pTempName );
}
if( nResult != 0 )
#endif
{
static const char * env_tmp[] = { "TEMP", "TMP", "TMPDIR", NULL };
@@ -427,7 +424,7 @@ HB_ERRCODE hb_fsTempDir( char * pszTempDir )
hb_xfree( pszTempDirEnv );
}
}
if( pszTempDir[ 0 ] != '\0' )
if( nResult == 0 && pszTempDir[ 0 ] != '\0' )
{
int len = ( int ) strlen( pszTempDir );
if( pszTempDir[ len - 1 ] != HB_OS_PATH_DELIM_CHR )