2007-07-30 18:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbcompat.ch
    + added #xtranslate ISPOINTER( <xValue> )
    * simplified bit operator translations

  * harbour/include/hbapi.h
    + added #define hb_itemPutCStatic(...) hb_itemPutCConst(...)

  * harbour/include/hbapiitm.h
    - removed #define hb_retclenAdoptRaw(...) hb_retclen_buffer(...)
      it's not _exactly_ the same and in some cases it cannot be
      replaced so users should know what exactly they are doing

  * harbour/source/rtl/gttrm/gttrm.c
    + added some #ifdef OS_UNIX_COMPATIBLE for future non *nix ports

  * harbour/source/rdd/dbf1.c
    ! added RT error when someone tires to create DBF with more then
      2046 fields - without it corrupted files were created or GPF
      appeared

  * harbour/contrib/ole2/w32ole.c
    * changed hb_retclenAdoptRaw() to hb_retclen_buffer()
This commit is contained in:
Przemyslaw Czerpak
2007-07-30 16:00:32 +00:00
parent 91789130ab
commit 85ffaae73a
7 changed files with 96 additions and 28 deletions

View File

@@ -8,6 +8,30 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-07-30 18:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbcompat.ch
+ added #xtranslate ISPOINTER( <xValue> )
* simplified bit operator translations
* harbour/include/hbapi.h
+ added #define hb_itemPutCStatic(...) hb_itemPutCConst(...)
* harbour/include/hbapiitm.h
- removed #define hb_retclenAdoptRaw(...) hb_retclen_buffer(...)
it's not _exactly_ the same and in some cases it cannot be
replaced so users should know what exactly they are doing
* harbour/source/rtl/gttrm/gttrm.c
+ added some #ifdef OS_UNIX_COMPATIBLE for future non *nix ports
* harbour/source/rdd/dbf1.c
! added RT error when someone tires to create DBF with more then
2046 fields - without it corrupted files were created or GPF
appeared
* harbour/contrib/ole2/w32ole.c
* changed hb_retclenAdoptRaw() to hb_retclen_buffer()
2007-07-27 01:52 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/make_gcc.sh
* harbour/makefile.gc

View File

@@ -221,7 +221,7 @@ static void TraceLog( const char * sFile, const char * sTraceMsg, ... )
if( nConvertedLen )
{
LPWSTR wString = (LPWSTR) hb_xgrab( nConvertedLen * 2 );
LPWSTR wString = (LPWSTR) hb_xgrab( nConvertedLen * 2 + 1 );
if( MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, cString, -1, wString, nConvertedLen ) )
{
@@ -296,7 +296,7 @@ static void TraceLog( const char * sFile, const char * sTraceMsg, ... )
if( wString )
{
hb_retclenAdoptRaw( (char *) wString, SysStringLen( wString ) );
hb_retclen_buffer( (char *) wString, SysStringLen( wString ) );
return;
}
}

View File

@@ -597,7 +597,6 @@ extern HB_EXPORT void hb_retnlllen( LONGLONG lNumber, int iWidth ); /* returns
/* xHarbour compatible function */
#define hb_retcAdopt( szText ) hb_retc_buffer( (szText) )
#define hb_retclenAdopt( szText, ulLen ) hb_retclen_buffer( (szText), (ulLen) )
#define hb_retclenAdoptRaw( szText, ulLen ) hb_retclen_buffer( (szText), (ulLen) )
#define hb_retcStatic( szText ) hb_retc_const( (szText) )
#ifdef HB_API_MACROS

View File

@@ -195,6 +195,7 @@ extern HB_EXPORT void hb_itemSwap ( PHB_ITEM pItem1, PHB_ITEM pItem2 )
/* xHarbour compatible function */
#define hb_itemForwardValue( dst, src ) hb_itemMove( (dst), (src) )
#define hb_itemPutCStatic( itm, str ) hb_itemPutCConst( (itm), (str) )
HB_EXTERN_END

View File

