2008-06-21 19:17 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/pp/hbpp.c
! Fixed to escape strings in generated hbverbld.h.
[TOMERGE 1.0.0RC1]
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2008-06-21 19:17 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* source/pp/hbpp.c
|
||||
! Fixed to escape strings in generated hbverbld.h.
|
||||
[TOMERGE 1.0.0RC1]
|
||||
|
||||
2008-06-21 18:25 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* contrib/hbwhat32/_winsock.c
|
||||
* contrib/hbwhat32/_winmous.c
|
||||
|
||||
@@ -297,6 +297,35 @@ static int hb_pp_preprocesfile( PHB_PP_STATE pState, char * szRuleFile )
|
||||
return iResult;
|
||||
}
|
||||
|
||||
/* NOTE: Caller should free the pointer. */
|
||||
static char * hb_pp_escapeString( char * szString )
|
||||
{
|
||||
int iPos;
|
||||
int iCountBackslash = 0;
|
||||
int iLen = strlen( szString );
|
||||
int iResult;
|
||||
char * szResult;
|
||||
|
||||
for( iPos = 0; iPos < iLen; iPos++ )
|
||||
{
|
||||
if( szString[ iPos ] == '\\' )
|
||||
++iCountBackslash;
|
||||
}
|
||||
|
||||
szResult = ( char * ) hb_xgrab( iLen + iCountBackslash + 1 );
|
||||
|
||||
for( iPos = 0, iResult = 0; iPos < iLen; iPos++ )
|
||||
{
|
||||
szResult[ iResult++ ] = szString[ iPos ];
|
||||
if( szString[ iPos ] == '\\' )
|
||||
szResult[ iResult++ ] = '\\';
|
||||
}
|
||||
|
||||
szResult[ iResult ] = '\0';
|
||||
|
||||
return szResult;
|
||||
}
|
||||
|
||||
static int hb_pp_generateVerInfo( char * szVerFile, int iSVNID, char * szChangeLogID, char * szLastEntry )
|
||||
{
|
||||
int iResult = 0;
|
||||
@@ -313,6 +342,8 @@ static int hb_pp_generateVerInfo( char * szVerFile, int iSVNID, char * szChangeL
|
||||
}
|
||||
else
|
||||
{
|
||||
char * pszEscaped;
|
||||
|
||||
fprintf( fout, "/*\n * $Id$\n */\n\n/*\n"
|
||||
" * Harbour Project source code:\n"
|
||||
" * Version information and build time switches.\n"
|
||||
@@ -328,29 +359,43 @@ static int hb_pp_generateVerInfo( char * szVerFile, int iSVNID, char * szChangeL
|
||||
fprintf( fout, "\n#define HB_VER_SVNID %d\n", iSVNID );
|
||||
|
||||
if( szChangeLogID )
|
||||
fprintf( fout, "\n#define HB_VER_CHLID \"%s\"\n", szChangeLogID );
|
||||
{
|
||||
pszEscaped = hb_pp_escapeString( szChangeLogID );
|
||||
fprintf( fout, "\n#define HB_VER_CHLID \"%s\"\n", pszEscaped );
|
||||
hb_xfree( pszEscaped );
|
||||
}
|
||||
|
||||
if( szLastEntry )
|
||||
fprintf( fout, "\n#define HB_VER_LENTRY \"%s\"\n", szLastEntry );
|
||||
{
|
||||
pszEscaped = hb_pp_escapeString( szChangeLogID );
|
||||
fprintf( fout, "\n#define HB_VER_LENTRY \"%s\"\n", pszEscaped );
|
||||
hb_xfree( pszEscaped );
|
||||
}
|
||||
|
||||
pszEnv = hb_getenv( "C_USR" );
|
||||
if( pszEnv )
|
||||
{
|
||||
fprintf( fout, "\n#define HB_VER_C_USR \"%s\"\n", pszEnv );
|
||||
pszEscaped = hb_pp_escapeString( pszEnv );
|
||||
fprintf( fout, "\n#define HB_VER_C_USR \"%s\"\n", pszEscaped );
|
||||
hb_xfree( pszEscaped );
|
||||
hb_xfree( pszEnv );
|
||||
}
|
||||
|
||||
pszEnv = hb_getenv( "L_USR" );
|
||||
if( pszEnv )
|
||||
{
|
||||
fprintf( fout, "\n#define HB_VER_L_USR \"%s\"\n", pszEnv );
|
||||
pszEscaped = hb_pp_escapeString( pszEnv );
|
||||
fprintf( fout, "\n#define HB_VER_L_USR \"%s\"\n", pszEscaped );
|
||||
hb_xfree( pszEscaped );
|
||||
hb_xfree( pszEnv );
|
||||
}
|
||||
|
||||
pszEnv = hb_getenv( "PRG_USR" );
|
||||
if( pszEnv )
|
||||
{
|
||||
fprintf( fout, "\n#define HB_VER_PRG_USR \"%s\"\n", pszEnv );
|
||||
pszEscaped = hb_pp_escapeString( pszEnv );
|
||||
fprintf( fout, "\n#define HB_VER_PRG_USR \"%s\"\n", pszEscaped );
|
||||
hb_xfree( pszEscaped );
|
||||
hb_xfree( pszEnv );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user