From 9f3e22e44c2c5a7167740412b06a343a3df60b91 Mon Sep 17 00:00:00 2001 From: Thomas Moulard <thomas.moulard@gmail.com> Date: Tue, 2 Nov 2010 21:16:31 +0100 Subject: [PATCH] Fix GCC warnings. --- include/dynamic-graph/contiifstream.h | 2 +- include/dynamic-graph/tracer-real-time.h | 6 +++--- src/dgraph/interpreter.cpp | 9 +++++---- src/dgraph/pool.cpp | 3 +-- src/plugins/shell-procedure.cpp | 2 +- src/shell/functions.cpp | 2 +- src/traces/tracer-real-time.cpp | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/dynamic-graph/contiifstream.h b/include/dynamic-graph/contiifstream.h index 2c298c2..d45bb6e 100644 --- a/include/dynamic-graph/contiifstream.h +++ b/include/dynamic-graph/contiifstream.h @@ -60,7 +60,7 @@ namespace dynamicgraph { { protected: std::string filename; - unsigned int cursor; + std::streamoff cursor; static const unsigned int BUFFER_SIZE = 256; char buffer[BUFFER_SIZE]; std::list< std::string > reader; diff --git a/include/dynamic-graph/tracer-real-time.h b/include/dynamic-graph/tracer-real-time.h index c5728cf..774042d 100644 --- a/include/dynamic-graph/tracer-real-time.h +++ b/include/dynamic-graph/tracer-real-time.h @@ -56,8 +56,8 @@ class DGTRACERREALTIME_EXPORT OutStringStream { public: char * buffer; - unsigned int index; - unsigned int bufferSize; + size_t index; + size_t bufferSize; bool full; std::string givenname; @@ -67,7 +67,7 @@ public: ~OutStringStream( void ); void resize( const unsigned int & size ); - bool addData( const char * data, const unsigned int & size ); + bool addData( const char * data, const std::streamoff& size ); void dump( std::ostream& os ); void empty( void ); diff --git a/src/dgraph/interpreter.cpp b/src/dgraph/interpreter.cpp index 3f50ad0..3728729 100644 --- a/src/dgraph/interpreter.cpp +++ b/src/dgraph/interpreter.cpp @@ -248,7 +248,7 @@ cmdHelp( const std::string& cmdLine, std::istringstream& cmdArg, std::ostream& o cmdArg >> ws; if( cmdArg.good() ) { - const unsigned int gc = cmdArg.tellg(); + const std::streamoff gc = cmdArg.tellg(); cmdArg >> procname; cmdArg.seekg(gc); cmdArg.clear(); personalizedHelp = true; @@ -314,9 +314,10 @@ cmdRun( const std::string& cmdLine, std::istringstream& cmdArg, std::ostream& os } } } catch( ExceptionAbstract& exc ) { - std::string& msg = (std::string&)exc.getStringMessage(); - std::ostringstream oss; - oss <<" (in line " << lineIdx <<" of file <" << filename << ">)"; + //FIXME: exception should be changed instead. + std::string& msg = const_cast<std::string&>(exc.getStringMessage()); + std::stringstream oss; + oss << " (in line " << lineIdx <<" of file <" << filename << ">)"; msg = msg + oss.str(); throw exc; } diff --git a/src/dgraph/pool.cpp b/src/dgraph/pool.cpp index 84d0083..7acc31e 100644 --- a/src/dgraph/pool.cpp +++ b/src/dgraph/pool.cpp @@ -158,8 +158,7 @@ writeGraph(const std::string &aFileName) #endif /*WIN32*/ /* Opening the file and writing the first comment. */ - std::ofstream GraphFile; - GraphFile.open((char *)aFileName.c_str(),std::ofstream::out); + std::ofstream GraphFile (aFileName.c_str(),std::ofstream::out); GraphFile << "/* This graph has been automatically generated. " << std::endl; GraphFile << " " << 1900+ltimeformatted.tm_year << " Month: " << 1+ltimeformatted.tm_mon diff --git a/src/plugins/shell-procedure.cpp b/src/plugins/shell-procedure.cpp index f98c403..fd4e470 100644 --- a/src/plugins/shell-procedure.cpp +++ b/src/plugins/shell-procedure.cpp @@ -123,7 +123,7 @@ cmdProcedure( const std::string& procname, if( args.good() ) { std::string argname; - const unsigned int gc = args.tellg(); + const std::streamoff gc = args.tellg(); args >> argname; args.seekg(gc); args.clear(); if( procname==argname ) diff --git a/src/shell/functions.cpp b/src/shell/functions.cpp index 3f9e3d2..06da286 100644 --- a/src/shell/functions.cpp +++ b/src/shell/functions.cpp @@ -464,7 +464,7 @@ cmdCompletionList( const std::string cmdLine, istringstream& cmdArg, std::ostrea try { std::string aFileName; cmdArg >> aFileName; - std::ofstream completionFile((char *)aFileName.c_str()); + std::ofstream completionFile(aFileName.c_str()); g_pool.writeCompletionList( completionFile ); diff --git a/src/traces/tracer-real-time.cpp b/src/traces/tracer-real-time.cpp index 054fe96..b85ae43 100644 --- a/src/traces/tracer-real-time.cpp +++ b/src/traces/tracer-real-time.cpp @@ -67,10 +67,10 @@ resize( const unsigned int & size ) } bool OutStringStream:: -addData( const char * data, const unsigned int & size ) +addData( const char * data, const std::streamoff& size ) { dgDEBUGIN(15); - unsigned int towrite = size; + size_t towrite = static_cast<size_t> (size); if( index+towrite>bufferSize ) { dgDEBUGOUT(15); -- GitLab