@@ -130,8 +130,13 @@
#xtranslate HEXTONUM([<c,...>]) => HB_HEXTONUM(<c>)
#xtranslate NUMTOHEX([<n,...>]) => HB_NUMTOHEX(<n>)
#xtranslate ISPOINTER( <xValue> ) => HB_ISPOINTER( <xValue> )
#xcommand TEXT INTO <v> => #pragma __text|<v>+=%s+HB_OSNEWLINE();<v>:=""
/* SWITCH ... ; case ... ; DEFAULT ; ... ; END */
#xcommand DEFAULT => OTHERWISE
@@ -145,18 +150,14 @@
#xcommand > [<*x*>] => } <x>
/* xHarbour operators: IN, HAS, LIKE, >>, <<, |, &, ^^ */
#translate ( <exp1> IN <exp2> ) => ( <exp1> $ <exp2> )
#translate ( <exp1> HAS <exp2> ) => ( HB_REGEXHAS( <exp2>, <exp1> ) )
#translate ( <exp1> LIKE <exp2> ) => ( HB_REGEXLIKE( <exp2>, <exp1> ) )
#translate ( <exp1> \<\< <exp2> ) => ( HB_BITSHIFT( <exp1>, <exp2> ) )
#translate ( <exp1> >> <exp2> ) => ( HB_BITSHIFT( <exp1>, -<exp2> ) )
#translate ( <exp1> | <exp2> ) => ( HB_BITOR( <exp1>, <exp2> ) )
#translate ( <exp1> & <exp2> ) => ( HB_BITAND( <exp1>, <exp2> ) )
#translate ( <exp1> ^^ <exp2> ) => ( HB_BITXOR( <exp1>, <exp2> ) )
#xtranslate HB_BITOR( [<expN>,] <exp2> | <exp3> ) => HB_BITOR( [<expN>,] <exp2>, <exp3> )
#xtranslate HB_BITAND( [<expN>,] <exp2> & <exp3> ) => HB_BITAND( [<expN>,] <exp2>, <exp3> )
#xtranslate HB_BITXOR( [<expN>,] <exp2> ^^ <exp3> ) => HB_BITXOR( [<expN>,] <exp2>, <exp3> )
#translate ( <exp1> IN <exp2> ) => ( (<exp1>) $ (<exp2>) )
#translate ( <exp1> HAS <exp2> ) => ( HB_REGEXHAS( (<exp2>), (<exp1>) ) )
#translate ( <exp1> LIKE <exp2> ) => ( HB_REGEXLIKE( (<exp2>), (<exp1>) ) )
#translate ( <exp1> \<\< <exp2> ) => ( HB_BITSHIFT( (<exp1>), (<exp2>) ) )
#translate ( <exp1> >> <exp2> ) => ( HB_BITSHIFT( (<exp1>), -(<exp2>) ) )
#translate ( <exp1> | <exp2> ) => ( HB_BITOR( (<exp1>), (<exp2>) ) )
#translate ( <exp1> & <exp2> ) => ( HB_BITAND( (<exp1>), (<exp2>) ) )
#translate ( <exp1> ^^ <exp2> ) => ( HB_BITXOR( (<exp1>), (<exp2>) ) )
#endif

View File

