From 77394377fb1cf5a9153a07f36c918dbd780ae075 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 27 May 2008 15:12:00 +0000 Subject: [PATCH] 2008-05-27 17:11 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/idle.c * updated included header files * removed unnecessary separated code for MacOSX * small modification in comment * harbour/source/hbpcre/pcreinal.h ! do not redefine BOOL type and TRUE / FALSE definitions * harbour/source/hbpcre/_hbpcreg.c * remap memory functions to Harbour core ones * harbour/source/hbpcre/pcrevutf.c * harbour/source/hbpcre/pcreoutf.c * harbour/source/hbpcre/pcrecomp.c * pacify warnings when utf8 mode is disabled * harbour/source/hbpcre/pcrefind.c * casting * harbour/contrib/gtwvg/wvtutils.c * harbour/contrib/rddads/adsfunc.c * cleanup warnings --- harbour/ChangeLog | 24 ++++++++++++++++++++++++ harbour/contrib/gtwvg/wvtutils.c | 26 +++++++++++--------------- harbour/contrib/rddads/adsfunc.c | 2 ++ harbour/source/hbpcre/_hbpcreg.c | 17 ++++++----------- harbour/source/hbpcre/pcrecomp.c | 9 +++++++++ harbour/source/hbpcre/pcrefind.c | 2 +- harbour/source/hbpcre/pcreinal.h | 2 ++ harbour/source/hbpcre/pcreoutf.c | 3 +++ harbour/source/hbpcre/pcrevutf.c | 4 ++++ harbour/source/rtl/idle.c | 20 +++++++++++--------- 10 files changed, 73 insertions(+), 36 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f50e07e8c3..4645c0ebfe 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,30 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-05-27 17:11 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rtl/idle.c + * updated included header files + * removed unnecessary separated code for MacOSX + * small modification in comment + + * harbour/source/hbpcre/pcreinal.h + ! do not redefine BOOL type and TRUE / FALSE definitions + + * harbour/source/hbpcre/_hbpcreg.c + * remap memory functions to Harbour core ones + + * harbour/source/hbpcre/pcrevutf.c + * harbour/source/hbpcre/pcreoutf.c + * harbour/source/hbpcre/pcrecomp.c + * pacify warnings when utf8 mode is disabled + + * harbour/source/hbpcre/pcrefind.c + * casting + + * harbour/contrib/gtwvg/wvtutils.c + * harbour/contrib/rddads/adsfunc.c + * cleanup warnings + 2008-05-27 09:43 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * include/hbapi.h * source/vm/hvm.c diff --git a/harbour/contrib/gtwvg/wvtutils.c b/harbour/contrib/gtwvg/wvtutils.c index be80460f38..3e812f4d22 100644 --- a/harbour/contrib/gtwvg/wvtutils.c +++ b/harbour/contrib/gtwvg/wvtutils.c @@ -1656,9 +1656,9 @@ HB_FUNC( WIN_SENDMESSAGE ) HB_FUNC( WIN_SENDDLGITEMMESSAGE ) { - char *cText; PHB_ITEM pText = hb_param( 5, HB_IT_STRING ); - int iLen; + char *cText = NULL; + int iLen = 0; if( pText ) { @@ -1666,26 +1666,22 @@ HB_FUNC( WIN_SENDDLGITEMMESSAGE ) cText = (char*) hb_xgrab( iLen+1 ); hb_xmemcpy( cText, hb_itemGetCPtr( pText ), iLen+1 ); } - else - { - cText = NULL; - } hb_retnl( (LONG) SendDlgItemMessage( (HWND) hb_parnl( 1 ) , (int) hb_parni( 2 ) , (UINT) hb_parni( 3 ) , (ISNIL(4) ? 0 : (WPARAM) hb_parnl( 4 )) , (cText ? (LPARAM) cText : (LPARAM) hb_parnl( 5 )) - ) ) ; + ) ); - if( ISBYREF( 5 ) && pText ) - { - hb_storclen( cText, iLen, 5 ) ; - } - if( cText ) - { - hb_xfree( cText ); - } + if( cText ) + { + if( ISBYREF( 5 ) ) + { + hb_storclen( cText, iLen, 5 ) ; + } + hb_xfree( cText ); + } } //-------------------------------------------------------------------// diff --git a/harbour/contrib/rddads/adsfunc.c b/harbour/contrib/rddads/adsfunc.c index fca4b85096..21fdb17e5e 100644 --- a/harbour/contrib/rddads/adsfunc.c +++ b/harbour/contrib/rddads/adsfunc.c @@ -1419,7 +1419,9 @@ UNSIGNED32 WINAPI hb_adsShowPercentageCB( UNSIGNED16 usPercentDone ) return fResult; } else + { HB_TRACE(HB_TR_DEBUG, ("hb_adsShowPercentageCB(%d) called with no codeblock set.\n", usPercentDone )); + } return 0; } diff --git a/harbour/source/hbpcre/_hbpcreg.c b/harbour/source/hbpcre/_hbpcreg.c index 9878504182..e509cc4efe 100644 --- a/harbour/source/hbpcre/_hbpcreg.c +++ b/harbour/source/hbpcre/_hbpcreg.c @@ -60,13 +60,6 @@ static void * hb_pcre_grab( size_t size ) return hb_xgrab( size ); } -#ifdef TRUE -#undef TRUE -#endif -#ifdef FALSE -#undef FALSE -#endif - #if 1 #include "_hbconf.h" #endif @@ -74,11 +67,13 @@ static void * hb_pcre_grab( size_t size ) #include "pcreinal.h" #ifndef VPCOMPAT -PCRE_EXP_DATA_DEFN void *(*pcre_malloc)(size_t) = malloc; -PCRE_EXP_DATA_DEFN void (*pcre_free)(void *) = free; -PCRE_EXP_DATA_DEFN void *(*pcre_stack_malloc)(size_t) = malloc; -PCRE_EXP_DATA_DEFN void (*pcre_stack_free)(void *) = free; +HB_EXTERN_BEGIN +PCRE_EXP_DATA_DEFN void *(*pcre_malloc)(size_t) = hb_pcre_grab; +PCRE_EXP_DATA_DEFN void (*pcre_free)(void *) = hb_xfree; +PCRE_EXP_DATA_DEFN void *(*pcre_stack_malloc)(size_t) = hb_pcre_grab; +PCRE_EXP_DATA_DEFN void (*pcre_stack_free)(void *) = hb_xfree; PCRE_EXP_DATA_DEFN int (*pcre_callout)(pcre_callout_block *) = NULL; +HB_EXTERN_END #endif /* End of pcre_globals.c */ diff --git a/harbour/source/hbpcre/pcrecomp.c b/harbour/source/hbpcre/pcrecomp.c index bab78457b5..aeae12eeed 100644 --- a/harbour/source/hbpcre/pcrecomp.c +++ b/harbour/source/hbpcre/pcrecomp.c @@ -1450,6 +1450,9 @@ for (;;) if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f]; break; } +#else + /* pacify warnings */ + (void)(utf8); #endif } } @@ -1543,6 +1546,9 @@ for (;;) if (code[-1] >= 0xc0) code += _pcre_utf8_table4[code[-1] & 0x3f]; break; } +#else + /* pacify warnings */ + (void)(utf8); #endif } } @@ -2134,6 +2140,9 @@ if (next >= 0) switch(op_code) case OP_CHAR: #ifdef SUPPORT_UTF8 if (utf8 && item > 127) { GETCHAR(item, utf8_char); } +#else + /* pacify warnings */ + (void)(utf8_char); #endif return item != next; diff --git a/harbour/source/hbpcre/pcrefind.c b/harbour/source/hbpcre/pcrefind.c index b1840f8901..529555c709 100644 --- a/harbour/source/hbpcre/pcrefind.c +++ b/harbour/source/hbpcre/pcrefind.c @@ -152,7 +152,7 @@ makes things a lot slower. */ for (;;) { - if (top <= bot) return -1; + if (top <= bot) return (unsigned int) -1; mid = (bot + top) >> 1; if (c == (ucp_table[mid].f0 & f0_charmask)) break; if (c < (ucp_table[mid].f0 & f0_charmask)) top = mid; diff --git a/harbour/source/hbpcre/pcreinal.h b/harbour/source/hbpcre/pcreinal.h index 102e2d01e2..01fdb2552e 100644 --- a/harbour/source/hbpcre/pcreinal.h +++ b/harbour/source/hbpcre/pcreinal.h @@ -551,10 +551,12 @@ variable-length repeat, or a anything other than literal characters. */ /* Miscellaneous definitions */ +#ifndef FALSE typedef int BOOL; #define FALSE 0 #define TRUE 1 +#endif /* Escape items that are just an encoding of a particular data value. */ diff --git a/harbour/source/hbpcre/pcreoutf.c b/harbour/source/hbpcre/pcreoutf.c index 0f100bf21e..e9e5b0b173 100644 --- a/harbour/source/hbpcre/pcreoutf.c +++ b/harbour/source/hbpcre/pcreoutf.c @@ -78,6 +78,9 @@ for (j = i; j > 0; j--) *buffer = _pcre_utf8_table2[i] | cvalue; return i + 1; #else +/* pacify warnings */ +(void)(cvalue); +(void)(buffer); return 0; /* Keep compiler happy; this function won't ever be */ #endif /* called when SUPPORT_UTF8 is not defined. */ } diff --git a/harbour/source/hbpcre/pcrevutf.c b/harbour/source/hbpcre/pcrevutf.c index bdfa2012c3..ace2baac3f 100644 --- a/harbour/source/hbpcre/pcrevutf.c +++ b/harbour/source/hbpcre/pcrevutf.c @@ -154,6 +154,10 @@ for (p = string; length-- > 0; p++) if ((*(++p) & 0xc0) != 0x80) return p - string; } } +#else +/* pacify warnings */ +(void)(string); +(void)(length); #endif return -1; diff --git a/harbour/source/rtl/idle.c b/harbour/source/rtl/idle.c index ed2b3204d8..63bd88506c 100644 --- a/harbour/source/rtl/idle.c +++ b/harbour/source/rtl/idle.c @@ -77,6 +77,7 @@ #ifndef __USE_POSIX199309 #define __USE_POSIX199309 #endif + #include #include #include #endif @@ -139,13 +140,6 @@ void hb_releaseCPU( void ) HB_DOS_INT86( 0x2F, ®s, ®s ); } -#elif defined(HB_OS_DARWIN) - { - struct timeval tv; - tv.tv_sec = 0; - tv.tv_usec = 1000; - select( 0, NULL, NULL, NULL, &tv ); - } #elif defined(HB_OS_UNIX) { struct timeval tv; @@ -153,10 +147,18 @@ void hb_releaseCPU( void ) tv.tv_usec = 1000; select( 0, NULL, NULL, NULL, &tv ); } - /* the code below is more efficient but doesn't work in Centos 5.1 + + /* the code below is simpler but seems that some Linux kernels + * (f.e. from Centos 5.1) have problems with nanosleep() + * so it was replaced by above code + */ + + /* + { static const struct timespec nanosecs = { 0, 1000000 }; nanosleep( &nanosecs, NULL ); - */ + } + */ #else /* Do nothing */