diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index c89f76d6ed5428472259bb9dd5029bdc5f774ec8..befa90a53ef68379b595543c8b81bc45290e8f40 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -119,7 +119,7 @@ void redraw_cb(CALLBACK_ARGS)
 void window_cb(CALLBACK_ARGS)
 {
   static int oldx = 0, oldy = 0, oldw = 0, oldh = 0, zoom = 1;
-  char *str = (char*)data;
+  const char *str = (const char*)data;
 
   if(!strcmp(str, "minimize")){
     WID->g_window->iconize();
@@ -176,7 +176,7 @@ void activate_cb(CALLBACK_ARGS)
 
   if(!data) return;
 
-  char *str = (char*)data;
+  const char *str = (const char*)data;
 
   if(!strcmp(str, "fast_redraw")){
     if(WID->gen_butt[2]->value())
@@ -372,7 +372,7 @@ void activate_cb(CALLBACK_ARGS)
 
 void status_xyz1p_cb(CALLBACK_ARGS)
 {
-  char *str = (char*)data;
+  const char *str = (const char*)data;
 
   if(!strcmp(str, "r")){ // rotate 90 degress around axis perp to the screen
     double axis[3] = {0., 0., 1.};
@@ -707,9 +707,6 @@ typedef struct{
 
 void file_save_as_cb(CALLBACK_ARGS)
 {
-  int i, nbformats;
-  static char *pat = NULL;
-
 #if defined(HAVE_NATIVE_FILE_CHOOSER)
 #  define TT "\t"
 #  define NN "\n"
@@ -753,12 +750,12 @@ void file_save_as_cb(CALLBACK_ARGS)
     {"YUV" TT "*.yuv", _save_yuv},
   };
 
-  nbformats = sizeof(formats) / sizeof(formats[0]);
-
+  int nbformats = sizeof(formats) / sizeof(formats[0]);
+  static char *pat = NULL;
   if(!pat) {
     pat = (char *)Malloc(nbformats * 256 * sizeof(char));
     strcpy(pat, formats[0].pat);
-    for(i = 1; i < nbformats; i++) {
+    for(int i = 1; i < nbformats; i++) {
       strcat(pat, NN);
       strcat(pat, formats[i].pat);
     }
@@ -776,13 +773,13 @@ void file_save_as_cb(CALLBACK_ARGS)
                       "Cancel", "Replace", NULL, name.c_str()))
           goto test;
     }
-    i = file_chooser_get_filter();
+    int i = file_chooser_get_filter();
     if(i >= 0 && i < nbformats){
-      if(!formats[i].func(name.c_str()))
-        goto test;
+      if(!formats[i].func(name.c_str())) goto test;
+    }
+    else{ // handle any additional automatic fltk filter
+      if(!_save_auto(name.c_str())) goto test;
     }
-    else // handle any additional automatic fltk filter
-      _save_auto(name.c_str());
   }
 }
 
@@ -918,7 +915,7 @@ void general_options_ok_cb(CALLBACK_ARGS)
     }
   }
   if(data){
-    char *name = (char*)data;
+    const char *name = (const char*)data;
     if(!strcmp(name, "rotation_center_coord")){
       CTX.draw_rotation_center = 1;
     }
@@ -1270,7 +1267,7 @@ void view_options_ok_cb(CALLBACK_ARGS)
   activate_cb(NULL, data);
 
   if(data){
-    char *str = (char*)data;
+    const char *str = (const char*)data;
     if(!strcmp(str, "range_min")){
       WID->view_value[31]->value(opt_view_min(WID->view_number, GMSH_GET, 0));
     }
@@ -1841,7 +1838,7 @@ void statistics_update_cb(CALLBACK_ARGS)
 
 void statistics_histogram_cb(CALLBACK_ARGS)
 {
-  char *name = (char*)data;
+  const char *name = (const char*)data;
   int type;
   if(!strcmp(name, "Gamma"))
     type = 0;
@@ -1913,7 +1910,7 @@ void visibility_cb(CALLBACK_ARGS)
 {
   // get the visibility info from the model, and update the browser accordingly
 
-  char *str = (char*)data;
+  const char *str = (const char*)data;
   if(str && !strcmp(str, "redraw_only"))
     WID->create_visibility_window(true);
   else
@@ -2002,7 +1999,7 @@ void visibility_delete_cb(CALLBACK_ARGS)
 
 void visibility_sort_cb(CALLBACK_ARGS)
 {
-  char *str = (char*)data;
+  const char *str = (const char*)data;
   int val;
   if(!strcmp(str, "type"))
     val = 1;
@@ -2159,7 +2156,7 @@ static void _apply_visibility(char mode,
 
 void visibility_interactive_cb(CALLBACK_ARGS)
 {
-  char *str = (char*)data;
+  const char *str = (const char*)data;
   const char *help;
   int what;
   char mode;
@@ -3513,7 +3510,7 @@ void mesh_delete_cb(CALLBACK_ARGS)
 
 void mesh_delete_parts_cb(CALLBACK_ARGS)
 {
-  char *str = (char*)data;
+  const char *str = (const char*)data;
   int what;
 
   if(!strcmp(str, "elements")){
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index b0e8c4ad8d1caf021a906d0c152d5ec11dc0f008..86083c9a7be7f02db4a91ce3ae727db875e6abc8 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -934,8 +934,8 @@ GUI::GUI(int argc, char **argv)
   create_graphic_window();
 
 #if defined(WIN32)
-  g_window->icon((char *)LoadImage(fl_display, MAKEINTRESOURCE(IDI_ICON),
-                                   IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR));
+  g_window->icon((const char*)LoadImage(fl_display, MAKEINTRESOURCE(IDI_ICON),
+					IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR));
 #elif defined(__APPLE__)
   // Nothing to do here
 #else
@@ -952,10 +952,10 @@ GUI::GUI(int argc, char **argv)
     0x08, 0x00, 0xff, 0x1f, 0x08, 0x00, 0xff, 0x1f, 0x04, 0x40, 0xfd, 0x3f,
     0x04, 0xa8, 0xea, 0x3f, 0x02, 0x55, 0x55, 0x7f, 0xa2, 0xaa, 0xaa, 0x7a,
     0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 };
-  g_window->icon((char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
-                                              gmsh32x32, 32, 32));
-  m_window->icon((char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
-                                              gmsh32x32, 32, 32));
+  g_window->icon((const char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
+						    gmsh32x32, 32, 32));
+  m_window->icon((const char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
+						    gmsh32x32, 32, 32));
 #endif
 
   // open graphics window first for correct non-modal behaviour on windows
@@ -1660,7 +1660,6 @@ void GUI::set_status(const char *msg, int num)
 void GUI::add_multiline_in_browser(Fl_Browser * o, const char *prefix, const char *str)
 {
   int start = 0, len;
-  char *buff;
   if(!str || !strlen(str) || !strcmp(str, "\n")) {
     o->add(" ");
     return;
@@ -1668,7 +1667,7 @@ void GUI::add_multiline_in_browser(Fl_Browser * o, const char *prefix, const cha
   for(unsigned int i = 0; i < strlen(str); i++) {
     if(i == strlen(str) - 1 || str[i] == '\n') {
       len = i - start + (str[i] == '\n' ? 0 : 1);
-      buff = new char[len + strlen(prefix) + 2];
+      char *buff = new char[len + strlen(prefix) + 2];
       strcpy(buff, prefix);
       strncat(buff, &str[start], len);
       buff[len + strlen(prefix)] = '\0';
@@ -3908,20 +3907,7 @@ FieldDialogBox::FieldDialogBox(Field *f, int x, int y, int width, int height,int
     {
       Fl_Group *g = new Fl_Group(x, y + 2*BH + WB, width, height - 2*BH-3*WB, "Help");
       Fl_Browser *o = new Fl_Browser(x + WB, y + 2*WB + 2*BH, width - 2 * WB, height - 4 * WB - 3 * BH);
-      
-      //    char name[1024], copyright[256], author[256], help[4096];
-      //    p->getName(name);
-      //    p->getInfos(author, copyright, help);
-      
-      o->add(" ");
-      //   add_multiline_in_browser(o, "@c@b@.", name);
       o->add(" ");
-      //  add_multiline_in_browser(o, "", help);
-      o->add(" ");
-      //add_multiline_in_browser(o, "Author: ", author);
-      //add_multiline_in_browser(o, "Copyright (C) ", copyright);
-      o->add(" ");
-      
       g->end();
     }
     o->end();
diff --git a/Geo/CustomContainer.h b/Geo/CustomContainer.h
index 734e60853d6f87cd82e05217e8b25ab91dd5ea8b..e018f6c73b40ce0db06b0ebe46459559edcad32e 100644
--- a/Geo/CustomContainer.h
+++ b/Geo/CustomContainer.h
@@ -4,13 +4,13 @@
 // bugs and problems to <gmsh@geuz.org>.
 //
 // CustomContainer.h - Copyright (C) 2008 S. Guzik, C. Geuzaine, J.-F. Remacle
+
 #ifndef _CUSTOMCONTAINER_H_
 #define _CUSTOMCONTAINER_H_
 
 #include <cstdlib>
 #include <cstring>
 
-
 /*******************************************************************************
  *
  * This lightweight pool class attempts to reduce memory usage by having the
diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index 5a96974dd0d9b8293b46fe32cfa1f0d9284ca13f..69398d65fcad530b4e3399fb165a9ef922554dfe 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -698,6 +698,15 @@ int GModel::indexMeshVertices(bool all)
   return numVertices;
 }
 
+/*
+int GModel::unIndexMeshVerticesNotInPartition(int partition)
+{
+  // tag all the vertices not belonging to the partition with index -1
+  // (so they won't be saved)
+  Msg::Error("unIndexMeshVerticesNotInPartition not implemented");
+}
+*/
+
 void GModel::scaleMesh(double factor)
 {
   std::vector<GEntity*> entities = getEntities();
diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp
index 445fe03a2ecc7e10c26d4969fbc449783b8f26ae..ff2518688277e635d2f219573d86ba627f1407e7 100644
--- a/Geo/GModelIO_Mesh.cpp
+++ b/Geo/GModelIO_Mesh.cpp
@@ -442,7 +442,7 @@ static void writeElementHeaderMSH(bool binary, FILE *fp, std::map<int,int> &elem
 }
 
 template<class T>
-static void writeElementsMSH(FILE *fp, const std::vector<T*> &ele, int saveAll, 
+static void writeElementsMSH(FILE *fp, const std::vector<T*> &ele, bool saveAll, 
                              double version, bool binary, int &num, int elementary, 
                              std::vector<int> &physicals)
 {
diff --git a/Geo/MZone.h b/Geo/MZone.h
index 7ea7bc1940be9406a881ecad18e4a600c65e7240..cb2453c7753b0f7b41c6a4d695a1623231b569b1 100644
--- a/Geo/MZone.h
+++ b/Geo/MZone.h
@@ -4,10 +4,10 @@
 // bugs and problems to <gmsh@geuz.org>.
 //
 // MZone.h - Copyright (C) 2008 S. Guzik, C. Geuzaine, J.-F. Remacle
+
 #ifndef _MZONE_H_
 #define _MZONE_H_
 
-
 /*******************************************************************************
  *
  * The classes in this file are used to define and generate representations of
diff --git a/Geo/MZoneBoundary.cpp b/Geo/MZoneBoundary.cpp
index 35883fefcd0afc61d3bf6c9555a9be8de5601173..648a814b1c8814d22279290752b1dc07643f5d1e 100644
--- a/Geo/MZoneBoundary.cpp
+++ b/Geo/MZoneBoundary.cpp
@@ -13,7 +13,6 @@
 #include "MZoneBoundary.h"
 #include "Message.h"
 
-
 /*******************************************************************************
  *
  * class BCPatchIndex
diff --git a/Geo/MZoneBoundary.h b/Geo/MZoneBoundary.h
index 9dd67d70e2c3f040d887ea781b2b4000818abf42..b0e8a8e4d0edb75f1cdf18b5d00251055680d3e1 100644
--- a/Geo/MZoneBoundary.h
+++ b/Geo/MZoneBoundary.h
@@ -4,10 +4,10 @@
 // bugs and problems to <gmsh@geuz.org>.
 //
 // MZoneBoundary.h - Copyright (C) 2008 S. Guzik, C. Geuzaine, J.-F. Remacle
+
 #ifndef _MZONEBOUNDARY_H_
 #define _MZONEBOUNDARY_H_
 
-
 /*******************************************************************************
  *
  * - The classes in this file are used to determine connectivity between