@@ -2290,6 +2290,19 @@ static ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo )
hb_itemRelease( pItem );
}
if( pArea->uiFieldCount * sizeof( DBFFIELD ) + sizeof( DBFHEADER ) +
( pArea->bTableType == DB_DBF_VFP ? 1 : 2 ) > UINT16_MAX )
{
pError = hb_errNew();
hb_errPutGenCode( pError, EG_CREATE );
hb_errPutSubCode( pError, EDBF_DATAWIDTH );
hb_errPutDescription( pError, hb_langDGetErrorDesc( EG_CREATE ) );
hb_errPutFileName( pError, ( char * ) pCreateInfo->abName );
SELF_ERROR( ( AREAP ) pArea, pError );
hb_itemRelease( pError );
return FAILURE;
}
if( !fRawBlob )
{
pError = NULL;

View File

@@ -147,16 +147,26 @@ static HB_GT_FUNCS SuperTable;
#define MOUSE_GPM 1
#define MOUSE_XTERM 2
#define TIMEVAL_GET(tv) gettimeofday(&(tv), NULL);
#if defined( OS_UNIX_COMPATIBLE )
#define TIMEVAL_GET(tv) gettimeofday(&(tv), NULL)
#define TIMEVAL_LESS(tv1, tv2) (((tv1).tv_sec == (tv2).tv_sec ) ? \
((tv1).tv_usec < (tv2).tv_usec) : \
((tv1).tv_sec < (tv2).tv_sec ))
#define TIMEVAL_ADD(dst, src, n) { \
(dst).tv_sec = (src).tv_sec + n / 1000; \
#define TIMEVAL_ADD(dst, src, n) do { \
(dst).tv_sec = (src).tv_sec + (n) / 1000; \
if(((dst).tv_usec = (src).tv_usec+(n%1000)*1000)>=1000000) {\
(dst).tv_usec -= 1000000; (dst).tv_sec++; \
} \
}
} while( 0 )
#else
#define TIMEVAL_GET(tv) do { (tv) = hb_dateSeconds(); } while( 0 )
#define TIMEVAL_LESS(tv1, tv2) ((tv1) < (tv2))
#define TIMEVAL_ADD(dst, src, n) do { (dst) = (src) + n / 1000; } while( 0 )
#endif
#define KEY_ALTMASK 0x10000000
#define KEY_CTRLMASK 0x20000000
@@ -250,9 +260,15 @@ typedef struct {
int mbup_row, mbup_col;
int mbdn_row, mbdn_col;
/* to analize DBLCLK on xterm */
#if defined( OS_UNIX_COMPATIBLE )
struct timeval BL_time;
struct timeval BR_time;
struct timeval BM_time;
#else
double BL_time;
double BR_time;
double BM_time;
#endif
} mouseEvent;
typedef struct _keyTab {
@@ -509,7 +525,7 @@ static const ClipKeyCode extdKeyTab[NO_EXTDKEYS] = {
static int getClipKey( int nKey )
{
int nRet = 0, nFlag = 0, n;
int nRet = 0, nFlag, n;
if( IS_CLIPKEY( nKey ) )
nRet = GET_CLIPKEY( nKey );
@@ -731,18 +747,23 @@ static int add_efds( int fd, int mode,
int ( *eventFunc ) ( int, int, void * ), void *data )
{
evtFD *pefd = NULL;
int i, fl;
int i;
if( eventFunc == NULL && mode != O_RDONLY )
return -1;
if( ( fl = fcntl( fd, F_GETFL, 0 ) ) == -1 )
return -1;
#if defined( OS_UNIX_COMPATIBLE )
{
int fl;
if( ( fl = fcntl( fd, F_GETFL, 0 ) ) == -1 )
return -1;
fl &= O_ACCMODE;
if( ( fl == O_RDONLY && mode == O_WRONLY ) ||
( fl == O_WRONLY && mode == O_RDONLY ) )
return -1;
fl &= O_ACCMODE;
if( ( fl == O_RDONLY && mode == O_WRONLY ) ||
( fl == O_WRONLY && mode == O_RDONLY ) )
return -1;
}
#endif
for( i = 0; i < s_termState.efds_no && !pefd; i++ )
if( s_termState.event_fds[i]->fd == fd )
@@ -908,7 +929,11 @@ static void chk_mevtdblck( mouseEvent * mEvt )
if( newbuttons != 0 )
{
#if defined( OS_UNIX_COMPATIBLE )
struct timeval tv;
#else
double tv;
#endif
TIMEVAL_GET( tv );
if( newbuttons & M_BUTTON_LEFT )
@@ -1175,8 +1200,13 @@ static int get_inch( int milisec )
{
unsigned char buf[STDIN_BUFLEN];
#if defined( OS_UNIX_COMPATIBLE )
n = read( s_termState.event_fds[i]->fd, buf,
STDIN_BUFLEN - s_termState.stdin_inbuf );
#else
n = hb_fsRead( s_termState.event_fds[i]->fd, buf,
STDIN_BUFLEN - s_termState.stdin_inbuf );
#endif
if( n == 0 )
s_termState.event_fds[i]->status = EVTFDSTAT_STOP;
else
@@ -2064,7 +2094,7 @@ static void hb_gt_trm_SetDispTrans( char * src, char * dst, int box )
if( src && dst )
{
for( i = 0; i < 256 && ( c = ( unsigned char ) src[i] ); i++ )
for( i = 0; i < 256 && ( c = ( unsigned char ) src[i] ) != 0; i++ )
{
d = ( unsigned char ) dst[i];
s_termState.chrattr[c] = d | HB_GTTRM_ATTR_STD;