2012-03-30 18:27 UTC+0200 Viktor Szakats (harbour syenar.net)

* contrib/hbct/ctnet.c
    + switched from HB_TCHAR_* macros to Str API

  * contrib/xhb/filestat.c
    + preparation for HB_TCHAR_* macro elimination by removing static worker function
    ! fixed wrong OS_UNIX_COMPATIBLE macro which effectively
      disabled *nix specific code. Now new code is enabled, so
      beware of platform fallout especially on more exotic *nixes.
      flavors. (untested on *nix)

  * contrib/hbqt/gtqtc/gtqtc.cpp
    - deleted inactive code using HB_TCHAR_* macro
This commit is contained in:
Viktor Szakats
2012-03-30 16:31:36 +00:00
parent 8146e914b2
commit 60298e198c
4 changed files with 67 additions and 73 deletions

View File

@@ -16,6 +16,20 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-03-30 18:27 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbct/ctnet.c
+ switched from HB_TCHAR_* macros to Str API
* contrib/xhb/filestat.c
+ preparation for HB_TCHAR_* macro elimination by removing static worker function
! fixed wrong OS_UNIX_COMPATIBLE macro which effectively
disabled *nix specific code. Now new code is enabled, so
beware of platform fallout especially on more exotic *nixes.
flavors. (untested on *nix)
* contrib/hbqt/gtqtc/gtqtc.cpp
- deleted inactive code using HB_TCHAR_* macro
2012-03-30 17:21 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/include/hbwinuni.h
* added explicit casting to HB_FSNAMECONV() macro to force compile

View File

@@ -114,12 +114,11 @@ static HB_BOOL hb_IsNetShared( const char * szLocalDevice )
HB_FUNC( NETCANCEL )
{
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE )
DWORD dwResult;
LPTSTR lpDevice = HB_TCHAR_CONVTO( hb_parcx( 1 ) );
void * hDevice;
dwResult = WNetCancelConnection( lpDevice, TRUE ); /* FALSE = fail if exist open files or print jobs. */
DWORD dwResult = WNetCancelConnection( HB_PARSTRDEF( 1, &hDevice, NULL ), TRUE ); /* FALSE = fail if exist open files or print jobs. */
HB_TCHAR_FREE( lpDevice );
hb_strfree( hDevice );
/* TRUE = force cancel connection even if exist
* open files or print jobs.
*/

View File

@@ -524,21 +524,6 @@ static bool hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT )
hb_xfree( pFileName );
}
{
#if 0
HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, HB_FALSE );
if( hSysMenu )
{
/* Create "Mark" prompt in SysMenu to allow console type copy operation */
LPTSTR buffer = HB_TCHAR_CONVTO( pWVT->pszSelectCopy );
AppendMenu( hSysMenu, MF_STRING, SYS_EV_MARK, buffer );
HB_TCHAR_FREE( buffer );
if( ! pWVT->bClosable )
EnableMenuItem( hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED );
}
#endif
}
return HB_TRUE;
}

View File

