2012-04-11 18:46 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* harbour/src/pp/ppcore.c
    ! fixed GPF if #pragma __*streaminclude is used with
      redirect user custom files
This commit is contained in:
Przemyslaw Czerpak
2012-04-11 16:46:54 +00:00
parent d2d521c8e1
commit 83bf2ee7d8
2 changed files with 28 additions and 9 deletions

View File

@@ -16,6 +16,11 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-04-11 18:46 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* harbour/src/pp/ppcore.c
! fixed GPF if #pragma __*streaminclude is used with
redirect user custom files
2012-04-11 13:53 UTC+0200 Viktor Szakats (harbour syenar.net)
* utils/hbmk2/hbmk2.prg
* do not consider ".C" (uppercase c) as C++ source file.

View File

@@ -2214,9 +2214,14 @@ static void hb_pp_pragmaStreamFile( PHB_PP_STATE pState, const char * szFileName
{
HB_SIZE nSize;
(void) fseek( pFile->file_in, 0L, SEEK_END );
nSize = ftell( pFile->file_in );
(void) fseek( pFile->file_in, 0L, SEEK_SET );
if( pFile->file_in )
{
(void) fseek( pFile->file_in, 0L, SEEK_END );
nSize = ftell( pFile->file_in );
(void) fseek( pFile->file_in, 0L, SEEK_SET );
}
else
nSize = pFile->nLineBufLen;
if( nSize > MAX_STREAM_SIZE )
hb_pp_error( pState, 'F', HB_PP_ERR_FILE_TOO_LONG, szFileName );
@@ -2230,14 +2235,23 @@ static void hb_pp_pragmaStreamFile( PHB_PP_STATE pState, const char * szFileName
if( nSize )
{
char * pBuffer = ( char * ) hb_xgrab( nSize * sizeof( char ) );
if( pFile->file_in == NULL && pState->iStreamDump != HB_PP_STREAM_C )
hb_membufAddData( pState->pStreamBuffer, pFile->pLineBuf, nSize );
else
{
char * pBuffer = ( char * ) hb_xgrab( nSize * sizeof( char ) );
nSize = ( HB_SIZE ) fread( pBuffer, sizeof( char ), nSize, pFile->file_in );
if( pState->iStreamDump == HB_PP_STREAM_C )
hb_strRemEscSeq( pBuffer, &nSize );
if( pFile->file_in )
nSize = ( HB_SIZE ) fread( pBuffer, sizeof( char ), nSize, pFile->file_in );
else
memcpy( pBuffer, pFile->pLineBuf, nSize );
hb_membufAddData( pState->pStreamBuffer, pBuffer, nSize );
hb_xfree( pBuffer );
if( pState->iStreamDump == HB_PP_STREAM_C )
hb_strRemEscSeq( pBuffer, &nSize );
hb_membufAddData( pState->pStreamBuffer, pBuffer, nSize );
hb_xfree( pBuffer );
}
}
/* insert new tokens into incoming buffer