1
1

Fixed several Coverity-Warnings

This commit was SVN r19304.
Этот коммит содержится в:
Matthias Jurenz 2008-08-15 15:15:21 +00:00
родитель c1abc108af
Коммит c7ac98dd62
20 изменённых файлов: 232 добавлений и 177 удалений

@ -26,6 +26,7 @@ included AFTER this macro definitions */
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -533,10 +534,21 @@ uint64_t OTF_File_size( OTF_File* file ) {
struct stat st;
if ( stat( file->filename, &st ) == -1 ) {
stat( file->filename, &st );
# ifdef OTF_VERBOSE
fprintf( stderr, "ERROR in function %s, file: %s, line: %i:\n "
"stat() failed: %s\n",
__FUNCTION__, __FILE__, __LINE__,
strerror(errno) );
# endif /* OTF_VERBOSE */
return st.st_size;
return 0;
} else {
return st.st_size;
}
}

@ -69,6 +69,7 @@ void OTF_FileManager_finalize( OTF_FileManager* manager ) {
OTF_FileList* pos;
OTF_FileList* next;
# ifdef OTF_DEBUG
@ -88,9 +89,10 @@ void OTF_FileManager_finalize( OTF_FileManager* manager ) {
while ( NULL != pos ) {
pos= pos->next;
next = pos->next;
free( pos );
pos = next;
}
}

@ -89,7 +89,7 @@ char* OTF_getFilename( const char* namestub, uint32_t id, OTF_FileType type,
break;
default:
free(ret);
return NULL;
}

@ -933,6 +933,11 @@ int OTF_Reader_readDefProcessGroup( OTF_RBuffer* buffer,
PARSE_ERROR( buffer );
# endif
if ( array ) {
free( array );
array= NULL;
}
return 0;
}
@ -942,6 +947,11 @@ int OTF_Reader_readDefProcessGroup( OTF_RBuffer* buffer,
PARSE_ERROR( buffer );
# endif
if ( array ) {
free( array );
array= NULL;
}
return 0;
}
@ -964,6 +974,11 @@ int OTF_Reader_readDefProcessGroup( OTF_RBuffer* buffer,
PARSE_ERROR( buffer );
# endif
if ( array ) {
free( array );
array= NULL;
}
return 0;
}
}

