diff --git a/include/dynamic-graph/contiifstream.h b/include/dynamic-graph/contiifstream.h
index 2c298c20ef4fa01748db36d070dd8d48ecbe0dd5..d45bb6e850ed76b2ef2f1e1edfb64131538cab09 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 c5728cfbab0d07a0888d071e7bfb9d446418560a..774042dede0da98b3037764e4b485d732213dfd3 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 3f50ad082cc23c24743194ce673f097ced9a1a8b..3728729a2d7e4369e94bc7d71e1e852fdbbdc511 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 84d008341022f30884ef7b50c68582e7b2de0040..7acc31ece5700bd12c0ea0d59f2e88eaa60d8352 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 f98c40369171225867587e2b90fdff6857cf129a..fd4e4707410afee8f5bfe8b6e6f50b0a56272fb6 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 3f9e3d260fa13102254453eb2bed5572dbb5285a..06da286793cc113ee37a9dfbb9873fc70a76e34b 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 054fe9683bac52724e541881c10379f205e423bf..b85ae43ecc51dcc334c8188d169cf36b2e735061 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);