@@ -64,14 +64,14 @@
#include <sys/stat.h>
#elif defined( HB_OS_WIN )
#include <windows.h>
#if ( defined( __BORLANDC__ ) || defined( _MSC_VER ) || defined( __LCC__ ) || defined( __DMC__ ) ) && ! defined( INVALID_FILE_ATTRIBUTES )
#if ! defined( INVALID_FILE_ATTRIBUTES )
#define INVALID_FILE_ATTRIBUTES ((DWORD)(-1))
#endif
#endif
static HB_BOOL hb_fsFileStats(
const char * pszFileName,
char * pszAttr,
char * szAttr,
HB_FOFFSET * llSize,
long * lcDate,
long * lcTime,
@@ -80,7 +80,7 @@ static HB_BOOL hb_fsFileStats(
{
HB_BOOL fResult = HB_FALSE;
#if defined( OS_UNIX_COMPATIBLE )
#if defined( HB_OS_UNIX )
struct stat statbuf;
@@ -130,10 +130,10 @@ static HB_BOOL hb_fsFileStats(
/* Extension characters */
if( ( statbuf.st_mode & S_IFLNK ) == S_IFLNK)
*pszAttr++ = 'Z'; /* Xharbour extension */
*szAttr++ = 'Z'; /* Xharbour extension */
if( ( statbuf.st_mode & S_IFSOCK ) == S_IFSOCK )
*pszAttr++ = 'K'; /* Xharbour extension */
*szAttr++ = 'K'; /* Xharbour extension */
/* device */
if( ( statbuf.st_mode & S_IFBLK ) == S_IFBLK ||
@@ -141,7 +141,7 @@ static HB_BOOL hb_fsFileStats(
ushbAttr |= HB_FA_DEVICE; /* Xharbour extension */
if( ( statbuf.st_mode & S_IFIFO ) == S_IFIFO )
*pszAttr++ = 'Y'; /* Xharbour extension */
*szAttr++ = 'Y'; /* Xharbour extension */
if( S_ISDIR( statbuf.st_mode ) )
ushbAttr |= HB_FA_DIRECTORY; /* Xharbour extension */
@@ -172,7 +172,7 @@ static HB_BOOL hb_fsFileStats(
ptms->tm_mon + 1, ptms->tm_mday );
*lmTime = ptms->tm_hour*3600 + ptms->tm_min * 60 + ptms->tm_sec;
hb_fsAttrDecode( ushbAttr, pszAttr );
hb_fsAttrDecode( ushbAttr, szAttr );
fResult = HB_TRUE;
}
@@ -189,50 +189,46 @@ static HB_BOOL hb_fsFileStats(
/* Get attributes... */
dwAttribs = GetFileAttributes( lpFileName );
if( dwAttribs == INVALID_FILE_ATTRIBUTES )
if( dwAttribs != INVALID_FILE_ATTRIBUTES )
{
/* return */
HB_TCHAR_FREE( lpFileName );
return HB_FALSE;
hb_fsAttrDecode( hb_fsAttrFromRaw( dwAttribs ), szAttr );
/* If file existed, do a findfirst */
hFind = FindFirstFile( lpFileName, &ffind );
if( hFind != INVALID_HANDLE_VALUE )
{
CloseHandle( hFind );
/* get file times and work them out */
*llSize = ( HB_FOFFSET ) ffind.nFileSizeLow + ( ( HB_FOFFSET ) ffind.nFileSizeHigh << 32 );
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;
}
else
{
*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;
}
else
{
*lcDate = hb_dateEncode( 0, 0, 0 );
*lcTime = 0;
}
fResult = HB_TRUE;
}
}
hb_fsAttrDecode( hb_fsAttrFromRaw( dwAttribs ), pszAttr );
/* If file existed, do a findfirst */
hFind = FindFirstFile( lpFileName, &ffind );
HB_TCHAR_FREE( lpFileName );
if( hFind != INVALID_HANDLE_VALUE )
{
CloseHandle( hFind );
/* get file times and work them out */
*llSize = ( HB_FOFFSET ) ffind.nFileSizeLow + ( ( HB_FOFFSET ) ffind.nFileSizeHigh << 32 );
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;
}
else
{
*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;
}
else
{
*lcDate = hb_dateEncode( 0, 0, 0 );
*lcTime = 0;
}
fResult = HB_TRUE;
}
}
#else
@@ -243,7 +239,7 @@ static HB_BOOL hb_fsFileStats(
if( findinfo )
{
hb_fsAttrDecode( findinfo->attr, pszAttr );
hb_fsAttrDecode( findinfo->attr, szAttr );
*llSize = ( HB_FOFFSET ) findinfo->size;
*lcDate = findinfo->lDate;
*lcTime = (findinfo->szTime[0] - '0') * 36000 +
@@ -268,22 +264,22 @@ static HB_BOOL hb_fsFileStats(
HB_FUNC( FILESTATS )
{
char szAttr[ 21 ];
const char * szFile = hb_parc( 1 );
HB_FOFFSET lSize = 0;
const char * szFileName = hb_parc( 1 );
HB_FOFFSET llSize = 0;
long lcDate = 0, lcTime = 0, lmDate = 0, lmTime = 0;
/* Parameter checking */
if( !szFile || !*szFile )
if( !szFileName || !*szFileName )
{
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 1,
hb_paramError(1) );
return;
}
if( hb_fsFileStats( szFile, szAttr, &lSize, &lcDate, &lcTime, &lmDate, &lmTime ) )
if( hb_fsFileStats( szFileName, szAttr, &llSize, &lcDate, &lcTime, &lmDate, &lmTime ) )
{
hb_storc ( szAttr, 2 );
hb_stornint( lSize, 3 );
hb_stornint( llSize, 3 );
hb_stordl ( lcDate, 4 );
hb_stornint( lcTime, 5 );
hb_stordl ( lmDate, 6 );