Skip to content
Snippets Groups Projects
Commit a263aaee authored by Thomas Moulard's avatar Thomas Moulard
Browse files

Merge branch 'topic/warnings'

parents df0d29ee eba38a9c
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -97,8 +97,8 @@ class DYNAMICGRAPH_EXPORT DebugTrace
inline void traceTemplate( const char* format,...)
{ DG_COMMON_TRACES; tmpbuffer.str(""); }
inline DebugTrace& pre( const std::ostream& dummy ) { return *this; }
inline DebugTrace& pre( const std::ostream& dummy,int level )
inline DebugTrace& pre( const std::ostream&) { return *this; }
inline DebugTrace& pre( const std::ostream&, int level)
{ traceLevel = level; return *this; }
/* inline DebugTrace& preTemplate( const std::ostream& dummy,int level ) */
/* { traceLevelTemplate = level; return *this; } */
......@@ -142,14 +142,14 @@ inline bool dgTDEBUG_ENABLE( const int & level ) { return level<=VP_TEMPLATE_DEB
# define dgDEBUG(level) if( 1 ) ; else std::cout
# define dgDEBUGMUTE(level) if( 1 ) ; else std::cout
# define dgERROR dgERRORFLOW.outputbuffer << dgPREERROR
inline void dgDEBUGF( const int level,const char* format,...) { return; }
inline void dgDEBUGF( const char* format,...) { return; }
inline void dgERRORF( const int level,const char* format,...) { return; }
inline void dgERRORF( const char* format,...) { return; }
inline void dgDEBUGF( const int, const char*,...) { return; }
inline void dgDEBUGF( const char*, ...) { return; }
inline void dgERRORF( const int, const char*,...) { return; }
inline void dgERRORF( const char*, ...) { return; }
// TEMPLATE
# define dgTDEBUG(level) if( 1 ) ; else std::cout
inline void dgTDEBUGF( const int level,const char* format,...) { return; }
inline void dgTDEBUGF( const char* format,...) { return; }
inline void dgTDEBUGF( const int, const char*,...) { return; }
inline void dgTDEBUGF( const char*,...) { return; }
#define dgDEBUG_ENABLE(level) false
#define dgTDEBUG_ENABLE(level) false
......
......@@ -94,7 +94,7 @@ class DYNAMICGRAPH_EXPORT Entity
std::ostream& os );
virtual SignalBase<int>* test(void) { return 0; }
virtual void test2( SignalBase<int>* ptr ) { return ; }
virtual void test2( SignalBase<int>* ) { return ; }
virtual const std::string& getCommandList( void ) const;
};
......
......@@ -109,16 +109,17 @@ class DYNAMICGRAPH_EXPORT EntityRegisterer
* of classType to the g_factory. It is then possible to create it
* with the g_factory.
*/
#define DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(classType,className) \
const std::string classType::CLASS_NAME = className; \
extern "C" { \
Entity *EntityMaker##_##classType( const std::string& objname ) \
{ \
return new classType( objname ); \
} \
EntityRegisterer reg##_##classType( className, \
&EntityMaker##_##classType ); \
} \
#define DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(classType,className) \
const std::string classType::CLASS_NAME = className; \
extern "C" { \
Entity *EntityMaker##_##classType( const std::string& objname ) \
{ \
return new classType( objname ); \
} \
EntityRegisterer reg##_##classType( className, \
&EntityMaker##_##classType ); \
} \
struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
} // namespace dynamicgraph
......
......@@ -51,7 +51,7 @@ class SignalBase : public boost::noncopyable
const bool& getReady( void ) const { return ready; }
const std::string& getName( void ) const { return name; }
virtual void setPeriodTime( const Time& p ) {}
virtual void setPeriodTime( const Time& ) {}
virtual Time getPeriodTime( void ) const { return 1; }
public:
......@@ -65,11 +65,11 @@ class SignalBase : public boost::noncopyable
/* --- DEPENDENCIES ------------------------------------------------------- */
virtual void addDependency( const SignalBase<Time>& signal ) {}
virtual void removeDependency( const SignalBase<Time>& signal ) {}
virtual void addDependency( const SignalBase<Time>& ) {}
virtual void removeDependency( const SignalBase<Time>& ) {}
virtual void clearDependencies( void ) {}
virtual bool needUpdate( const Time& t ) const {return ready;}
virtual bool needUpdate( const Time& ) const {return ready;}
inline void setReady( const bool sready = true ) { ready = sready; }
virtual std::ostream &
......@@ -79,9 +79,9 @@ class SignalBase : public boost::noncopyable
}
virtual std::ostream&
displayDependencies( std::ostream& os,const int depth=-1,
displayDependencies( std::ostream& os,const int=-1,
std::string space="",
std::string next1="",std::string next2="" ) const
std::string next1="",std::string ="" ) const
{
os << space << next1 << "-- ";
display(os); return os;
......@@ -115,22 +115,22 @@ class SignalBase : public boost::noncopyable
/* Generic set function. Should be reimplemented by the specific Signal.
* Sets a signal value
*/
virtual void set( std::istringstream& value )
virtual void set( std::istringstream&)
{ DG_THROW ExceptionSignal( ExceptionSignal::SET_IMPOSSIBLE,
"Set operation not possible with this signal. ",
"(while trying to set %s).",this->getName().c_str() );
}
virtual void get( std::ostream& os ) const
virtual void get(std::ostream&) const
{ DG_THROW ExceptionSignal( ExceptionSignal::SET_IMPOSSIBLE,
"Get operation not possible with this signal. ",
"(while trying to get %s).",this->getName().c_str() );
}
virtual inline void recompute( const Time & t)
virtual inline void recompute( const Time &)
{ DG_THROW ExceptionSignal( ExceptionSignal::SET_IMPOSSIBLE,
"Recompute operation not possible with this signal. ",
"(while trying to recompute %s).",this->getName().c_str() );
}
virtual void trace( std::ostream& os ) const
virtual void trace( std::ostream& ) const
{ DG_THROW ExceptionSignal( ExceptionSignal::SET_IMPOSSIBLE,
"Trace operation not possible with this signal. ",
"(while trying to trace %s).",this->getName().c_str() );
......
......@@ -87,7 +87,7 @@ namespace dynamicgraph {
template< class T,class Time >
Signal<T,Time>::
Signal( std::string name )
:__SIGNAL_INIT(name,,NULL,NULL,NULL)
:__SIGNAL_INIT(name,T(),NULL,NULL,NULL)
{
return;
}
......
......@@ -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 );
......
......@@ -63,7 +63,7 @@ void DebugTrace::openFile( const char * filename )
//std::cout << filename << dg_debugfile.good() << dg_debugfile.is_open() << std::endl;
}
void DebugTrace::closeFile( const char * filename )
void DebugTrace::closeFile(const char *)
{
if( dg_debugfile.good()&&dg_debugfile.is_open() ) { dg_debugfile.close(); }
dg_debugfile.setstate( std::ios::failbit ) ;
......
......@@ -238,7 +238,7 @@ namespace dynamicgraph
dgDEBUGOUT(15);
}
void pushImportPaths (dynamicgraph::Interpreter& interpreter,
void pushImportPaths (dynamicgraph::Interpreter&,
const std::string& cmdLine,
std::istringstream& cmdArg,
std::ostream& os)
......@@ -256,9 +256,9 @@ namespace dynamicgraph
importPaths.push_back (path);
}
void popImportPaths (dynamicgraph::Interpreter& interpreter,
void popImportPaths (dynamicgraph::Interpreter&,
const std::string& cmdLine,
std::istringstream& cmdArg,
std::istringstream&,
std::ostream& os)
{
if (cmdLine == "help")
......
......@@ -52,7 +52,7 @@ using namespace std;
void InterpreterHelper::
cmdPlug( const std::string& obj1, const std::string & signame1,
const std::string& obj2, const std::string & signame2,
std::ostream& os )
std::ostream& )
{
dgDEBUG(20) << "Get Ent1 <"<<obj1<<"> ."<<endl;
Entity& ent1 = g_pool.getEntity(obj1);
......@@ -85,7 +85,7 @@ cmdNew( const std::string& className,
void InterpreterHelper::
cmdDestroy( const std::string& objName,
std::ostream& os)
std::ostream& )
{
dgDEBUG(15) << "Destroy <" << objName <<"> requested."<<endl;
......@@ -96,7 +96,7 @@ cmdDestroy( const std::string& objName,
void InterpreterHelper::
cmdLoadPlugin( const std::string& directory,
const std::string& pluginName,
std::ostream& os )
std::ostream& )
{
if( directory.length() != 0 ) dlPtr.setDirectory( directory );
......@@ -110,7 +110,7 @@ cmdLoadPlugin( const std::string& directory,
void InterpreterHelper::
cmdUnloadPlugin( const std::string& pluginName,
std::ostream& os )
std::ostream& )
{
dgDEBUGIN(15);
......@@ -133,7 +133,7 @@ void InterpreterHelper::
cmdSetSignal( const std::string& objname,
const std::string& signame,
const std::string& value,
std::ostream& os )
std::ostream& )
{
dgDEBUGIN(15);
......@@ -167,7 +167,7 @@ void InterpreterHelper::
cmdComputeSignal( const std::string& objname,
const std::string& signame,
const int &time,
std::ostream& os )
std::ostream& )
{
dgDEBUGIN(15);
......
......@@ -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;
}
......
......@@ -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
......
......@@ -81,7 +81,7 @@ cmdContinueProcedure( const std::string& cmdLine,std::istringstream& args,std::o
}
void ShellProcedure::
cmdEndProcedure( const std::string& cmdLine,std::istringstream& args,std::ostream& os )
cmdEndProcedure( const std::string& cmdLine,std::istringstream&, std::ostream& os )
{
if( cmdLine == "help" )
{
......@@ -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 )
......
......@@ -92,7 +92,7 @@ cmdClearPlugin( const std::string cmdLine, std::istringstream& cmdArg, std::ostr
}
void ShellFunctions::
cmdDisplayPlugins( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os )
cmdDisplayPlugins( const std::string cmdLine, std::istringstream&, std::ostream& os )
{
if( cmdLine == "help" )
{
......@@ -132,7 +132,7 @@ cmdDisplayFactory( const std::string cmdLine, std::istringstream& cmdArg,
}
void ShellFunctions::
cmdCommentary( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os )
cmdCommentary( const std::string cmdLine, std::istringstream&, std::ostream& os )
{
if( cmdLine == "help" )
{ os << " # comment with '#': ignore the end of the line." <<endl; }
......@@ -439,7 +439,7 @@ cmdSleep( const std::string cmdLine, istringstream& cmdArg, std::ostream& os )
}
void ShellFunctions::
cmdBeep( const std::string cmdLine, istringstream& cmdArg, std::ostream& os )
cmdBeep( const std::string cmdLine, std::istringstream&, std::ostream& os )
{
if( cmdLine == "help" )
{
......@@ -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 );
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment