2008-10-27 11:26 UTC+0200 Viktor Szakats (harbour.01 syenar hu)

* source/common/hbstr.c
    * Some tweaks to hb_snprintf(). It still doesn't work 
      for some reason.

  * include/hbapi.h
    + Added hb_snprintf() to header.

  * source/debug/dbgentry.c
    * Changed strcpy() to hb_strncpy(). Chances are high 
      this is wrong. Please review and test.
This commit is contained in:
Viktor Szakats
2008-10-27 10:26:54 +00:00
parent 2a1b6c0d64
commit bfd31350c2
4 changed files with 28 additions and 17 deletions

View File

@@ -8,6 +8,18 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-10-27 11:26 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/common/hbstr.c
* Some tweaks to hb_snprintf(). It still doesn't work
for some reason.
* include/hbapi.h
+ Added hb_snprintf() to header.
* source/debug/dbgentry.c
* Changed strcpy() to hb_strncpy(). Chances are high
this is wrong. Please review and test.
2008-10-27 10:37 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/pp/ppcore.c
+ Added '#pragma TEXTHIDDEN=<ON | OFF>' to control the

View File

@@ -821,12 +821,13 @@ extern HB_EXPORT char * hb_strndup( const char * pszText, ULONG ulLen ); /* r
extern HB_EXPORT char * hb_strduptrim( const char * pszText ); /* returns a pointer to a newly allocated copy of the trimmed source string */
extern HB_EXPORT ULONG hb_strlentrim( const char * pszText ); /* like strlen() but result is the length of trimmed text */
extern HB_EXPORT ULONG hb_strnlen( const char * pszText, ULONG ulLen ); /* like strlen() but result is limited to ulLen */
extern HB_EXPORT char * hb_xstrcat( char *dest, const char *src, ... ); /* Concatenates multiple strings into a single result */
extern HB_EXPORT char * hb_xstrcpy( char *szDest, const char *szSrc, ...); /* Concatenates multiple strings into a single result */
extern HB_EXPORT BOOL hb_compStrToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth ); /* converts string to number, sets iDec, iWidth and returns TRUE if results is double, used by compiler */
extern HB_EXPORT BOOL hb_valStrnToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth ); /* converts string to number, sets iDec, iWidth and returns TRUE if results is double, used by VAL() */
extern HB_EXPORT BOOL hb_strToNum( const char* szNum, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */
extern HB_EXPORT BOOL hb_strnToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */
extern HB_EXPORT char * hb_xstrcat( char * dest, const char * src, ... ); /* Concatenates multiple strings into a single result */
extern HB_EXPORT char * hb_xstrcpy( char * szDest, const char * szSrc, ... ); /* Concatenates multiple strings into a single result */
extern HB_EXPORT BOOL hb_compStrToNum( const char * szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth ); /* converts string to number, sets iDec, iWidth and returns TRUE if results is double, used by compiler */
extern HB_EXPORT BOOL hb_valStrnToNum( const char * szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth ); /* converts string to number, sets iDec, iWidth and returns TRUE if results is double, used by VAL() */
extern HB_EXPORT BOOL hb_strToNum( const char * szNum, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */
extern HB_EXPORT BOOL hb_strnToNum( const char * szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */
extern HB_EXPORT void hb_snprintf( char * buffer, ULONG nSize, const char * format, ... ); /* snprintf() wrapper */
extern HB_EXPORT BOOL hb_strMatchFile( const char * pszString, const char * szPattern ); /* compare two strings using platform dependent rules for file matching */
extern HB_EXPORT BOOL hb_strMatchRegExp( const char * szString, const char * szPattern ); /* compare two strings using a regular expression pattern */

View File

@@ -1112,29 +1112,27 @@ char * hb_compDecodeString( int iMethod, const char * szText, ULONG * pulLen )
#undef _HB_SNPRINTF_ADD_EOS
#undef snprintf
/* NOTE: The full size of the buffer is expected as nSize. [vszakats] */
HB_EXPORT void hb_snprintf( char * buffer, ULONG nSize, ... )
HB_EXPORT void hb_snprintf( char * buffer, ULONG nSize, const char * format, ... )
{
va_list va;
va_list arglist;
va_start( va, nSize );
va_start( arglist, format );
#if defined( __DJGPP__ ) && ( __DJGPP__ < 2 || ( __DJGPP__ == 2 && __DJGPP_MINOR__ <= 3 ) )
/* Use sprintf() for DJGPP <= 2.03.
This is a temporary hack, should implement a C99 snprintf() ourselves. */
sprintf( buffer, va );
sprintf( buffer, format, arglist );
#elif defined( _MSC_VER ) && _MSC_VER >= 1400
_snprintf_s( buffer, nSize, _TRUNCATE, va );
_snprintf_s( buffer, nSize, _TRUNCATE, format, arglist );
#elif defined( _MSC_VER ) || defined( __DMC__ ) && !defined( __XCC__ )
_snprintf( buffer, nSize, va );
_snprintf( buffer, nSize, format, arglist );
#define _HB_SNPRINTF_ADD_EOS
#elif defined( __WATCOMC__ ) && __WATCOMC__ < 1200
_bprintf( buffer, nSize, va );
_bprintf( buffer, nSize, format, arglist );
#else
snprintf( buffer, nSize, va );
snprintf( buffer, nSize, format, arglist );
#endif
va_end( va );
#ifdef _HB_SNPRINTF_ADD_EOS
if( buffer && nSize )
buffer[ nSize - 1 ] = '\0';

View File

@@ -1056,7 +1056,7 @@ hb_dbgEvalSubstituteVar( HB_WATCHPOINT *watch, char *szWord, int nStart, int nLe
t[ nStart + 6 ] = '0' + ( char ) ( ( j + 1 ) / 10 );
t[ nStart + 7 ] = '0' + ( char ) ( ( j + 1 ) % 10 );
t[ nStart + 8 ] = ']';
strcpy( t + nStart + 9, watch->szExpr + nStart + nLen );
hb_strncpy( t + nStart + 9, watch->szExpr + nStart + nLen, strlen( watch->szExpr ) - nLen + 1 - nStart );
FREE( watch->szExpr );
watch->szExpr = t;
return nStart + 9;