Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2:Test
fillup
fillup-1.42.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fillup-1.42.dif of Package fillup
--- SRC/consume.c +++ SRC/consume.c 2005-09-02 12:44:00.000000000 +0200 @@ -140,7 +140,7 @@ { break; /* line break detected */ } - else if( *buffer == EOF ) + else if( *buffer == 0 ) { break; /* End-Of-File detected */ } --- SRC/file.c +++ SRC/file.c 2005-09-02 12:44:00.000000000 +0200 @@ -35,18 +35,34 @@ File_t returnValue; FILE * filePointer; long fileLength; - char * buffer = NULL; if( FileOpened == openFileForReading( filename, &filePointer ) ) { if( Success == getFileLength( filePointer, &fileLength ) ) { - if( Success == - allocateBuffer( fileLength, ( void ** )&buffer ) ) + void * ptr; + + /* + * Allocate one byte more if a newline must be added + */ + if( Success == allocateBuffer( fileLength + 1 , &ptr ) ) { - if( Success == - readFileToBuffer( filePointer, fileLength, &buffer ) ) - { + char * buffer = ( char * )ptr; + + if( Success == readFileToBuffer( filePointer, fileLength, &buffer ) ) + { + + if ( FALSE == queryParameter( IgnoreEOF ) ) + { + char * eof = (buffer + fileLength - 1); + + if ( *eof != '\n' ) + { + *( eof + 1 ) = '\n'; + fileLength++; + } + } + addToWatchdog( fileLength ); associateBuffer( fileSpecifier, fileLength, &buffer ); returnValue = FileOperationsSuccessful; --- SRC/parameters.c +++ SRC/parameters.c 2005-09-02 12:44:00.000000000 +0200 @@ -368,6 +368,13 @@ } break; + case IgnoreEOF: + if( parameterIgnoreEOF == IsSet ) + { + returnValue = TRUE; + } + break; + case IgnoreDefinites: if( parameterIgnoreDefinites == IsSet ) { --- SRC/parser.c +++ SRC/parser.c 2005-09-02 12:44:00.000000000 +0200 @@ -296,6 +296,7 @@ unsigned long Size; char * delimiterString; char delimiterChar; + void * ptr; queryStringParameter( Delimiter, &delimiterString ); delimiterChar = delimiterString[ 0 ]; @@ -305,23 +306,25 @@ countDelimiters( delimiterChar, baseFileBuffer, baseFileBufferLength ); baseFileBlocksLength++; /* add possible trailing comment */ Size = baseFileBlocksLength * sizeof( VariableBlock_t ); - if( Success != allocateBuffer( Size, ( void ** )&baseFileBlock ) ) + if( Success != allocateBuffer( Size, &ptr ) ) { fillup_exception( __FILE__, __LINE__, ConfigurationException, "createAdministrationInfo" ); exitOnFailure( ); } + baseFileBlock = ( VariableBlock_t * )ptr; additionalFileBlocksLength = countDelimiters( delimiterChar, additionalFileBuffer, additionalFileBufferLength ); additionalFileBlocksLength++; /* add possible trailing comment */ Size = additionalFileBlocksLength * sizeof( VariableBlock_t ); - if( Success != allocateBuffer( Size, ( void ** )&additionalFileBlock ) ) + if( Success != allocateBuffer( Size, &ptr ) ) { fillup_exception( __FILE__, __LINE__, ConfigurationException, "createAdministrationInfo" ); exitOnFailure( ); } + additionalFileBlock = ( VariableBlock_t * )ptr; if( queryParameter( ForbiddenFile ) == TRUE ) { @@ -329,12 +332,13 @@ delimiterChar, forbiddenFileBuffer, forbiddenFileBufferLength ); forbiddenFileBlocksLength++; /* add possible trailing comment */ Size = forbiddenFileBlocksLength * sizeof( VariableBlock_t ); - if( Success != allocateBuffer( Size, ( void ** )&forbiddenFileBlock ) ) + if( Success != allocateBuffer( Size, &ptr ) ) { fillup_exception( __FILE__, __LINE__, ConfigurationException, "createAdministrationInfo" ); exitOnFailure( ); } + forbiddenFileBlock = ( VariableBlock_t * )ptr; } } @@ -477,8 +481,8 @@ getVBeginOfBlock( outputBuffer, &Line ); Line = Line + getVLength( outputBuffer ); LinePointer = Line; - for( lineIndex = 0; - ( *LinePointer != EOF ) && ( *LinePointer != '\n' ); + for( lineIndex = 0; + ( *LinePointer != 0 ) && ( *LinePointer != '\n' ) ; lineIndex++ ) { LinePointer++; /* concerns only the current line */ --- SRC/services.c +++ SRC/services.c 2005-09-02 12:44:00.000000000 +0200 @@ -444,8 +444,9 @@ if( 0 == fseek( filePointer, 0L, SEEK_SET ) ) { - if( fileLength == - ( long )fread( *fileBuffer, sizeof( char ), fileLength, filePointer ) ) + if( ( fileLength == + ( long )fread( *fileBuffer, sizeof( char ), fileLength, filePointer ) ) + && ( 0 == ferror( filePointer ) ) ) { returnValue = Success; } @@ -558,23 +559,22 @@ Service_t allocateBuffer ( - long fileLength, /* in */ + long Length, /* in */ void ** buffer /* out */ ) { Service_t returnValue; - *buffer = malloc( fileLength + 1 ); + *buffer = malloc( Length + 1 ); if( *buffer == NULL ) { - fillup_exception( __FILE__, __LINE__, ServiceException, - "malloc" ); + fillup_exception( __FILE__, __LINE__, ServiceException, "malloc" ); returnValue = Error; } else { /* reset the buffer */ - ( void )memset( *buffer, EOF, fileLength + 1 ); + ( void )memset( *buffer, 0, Length + 1 ); returnValue = Success; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor