2012-03-20 18:40 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/include/hbwinuni.h
+ added HB_FSNAMECONV() macro - it's automatically redirected to
hb_fsNameConv() or hb_fsNameConvU16() functions depending on
UNICODE windows macro
* harbour/include/hbapifs.h
* harbour/src/rtl/filesys.c
+ added hb_fsNameConvU16() C function - it makes similar operatin to
hb_fsNameConv() but returns UTF16 string.
+ added hb_fsPipeUnblock() C function - currently it works only
in POSIX systems
* HB_FSNAMECONV() instead of HB_TCHAR_*() macros
* harbour/src/rtl/hbcom.c
* HB_FSNAMECONV() instead of HB_TCHAR_*() macros
% encapsulate port open and close operations inside
hb_vmUnlock()/hb_vmLock() - on some systems this can
be slow operations, i.e. close() is delayed until
byte in output buffer are not transmitted.
* harbour/src/rtl/hbproces.c
% prefer read then write in pipe operations
! in POSIX systems set unblocking mode for PIPE handles in
hb_fsProcessRun() function - it fixes potential deadlock
* harbour/src/common/strwild.c
* formatting
* harbour/src/rtl/dircmd.prg
% use space( n ) instead of repl( chr( 0 ), n ) for allocating
dirty buffer
* harbour/src/rtl/gttrm/gttrm.c
* harbour/src/rtl/gtsln/kbsln.c
* ignore broken UTF8 characters in input
This commit is contained in:
@@ -16,6 +16,43 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-03-20 18:40 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* harbour/include/hbwinuni.h
|
||||
+ added HB_FSNAMECONV() macro - it's automatically redirected to
|
||||
hb_fsNameConv() or hb_fsNameConvU16() functions depending on
|
||||
UNICODE windows macro
|
||||
|
||||
* harbour/include/hbapifs.h
|
||||
* harbour/src/rtl/filesys.c
|
||||
+ added hb_fsNameConvU16() C function - it makes similar operatin to
|
||||
hb_fsNameConv() but returns UTF16 string.
|
||||
+ added hb_fsPipeUnblock() C function - currently it works only
|
||||
in POSIX systems
|
||||
* HB_FSNAMECONV() instead of HB_TCHAR_*() macros
|
||||
|
||||
* harbour/src/rtl/hbcom.c
|
||||
* HB_FSNAMECONV() instead of HB_TCHAR_*() macros
|
||||
% encapsulate port open and close operations inside
|
||||
hb_vmUnlock()/hb_vmLock() - on some systems this can
|
||||
be slow operations, i.e. close() is delayed until
|
||||
byte in output buffer are not transmitted.
|
||||
|
||||
* harbour/src/rtl/hbproces.c
|
||||
% prefer read then write in pipe operations
|
||||
! in POSIX systems set unblocking mode for PIPE handles in
|
||||
hb_fsProcessRun() function - it fixes potential deadlock
|
||||
|
||||
* harbour/src/common/strwild.c
|
||||
* formatting
|
||||
|
||||
* harbour/src/rtl/dircmd.prg
|
||||
% use space( n ) instead of repl( chr( 0 ), n ) for allocating
|
||||
dirty buffer
|
||||
|
||||
* harbour/src/rtl/gttrm/gttrm.c
|
||||
* harbour/src/rtl/gtsln/kbsln.c
|
||||
* ignore broken UTF8 characters in input
|
||||
|
||||
2012-03-19 12:55 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* harbour/contrib/hbmzip/mzip.c
|
||||
! fixed typo in DOS/Windows/OS2 READONLY attribute translation
|
||||
|
||||
@@ -177,6 +177,7 @@ extern HB_EXPORT HB_SIZE hb_fsWriteLarge ( HB_FHANDLE hFileHandle, const voi
|
||||
extern HB_EXPORT HB_SIZE hb_fsWriteAt ( HB_FHANDLE hFileHandle, const void * pBuff, HB_SIZE nCount, HB_FOFFSET nOffset ); /* write to an open file at given offset from a buffer (>64K) */
|
||||
extern HB_EXPORT HB_FHANDLE hb_fsPOpen ( const char * pFilename, const char * pMode );
|
||||
extern HB_EXPORT HB_BOOL hb_fsPipeCreate ( HB_FHANDLE hPipe[ 2 ] );
|
||||
extern HB_EXPORT HB_BOOL hb_fsPipeUnblock ( HB_FHANDLE hPipeHandle );
|
||||
extern HB_EXPORT HB_SIZE hb_fsPipeIsData ( HB_FHANDLE hPipeHandle, HB_SIZE nBufferSize, HB_MAXINT nTimeOut );
|
||||
extern HB_EXPORT HB_SIZE hb_fsPipeRead ( HB_FHANDLE hPipeHandle, void * buffer, HB_SIZE nSize, HB_MAXINT nTimeOut );
|
||||
extern HB_EXPORT int hb_fsIsPipeOrSock( HB_FHANDLE hPipeHandle );
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
#define HB_STRNCAT( dst, src, len ) hb_wstrncat( dst, src, len )
|
||||
#define HB_STRCMP( s1, s2 ) hb_wstrcmp( s1, s2 )
|
||||
#define HB_STRNCMP( s1, s2, len ) hb_wstrncmp( s1, s2, len )
|
||||
#define HB_FSNAMECONV( fname, pfree ) ( *pfree = hb_fsNameConvU16( fname ) )
|
||||
#else
|
||||
#define HB_PARSTR( n, h, len ) hb_parstr( n, hb_setGetOSCP(), h, len )
|
||||
#define HB_PARSTRDEF( n, h, len ) hb_strnull( hb_parstr( n, hb_setGetOSCP(), h, len ) )
|
||||
@@ -109,6 +110,7 @@
|
||||
#define HB_STRNCAT( dst, src, len ) hb_strncat( dst, src, len )
|
||||
#define HB_STRCMP( s1, s2 ) strcmp( s1, s2 )
|
||||
#define HB_STRNCMP( s1, s2, len ) strncmp( s1, s2, len )
|
||||
#define HB_FSNAMECONV( fname, pfree ) pfreehb_fsNameConvU16( fname, pfree )
|
||||
#endif
|
||||
|
||||
#endif /* HB_OS_WIN */
|
||||
|
||||
@@ -76,7 +76,8 @@ HB_BOOL hb_strMatchWild( const char *szString, const char *szPattern )
|
||||
fAny = HB_TRUE;
|
||||
i++;
|
||||
}
|
||||
else if( j < nLen && ( szPattern[i] == '?' || szPattern[i] == szString[j] ) )
|
||||
else if( j < nLen &&
|
||||
( szPattern[i] == '?' || szPattern[i] == szString[j] ) )
|
||||
{
|
||||
if( fAny )
|
||||
{
|
||||
@@ -210,7 +211,7 @@ HB_BOOL hb_strMatchCaseWildExact( const char *szString, const char *szPattern )
|
||||
i = j = nAny = 0;
|
||||
nLen = strlen( szString );
|
||||
nSize = strlen( szPattern );
|
||||
while ( i < nSize || ( j < nLen && !fAny ) )
|
||||
while( i < nSize || ( j < nLen && !fAny ) )
|
||||
{
|
||||
if( i < nSize && szPattern[i] == '*' )
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ STATIC PROCEDURE PutDBF( aDirEntry )
|
||||
|
||||
IF ( fhnd := FOpen( aDirEntry[ F_NAME ] ) ) != F_ERROR
|
||||
|
||||
buffer := Replicate( Chr( 0 ), 8 )
|
||||
buffer := Space( 8 )
|
||||
|
||||
IF FRead( fhnd, @buffer, 8 ) == 8 .AND. ;
|
||||
AScan( { 0x03, 0x06, 0x30, 0x31, 0x83, 0x86, 0xE5, 0xE6, 0xF5, 0xF6 }, ;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -429,7 +429,7 @@ int hb_gt_sln_ReadKey( PHB_GT pGT, int iEventMask )
|
||||
int n = 0;
|
||||
HB_USHORT uc = 0;
|
||||
|
||||
if( hb_cdpGetFromUTF8( hb_sln_cdpIN, ( HB_BYTE ) ch, &n, &uc ) )
|
||||
if( hb_cdpGetFromUTF8( hb_sln_cdpIN, ( HB_UCHAR ) ch, &n, &uc ) )
|
||||
{
|
||||
unsigned int buf[ 10 ], i = 0;
|
||||
|
||||
@@ -439,16 +439,13 @@ int hb_gt_sln_ReadKey( PHB_GT pGT, int iEventMask )
|
||||
- HB_MAX( hb_sln_escDelay, 0 ) ) == 0 )
|
||||
break;
|
||||
buf[ i++ ] = SLang_getkey();
|
||||
if( !hb_cdpGetFromUTF8( hb_sln_cdpIN, ( HB_BYTE ) buf[ i - 1 ], &n, &uc ) )
|
||||
break;
|
||||
if( !hb_cdpGetFromUTF8( hb_sln_cdpIN, ( HB_UCHAR ) buf[ i - 1 ], &n, &uc ) )
|
||||
n = -1;
|
||||
}
|
||||
if( n > 0 )
|
||||
{
|
||||
while( i > 0 )
|
||||
SLang_ungetkey( buf[ --i ] );
|
||||
}
|
||||
else
|
||||
if( n == 0 )
|
||||
ch = uc;
|
||||
else while( i > 0 )
|
||||
SLang_ungetkey( buf[ --i ] );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1477,9 +1477,10 @@ again:
|
||||
while( n > 0 )
|
||||
{
|
||||
ch = test_bufch( pTerm, i++, pTerm->esc_delay );
|
||||
if( ch < 0 || ch > 255 ||
|
||||
!hb_cdpGetFromUTF8( pTerm->cdpIn, ch, &n, &uc ) )
|
||||
if( ch < 0 || ch > 255 )
|
||||
break;
|
||||
if( !hb_cdpGetFromUTF8( pTerm->cdpIn, ch, &n, &uc ) )
|
||||
n = -1;
|
||||
}
|
||||
if( n == 0 )
|
||||
{
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
# include "../../src/3rd/hbpmcom/com.h"
|
||||
#elif defined( HB_OS_WIN )
|
||||
# include <windows.h>
|
||||
# include "hbwinuni.h"
|
||||
#elif defined( HB_OS_OS2 )
|
||||
# define INCL_BASE
|
||||
# define INCL_DOS
|
||||
@@ -1235,6 +1236,7 @@ int hb_comClose( int iPort )
|
||||
|
||||
if( pCom )
|
||||
{
|
||||
hb_vmUnlock();
|
||||
#if defined( TIOCNXCL )
|
||||
ioctl( pCom->fd, TIOCNXCL );
|
||||
#endif
|
||||
@@ -1250,6 +1252,7 @@ int hb_comClose( int iPort )
|
||||
pCom->fd = ( HB_FHANDLE ) FS_ERROR;
|
||||
pCom->status &= ~HB_COM_OPEN;
|
||||
}
|
||||
hb_vmLock();
|
||||
}
|
||||
|
||||
return iResult;
|
||||
@@ -1271,6 +1274,8 @@ int hb_comOpen( int iPort )
|
||||
char buffer[ HB_COM_DEV_NAME_MAX ];
|
||||
const char * name = hb_comGetName( pCom, buffer, sizeof( buffer ) );
|
||||
|
||||
hb_vmUnlock();
|
||||
|
||||
pCom->fd = open( name, O_RDWR | O_NOCTTY );
|
||||
if( pCom->fd != -1 )
|
||||
{
|
||||
@@ -1289,6 +1294,8 @@ int hb_comOpen( int iPort )
|
||||
pCom->status |= HB_COM_OPEN;
|
||||
}
|
||||
hb_comSetOsError( pCom, iResult == -1 );
|
||||
|
||||
hb_vmLock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1957,11 +1964,13 @@ int hb_comClose( int iPort )
|
||||
|
||||
if( pCom )
|
||||
{
|
||||
hb_vmUnlock();
|
||||
/* FlushFileBuffers( pCom->hComm ); */
|
||||
fResult = CloseHandle( pCom->hComm );
|
||||
pCom->hComm = INVALID_HANDLE_VALUE;
|
||||
pCom->status &= ~HB_COM_OPEN;
|
||||
hb_comSetOsError( pCom, !fResult );
|
||||
hb_vmLock();
|
||||
}
|
||||
|
||||
return fResult ? 0 : -1;
|
||||
@@ -1982,9 +1991,11 @@ int hb_comOpen( int iPort )
|
||||
{
|
||||
char buffer[ HB_COM_DEV_NAME_MAX ];
|
||||
const char * szName = hb_comGetName( pCom, buffer, sizeof( buffer ) );
|
||||
TCHAR lpName[ HB_COM_DEV_NAME_MAX ];
|
||||
LPTSTR lpName, lpFree;
|
||||
|
||||
HB_TCHAR_COPYTO( lpName, szName, HB_SIZEOFARRAY( lpName ) - 1 );
|
||||
lpName = HB_FSNAMECONV( szName, &lpFree );
|
||||
|
||||
hb_vmUnlock();
|
||||
|
||||
pCom->hComm = CreateFile( lpName,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
@@ -1998,6 +2009,11 @@ int hb_comOpen( int iPort )
|
||||
pCom->status |= HB_COM_OPEN;
|
||||
}
|
||||
hb_comSetOsError( pCom, !fResult );
|
||||
|
||||
hb_vmLock();
|
||||
|
||||
if( lpFree )
|
||||
hb_xfree( lpFree );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2763,11 +2779,13 @@ int hb_comClose( int iPort )
|
||||
|
||||
if( pCom )
|
||||
{
|
||||
hb_vmUnlock();
|
||||
/* DosResetBuffer( pCom->hFile ); */
|
||||
rc = DosClose( pCom->hFile );
|
||||
pCom->hFile = 0;
|
||||
pCom->status &= ~HB_COM_OPEN;
|
||||
hb_comSetOsError( pCom, rc );
|
||||
hb_vmLock();
|
||||
}
|
||||
|
||||
return ( rc == NO_ERROR ) ? 0 : -1;
|
||||
@@ -2790,6 +2808,8 @@ int hb_comOpen( int iPort )
|
||||
const char * pszName = hb_comGetName( pCom, buffer, sizeof( buffer ) );
|
||||
ULONG ulAction = 0;
|
||||
|
||||
hb_vmUnlock();
|
||||
|
||||
rc = DosOpen( ( PSZ ) pszName,
|
||||
&pCom->hFile,
|
||||
&ulAction,
|
||||
@@ -2802,6 +2822,8 @@ int hb_comOpen( int iPort )
|
||||
pCom->status |= HB_COM_OPEN;
|
||||
|
||||
hb_comSetOsError( pCom, rc );
|
||||
|
||||
hb_vmLock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3281,10 +3303,12 @@ int hb_comClose( int iPort )
|
||||
|
||||
if( pCom )
|
||||
{
|
||||
hb_vmUnlock();
|
||||
COMPortClose( iPort - 1 );
|
||||
pCom->status &= ~HB_COM_OPEN;
|
||||
hb_comSetOsError( pCom, 0 );
|
||||
iResult = 0;
|
||||
hb_vmLock();
|
||||
}
|
||||
|
||||
return iResult;
|
||||
@@ -3305,6 +3329,8 @@ int hb_comOpen( int iPort )
|
||||
{
|
||||
int iBaud, iParity, iSize, iStop, iFlowControl;
|
||||
|
||||
hb_vmUnlock();
|
||||
|
||||
iBaud = iParity = iSize = iStop = 0;
|
||||
iFlowControl = 0;
|
||||
s_comChkPortParam( &iBaud, &iParity, &iSize, &iStop );
|
||||
@@ -3320,6 +3346,8 @@ int hb_comOpen( int iPort )
|
||||
hb_comSetOsError( pCom, iResult );
|
||||
iResult = -1;
|
||||
}
|
||||
|
||||
hb_vmLock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1017,12 +1017,12 @@ int hb_fsProcessRun( const char * pszFilename,
|
||||
for( ;; )
|
||||
{
|
||||
dwCount = 0;
|
||||
if( nStdInLen && hStdin != FS_ERROR )
|
||||
lpHandles[ dwCount++ ] = ( HANDLE ) hb_fsGetOsHandle( hStdin );
|
||||
if( hStdout != FS_ERROR )
|
||||
lpHandles[ dwCount++ ] = ( HANDLE ) hb_fsGetOsHandle( hStdout );
|
||||
if( hStderr != FS_ERROR )
|
||||
lpHandles[ dwCount++ ] = ( HANDLE ) hb_fsGetOsHandle( hStderr );
|
||||
if( nStdInLen && hStdin != FS_ERROR )
|
||||
lpHandles[ dwCount++ ] = ( HANDLE ) hb_fsGetOsHandle( hStdin );
|
||||
|
||||
lpHandles[ dwCount++ ] = ( HANDLE ) hb_fsGetOsHandle( hProcess );
|
||||
|
||||
@@ -1110,6 +1110,13 @@ int hb_fsProcessRun( const char * pszFilename,
|
||||
hStdin = FS_ERROR;
|
||||
}
|
||||
|
||||
if( hStdin != FS_ERROR )
|
||||
hb_fsPipeUnblock( hStdin );
|
||||
if( hStdout != FS_ERROR )
|
||||
hb_fsPipeUnblock( hStdout );
|
||||
if( hStderr != FS_ERROR )
|
||||
hb_fsPipeUnblock( hStderr );
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
fdMax = 0;
|
||||
@@ -1145,18 +1152,6 @@ int hb_fsProcessRun( const char * pszFilename,
|
||||
n = select( fdMax + 1, prfds, pwfds, NULL, NULL );
|
||||
if( n > 0 )
|
||||
{
|
||||
if( nStdInLen && hStdin != FS_ERROR && FD_ISSET( hStdin, &wfds ) )
|
||||
{
|
||||
ul = hb_fsWriteLarge( hStdin, pStdInBuf, nStdInLen );
|
||||
pStdInBuf += ul;
|
||||
nStdInLen -= ul;
|
||||
if( nStdInLen == 0 )
|
||||
{
|
||||
hb_fsClose( hStdin );
|
||||
hStdin = FS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if( hStdout != FS_ERROR && FD_ISSET( hStdout, &rfds ) )
|
||||
{
|
||||
if( nOutBuf == nOutSize )
|
||||
@@ -1196,7 +1191,21 @@ int hb_fsProcessRun( const char * pszFilename,
|
||||
else
|
||||
nErrBuf += ul;
|
||||
}
|
||||
|
||||
if( nStdInLen && hStdin != FS_ERROR && FD_ISSET( hStdin, &wfds ) )
|
||||
{
|
||||
ul = hb_fsWriteLarge( hStdin, pStdInBuf, nStdInLen );
|
||||
pStdInBuf += ul;
|
||||
nStdInLen -= ul;
|
||||
if( nStdInLen == 0 )
|
||||
{
|
||||
hb_fsClose( hStdin );
|
||||
hStdin = FS_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if( hStdin != FS_ERROR )
|
||||
|
||||
Reference in New Issue
Block a user