Changes to OTF:
authorjurenz
Thu Mar 21 12:55:41 2013 +0000 (2 months ago)
changeset 215140731cae33eef
parent 21513 53f48f04926d
child 21515 d738e2d8135c
Changes to OTF:
- fixed even more Coverity warnings
ompi/contrib/vt/vt/extlib/otf/otfauxlib/OTFAUX_Thumbnail.c
ompi/contrib/vt/vt/extlib/otf/otflib/OTF_File.c
ompi/contrib/vt/vt/extlib/otf/otflib/OTF_MasterControl.c
ompi/contrib/vt/vt/extlib/otf/otflib/OTF_RBuffer.h
ompi/contrib/vt/vt/extlib/otf/otflib/OTF_Reader.c
     1.1 --- a/ompi/contrib/vt/vt/extlib/otf/otfauxlib/OTFAUX_Thumbnail.c	Thu Mar 21 11:25:05 2013 +0000
     1.2 +++ b/ompi/contrib/vt/vt/extlib/otf/otfauxlib/OTFAUX_Thumbnail.c	Thu Mar 21 12:55:41 2013 +0000
     1.3 @@ -221,6 +221,8 @@
     1.4                                                 const uint32_t* /* function tokens */ ),
     1.5                               void* data )
     1.6  {
     1.7 +    int ret = 0;
     1.8 +
     1.9      unsigned long long process;
    1.10      uint32_t* functions;
    1.11      int status;
    1.12 @@ -256,15 +258,15 @@
    1.13          }
    1.14      }
    1.15  
    1.16 -    if ( fgetc( tn_reader->file ) != EOF )
    1.17 +    if ( fgetc( tn_reader->file ) == EOF )
    1.18      {
    1.19 -        return 0;
    1.20 +        ret = ( i == tn_reader->nprocs
    1.21 +                && j == tn_reader->width
    1.22 +                && feof( tn_reader->file ) );
    1.23      }
    1.24  
    1.25  out:
    1.26      free( functions );
    1.27  
    1.28 -    return i == tn_reader->nprocs
    1.29 -           && j == tn_reader->width
    1.30 -           && feof( tn_reader->file );
    1.31 +    return ret;
    1.32  }
     2.1 --- a/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_File.c	Thu Mar 21 11:25:05 2013 +0000
     2.2 +++ b/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_File.c	Thu Mar 21 12:55:41 2013 +0000
     2.3 @@ -595,10 +595,6 @@
     2.4  	int status;
     2.5  #endif /* HAVE_ZLIB */
     2.6  
     2.7 -	if ( NULL != file->iofsl ) {
     2.8 -		return OTF_File_iofsl_close( file );
     2.9 -	}
    2.10 -
    2.11  	if ( NULL == file ) {
    2.12  			
    2.13  		OTF_Error( "ERROR in function %s, file: %s, line: %i:\n "
    2.14 @@ -608,6 +604,9 @@
    2.15  		return 0;
    2.16  	}
    2.17  
    2.18 +	if ( NULL != file->iofsl ) {
    2.19 +		return OTF_File_iofsl_close( file );
    2.20 +	}
    2.21  
    2.22  #ifdef HAVE_ZLIB
    2.23  
    2.24 @@ -1098,17 +1097,6 @@
    2.25  	uint32_t len;
    2.26  	OTF_File* ret;
    2.27  
    2.28 -	if ( OTF_FileManager_isIofsl( manager ) ) {
    2.29 -		/* open all files except *.otf and global definitions/markers with iofsl */
    2.30 -		if ( OTF_File_nameSuffixCmp( filename, ".otf" )
    2.31 -			&& OTF_File_nameSuffixCmp( filename, ".0.def" )
    2.32 -			&& OTF_File_nameSuffixCmp( filename, ".0.def.z" )
    2.33 -			&& OTF_File_nameSuffixCmp( filename, ".0.marker" )
    2.34 -			&& OTF_File_nameSuffixCmp( filename, ".0.marker.z" ) ) {
    2.35 -			return OTF_File_iofsl_open_zlevel( filename, manager, mode, zlevel );
    2.36 -		}
    2.37 -	}
    2.38 -
    2.39  	/* Check input parameters */
    2.40  	if( NULL == filename ) {
    2.41  
    2.42 @@ -1127,6 +1115,17 @@
    2.43  		return NULL;
    2.44  	}
    2.45  
    2.46 +	if ( OTF_FileManager_isIofsl( manager ) ) {
    2.47 +		/* open all files except *.otf and global definitions/markers with iofsl */
    2.48 +		if ( OTF_File_nameSuffixCmp( filename, ".otf" )
    2.49 +			&& OTF_File_nameSuffixCmp( filename, ".0.def" )
    2.50 +			&& OTF_File_nameSuffixCmp( filename, ".0.def.z" )
    2.51 +			&& OTF_File_nameSuffixCmp( filename, ".0.marker" )
    2.52 +			&& OTF_File_nameSuffixCmp( filename, ".0.marker.z" ) ) {
    2.53 +			return OTF_File_iofsl_open_zlevel( filename, manager, mode, zlevel );
    2.54 +		}
    2.55 +	}
    2.56 +
    2.57  	ret= (OTF_File*) malloc( sizeof(OTF_File) );
    2.58  	if( NULL == ret ) {
    2.59  
     3.1 --- a/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_MasterControl.c	Thu Mar 21 11:25:05 2013 +0000
     3.2 +++ b/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_MasterControl.c	Thu Mar 21 12:55:41 2013 +0000
     3.3 @@ -207,6 +207,7 @@
     3.4  			if ( ! OTF_RBuffer_testChar( buffer, ':') ) {
     3.5  				OTF_Error( "OTF_MasterControl_read() "
     3.6  					"ERROR: missing expected character ':'" );
     3.7 +				free( buffer );
     3.8  				return 0;
     3.9  			}
    3.10  			mode = (OTF_IofslMode)OTF_RBuffer_readUint32( buffer );
    3.11 @@ -214,12 +215,14 @@
    3.12  				&& mode != OTF_IOFSL_MULTIFILE ) {
    3.13  				OTF_Error( "OTF_MasterControl_read() "
    3.14  					"ERROR: invalid IofslMode." );
    3.15 +				free( buffer );
    3.16  				return 0;
    3.17  			}
    3.18  
    3.19  			if ( ! OTF_RBuffer_testChar( buffer, ':') ) {
    3.20  				OTF_Error( "OTF_MasterControl_read() "
    3.21  					"ERROR: missing expected character ':'" );
    3.22 +				free( buffer );
    3.23  				return 0;
    3.24  			}
    3.25  			streamid_bits = OTF_RBuffer_readUint32( buffer );
     4.1 --- a/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_RBuffer.h	Thu Mar 21 11:25:05 2013 +0000
     4.2 +++ b/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_RBuffer.h	Thu Mar 21 12:55:41 2013 +0000
     4.3 @@ -28,10 +28,14 @@
     4.4  #include "OTF_KeyValue.h"
     4.5  
     4.6  /* *** some macros *** ****************************************** */
     4.7 -#define PARSE_ERROR( buffer ) \
     4.8 -	OTF_Error( "Parse error in function %s, file: %s, line: %i:\n %s\n", \
     4.9 -		__FUNCTION__, __FILE__, __LINE__, OTF_RBuffer_printRecord( buffer ) );
    4.10 -
    4.11 +#define PARSE_ERROR( buffer ) { \
    4.12 +	char* record = OTF_RBuffer_printRecord( buffer ); \
    4.13 +	if ( NULL != record ) { \
    4.14 +		OTF_Error( "Parse error in function %s, file: %s, line: %i:\n %s\n", \
    4.15 +			__FUNCTION__, __FILE__, __LINE__, record ); \
    4.16 +		free( record ); \
    4.17 +	} \
    4.18 +}
    4.19  
    4.20  #ifdef __cplusplus
    4.21  extern "C" {
     5.1 --- a/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_Reader.c	Thu Mar 21 11:25:05 2013 +0000
     5.2 +++ b/ompi/contrib/vt/vt/extlib/otf/otflib/OTF_Reader.c	Thu Mar 21 12:55:41 2013 +0000
     5.3 @@ -1033,6 +1033,8 @@
     5.4  	reader->statisticsHeap= NULL;
     5.5  	reader->markerHeap= NULL;
     5.6  
     5.7 +	reader->mc= NULL;
     5.8 +
     5.9  	reader->minTime= 0;
    5.10  	reader->maxTime= (uint64_t) -1;
    5.11