@ -64,12 +64,6 @@ char OTF_RBuffer_checkTimeRecord( OTF_RBuffer* rbuffer ) {
c= rbuffer->buffer[ p ];
while ( ( ' ' == c ) || ( '\t' == c ) ) {
if ( '\n' == c ) {
/* not a time record */
return 0;
}
++p;
c= rbuffer->buffer[ p ];
}
@ -106,12 +100,6 @@ char OTF_RBuffer_checkProcessRecord( OTF_RBuffer* rbuffer ) {
c= rbuffer->buffer[ p ];
while ( ( ' ' == c ) || ( '\t' == c ) ) {
if ( '\n' == c ) {
/* not a process record */
return 0;
}
++p;
c= rbuffer->buffer[ p ];
}

@ -418,7 +418,7 @@ int OTF_Heap_initEventHeap( OTF_Heap* heap, OTF_Reader* reader ) {
heap->n= 0;
heap->s= OTF_MasterControl_getCount( reader->mc );
heap->buffers= (OTF_RBuffer**) malloc( heap->s * sizeof(OTF_RBuffer) );
heap->buffers= (OTF_RBuffer**) malloc( heap->s * sizeof(OTF_RBuffer*) );
if( NULL == heap->buffers ) {
# ifdef OTF_VERBOSE
@ -507,7 +507,7 @@ int OTF_Heap_initDefHeap( OTF_Heap* heap, OTF_Reader* reader ) {
heap->n= 0;
heap->s= 1 + OTF_MasterControl_getCount( reader->mc );
heap->buffers= (OTF_RBuffer**) malloc( heap->s * sizeof(OTF_RBuffer) );
heap->buffers= (OTF_RBuffer**) malloc( heap->s * sizeof(OTF_RBuffer*) );
if( NULL == heap->buffers ) {
# ifdef OTF_VERBOSE
@ -606,7 +606,7 @@ int OTF_Heap_initStatisticsHeap( OTF_Heap* heap, OTF_Reader* reader ) {
heap->n= 0;
heap->s= OTF_MasterControl_getCount( reader->mc );
heap->buffers= (OTF_RBuffer**) malloc( heap->s * sizeof(OTF_RBuffer) );
heap->buffers= (OTF_RBuffer**) malloc( heap->s * sizeof(OTF_RBuffer*) );
if( NULL == heap->buffers ) {
# ifdef OTF_VERBOSE
@ -697,7 +697,7 @@ int OTF_Heap_initSnapshotsHeap( OTF_Heap* heap, OTF_Reader* reader ) {
heap->n= 0;
heap->s= OTF_MasterControl_getCount( reader->mc );
heap->buffers= (OTF_RBuffer**) malloc( heap->s * sizeof(OTF_RBuffer) );
heap->buffers= (OTF_RBuffer**) malloc( heap->s * sizeof(OTF_RBuffer*) );
if( NULL == heap->buffers ) {
# ifdef OTF_VERBOSE

@ -147,7 +147,20 @@ OTF_WStream* OTF_WStream_open( const char* namestub, uint32_t id,
OTF_FileManager* manager ) {
OTF_WStream* ret= (OTF_WStream*) malloc( sizeof(OTF_WStream) );
OTF_WStream* ret= NULL;
if( NULL == manager ) {
# ifdef OTF_VERBOSE
fprintf( stderr, "ERROR in function %s, file: %s, line: %i:\n "
"manager has not been specified.\n",
__FUNCTION__, __FILE__, __LINE__ );
# endif
return NULL;
}
ret= (OTF_WStream*) malloc( sizeof(OTF_WStream) );
if( NULL == ret ) {
# ifdef OTF_VERBOSE
@ -161,20 +174,8 @@ OTF_WStream* OTF_WStream_open( const char* namestub, uint32_t id,
OTF_WStream_init( ret );
ret->namestub= OTF_strdup( namestub );
ret->id= id;
if( NULL == manager ) {
# ifdef OTF_VERBOSE
fprintf( stderr, "ERROR in function %s, file: %s, line: %i:\n "
"manager has not been specified.\n",
__FUNCTION__, __FILE__, __LINE__ );
# endif
return NULL;
}
ret->manager= manager;
/* leave buffers allone, they are allocated on demand */

@ -151,7 +151,20 @@ int OTF_Writer_finish( OTF_Writer* writer ) {
OTF_Writer* OTF_Writer_open( const char* namestub, uint32_t m, OTF_FileManager* manager ) {
OTF_Writer* ret= (OTF_Writer*) malloc( sizeof(OTF_Writer) );
OTF_Writer* ret= NULL;
if( NULL == manager ) {
# ifdef OTF_VERBOSE
fprintf( stderr, "ERROR in function %s, file: %s, line: %i:\n "
"manager has not been specified.\n",
__FUNCTION__, __FILE__, __LINE__ );
# endif
return NULL;
}
ret= (OTF_Writer*) malloc( sizeof(OTF_Writer) );
if( NULL == ret ) {
# ifdef OTF_VERBOSE
@ -169,16 +182,6 @@ OTF_Writer* OTF_Writer_open( const char* namestub, uint32_t m, OTF_FileManager*
ret->namestub= OTF_stripFilename( namestub );
if( NULL == manager ) {
# ifdef OTF_VERBOSE
fprintf( stderr, "ERROR in function %s, file: %s, line: %i:\n "
"manager has not been specified.\n",
__FUNCTION__, __FILE__, __LINE__ );
# endif
return NULL;
}
ret->manager= manager;
ret->mc= OTF_MasterControl_new( ret->manager );

@ -231,8 +231,6 @@ public:
class State {
uint32_t x;
std::map<uint32_t,ProcessState> processes;
/* maps the function to its funtiongroupid */

@ -87,7 +87,7 @@ int main ( int argc, const char** args ) {
const char* p;
uint32_t len;
const char* infilename;
char* infilename= NULL;
char* outfilename= NULL;
int keep= 0;
@ -191,14 +191,18 @@ int main ( int argc, const char** args ) {
/* assume argument is a file name */
len= (uint32_t) strlen( args[i] );
infilename= (char*)realloc( infilename, len +1 );
assert( NULL != infilename );
strncpy( infilename, args[i], len +1 );
switch ( mode ) {
case MODE_DECOMPRESS:
/* decompress file */
infilename= args[i];
len= (uint32_t) strlen( infilename );
outfilename= realloc( outfilename, len +1 );
outfilename= (char*)realloc( outfilename, len +1 );
assert( NULL != outfilename );
/* built outfilename */
@ -249,8 +253,6 @@ int main ( int argc, const char** args ) {
default:
/* compress file */
infilename= args[i];
len= (uint32_t) strlen( infilename );
/* check for ".z" at the end and refuse compression if found */
if ( ( 2 < len ) && ( 0 == strcmp( ".z", infilename +len -2 ) ) ) {
@ -318,6 +320,7 @@ int main ( int argc, const char** args ) {
}
free( outfilename );
free( infilename );
outfilename= NULL;
infilename= NULL;
@ -358,12 +361,17 @@ int compressFile( const char* filename, const char* outfilename,
if ( NULL == fin ) {
fprintf( stderr, "cannot open file '%s' for reading, skip\n", filename );
free( inbuf );
free( outbuf );
return 1;
}
fout= fopen( outfilename, "wb" );
if ( NULL == fout ) {
fprintf( stderr, "cannot open file '%s' for writing, skip\n", outfilename );
fclose( fin );
free( inbuf );
free( outbuf );
return 1;
}
@ -477,12 +485,17 @@ int decompressFile( const char* infilename, const char* outfilename, uint32_t bl
if ( NULL == fin ) {
fprintf( stderr, "cannot open file '%s' for reading, skip\n", infilename );
free( inbuf );
free( outbuf );
return 1;
}
fout= fopen( outfilename, "wb" );
if ( NULL == fout ) {
fprintf( stderr, "cannot open file '%s' for writing, skip\n", outfilename );
fclose( fin );
free( inbuf );
free( outbuf );
return 1;
}
@ -524,6 +537,8 @@ int decompressFile( const char* infilename, const char* outfilename, uint32_t bl
if ( Z_OK != status ) {
fprintf( stderr, "error in uncompressing\n" );
fclose( fin );
fclose( fout );
return 0;
}
@ -557,6 +572,9 @@ int decompressFile( const char* infilename, const char* outfilename, uint32_t bl
inflateEnd( &z );
fclose( fin );
fclose( fout );
free( inbuf );
free( outbuf );
return 0;
}

@ -34,7 +34,7 @@ int main( int argc, char** argv ) {
int i;
char tmp[10240];
char tmp[1024];
if( argc == 1 ) {
@ -67,18 +67,14 @@ int main( int argc, char** argv ) {
} else if ( 0 == strcmp( argv[i], "--libs" ) ) {
memset(tmp, 0, 10240 );
strcat( tmp, "-L" );
strcat( tmp, OTFCONFIG_LIBDIR );
strcat( tmp, " -lotf" );
snprintf( tmp, sizeof(tmp) -1, "-L%s -lotf %s\n",
OTFCONFIG_LIBDIR,
#ifdef HAVE_ZLIB
strcat( tmp, " -lz" );
"-lz" );
#else /* HAVE_ZLIB */
"" );
#endif /* HAVE_ZLIB */
strcat( tmp, "\n" );
printf( tmp );
} else if ( 0 == strcmp( argv[i], "--sizes" ) ) {

@ -15,6 +15,7 @@
#include <string>
#include <vector>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -105,13 +106,13 @@ ReadDataFile()
return false;
}
char buffer[STRBUFSIZE];
char buffer[1024];
std::string line;
unsigned int line_no = 0;
unsigned int key_idx = 0;
while( key_idx < keys_num
&& in.getline( buffer, STRBUFSIZE ) )
&& in.getline( buffer, sizeof(buffer) ) )
{
line_no++;
@ -240,8 +241,8 @@ ReadDataFile()
}
else if( key.compare( "inst_avail" ) == 0 )
{
char cvalue[STRBUFSIZE];
strcpy( cvalue, value.c_str() );
char cvalue[100];
strncpy( cvalue, value.c_str(), sizeof(cvalue) );
char * token = strtok( cvalue, " " );
if( !token )
@ -654,8 +655,9 @@ ParseCommandLine( int argc, char ** argv )
return false;
}
char * args = new char[strlen(argv[i+1])+1];
strcpy( args, argv[++i] );
int len = strlen(argv[i+1])+1;
char * args = new char[len];
strncpy( args, argv[++i], len );
char * token = strtok( args, " " );
do
@ -1089,58 +1091,58 @@ Wrapper::show()
//
if( showmeLink() )
{
char vtlib[STRBUFSIZE];
char vtlib[1024];
if( usesOMP() )
{
if( usesMPI() )
{
sprintf( vtlib, "%s %s %s %s "VTHYBLIB" %s %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
snprintf( vtlib, sizeof(vtlib), "%s %s %s %s "VTHYBLIB" %s %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
#if defined(WRAP_LANG_F77) || defined(WRAP_LANG_F90)
Properties.fmpilib.c_str(),
Properties.fmpilib.c_str(),
#else
"",
"",
#endif
Properties.pmpilib.c_str(),
Properties.comp_ulibs.c_str() );
Properties.pmpilib.c_str(),
Properties.comp_ulibs.c_str() );
}
else
{
sprintf( vtlib, "%s %s %s "VTOMPLIB" %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
Properties.comp_ulibs.c_str() );
snprintf( vtlib, sizeof(vtlib), "%s %s %s "VTOMPLIB" %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
Properties.comp_ulibs.c_str() );
}
}
else if( usesMPI() )
{
sprintf( vtlib, "%s %s %s %s "VTMPILIB" %s %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
snprintf( vtlib, sizeof(vtlib), "%s %s %s %s "VTMPILIB" %s %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
#if defined(WRAP_LANG_F77) || defined(WRAP_LANG_F90)
Properties.fmpilib.c_str(),
Properties.fmpilib.c_str(),
#else
"",
"",
#endif
Properties.pmpilib.c_str(),
Properties.comp_ulibs.c_str() );
Properties.pmpilib.c_str(),
Properties.comp_ulibs.c_str() );
}
else
{
sprintf( vtlib, "%s %s %s "VTSEQLIB" %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
Properties.comp_ulibs.c_str() );
snprintf( vtlib, sizeof(vtlib), "%s %s %s "VTSEQLIB" %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
Properties.comp_ulibs.c_str() );
}
std::cout << (showmeCompile() ? "" : Properties.comp_args) << " "
@ -1218,7 +1220,7 @@ Wrapper::run()
}
else
{
char vtlib[STRBUFSIZE];
char vtlib[1024];
if( usesOMP() || getInstType() == INST_TYPE_POMP )
{
@ -1242,54 +1244,54 @@ Wrapper::run()
{
if( usesMPI() )
{
sprintf( vtlib, "%s %s %s %s "VTHYBLIB" %s %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
snprintf( vtlib, sizeof(vtlib), "%s %s %s %s "VTHYBLIB" %s %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
#if defined(WRAP_LANG_F77) || defined(WRAP_LANG_F90)
Properties.fmpilib.c_str(),
Properties.fmpilib.c_str(),
#else
"",
"",
#endif
Properties.pmpilib.c_str(),
Properties.comp_ulibs.c_str() );
Properties.pmpilib.c_str(),
Properties.comp_ulibs.c_str() );
}
else
{
sprintf( vtlib, "%s %s %s "VTOMPLIB" %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
Properties.comp_ulibs.c_str() );
snprintf( vtlib, sizeof(vtlib), "%s %s %s "VTOMPLIB" %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
Properties.comp_ulibs.c_str() );
}
}
else
{
if( usesMPI() )
{
sprintf( vtlib, "%s %s %s %s "VTMPILIB" %s %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
snprintf( vtlib, sizeof(vtlib), "%s %s %s %s "VTMPILIB" %s %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
#if defined(WRAP_LANG_F77) || defined(WRAP_LANG_F90)
Properties.fmpilib.c_str(),
Properties.fmpilib.c_str(),
#else
"",
"",
#endif
Properties.pmpilib.c_str(),
Properties.comp_ulibs.c_str() );
Properties.pmpilib.c_str(),
Properties.comp_ulibs.c_str() );
}
else
{
sprintf( vtlib, "%s %s %s "VTSEQLIB" %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
Properties.comp_ulibs.c_str() );
snprintf( vtlib, sizeof(vtlib), "%s %s %s "VTSEQLIB" %s",
Properties.comp_ldflags.c_str(),
Properties.libdir.c_str(),
getInstType() == INST_TYPE_DYNINST ?
Properties.dynattlib.c_str() : "",
Properties.comp_ulibs.c_str() );
}
}
@ -1347,8 +1349,14 @@ Wrapper::run()
std::cout << "+++ rename " << Properties.vec_opari_mfiles_obj[i]
<< " to " << target << std::endl;
rename( Properties.vec_opari_mfiles_obj[i].c_str(),
target.c_str() );
if( rename( Properties.vec_opari_mfiles_obj[i].c_str(),
target.c_str() ) == -1 )
{
std::cerr << ExeName << ": error: could not rename "
<< Properties.vec_opari_mfiles_obj[i].c_str()
<< " to " << target.c_str() << std::endl
<< strerror(errno) << std::endl;
}
}
}
}
@ -1543,10 +1551,10 @@ Wrapper::opari_getIncFilesFromTabFile( const std::string tabfile )
std::ifstream in( tabfile.c_str() );
if( in )
{
char buffer[STRBUFSIZE];
char buffer[1024];
std::string line;
while( in.getline( buffer, STRBUFSIZE ) )
while( in.getline( buffer, sizeof(buffer) ) )
{
line = buffer;

@ -13,8 +13,6 @@
#ifndef _COMPWRAP_H_
#define _COMPWRAP_H_
#define STRBUFSIZE 4096
#define VTSEQLIB "-lvt"
#define VTMPILIB "-lvt.mpi"
#define VTOMPLIB "-lvt.omp"

@ -151,18 +151,20 @@ int main (int argc, char *argv[]) {
break;
}
}
}
if ( infile && lang == L_NA ) {
cerr << "ERROR: cannot determine input file language\n";
errFlag =true;
if ( lang == L_NA ) {
cerr << "ERROR: cannot determine input file language\n";
errFlag = true;
}
}
// generate output file name if necessary
if ( !errFlag && (a+1) == argc ) {
if ( !errFlag && infile && (a+1) == argc ) {
out_filename = new char[strlen(infile)+5];
char* dot = (char *) strrchr(infile, '.');
if ( dot != 0 ) {
sprintf(out_filename, "%.*s.mod%s", (int)(dot - infile), infile, dot);
snprintf(out_filename, strlen(infile)+5, "%.*s.mod%s",
(int)(dot - infile), infile, dot);
if ( keepSrcInfo && (lang & L_FORTRAN) ) {
dot = strrchr(out_filename, '.');
@ -209,24 +211,28 @@ int main (int argc, char *argv[]) {
if ( tabfile && (a == argc) ) {
// just generate table file
generateTableFile(rcdir, rcfile, tabfile);
} else {
} else if( infile ) {
// generate opari include file name
// C: in working directory
// F: in rcfile directory
char* incfile = 0;
int len = 0;
if ( lang & L_FORTRAN ) {
// only need base filename without path
const char* dirsep = strrchr(infile, '/');
if ( dirsep ) {
incfile = new char[strlen(rcdir)+strlen(dirsep)+12];
sprintf(incfile, "%s/%s.opari.inc", rcdir, dirsep+1);
len = strlen(rcdir)+strlen(dirsep)+12;
incfile = new char[len];
snprintf(incfile, len, "%s/%s.opari.inc", rcdir, dirsep+1);
} else {
incfile = new char[strlen(rcdir)+strlen(infile)+13];
sprintf(incfile, "%s/%s.opari.inc", rcdir, infile);
len = strlen(rcdir)+strlen(infile)+13;
incfile = new char[len];
snprintf(incfile, len, "%s/%s.opari.inc", rcdir, infile);
}
} else {
incfile = new char[strlen(infile)+12];
sprintf(incfile, "%s.opari.inc", infile);
len = strlen(infile)+12;
incfile = new char[len];
snprintf(incfile, len, "%s.opari.inc", infile);
}
// transform

@ -29,7 +29,7 @@ struct Process {
};
struct FiltHandlerArgument {
FiltHandlerArgument() {}
FiltHandlerArgument() : wstream(0), mc(0) {}
FiltHandlerArgument(const FiltHandlerArgument& fha);

@ -1178,8 +1178,8 @@ static map<uint32_t,uint64_t> readFilterFile( const string& filename, const map<
ulimit= ATOL8(line.substr(a+4, line.size()-a-4).c_str());
line= line.substr(0, a);
sline = new char[line.length()+1];
strcpy( sline,line.c_str() );
sline= new char[line.length()+1];
strncpy( sline, line.c_str(), line.length()+1 );
char* token = strtok(sline, ";");
while( token ) {
@ -1195,7 +1195,7 @@ static map<uint32_t,uint64_t> readFilterFile( const string& filename, const map<
token = strtok(NULL,";");
}
delete sline;
delete[] sline;
}
i.close();

@ -331,8 +331,8 @@ readUnifyControlFiles()
char filename[STRBUFSIZE];
// create file name
sprintf( filename, "%s.%x.uctl",
Params.in_file_prefix.c_str(), i+1 );
snprintf( filename, sizeof( filename ) - 1, "%s.%x.uctl",
Params.in_file_prefix.c_str(), i+1 );
// open unify control file for reading
//
@ -593,8 +593,8 @@ cleanUp()
//
for( i = 0; i < Params.uctl_files_num; i++ )
{
sprintf( filename1, "%s.%x.uctl",
Params.in_file_prefix.c_str(), i+1 );
snprintf( filename1, sizeof( filename1 ) - 1, "%s.%x.uctl",
Params.in_file_prefix.c_str(), i+1 );
if( remove( filename1 ) != 0 )
{

@ -639,24 +639,25 @@ Definitions::createGlobal( const std::vector<DefRec_Base_struct*> *
if( p_loc_def_entry->type ==
DefRec_DefProcessGroup_struct::TYPE_OMP_TEAM )
{
snprintf( new_name, sizeof( new_name ),
snprintf( new_name, sizeof( new_name ) - 1,
"OMP Thread Team %d", omp_comm_idx++ );
}
else if( p_loc_def_entry->type ==
DefRec_DefProcessGroup_struct::TYPE_MPI_COMM_WORLD )
{
strcpy( new_name, "MPI_COMM_WORLD" );
strncpy( new_name, "MPI_COMM_WORLD",
sizeof( new_name ) - 1 );
}
else if( p_loc_def_entry->type ==
DefRec_DefProcessGroup_struct::TYPE_MPI_COMM_SELF )
{
snprintf( new_name, sizeof( new_name ),
snprintf( new_name, sizeof( new_name ) - 1,
"MPI_COMM_SELF %d", mpi_comm_self_idx++ );
}
else
{
strncpy( new_name, p_loc_def_entry->name.c_str(),
sizeof( new_name ) );
sizeof( new_name ) - 1 );
}
// add new definition to vector of global definitions
@ -1371,7 +1372,7 @@ Definitions::writeGlobal( const std::vector<DefRec_Base_struct*> *
n,
array );
delete array;
delete[] array;
break;
}
@ -1610,7 +1611,7 @@ Definitions::addMPIComms2Global( std::vector<DefRec_Base_struct*> *
std::vector<uint32_t> vec_members = m_mapMPICommId2Members[commid];
// add index to comm's name
snprintf( comm_name, sizeof( comm_name ),
snprintf( comm_name, sizeof( comm_name ) - 1,
"MPI Communicator %d", comm_name_idx++ );
// create token for global comm.

@ -51,7 +51,8 @@ public:
//
struct DefRec_Base_struct
{
DefRec_Base_struct() {}
DefRec_Base_struct()
: loccpuid(0), deftoken(0) {}
DefRec_Base_struct(DefRecTypeT _etype)
: etype(_etype), loccpuid(0), deftoken(0) {}
virtual ~DefRec_Base_struct() {}
@ -67,7 +68,8 @@ public:
struct DefRec_DefinitionComment_struct : DefRec_Base_struct
{
DefRec_DefinitionComment_struct()
: DefRec_Base_struct(DEF_REC_TYPE__DefinitionComment) {}
: DefRec_Base_struct(DEF_REC_TYPE__DefinitionComment),
orderidx(0) {}
DefRec_DefinitionComment_struct(uint32_t _orderidx,
std::string _comment)
: DefRec_Base_struct(DEF_REC_TYPE__DefinitionComment),
@ -97,7 +99,8 @@ public:
struct DefRec_DefTimerResolution_struct : DefRec_Base_struct
{
DefRec_DefTimerResolution_struct()
: DefRec_Base_struct(DEF_REC_TYPE__DefTimerResolution) {}
: DefRec_Base_struct(DEF_REC_TYPE__DefTimerResolution),
ticksPerSecond(0) {}
DefRec_DefTimerResolution_struct(uint64_t _ticksPerSecond)
: DefRec_Base_struct(DEF_REC_TYPE__DefTimerResolution),
ticksPerSecond(_ticksPerSecond) {}
@ -111,7 +114,8 @@ public:
struct DefRec_DefProcess_struct : DefRec_Base_struct
{
DefRec_DefProcess_struct()
: DefRec_Base_struct(DEF_REC_TYPE__DefProcess) {}
: DefRec_Base_struct(DEF_REC_TYPE__DefProcess),
parent(0) {}
DefRec_DefProcess_struct(uint32_t _deftoken, std::string _name,
uint32_t _parent)
: DefRec_Base_struct(DEF_REC_TYPE__DefProcess),
@ -132,7 +136,6 @@ public:
DefRec_DefProcessGroup_struct()
: DefRec_Base_struct(DEF_REC_TYPE__DefProcessGroup) {}
DefRec_DefProcessGroup_struct(uint32_t _loccpuid,
uint32_t _deftoken,
ProcessGroupTypeT _type,
@ -184,7 +187,8 @@ public:
struct DefRec_DefScl_struct : DefRec_Base_struct
{
DefRec_DefScl_struct()
: DefRec_Base_struct(DEF_REC_TYPE__DefScl) {}
: DefRec_Base_struct(DEF_REC_TYPE__DefScl),
sclfile(0), sclline(0) {}
DefRec_DefScl_struct(uint32_t _loccpuid, uint32_t _deftoken,
uint32_t _sclfile, uint32_t _sclline)
: DefRec_Base_struct(DEF_REC_TYPE__DefScl),
@ -217,7 +221,8 @@ public:
struct DefRec_DefFile_struct : DefRec_Base_struct
{
DefRec_DefFile_struct()
: DefRec_Base_struct(DEF_REC_TYPE__DefFile) {}
: DefRec_Base_struct(DEF_REC_TYPE__DefFile),
group(0) {}
DefRec_DefFile_struct(uint32_t _loccpuid, uint32_t _deftoken,
std::string _name, uint32_t _group )
: DefRec_Base_struct(DEF_REC_TYPE__DefFile),
@ -251,7 +256,8 @@ public:
struct DefRec_DefFunction_struct : DefRec_Base_struct
{
DefRec_DefFunction_struct()
: DefRec_Base_struct(DEF_REC_TYPE__DefFunction) {}
: DefRec_Base_struct(DEF_REC_TYPE__DefFunction),
group(0), scltoken(0) {}
DefRec_DefFunction_struct(uint32_t _loccpuid, uint32_t _deftoken,
std::string _name, uint32_t _group,
uint32_t _scltoken)
@ -270,7 +276,8 @@ public:
struct DefRec_DefCollectiveOperation_struct : DefRec_Base_struct
{
DefRec_DefCollectiveOperation_struct()
: DefRec_Base_struct(DEF_REC_TYPE__DefCollectiveOperation) {}
: DefRec_Base_struct(DEF_REC_TYPE__DefCollectiveOperation),
type(0) {}
DefRec_DefCollectiveOperation_struct(uint32_t _loccpuid,
uint32_t _collOp,
std::string _name,
@ -304,7 +311,8 @@ public:
struct DefRec_DefCounter_struct : DefRec_Base_struct
{
DefRec_DefCounter_struct()
: DefRec_Base_struct(DEF_REC_TYPE__DefCounter) {}
: DefRec_Base_struct(DEF_REC_TYPE__DefCounter),
properties(0), countergroup(0) {}
DefRec_DefCounter_struct(uint32_t _loccpuid, uint32_t _deftoken,
std::string _name, uint32_t _properties,
uint32_t _countergroup, std::string _unit)
@ -352,10 +360,11 @@ private:
struct MPIComm_struct
{
MPIComm_struct(const uint32_t & _commid) : commid(_commid), index((uint32_t)-1) {}
MPIComm_struct(const uint32_t & _commid)
: commid(_commid), loccpuid(0), deftoken(0), index((uint32_t)-1) {}
MPIComm_struct(const uint32_t & _commid, const uint32_t & _index)
: commid(_commid), index(_index) {}
: commid(_commid), loccpuid(0), deftoken(0), index(_index) {}
MPIComm_struct(const uint32_t & _commid, const uint32_t & _loccpuid,
const uint32_t & _deftoken, const uint32_t & _index)

@ -520,7 +520,7 @@ Statistics::formatTime( uint64_t time )
{
if( i == 3 || sec >= 0.1 )
{
sprintf( str, "%.3f%s", sec, unit[i] );
snprintf( str, sizeof( str ) - 1, "%.3f%s", sec, unit[i] );
break;
}
sec *= 1000.0;