From e0e468c641a624fdee1af451a8063b0385b034d5 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 8 Jul 2009 07:26:10 +0000 Subject: [PATCH] 2009-07-08 09:18 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbtip/utils.c % Cleanup, formatting, minor optimizations. * contrib/xhb/hbserv.c * contrib/hbgd/gdwrp.c * contrib/hbtip/utils.c * source/rtl/dateshb.c * source/rtl/setcolor.c * source/rtl/natmsg.c * source/rtl/hbinet.c % Using hb_retc_const() to return constant strings. * contrib/hbnf/fttext.c * contrib/hbmisc/hb_f.c ! Fixed to use hb_retnint() to return HB_FHANDLE. * contrib/xhb/hbxml.c * contrib/hbtip/utils.c * contrib/xhb/freadlin.c * examples/hbdoc/hbdfrdln.c * examples/hbmake/hbmakec.c ! Fixed to retrieve file handles with hb_itemGetNInt() and hb_parnint(), instead of long versions. --- harbour/ChangeLog | 25 ++ harbour/contrib/hbgd/gdwrp.c | 4 +- harbour/contrib/hbmisc/hb_f.c | 24 +- harbour/contrib/hbnf/fttext.c | 4 +- harbour/contrib/hbtip/utils.c | 543 +++++++++++++----------------- harbour/contrib/xhb/freadlin.c | 2 +- harbour/contrib/xhb/hbserv.c | 90 ++--- harbour/contrib/xhb/hbxml.c | 11 +- harbour/examples/hbdoc/hbdfrdln.c | 2 +- harbour/examples/hbmake/hbmakec.c | 2 +- harbour/source/rtl/dateshb.c | 2 +- harbour/source/rtl/hbinet.c | 10 +- harbour/source/rtl/natmsg.c | 6 +- harbour/source/rtl/setcolor.c | 2 +- 14 files changed, 330 insertions(+), 397 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a5465f7cd1..7ef8a57a6a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,31 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-08 09:18 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbtip/utils.c + % Cleanup, formatting, minor optimizations. + + * contrib/xhb/hbserv.c + * contrib/hbgd/gdwrp.c + * contrib/hbtip/utils.c + * source/rtl/dateshb.c + * source/rtl/setcolor.c + * source/rtl/natmsg.c + * source/rtl/hbinet.c + % Using hb_retc_const() to return constant strings. + + * contrib/hbnf/fttext.c + * contrib/hbmisc/hb_f.c + ! Fixed to use hb_retnint() to return HB_FHANDLE. + + * contrib/xhb/hbxml.c + * contrib/hbtip/utils.c + * contrib/xhb/freadlin.c + * examples/hbdoc/hbdfrdln.c + * examples/hbmake/hbmakec.c + ! Fixed to retrieve file handles with hb_itemGetNInt() and hb_parnint(), + instead of long versions. + 2009-07-08 01:11 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbtip/encurl.prg * contrib/hbtip/thtml.prg diff --git a/harbour/contrib/hbgd/gdwrp.c b/harbour/contrib/hbgd/gdwrp.c index 855409a9e0..2266887645 100644 --- a/harbour/contrib/hbgd/gdwrp.c +++ b/harbour/contrib/hbgd/gdwrp.c @@ -562,9 +562,9 @@ HB_FUNC( GDVERSION ) hb_snprintf( szVer, sizeof( szVer ), "GD Version %s", GD_VERSION_STRING ); hb_retc( szVer ); #elif HB_GD_VERS( 2, 0, 33 ) - hb_retc( "GD Version 2.0.33" ); + hb_retc_const( "GD Version 2.0.33" ); #else - hb_retc( "GD Version 2.0.28" ); + hb_retc_const( "GD Version 2.0.28" ); #endif } diff --git a/harbour/contrib/hbmisc/hb_f.c b/harbour/contrib/hbmisc/hb_f.c index c2d9d36a75..fd89d51826 100644 --- a/harbour/contrib/hbmisc/hb_f.c +++ b/harbour/contrib/hbmisc/hb_f.c @@ -88,13 +88,13 @@ HB_FUNC( HB_FUSE ) c = ( char * ) hb_xgrab( c_size ); lastbyte[area] = hb_fsSeek( handles[ area ], 0L, FS_END ); isEof[area] = ( lastbyte[ area ] == 0 ); - hb_retni( handles[ area ] ); + hb_retnint( handles[ area ] ); } else { hb_fsClose( handles[area] ); hb_xfree( b ); hb_xfree( c ); - hb_retni( 1 ); + hb_retnint( 1 ); recno[area] = 0L; offset[area] = 0L; handles[area] = 0; @@ -181,7 +181,7 @@ static long hb_hbfskip( int recs ) HB_FUNC( HB_FSKIP ) { - hb_hbfskip( HB_ISNUM( 1 ) ? hb_parni(1) : 1 ); + hb_hbfskip( HB_ISNUM( 1 ) ? hb_parni( 1 ) : 1 ); } HB_FUNC( HB_FREADLN ) @@ -213,7 +213,7 @@ HB_FUNC( HB_FGOTO ) long target; long last; - target = hb_parnl(1); + target = hb_parnl( 1 ); if ( recno[area] > target ) { while ( recno[area] != target ) { @@ -299,19 +299,19 @@ HB_FUNC( HB_FSELECT ) { hb_retni( area + 1 ); - if ( HB_ISNUM(1) ) - area = hb_parni(1) - 1; + if( HB_ISNUM( 1 ) ) + area = hb_parni( 1 ) - 1; } HB_FUNC( HB_FINFO ) /* used for debugging */ { hb_reta( 6 ); - hb_storvni( area+1, -1, 1); - hb_storvni( last_rec[area], -1, 2); - hb_storvni( recno[area], -1, 3); - hb_storvni( offset[area], -1, 4); - hb_storvni( lastbyte[area], -1, 5); - hb_storvl ( isEof[area], -1, 6); + hb_storvni( area+1, -1, 1 ); + hb_storvni( last_rec[area], -1, 2 ); + hb_storvni( recno[area], -1, 3 ); + hb_storvni( offset[area], -1, 4 ); + hb_storvni( lastbyte[area], -1, 5 ); + hb_storvl( isEof[area], -1, 6 ); } HB_FUNC( HB_FREADANDSKIP ) diff --git a/harbour/contrib/hbnf/fttext.c b/harbour/contrib/hbnf/fttext.c index 88339e9225..9bb28778cc 100644 --- a/harbour/contrib/hbnf/fttext.c +++ b/harbour/contrib/hbnf/fttext.c @@ -310,14 +310,14 @@ HB_FUNC( FT_FUSE ) offset[area] = 0 ; recno[area] = 1; lastbyte[area] = hb_fsSeek( handles[area], 0L, FS_END ); - hb_retni( handles[area] ); + hb_retnint( handles[area] ); } else { if ( handles[area] != 0 ) { hb_fsClose( handles[area] ); - hb_retni(0); + hb_retnint( 0 ); recno[area] = 0L; offset[area] = 0L; handles[area] = 0; diff --git a/harbour/contrib/hbtip/utils.c b/harbour/contrib/hbtip/utils.c index 9819ae7221..a7685ee06b 100644 --- a/harbour/contrib/hbtip/utils.c +++ b/harbour/contrib/hbtip/utils.c @@ -61,22 +61,22 @@ * */ +#define HB_OS_WIN_USED + #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" #include "hbapifs.h" #include "hbdate.h" -#ifdef HB_OS_WIN - #include +#if defined( HB_OS_WIN ) + #ifndef TIME_ZONE_ID_INVALID + #define TIME_ZONE_ID_INVALID ( DWORD ) 0xFFFFFFFF + #endif #else #include #endif -#ifndef TIME_ZONE_ID_INVALID - #define TIME_ZONE_ID_INVALID ( DWORD ) 0xFFFFFFFF -#endif - /************************************************************ * Useful internet timestamp based on RFC822 */ @@ -86,95 +86,93 @@ HB_FUNC( TIP_TIMESTAMP ) PHB_ITEM pDate = hb_param( 1, HB_IT_DATE ); ULONG ulHour = hb_parnl( 2 ); int nLen; - char *szRet = ( char * ) hb_xgrab( 64 ); + char * szRet = ( char * ) hb_xgrab( 64 ); /* sadly, many strftime windows implementations are broken */ -#ifdef HB_OS_WIN +#if defined( HB_OS_WIN ) TIME_ZONE_INFORMATION tzInfo; - long lDate; - int iYear, iMonth, iDay; - const char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - const char *months[] = { - "Jan", "Feb", "Mar", - "Apr", "May", "Jun", - "Jul", "Aug", "Sep", - "Oct", "Nov", "Dec" }; - SYSTEMTIME st; + static const char * s_days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; + static const char * s_months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; if( GetTimeZoneInformation( &tzInfo ) == TIME_ZONE_ID_INVALID ) tzInfo.Bias = 0; else tzInfo.Bias -= tzInfo.Bias; - if( !pDate ) + if( ! pDate ) { + SYSTEMTIME st; + GetLocalTime( &st ); hb_snprintf( szRet, 64, "%s, %u %s %u %02u:%02u:%02u %+03d%02d", - days[ st.wDayOfWeek ], st.wDay, months[ st.wMonth -1], + s_days[ st.wDayOfWeek ], st.wDay, s_months[ st.wMonth - 1 ], st.wYear, st.wHour, st.wMinute, st.wSecond, - (int)( tzInfo.Bias / 60 ), - (int)( tzInfo.Bias % 60 > 0 ? - tzInfo.Bias % 60 : tzInfo.Bias % 60 ) ); + ( int ) ( tzInfo.Bias / 60 ), + ( int ) ( tzInfo.Bias % 60 > 0 ? - tzInfo.Bias % 60 : tzInfo.Bias % 60 ) ); } else { - lDate = hb_itemGetDL( pDate ); + long lDate = hb_itemGetDL( pDate ); + int iYear, iMonth, iDay; + hb_dateDecode( lDate, &iYear, &iMonth, &iDay ); hb_snprintf( szRet, 64, "%s, %d %s %d %02u:%02u:%02u %+03d%02d", - days[ hb_dateDOW( iYear, iMonth, iDay ) - 1 ], iDay, - months[ iMonth -1], iYear, - (unsigned int)( ulHour / 3600 ), (unsigned int)( (ulHour % 3600) / 60 ), (unsigned int)( ulHour % 60 ), - (int)( tzInfo.Bias / 60 ), - (int)( tzInfo.Bias % 60 > 0 ? - tzInfo.Bias % 60 : tzInfo.Bias % 60 ) ); + s_days[ hb_dateDOW( iYear, iMonth, iDay ) - 1 ], iDay, + s_months[ iMonth - 1 ], iYear, + ( unsigned int )( ulHour / 3600 ), ( unsigned int )( ( ulHour % 3600 ) / 60 ), ( unsigned int ) ( ulHour % 60 ), + ( int ) ( tzInfo.Bias / 60 ), + ( int ) ( tzInfo.Bias % 60 > 0 ? - tzInfo.Bias % 60 : tzInfo.Bias % 60 ) ); } nLen = strlen( szRet ); #else - char szDate[ 9 ]; struct tm tmTime; time_t current; /* init time structure anyway */ time( ¤t ); #if defined( HB_HAS_LOCALTIME_R ) - localtime_r( ¤t , &tmTime ); + localtime_r( ¤t, &tmTime ); #else tmTime = *localtime( ¤t ); #endif - if ( pDate ) + if( pDate ) { + char szDate[ 9 ]; + hb_itemGetDS( pDate, szDate ); tmTime.tm_year = ( - (szDate[0] - '0') * 1000 + - (szDate[1] - '0') * 100 + - (szDate[2] - '0') * 10 + - (szDate[3] - '0') ) -1900; + ( szDate[ 0 ] - '0' ) * 1000 + + ( szDate[ 1 ] - '0' ) * 100 + + ( szDate[ 2 ] - '0' ) * 10 + + ( szDate[ 3 ] - '0' ) ) -1900; tmTime.tm_mon = ( - (szDate[4] - '0') * 10 + - (szDate[5] - '0') ) -1; + ( szDate[ 4 ] - '0' ) * 10 + + ( szDate[ 5 ] - '0' ) ) - 1; tmTime.tm_mday = - (szDate[6] - '0') * 10 + - (szDate[7] - '0'); + ( szDate[ 6 ] - '0' ) * 10 + + ( szDate[ 7 ] - '0' ); tmTime.tm_hour = ulHour / 3600; - tmTime.tm_min = (ulHour % 3600) / 60; - tmTime.tm_sec = (ulHour % 60); + tmTime.tm_min = ( ulHour % 3600 ) / 60; + tmTime.tm_sec = ( ulHour % 60 ); } nLen = strftime( szRet, 64, "%a, %d %b %Y %H:%M:%S %z", &tmTime ); #endif - if ( nLen < 64 ) + if( nLen < 64 ) szRet = ( char * ) hb_xrealloc( szRet, nLen + 1 ); hb_retclen_buffer( szRet, nLen ); @@ -184,18 +182,12 @@ HB_FUNC( TIP_TIMESTAMP ) typedef struct tag_mime { - /* Position in stream from which the match begins */ - int pos; - /* String to match */ - const char *pattern; - /* Mimetype if complete */ - const char *mime_type; - /* following entry to determine a mimetype, relative to current position (or 0) */ - int next; - /* alternative entry to determine a mimetype, relative to current position (or 0) */ - int alternate; - /* flags for confrontation */ - short unsigned int flags; + int pos; /* Position in stream from which the match begins */ + const char * pattern; /* String to match */ + const char * mime_type; /* Mimetype if complete */ + int next; /* following entry to determine a mimetype, relative to current position (or 0) */ + int alternate; /* alternative entry to determine a mimetype, relative to current position (or 0) */ + short unsigned int flags; /* flags for confrontation */ } MIME_ENTRY; #define MIME_FLAG_TRIMSPACES 0x0001 @@ -332,17 +324,14 @@ static MIME_ENTRY s_mimeTable[ MIME_TABLE_SIZE ] = typedef struct tag_mime_ext { - /* Extension to match */ - const char *pattern; - /* Mimetype if complete */ - const char *mime_type; - /* flags for confrontation */ - short unsigned int flags; + const char * pattern; /* Extension to match */ + const char * mime_type; /* Mimetype if complete */ + short unsigned int flags; /* flags for confrontation */ } EXT_MIME_ENTRY; #define EXT_MIME_TABLE_SIZE 19 -static EXT_MIME_ENTRY s_extMimeTable[EXT_MIME_TABLE_SIZE] = +static EXT_MIME_ENTRY s_extMimeTable[ EXT_MIME_TABLE_SIZE ] = { /* Dos/win executable */ /* 0*/ { "EXE", "application/x-dosexec", MIME_FLAG_CASEINSENS }, @@ -387,161 +376,126 @@ static EXT_MIME_ENTRY s_extMimeTable[EXT_MIME_TABLE_SIZE] = }; - -static const char *s_findExtMimeType( const char *cExt ) +static const char * s_findExtMimeType( const char * cExt ) { int iCount; - for ( iCount = 0; iCount < EXT_MIME_TABLE_SIZE; iCount ++ ) + for( iCount = 0; iCount < EXT_MIME_TABLE_SIZE; iCount++ ) { - if ( s_extMimeTable[iCount].flags == MIME_FLAG_CASEINSENS ) + if( s_extMimeTable[ iCount ].flags == MIME_FLAG_CASEINSENS ) { - if ( hb_stricmp( cExt, s_extMimeTable[iCount].pattern ) == 0) - { - return s_extMimeTable[iCount].mime_type; - } + if( hb_stricmp( cExt, s_extMimeTable[ iCount ].pattern ) == 0 ) + return s_extMimeTable[ iCount ].mime_type; } else { - if ( strcmp( cExt, s_extMimeTable[iCount].pattern ) == 0) - { - return s_extMimeTable[iCount].mime_type; - } + if( strcmp( cExt, s_extMimeTable[ iCount ].pattern ) == 0 ) + return s_extMimeTable[ iCount ].mime_type; } } return NULL; } - - -static const char *s_findMimeStringInTree( const char *cData, int iLen, int iElem ) +static const char * s_findMimeStringInTree( const char * cData, int iLen, int iElem ) { - MIME_ENTRY *elem = s_mimeTable + iElem; + MIME_ENTRY * elem = s_mimeTable + iElem; int iPos = elem->pos; - int iDataLen = strlen( elem->pattern ); + int iDataLen = strlen( elem->pattern ); /* allow \0 to be used for matches */ - if ( iDataLen == 0 ) - { + if( iDataLen == 0 ) iDataLen = 1; - } /* trim spaces if required */ - while ( iPos < iLen && - ( (( elem->flags & MIME_FLAG_TRIMSPACES ) == MIME_FLAG_TRIMSPACES && ( - cData[iPos] == ' ' || cData[iPos] == '\r' || cData[iPos] == '\n') ) || - (( elem->flags & MIME_FLAG_TRIMTABS ) == MIME_FLAG_TRIMSPACES && cData[iPos] == '\t') ) ) + while( iPos < iLen && + ( ( ( elem->flags & MIME_FLAG_TRIMSPACES ) == MIME_FLAG_TRIMSPACES && ( + cData[ iPos ] == ' ' || cData[ iPos ] == '\r' || cData[ iPos ] == '\n' ) ) || + ( ( elem->flags & MIME_FLAG_TRIMTABS ) == MIME_FLAG_TRIMSPACES && cData[ iPos ] == '\t' ) ) ) { iPos ++; } - if ( (iPos < iLen) && (iLen - iPos >= iDataLen) ) + if( ( iPos < iLen ) && ( iLen - iPos >= iDataLen ) ) { - if ( (elem->flags & MIME_FLAG_CASEINSENS) == MIME_FLAG_CASEINSENS ) + if( ( elem->flags & MIME_FLAG_CASEINSENS ) == MIME_FLAG_CASEINSENS ) { - if ( (*elem->pattern == 0 && cData[iPos] == 0) || hb_strnicmp( cData + iPos, elem->pattern, iDataLen ) == 0) + if( ( *elem->pattern == 0 && cData[ iPos ] == 0 ) || hb_strnicmp( cData + iPos, elem->pattern, iDataLen ) == 0 ) { /* is this the begin of a match tree? */ - if ( elem->next != 0 ) - { + if( elem->next != 0 ) return s_findMimeStringInTree( cData, iLen, iElem + elem->next ); - } else - { return elem->mime_type; - } } } else { - if ( (*elem->pattern == 0 && cData[iPos] == 0) || strncmp( cData + iPos, elem->pattern, iDataLen ) == 0) + if( ( *elem->pattern == 0 && cData[ iPos ] == 0) || strncmp( cData + iPos, elem->pattern, iDataLen ) == 0 ) { - if ( elem->next != 0 ) - { + if( elem->next != 0 ) return s_findMimeStringInTree( cData, iLen, iElem + elem->next ); - } else - { return elem->mime_type; - } } } } /* match failed! */ - if ( elem->alternate != 0 ) - { + if( elem->alternate != 0 ) return s_findMimeStringInTree( cData, iLen, iElem + elem->alternate ); - } - /* total giveup */ - return NULL; + return NULL; /* total giveup */ } - -static const char *s_findStringMimeType( const char *cData, int iLen ) +static const char * s_findStringMimeType( const char * cData, int iLen ) { int iCount; BOOL bFormFeed; - for ( iCount = 0; iCount < MIME_TABLE_SIZE; iCount ++ ) + for( iCount = 0; iCount < MIME_TABLE_SIZE; iCount++ ) { - MIME_ENTRY *elem = s_mimeTable + iCount; + MIME_ENTRY * elem = s_mimeTable + iCount; int iPos = elem->pos; - int iDataLen = strlen( elem->pattern ); + int iDataLen = strlen( elem->pattern ); - if ( (elem->flags & MIME_FLAG_CONTINUE) == MIME_FLAG_CONTINUE ) - { + if( ( elem->flags & MIME_FLAG_CONTINUE ) == MIME_FLAG_CONTINUE ) continue; - } /* trim spaces if required */ - while ( iPos < iLen && - ( (( elem->flags & MIME_FLAG_TRIMSPACES ) == MIME_FLAG_TRIMSPACES && ( - cData[iPos] == ' ' || cData[iPos] == '\r' || cData[iPos] == '\n') ) || - (( elem->flags & MIME_FLAG_TRIMTABS ) == MIME_FLAG_TRIMSPACES && cData[iPos] == '\t') ) ) + while( iPos < iLen && + ( ( ( elem->flags & MIME_FLAG_TRIMSPACES ) == MIME_FLAG_TRIMSPACES && ( + cData[ iPos ] == ' ' || cData[ iPos ] == '\r' || cData[ iPos ] == '\n' ) ) || + ( ( elem->flags & MIME_FLAG_TRIMTABS ) == MIME_FLAG_TRIMSPACES && cData[ iPos ] == '\t' ) ) ) { iPos ++; } - if ( iPos >= iLen ) - { + if( iPos >= iLen ) continue; - } - if ( iLen - iPos < iDataLen ) - { + if( iLen - iPos < iDataLen ) continue; - } - if ( (elem->flags & MIME_FLAG_CASEINSENS) == MIME_FLAG_CASEINSENS ) + if( ( elem->flags & MIME_FLAG_CASEINSENS ) == MIME_FLAG_CASEINSENS ) { - if ( (*elem->pattern == 0 && cData[iPos] == 0) || hb_strnicmp( cData + iPos, elem->pattern, iDataLen ) == 0) + if( ( *elem->pattern == 0 && cData[ iPos ] == 0 ) || hb_strnicmp( cData + iPos, elem->pattern, iDataLen ) == 0 ) { /* is this the begin of a match tree? */ - if ( elem->next != 0 ) - { + if( elem->next != 0 ) return s_findMimeStringInTree( cData, iLen, iCount + elem->next ); - } else - { return elem->mime_type; - } } } else { - if ( (*elem->pattern == 0 && cData[iPos] == 0) || strncmp( cData + iPos, elem->pattern, iDataLen ) == 0) + if( ( *elem->pattern == 0 && cData[ iPos ] == 0 ) || strncmp( cData + iPos, elem->pattern, iDataLen ) == 0 ) { - if ( elem->next != 0 ) - { + if( elem->next != 0 ) return s_findMimeStringInTree( cData, iLen, iCount + elem->next ); - } else - { return elem->mime_type; - } } } } @@ -549,39 +503,34 @@ static const char *s_findStringMimeType( const char *cData, int iLen ) /* Failure; let's see if it's a text/plain. */ bFormFeed = FALSE; iCount = 0; - while ( iCount < iLen ) + while( iCount < iLen ) { /* form feed? */ - if ( cData[ iCount ] == '\x0C' ) - { + if( cData[ iCount ] == '\x0C' ) bFormFeed = TRUE; - } + /* esc sequence? */ - else if ( cData[iCount] == '\x1B' ) + else if( cData[ iCount ] == '\x1B' ) { bFormFeed = TRUE; - iCount ++; - if ( cData[iCount] <= 27 ) - { + iCount++; + if( cData[ iCount ] <= 27 ) + iCount++; + + if( cData[ iCount ] <= 27 ) iCount ++; - } - if ( cData[iCount] <= 27 ) - { - iCount ++; - } } - else if ( - (cData[iCount] < 27 && cData[iCount] != '\t' && cData[iCount] != '\n' && cData[iCount] == '\r') || - cData[iCount] == '\xFF') + else if( + ( cData[ iCount ] < 27 && cData[ iCount ] != '\t' && cData[ iCount ] != '\n' && cData[ iCount ] == '\r' ) || + cData[ iCount ] == '\xFF' ) { - /* not an ASCII file, we surrender */ - return NULL; + return NULL; /* not an ASCII file, we surrender */ } iCount++; } - if ( bFormFeed ) + if( bFormFeed ) { /* we have escape sequences, seems a PRN/terminal file */ return "application/remote-printing"; @@ -590,10 +539,9 @@ static const char *s_findStringMimeType( const char *cData, int iLen ) return "text/plain"; } - -static const char *s_findFileMimeType( HB_FHANDLE fileIn ) +static const char * s_findFileMimeType( HB_FHANDLE fileIn ) { - char buf[512]; + char buf[ 512 ]; int iLen; ULONG ulPos; @@ -601,7 +549,7 @@ static const char *s_findFileMimeType( HB_FHANDLE fileIn ) hb_fsSeek( fileIn, 0, SEEK_SET ); iLen = hb_fsRead( fileIn, buf, sizeof( buf ) ); - if ( iLen > 0 ) + if( iLen > 0 ) { hb_fsSeek( fileIn, ulPos, SEEK_SET ); return s_findStringMimeType( buf, iLen ); @@ -610,100 +558,67 @@ static const char *s_findFileMimeType( HB_FHANDLE fileIn ) return NULL; } - - HB_FUNC( TIP_FILEMIMETYPE ) { PHB_ITEM pFile = hb_param( 1, HB_IT_STRING | HB_IT_NUMERIC ); - const char *ext_type = NULL; - const char *magic_type = NULL; - HB_FHANDLE fileIn; - - if ( pFile == NULL ) + if( pFile ) { - hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) ); - return; - } + HB_FHANDLE fileIn; + const char * ext_type = NULL; + const char * magic_type = NULL; - if ( HB_IS_STRING( pFile ) ) - { - /* decode the extension */ - const char *fname = hb_itemGetCPtr( pFile ); - int iPos = strlen( fname )-1; - - while ( iPos >= 0 && fname[iPos] != '.' ) + if( HB_IS_STRING( pFile ) ) { - iPos--; - } + /* decode the extension */ + const char * fname = hb_itemGetCPtr( pFile ); + int iPos = strlen( fname ) - 1; - if ( iPos > 0 ) - { - ext_type = s_findExtMimeType( fname + iPos + 1 ); - } + while( iPos >= 0 && fname[ iPos ] != '.' ) + iPos--; - fileIn = hb_fsOpen( fname, FO_READ ); - if ( hb_fsError() == 0 ) - { - magic_type = s_findFileMimeType( fileIn ); - } - hb_fsClose( fileIn ); - } - else - { - fileIn = ( HB_FHANDLE ) hb_itemGetNL( pFile ); - magic_type = s_findFileMimeType( fileIn ); - } + if( iPos > 0 ) + ext_type = s_findExtMimeType( fname + iPos + 1 ); - if ( magic_type == NULL ) - { - if ( ext_type != NULL ) - { - hb_retc( ext_type ); + fileIn = hb_fsOpen( fname, FO_READ ); + + if( hb_fsError() == 0 ) + magic_type = s_findFileMimeType( fileIn ); + + hb_fsClose( fileIn ); } else { - hb_retc( "unknown" ); /* it's a valid MIME type */ + fileIn = ( HB_FHANDLE ) hb_itemGetNInt( pFile ); + magic_type = s_findFileMimeType( fileIn ); } + + if( magic_type ) + hb_retc_const( magic_type ); + else + hb_retc_const( ext_type ? ext_type : "unknown" ); /* "unkown" is a valid MIME type */ } else - { - hb_retc( magic_type ); - } + hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) ); } - HB_FUNC( TIP_MIMETYPE ) { PHB_ITEM pData = hb_param( 1, HB_IT_STRING ); - const char *magic_type; - const char *cData; - ULONG ulLen; - if ( pData == NULL ) + if( pData ) { - hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) ); - return; - } + const char * magic_type = s_findStringMimeType( hb_itemGetCPtr( pData ), hb_itemGetCLen( pData ) ); - ulLen = hb_itemGetCLen( pData ); - cData = hb_itemGetCPtr( pData ); - - magic_type = s_findStringMimeType( cData, ulLen ); - - if ( magic_type == NULL ) - { - hb_retc( "unknown" ); + hb_retc_const( magic_type ? magic_type : "unknown" ); } else - { - hb_retc( magic_type ); - } + hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) ); } /* Case insensitive string comparison to optimize this expression: - IF Lower( ) == Lower( SubStr( , , Len() ) ) + IF Lower( ) == Lower( SubStr( , , Len( ) ) ) must be provided as a pointer to the character string containing a substring is the numeric position to start comparison in is the character string to compare with characters in , beginning at @@ -740,7 +655,7 @@ static ULONG hb_strAtI( const char * szSub, ULONG ulSubLen, const char * szText, while( ulPos < ulLen && ulSubPos < ulSubLen ) { - if( HB_TOLOWER( (BYTE) szText[ ulPos ] ) == HB_TOLOWER( (BYTE) szSub[ ulSubPos ] ) ) + if( HB_TOLOWER( ( BYTE ) szText[ ulPos ] ) == HB_TOLOWER( ( BYTE ) szSub[ ulSubPos ] ) ) { ulSubPos++; ulPos++; @@ -766,11 +681,11 @@ HB_FUNC( TIP_ATI ) { PHB_ITEM pSub = hb_param( 1, HB_IT_STRING ); PHB_ITEM pText = hb_param( 2, HB_IT_STRING ); - PHB_ITEM pStart = hb_param( 3, HB_IT_NUMERIC ); - PHB_ITEM pEnd = hb_param( 4, HB_IT_NUMERIC ); if( pText && pSub ) { + PHB_ITEM pStart = hb_param( 3, HB_IT_NUMERIC ); + PHB_ITEM pEnd = hb_param( 4, HB_IT_NUMERIC ); LONG lLen = hb_itemGetCLen( pText ); LONG lStart = pStart ? hb_itemGetNL( pStart ) : 1; LONG lEnd = pEnd ? hb_itemGetNL( pEnd ) : lLen; @@ -801,104 +716,100 @@ HB_FUNC( TIP_ATI ) } } else - { hb_errRT_BASE_SubstR( EG_ARG, 1108, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); - } } HB_FUNC( TIP_HTMLSPECIALCHARS ) { - const char *cData = hb_parc( 1 ); - int nLen = hb_parclen( 1 ); - char * cRet; - int nPos = 0, nPosRet = 0; - BYTE cElem; + const char * cData = hb_parc( 1 ); - if( ! cData ) + if( cData ) { + int nLen = hb_parclen( 1 ); + + if( nLen ) + { + /* Giving maximum final length possible */ + char * cRet = ( char * ) hb_xgrab( nLen * 6 + 1 ); + int nPos = 0, nPosRet = 0; + BYTE cElem; + + while( nPos < nLen ) + { + cElem = ( BYTE ) cData[ nPos ]; + + if( cElem == '&' ) + { + cRet[ nPosRet++ ] = '&'; + cRet[ nPosRet++ ] = 'a'; + cRet[ nPosRet++ ] = 'm'; + cRet[ nPosRet++ ] = 'p'; + cRet[ nPosRet++ ] = ';'; + } + else if( cElem == '<' ) + { + cRet[ nPosRet++ ] = '&'; + cRet[ nPosRet++ ] = 'l'; + cRet[ nPosRet++ ] = 't'; + cRet[ nPosRet++ ] = ';'; + } + else if( cElem == '>' ) + { + cRet[ nPosRet++ ] = '&'; + cRet[ nPosRet++ ] = 'g'; + cRet[ nPosRet++ ] = 't'; + cRet[ nPosRet++ ] = ';'; + } + else if( cElem == '"' ) + { + cRet[ nPosRet++ ] = '&'; + cRet[ nPosRet++ ] = 'q'; + cRet[ nPosRet++ ] = 'u'; + cRet[ nPosRet++ ] = 'o'; + cRet[ nPosRet++ ] = 't'; + cRet[ nPosRet++ ] = ';'; + } + else if( cElem == '\'' ) + { + cRet[ nPosRet++ ] = '&'; + cRet[ nPosRet++ ] = '#'; + cRet[ nPosRet++ ] = '0'; + cRet[ nPosRet++ ] = '3'; + cRet[ nPosRet++ ] = '9'; + cRet[ nPosRet++ ] = ';'; + } + else if( cElem == '\r' ) + { + cRet[ nPosRet++ ] = '&'; + cRet[ nPosRet++ ] = '#'; + cRet[ nPosRet++ ] = '0'; + cRet[ nPosRet++ ] = '1'; + cRet[ nPosRet++ ] = '3'; + cRet[ nPosRet++ ] = ';'; + } + else if( cElem == '\n' ) + { + cRet[ nPosRet++ ] = '&'; + cRet[ nPosRet++ ] = '#'; + cRet[ nPosRet++ ] = '0'; + cRet[ nPosRet++ ] = '1'; + cRet[ nPosRet++ ] = '0'; + cRet[ nPosRet++ ] = ';'; + } + else if( cElem >= ' ' ) + { + cRet[ nPosRet ] = cElem; + nPosRet++; + } + + nPos++; + } + + hb_retclen_buffer( cRet, nPosRet ); + } + else + hb_retc_null(); + } + else hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 1, hb_paramError(1) ); - return; - } - - if( ! nLen ) - { - hb_retc_null(); - return; - } - - /* Giving maximum final length possible */ - cRet = ( char * ) hb_xgrab( nLen * 6 + 1 ); - - while( nPos < nLen ) - { - cElem = ( BYTE ) cData[ nPos ]; - - if( cElem == '&' ) - { - cRet[ nPosRet++ ] = '&'; - cRet[ nPosRet++ ] = 'a'; - cRet[ nPosRet++ ] = 'm'; - cRet[ nPosRet++ ] = 'p'; - cRet[ nPosRet++ ] = ';'; - } - else if( cElem == '<' ) - { - cRet[ nPosRet++ ] = '&'; - cRet[ nPosRet++ ] = 'l'; - cRet[ nPosRet++ ] = 't'; - cRet[ nPosRet++ ] = ';'; - } - else if( cElem == '>' ) - { - cRet[ nPosRet++ ] = '&'; - cRet[ nPosRet++ ] = 'g'; - cRet[ nPosRet++ ] = 't'; - cRet[ nPosRet++ ] = ';'; - } - else if( cElem == '"' ) - { - cRet[ nPosRet++ ] = '&'; - cRet[ nPosRet++ ] = 'q'; - cRet[ nPosRet++ ] = 'u'; - cRet[ nPosRet++ ] = 'o'; - cRet[ nPosRet++ ] = 't'; - cRet[ nPosRet++ ] = ';'; - } - else if( cElem == '\'' ) - { - cRet[ nPosRet++ ] = '&'; - cRet[ nPosRet++ ] = '#'; - cRet[ nPosRet++ ] = '0'; - cRet[ nPosRet++ ] = '3'; - cRet[ nPosRet++ ] = '9'; - cRet[ nPosRet++ ] = ';'; - } - else if( cElem == '\r' ) - { - cRet[ nPosRet++ ] = '&'; - cRet[ nPosRet++ ] = '#'; - cRet[ nPosRet++ ] = '0'; - cRet[ nPosRet++ ] = '1'; - cRet[ nPosRet++ ] = '3'; - cRet[ nPosRet++ ] = ';'; - } - else if( cElem == '\n' ) - { - cRet[ nPosRet++ ] = '&'; - cRet[ nPosRet++ ] = '#'; - cRet[ nPosRet++ ] = '0'; - cRet[ nPosRet++ ] = '1'; - cRet[ nPosRet++ ] = '0'; - cRet[ nPosRet++ ] = ';'; - } - else if( cElem >= ' ' ) - { - cRet[ nPosRet ] = cElem; - nPosRet++; - } - - nPos++; - } - - hb_retclen_buffer( cRet, nPosRet ); } diff --git a/harbour/contrib/xhb/freadlin.c b/harbour/contrib/xhb/freadlin.c index 892644afb2..89efebce8f 100644 --- a/harbour/contrib/xhb/freadlin.c +++ b/harbour/contrib/xhb/freadlin.c @@ -165,7 +165,7 @@ char * hb_fsReadLine( HB_FHANDLE hFileHandle, LONG * plBuffLen, const char ** Te HB_FUNC( HB_FREADLINE ) { PHB_ITEM pTerm1; - HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnl( 1 ); + HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnint( 1 ); const char ** Term; char * pBuffer; int * iTermSizes; diff --git a/harbour/contrib/xhb/hbserv.c b/harbour/contrib/xhb/hbserv.c index 7bcde183f8..ad323134d1 100644 --- a/harbour/contrib/xhb/hbserv.c +++ b/harbour/contrib/xhb/hbserv.c @@ -945,8 +945,8 @@ HB_FUNC( HB_SIGNALDESC ) case SIGSEGV: switch( iSubSig ) { #if ! defined(HB_OS_BSD) && ! defined(HB_OS_OS2_GCC) && ! defined( __WATCOMC__ ) - case SEGV_MAPERR: hb_retc( "Segmentation fault: address not mapped to object"); return; - case SEGV_ACCERR: hb_retc( "Segmentation fault: invalid permissions for mapped object"); return; + case SEGV_MAPERR: hb_retc_const( "Segmentation fault: address not mapped to object"); return; + case SEGV_ACCERR: hb_retc_const( "Segmentation fault: invalid permissions for mapped object"); return; #endif default: hb_retc("Segmentation fault"); return; } @@ -954,66 +954,66 @@ HB_FUNC( HB_SIGNALDESC ) case SIGILL: switch( iSubSig ) { #if ! defined(HB_OS_BSD) && ! defined(HB_OS_OS2_GCC) && ! defined( __WATCOMC__ ) - case ILL_ILLOPC: hb_retc( "Illegal operation: illegal opcode"); return; - case ILL_ILLOPN: hb_retc( "Illegal operation: illegal operand"); return; - case ILL_ILLADR: hb_retc( "Illegal operation: illegal addressing mode"); return; - case ILL_ILLTRP: hb_retc( "Illegal operation: illegal trap"); return; - case ILL_PRVOPC: hb_retc( "Illegal operation: privileged opcode"); return; - case ILL_PRVREG: hb_retc( "Illegal operation: privileged register"); return; - case ILL_COPROC: hb_retc( "Illegal operation: coprocessor error"); return; - case ILL_BADSTK: hb_retc( "Illegal operation: internal stack error"); return; + case ILL_ILLOPC: hb_retc_const( "Illegal operation: illegal opcode"); return; + case ILL_ILLOPN: hb_retc_const( "Illegal operation: illegal operand"); return; + case ILL_ILLADR: hb_retc_const( "Illegal operation: illegal addressing mode"); return; + case ILL_ILLTRP: hb_retc_const( "Illegal operation: illegal trap"); return; + case ILL_PRVOPC: hb_retc_const( "Illegal operation: privileged opcode"); return; + case ILL_PRVREG: hb_retc_const( "Illegal operation: privileged register"); return; + case ILL_COPROC: hb_retc_const( "Illegal operation: coprocessor error"); return; + case ILL_BADSTK: hb_retc_const( "Illegal operation: internal stack error"); return; #endif - default: hb_retc( "Illegal operation" ); return; + default: hb_retc_const( "Illegal operation" ); return; } case SIGFPE: switch( iSubSig ) { #if ! defined(HB_OS_OS2_GCC) && ! defined( __WATCOMC__ ) #if ! defined( HB_OS_DARWIN ) - case FPE_INTDIV: hb_retc( "Floating point: integer divide by zero"); return; - case FPE_INTOVF: hb_retc( "Floating point: integer overflow"); return; + case FPE_INTDIV: hb_retc_const( "Floating point: integer divide by zero"); return; + case FPE_INTOVF: hb_retc_const( "Floating point: integer overflow"); return; #endif - case FPE_FLTDIV: hb_retc( "Floating point: floating point divide by zero"); return; - case FPE_FLTOVF: hb_retc( "Floating point: floating point overflow"); return; - case FPE_FLTUND: hb_retc( "Floating point: floating point underflow"); return; - case FPE_FLTRES: hb_retc( "Floating point: floating point inexact result"); return; - case FPE_FLTINV: hb_retc( "Floating point: floating point invalid operation"); return; + case FPE_FLTDIV: hb_retc_const( "Floating point: floating point divide by zero"); return; + case FPE_FLTOVF: hb_retc_const( "Floating point: floating point overflow"); return; + case FPE_FLTUND: hb_retc_const( "Floating point: floating point underflow"); return; + case FPE_FLTRES: hb_retc_const( "Floating point: floating point inexact result"); return; + case FPE_FLTINV: hb_retc_const( "Floating point: floating point invalid operation"); return; #if ! defined( HB_OS_DARWIN ) - case FPE_FLTSUB: hb_retc( "Floating point: subscript out of range"); return; + case FPE_FLTSUB: hb_retc_const( "Floating point: subscript out of range"); return; #endif #endif - default: hb_retc( "Floating point" ); return; + default: hb_retc_const( "Floating point" ); return; } case SIGQUIT: - hb_retc( "Quit" ); + hb_retc_const( "Quit" ); return; case SIGHUP: - hb_retc( "Update" ); + hb_retc_const( "Update" ); return; case SIGINT: - hb_retc( "Interrupt" ); + hb_retc_const( "Interrupt" ); return; case SIGPIPE: - hb_retc( "Broken pipe" ); + hb_retc_const( "Broken pipe" ); return; case SIGTERM: - hb_retc( "Terminate process" ); + hb_retc_const( "Terminate process" ); return; case SIGABRT: - hb_retc( "Abort" ); + hb_retc_const( "Abort" ); case SIGUSR1: - hb_retc( "User defined" ); + hb_retc_const( "User defined" ); return; case SIGUSR2: - hb_retc( "User defined (secondary)" ); + hb_retc_const( "User defined (secondary)" ); return; } #endif @@ -1024,58 +1024,58 @@ HB_FUNC( HB_SIGNALDESC ) switch( iSubSig ) { case EXCEPTION_ACCESS_VIOLATION: - hb_retc("Memory read/write access violation"); return; + hb_retc_const("Memory read/write access violation"); return; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - hb_retc("Array out of bounds" ); return; + hb_retc_const("Array out of bounds" ); return; case EXCEPTION_DATATYPE_MISALIGNMENT: - hb_retc("Data misaligned" ); return; + hb_retc_const("Data misaligned" ); return; case EXCEPTION_FLT_DENORMAL_OPERAND: - hb_retc("Denormal operand in Floating-point operation"); return; + hb_retc_const("Denormal operand in Floating-point operation"); return; case EXCEPTION_FLT_DIVIDE_BY_ZERO: - hb_retc("Floating-point division by zero"); return; + hb_retc_const("Floating-point division by zero"); return; case EXCEPTION_FLT_INEXACT_RESULT: - hb_retc("Inexact floating-point operation result"); return; + hb_retc_const("Inexact floating-point operation result"); return; case EXCEPTION_FLT_INVALID_OPERATION: - hb_retc("Invalid floating-point operation"); return; + hb_retc_const("Invalid floating-point operation"); return; case EXCEPTION_FLT_OVERFLOW: - hb_retc("Floating-point numeric overflow"); return; + hb_retc_const("Floating-point numeric overflow"); return; case EXCEPTION_FLT_STACK_CHECK: - hb_retc("Floating-point out of stack"); return; + hb_retc_const("Floating-point out of stack"); return; case EXCEPTION_FLT_UNDERFLOW: - hb_retc("Floating-point numeric underflow"); return; + hb_retc_const("Floating-point numeric underflow"); return; case EXCEPTION_ILLEGAL_INSTRUCTION: - hb_retc("Illegal instruction"); return; + hb_retc_const("Illegal instruction"); return; case EXCEPTION_IN_PAGE_ERROR: - hb_retc("Paging error"); return; + hb_retc_const("Paging error"); return; case EXCEPTION_INT_DIVIDE_BY_ZERO: - hb_retc("Integer division by zero"); return; + hb_retc_const("Integer division by zero"); return; case EXCEPTION_INT_OVERFLOW: - hb_retc("Integer numeric overflow"); return; + hb_retc_const("Integer numeric overflow"); return; case EXCEPTION_PRIV_INSTRUCTION: - hb_retc("Illegal instruction for current machine mode"); return; + hb_retc_const("Illegal instruction for current machine mode"); return; case EXCEPTION_STACK_OVERFLOW: - hb_retc("Stack overflow"); return; + hb_retc_const("Stack overflow"); return; } } #endif - hb_retc("Unrecognized signal"); + hb_retc_const("Unrecognized signal"); } diff --git a/harbour/contrib/xhb/hbxml.c b/harbour/contrib/xhb/hbxml.c index 72e4364fbe..7681ffad91 100644 --- a/harbour/contrib/xhb/hbxml.c +++ b/harbour/contrib/xhb/hbxml.c @@ -2383,10 +2383,7 @@ HB_FUNC( HBXML_NODE_TO_STRING ) hb_retclen_buffer( buffer, iLen ); } else - { mxml_sgs_destroy( sgs ); - hb_ret(); - } } /** @@ -2397,9 +2394,9 @@ HB_FUNC( HBXML_NODE_TO_STRING ) HB_FUNC( HBXML_NODE_WRITE ) { - PHB_ITEM pNode = hb_param(1, HB_IT_OBJECT ); + PHB_ITEM pNode = hb_param( 1, HB_IT_OBJECT ); PHB_ITEM pHandle = hb_param( 2, HB_IT_NUMERIC ); - PHB_ITEM pStyle = hb_param(3, HB_IT_NUMERIC ); + PHB_ITEM pStyle = hb_param( 3, HB_IT_NUMERIC ); MXML_OUTPUT out; int iStyle, iRet; @@ -2409,13 +2406,13 @@ HB_FUNC( HBXML_NODE_WRITE ) return; } - if ( pStyle == NULL ) + if( pStyle == NULL ) iStyle = 0; else iStyle = hb_itemGetNI( pStyle ); mxml_output_setup( &out, mxml_output_func_to_handle , 0 ); - out.u.hFile = ( HB_FHANDLE ) hb_itemGetNL( pHandle ); + out.u.hFile = ( HB_FHANDLE ) hb_itemGetNInt( pHandle ); iRet = mxml_node_write( &out, pNode, iStyle ); hb_retni( iRet ); diff --git a/harbour/examples/hbdoc/hbdfrdln.c b/harbour/examples/hbdoc/hbdfrdln.c index 892644afb2..89efebce8f 100644 --- a/harbour/examples/hbdoc/hbdfrdln.c +++ b/harbour/examples/hbdoc/hbdfrdln.c @@ -165,7 +165,7 @@ char * hb_fsReadLine( HB_FHANDLE hFileHandle, LONG * plBuffLen, const char ** Te HB_FUNC( HB_FREADLINE ) { PHB_ITEM pTerm1; - HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnl( 1 ); + HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnint( 1 ); const char ** Term; char * pBuffer; int * iTermSizes; diff --git a/harbour/examples/hbmake/hbmakec.c b/harbour/examples/hbmake/hbmakec.c index 3927656cb5..0a662b5847 100644 --- a/harbour/examples/hbmake/hbmakec.c +++ b/harbour/examples/hbmake/hbmakec.c @@ -312,7 +312,7 @@ char * hb_fsReadLine( HB_FHANDLE hFileHandle, LONG * plBuffLen, const char ** Te HB_FUNC( HB_FREADLINE ) { PHB_ITEM pTerm1; - HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnl( 1 ); + HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnint( 1 ); const char ** Term; char * pBuffer; int * iTermSizes; diff --git a/harbour/source/rtl/dateshb.c b/harbour/source/rtl/dateshb.c index 5f340c571d..d4fed8508f 100644 --- a/harbour/source/rtl/dateshb.c +++ b/harbour/source/rtl/dateshb.c @@ -381,7 +381,7 @@ HB_FUNC( HB_TSTOSTR ) if( lTime == 0 ) { if( lDate == 0 ) - hb_retc( "00:00" ); + hb_retc_const( "00:00" ); else { szBuffer[ 10 ] = '\0'; diff --git a/harbour/source/rtl/hbinet.c b/harbour/source/rtl/hbinet.c index 2a7356bd8a..c0807d4b61 100644 --- a/harbour/source/rtl/hbinet.c +++ b/harbour/source/rtl/hbinet.c @@ -693,10 +693,10 @@ HB_FUNC( HB_INETSTATUSDESC ) switch( Socket->status ) { - case 0: hb_retc( "Connection not opened" ); return; - case 1: hb_retc( "Connection alive" ); return; - case 2: hb_retc( "Last operation error" ); return; - case 3: hb_retc( "Last operation timeout" ); return; + case 0: hb_retc_const( "Connection not opened" ); return; + case 1: hb_retc_const( "Connection alive" ); return; + case 2: hb_retc_const( "Last operation error" ); return; + case 3: hb_retc_const( "Last operation timeout" ); return; } } */ @@ -2194,7 +2194,7 @@ HB_FUNC( HB_INETDGRAMRECV ) HB_FUNC( HB_INETCRLF ) { - hb_retc( "\r\n" ); + hb_retc_const( "\r\n" ); } HB_FUNC( HB_INETISSOCKET ) diff --git a/harbour/source/rtl/natmsg.c b/harbour/source/rtl/natmsg.c index ba93c386da..50ba6a5834 100644 --- a/harbour/source/rtl/natmsg.c +++ b/harbour/source/rtl/natmsg.c @@ -109,7 +109,7 @@ HB_FUNC( __NATMSG ) { if( hb_pcount() == 0 ) /* TODO: Replace this with Language API call. */ - hb_retc( "Invalid argument" ); + hb_retc_const( "Invalid argument" ); else if( HB_ISNUM( 1 ) ) hb_retc( hb_nationGetMsg( hb_parni( 1 ) ) ); else @@ -121,7 +121,7 @@ HB_FUNC( __NATSORTVER ) /* NOTE: CA-Cl*pper 5.2e Intl. will return: "NATSORT v1.2i x14 19/Mar/93" */ /* NOTE: CA-Cl*pper 5.3 Intl. will return: "NATSORT v1.3i x19 06/Mar/95" */ - hb_retc( "NATSORT (Harbour)" ); + hb_retc_const( "NATSORT (Harbour)" ); } HB_FUNC( __NATMSGVER ) @@ -129,5 +129,5 @@ HB_FUNC( __NATMSGVER ) /* NOTE: CA-Cl*pper 5.2e Intl. will return: "NATMSGS v1.2i x14 19/Mar/93" */ /* NOTE: CA-Cl*pper 5.3 Intl. will return: "NATMSGS v1.3i x19 06/Mar/95" */ - hb_retc( "NATMSGS (Harbour)" ); + hb_retc_const( "NATMSGS (Harbour)" ); } diff --git a/harbour/source/rtl/setcolor.c b/harbour/source/rtl/setcolor.c index 1480d0bd0b..ef8739ae46 100644 --- a/harbour/source/rtl/setcolor.c +++ b/harbour/source/rtl/setcolor.c @@ -114,5 +114,5 @@ HB_FUNC( HB_NTOCOLOR ) hb_retc( szColorString ); } else - hb_retc( "N/N" ); + hb_retc_const( "N/N" ); }