[glom] C++11: More use of auto.



commit 91b6d5c54bbfcc329d8ec28ddc9e2776d0ec5762
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jul 3 13:21:14 2015 +0200

    C++11: More use of auto.

 glom/import_csv/csv_parser.cc                      |    4 +-
 glom/import_csv/dialog_import_csv.cc               |   23 ++++----
 glom/libglom/connectionpool_backends/mysql.cc      |    4 +-
 glom/libglom/connectionpool_backends/postgres.cc   |    6 +-
 .../connectionpool_backends/postgres_self.cc       |   55 ++++++++++----------
 glom/libglom/connectionpool_backends/sqlite.cc     |    4 +-
 glom/libglom/data_structure/glomconversions.cc     |   28 +++++-----
 glom/libglom/data_structure/has_title_singular.cc  |    2 +-
 glom/libglom/db_utils.cc                           |    8 ++--
 glom/libglom/document/bakery/document.cc           |    2 +-
 glom/libglom/document/document.cc                  |   46 ++++++++--------
 .../libglom/python_embed/pygdavalue_conversions.cc |    4 +-
 glom/libglom/utils.cc                              |    4 +-
 glom/mode_data/db_adddel/db_adddel.cc              |    2 +-
 glom/print_layout/canvas_print_layout.cc           |    2 +-
 tests/test_selfhosting_new_then_lookup.cc          |    2 +-
 16 files changed, 98 insertions(+), 98 deletions(-)
---
diff --git a/glom/import_csv/csv_parser.cc b/glom/import_csv/csv_parser.cc
index be71a4e..ee72425 100644
--- a/glom/import_csv/csv_parser.cc
+++ b/glom/import_csv/csv_parser.cc
@@ -344,10 +344,10 @@ bool CsvParser::on_idle_parse()
     // Note that, unlike std::string::find*, std::find* returns an iterator (char*), not a position.
     // It returns outbuf if none is found.
     const char newline_to_find[] = { '\r', '\n', '\0' };
-    const char* pos_newline = std::find_first_of<const char*>(prev, outbuf, newline_to_find, newline_to_find 
+ sizeof(newline_to_find));
+    const auto pos_newline = std::find_first_of<const char*>(prev, outbuf, newline_to_find, newline_to_find 
+ sizeof(newline_to_find));
 
     const char quote_to_find[] = {(char)QUOTE};
-    const char* pos_quote = std::find_first_of<const char*>(prev, outbuf, quote_to_find, quote_to_find + 
sizeof(quote_to_find));
+    const auto pos_quote = std::find_first_of<const char*>(prev, outbuf, quote_to_find, quote_to_find + 
sizeof(quote_to_find));
 
     // Examine the first character (quote or newline) that was found:
     const char* pos = pos_newline;
diff --git a/glom/import_csv/dialog_import_csv.cc b/glom/import_csv/dialog_import_csv.cc
index be38f91..7052df4 100644
--- a/glom/import_csv/dialog_import_csv.cc
+++ b/glom/import_csv/dialog_import_csv.cc
@@ -48,7 +48,7 @@ const char* AUTODETECT_ENCODINGS_CHARSETS[] = {
   "UCS-4"
 };
 
-const guint N_AUTODETECT_ENCODINGS_CHARSETS = 
sizeof(AUTODETECT_ENCODINGS_CHARSETS)/sizeof(AUTODETECT_ENCODINGS_CHARSETS[0]);
+const auto N_AUTODETECT_ENCODINGS_CHARSETS = 
sizeof(AUTODETECT_ENCODINGS_CHARSETS)/sizeof(AUTODETECT_ENCODINGS_CHARSETS[0]);
 
 
 Glib::ustring encoding_display(const Glib::ustring& name, const Glib::ustring& charset)
@@ -103,7 +103,7 @@ Dialog_Import_CSV::Dialog_Import_CSV(BaseObjectType* cobject, const Glib::RefPtr
   // Separator:
   m_encoding_model->append();
 
-  const FileEncodings::type_list_encodings list_encodings =  FileEncodings::get_list_of_encodings();
+  const auto list_encodings =  FileEncodings::get_list_of_encodings();
   for(const auto& encoding : list_encodings)
   {
     if(encoding.get_name().empty())
@@ -277,8 +277,8 @@ void Dialog_Import_CSV::show_error_dialog(const Glib::ustring&, const Glib::ustr
 
 void Dialog_Import_CSV::encoding_data_func(const Gtk::TreeModel::iterator& iter, Gtk::CellRendererText& 
renderer)
 {
-  const Glib::ustring name = (*iter)[m_encoding_columns.m_col_name];
-  const Glib::ustring charset = (*iter)[m_encoding_columns.m_col_charset];
+  const auto name = (*iter)[m_encoding_columns.m_col_name];
+  const auto charset = (*iter)[m_encoding_columns.m_col_charset];
 
   renderer.set_property("text", encoding_display(name, charset));
 }
@@ -357,7 +357,7 @@ void Dialog_Import_CSV::on_first_line_as_title_toggled()
       (*iter)[m_sample_columns.m_col_row] = 0;
 
       // Remove last row if we hit the limit
-      const guint sample_rows = m_sample_model->children().size() - 1;
+      const auto sample_rows = m_sample_model->children().size() - 1;
       if(sample_rows > static_cast<guint>(m_sample_rows->get_value_as_int()))
       {
         //m_sample_model->erase(m_sample_model->children().rbegin());
@@ -376,7 +376,8 @@ void Dialog_Import_CSV::on_sample_rows_changed()
   if(!m_sample_model)
     return;
 
-  const guint current_sample_rows = m_sample_model->children().size() - 1;
+  const auto children_size = m_sample_model->children().size();
+  const guint current_sample_rows = (children_size == 0 ? 0 : children_size - 1);
   const guint new_sample_rows = m_sample_rows->get_value_as_int();
 
   if(current_sample_rows > new_sample_rows)
@@ -486,7 +487,7 @@ void Dialog_Import_CSV::on_parser_line_scanned(CsvParser::type_row_strings row,
   // Add the row to the treeview if there are not yet as much sample rows
   // as the user has chosen (note the first row is to choose the target fields,
   // not a sample row, which is why we do -1 here).
-  const guint sample_rows = m_sample_model->children().size() - 1;
+  const auto sample_rows = m_sample_model->children().size() - 1;
 
   // Don't add if this is the first line and m_first_line_as_title is active:
   if(row_number > 1 || !m_first_line_as_title->get_active())
@@ -547,7 +548,7 @@ Gtk::CellRendererCombo* Dialog_Import_CSV::create_sample_cell(guint index)
 
 void Dialog_Import_CSV::line_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
 {
-  const int row = (*iter)[m_sample_columns.m_col_row];
+  const auto row = (*iter)[m_sample_columns.m_col_row];
   auto renderer_text = dynamic_cast<Gtk::CellRendererText*>(renderer);
   if(!renderer_text)
     throw std::logic_error("CellRenderer is not a CellRendererText in line_data_func");
@@ -560,7 +561,7 @@ void Dialog_Import_CSV::line_data_func(Gtk::CellRenderer* renderer, const Gtk::T
 
 void Dialog_Import_CSV::field_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter, 
guint column_number)
 {
-  const int row = (*iter)[m_sample_columns.m_col_row];
+  const auto row = (*iter)[m_sample_columns.m_col_row];
   auto renderer_combo = dynamic_cast<Gtk::CellRendererCombo*>(renderer);
   if(!renderer_combo) throw std::logic_error("CellRenderer is not a CellRendererCombo in field_data_func");
 
@@ -642,7 +643,7 @@ void Dialog_Import_CSV::on_field_edited(const Glib::ustring& path, const Glib::u
   auto iter = m_sample_model->get_iter(treepath);
 
   // Lookup field indicated by new_text
-  const Gtk::TreeNodeChildren& children = m_field_model->children();
+  const auto children = m_field_model->children();
   for(auto field_iter = children.begin(); field_iter != children.end(); ++ field_iter)
   {
     if( (*field_iter)[m_field_columns.m_col_field_name] == new_text)
@@ -656,7 +657,7 @@ void Dialog_Import_CSV::on_field_edited(const Glib::ustring& path, const Glib::u
       m_fields[column_number] = field;
 
       // Update the rows, so they are redrawn, doing a conversion to the new type.
-      const Gtk::TreeNodeChildren& sample_children = m_sample_model->children();
+      const auto sample_children = m_sample_model->children();
       // Create a TreeModel::Path with initial index 0. We need a TreeModel::Path for the row_changed() call
       Gtk::TreeModel::Path path("0");
 
diff --git a/glom/libglom/connectionpool_backends/mysql.cc b/glom/libglom/connectionpool_backends/mysql.cc
index 43dce00..4bb73cf 100644
--- a/glom/libglom/connectionpool_backends/mysql.cc
+++ b/glom/libglom/connectionpool_backends/mysql.cc
@@ -87,7 +87,7 @@ Glib::RefPtr<Gnome::Gda::Connection> MySQL::attempt_connect(const Glib::ustring&
   const Glib::ustring cnc_string_main = "HOST=" + DbUtils::gda_cnc_string_encode(m_host)
    + ";PORT=" + DbUtils::gda_cnc_string_encode(port)
    + ";PROTOCOL=TCP"; //PROTOCOL is in libgda >= 5.1.2.
-  const Glib::ustring cnc_string = cnc_string_main +";DB_NAME=" + DbUtils::gda_cnc_string_encode(database);
+  const auto cnc_string = cnc_string_main +";DB_NAME=" + DbUtils::gda_cnc_string_encode(database);
 
   Glib::RefPtr<Gnome::Gda::Connection> connection;
   Glib::RefPtr<Gnome::Gda::DataModel> data_model;
@@ -125,7 +125,7 @@ Glib::RefPtr<Gnome::Gda::Connection> MySQL::attempt_connect(const Glib::ustring&
     std::cout << "debug: " << G_STRFUNC << ": Attempting to connect without specifying the database." << 
std::endl;
 #endif
 
-    const Glib::ustring cnc_string = cnc_string_main + ";DB_NAME=" + 
DbUtils::gda_cnc_string_encode(default_database);
+    const auto cnc_string = cnc_string_main + ";DB_NAME=" + DbUtils::gda_cnc_string_encode(default_database);
     Glib::RefPtr<Gnome::Gda::Connection> temp_conn;
     auto auth_string = create_auth_string(username, password);
     try
diff --git a/glom/libglom/connectionpool_backends/postgres.cc 
b/glom/libglom/connectionpool_backends/postgres.cc
index 8944c9a..b70a988 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -72,9 +72,9 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
   //This _might_ be different on some systems. I hope not. murrayc
   const auto default_database = "template1";
   //const auto actual_database = (!database.empty()) ? database : default_database;;
-  const Glib::ustring cnc_string_main = "HOST=" + DbUtils::gda_cnc_string_encode(m_host)
+  const auto cnc_string_main = "HOST=" + DbUtils::gda_cnc_string_encode(m_host)
    + ";PORT=" + DbUtils::gda_cnc_string_encode(port);
-  const Glib::ustring cnc_string = cnc_string_main + ";DB_NAME=" + DbUtils::gda_cnc_string_encode(database);
+  const auto cnc_string = cnc_string_main + ";DB_NAME=" + DbUtils::gda_cnc_string_encode(database);
 
   Glib::RefPtr<Gnome::Gda::Connection> connection;
   Glib::RefPtr<Gnome::Gda::DataModel> data_model;
@@ -112,7 +112,7 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
     std::cout << "debug: " << G_STRFUNC << ": Attempting to connect without specifying the database." << 
std::endl;
 #endif
 
-    const Glib::ustring cnc_string = cnc_string_main + ";DB_NAME=" + 
DbUtils::gda_cnc_string_encode(default_database);
+    const auto cnc_string = cnc_string_main + ";DB_NAME=" + DbUtils::gda_cnc_string_encode(default_database);
     Glib::RefPtr<Gnome::Gda::Connection> temp_conn;
     auto auth_string = create_auth_string(username, password);
     try
diff --git a/glom/libglom/connectionpool_backends/postgres_self.cc 
b/glom/libglom/connectionpool_backends/postgres_self.cc
index 6858adb..32db63d 100644
--- a/glom/libglom/connectionpool_backends/postgres_self.cc
+++ b/glom/libglom/connectionpool_backends/postgres_self.cc
@@ -123,7 +123,7 @@ bool PostgresSelfHosted::install_postgres(const SlotProgress& /* slot_progress *
   //so there is no need to start a Glom service after installation at system startup,
   //though it will not hurt Glom if you do that.
   const gchar *packages[] = { "postgresql-8.1", 0 };
-  const bool result = gst_packages_install(parent_window->gobj() /* parent window */, packages);
+  const auto result = gst_packages_install(parent_window->gobj() /* parent window */, packages);
   if(result)
   {
     std::cout << "Glom: gst_packages_install() reports success." << std::endl;
@@ -179,7 +179,7 @@ Backend::InitErrors PostgresSelfHosted::initialize(const SlotProgress& slot_prog
   }
 
   //Create the config directory:
-  const std::string dbdir_config = get_self_hosting_config_path(true /* create */);
+  const auto dbdir_config = get_self_hosting_config_path(true /* create */);
   if(dbdir_config.empty())
   {
     std::cerr << G_STRFUNC << ": Couldn't create the config directory: " << dbdir << std::endl;
@@ -191,7 +191,7 @@ Backend::InitErrors PostgresSelfHosted::initialize(const SlotProgress& slot_prog
   set_network_shared(slot_progress, m_network_shared); //Creates pg_hba.conf
 
   //Check that there is not an existing data directory:
-  const std::string dbdir_data = get_self_hosting_data_path(true /* create */);
+  const auto dbdir_data = get_self_hosting_data_path(true /* create */);
   if(dbdir_data.empty())
   {
     std::cerr << G_STRFUNC << ": Couldn't create the data directory: " << dbdir << std::endl;
@@ -204,7 +204,7 @@ Backend::InitErrors PostgresSelfHosted::initialize(const SlotProgress& slot_prog
   //Get file:// URI for the tmp/ directory:
   const auto temp_pwfile = Utils::get_temp_file_path("glom_initdb_pwfile");
   const auto temp_pwfile_uri = Glib::filename_to_uri(temp_pwfile);
-  const bool pwfile_creation_succeeded = create_text_file(temp_pwfile_uri, password);
+  const auto pwfile_creation_succeeded = create_text_file(temp_pwfile_uri, password);
   g_assert(pwfile_creation_succeeded);
 
   // Make sure to use double quotes for the executable path, because the
@@ -213,7 +213,7 @@ Backend::InitErrors PostgresSelfHosted::initialize(const SlotProgress& slot_prog
                                         " -U " + initial_username + " --pwfile=" + 
Glib::shell_quote(temp_pwfile);
 
   //Note that --pwfile takes the password from the first line of a file. It's an alternative to supplying it 
when prompted on stdin.
-  const bool result = Glom::Spawn::execute_command_line_and_wait(command_initdb, slot_progress);
+  const auto result = Glom::Spawn::execute_command_line_and_wait(command_initdb, slot_progress);
   if(!result)
   {
     std::cerr << G_STRFUNC << ": Error while attempting to create self-hosting database." << std::endl;
@@ -229,11 +229,11 @@ Glib::ustring PostgresSelfHosted::get_postgresql_utils_version(const SlotProgres
 {
   Glib::ustring result;
 
-  const std::string command = get_path_to_postgres_executable("pg_ctl") + " --version";
+  const auto command = get_path_to_postgres_executable("pg_ctl") + " --version";
 
   //The first command does not return, but the second command can check whether it succeeded:
   std::string output;
-  const bool spawn_result = Glom::Spawn::execute_command_line_and_wait(command, slot_progress, output);
+  const auto spawn_result = Glom::Spawn::execute_command_line_and_wait(command, slot_progress, output);
   if(!spawn_result)
   {
     std::cerr << G_STRFUNC << ": Error while attempting to discover the pg_ctl version." << std::endl;
@@ -298,8 +298,7 @@ float PostgresSelfHosted::get_postgresql_utils_version_as_number(const SlotProgr
   if(!regex)
     return result;
 
-  typedef std::vector<Glib::ustring> type_vec_strings;
-  const type_vec_strings vec = regex->split(version_str, Glib::REGEX_MATCH_NOTEMPTY);
+  const auto vec = regex->split(version_str, Glib::REGEX_MATCH_NOTEMPTY);
   //std::cout << "DEBUG: str == " << version_str << std::endl;
   //std::cout << "DEBUG: vec.size() == " << vec.size() << std::endl;
 
@@ -312,7 +311,7 @@ float PostgresSelfHosted::get_postgresql_utils_version_as_number(const SlotProgr
     if(str.empty())
       continue;
 
-    const float num = atoi(str.c_str());
+    const auto num = atoi(str.c_str());
     if(count == 0)
       result = num;
     else if(count == 1)
@@ -353,11 +352,11 @@ Backend::StartupErrors PostgresSelfHosted::startup(const SlotProgress& slot_prog
   const auto dbdir = Glib::filename_from_uri(dbdir_uri);
   g_assert(!dbdir.empty());
 
-  const std::string dbdir_data = Glib::build_filename(dbdir, FILENAME_DATA);
+  const auto dbdir_data = Glib::build_filename(dbdir, FILENAME_DATA);
   const auto dbdir_data_uri = Glib::filename_to_uri(dbdir_data);
   if(!(file_exists_uri(dbdir_data_uri)))
   {
-    const std::string dbdir_backup = Glib::build_filename(dbdir, FILENAME_BACKUP);
+    const auto dbdir_backup = Glib::build_filename(dbdir, FILENAME_BACKUP);
     const auto dbdir_backup_uri = Glib::filename_to_uri(dbdir_backup);
     if(file_exists_uri(dbdir_backup_uri))
     {
@@ -375,7 +374,7 @@ Backend::StartupErrors PostgresSelfHosted::startup(const SlotProgress& slot_prog
   //Attempt to ensure that the config files are correct:
   set_network_shared(slot_progress, m_network_shared); //Creates pg_hba.conf
 
-  const unsigned int available_port = discover_first_free_port(PORT_POSTGRESQL_SELF_HOSTED_START, 
PORT_POSTGRESQL_SELF_HOSTED_END);
+  const auto available_port = discover_first_free_port(PORT_POSTGRESQL_SELF_HOSTED_START, 
PORT_POSTGRESQL_SELF_HOSTED_END);
   //std::cout << "debug: " << G_STRFUNC << ":() : debug: Available port for self-hosting: " << 
available_port << std::endl;
   if(available_port == 0)
   {
@@ -391,11 +390,11 @@ Backend::StartupErrors PostgresSelfHosted::startup(const SlotProgress& slot_prog
   // -k specifies a directory to use for the socket. This must be writable by us.
   // Make sure to use double quotes for the executable path, because the
   // CreateProcess() API used on Windows does not support single quotes.
-  const std::string dbdir_config = Glib::build_filename(dbdir, "config");
-  const std::string dbdir_hba = Glib::build_filename(dbdir_config, "pg_hba.conf");
-  const std::string dbdir_pid = Glib::build_filename(dbdir, "pid");
-  const std::string listen_address = (m_network_shared ? "*" : "localhost");
-  const std::string command_postgres_start = get_path_to_postgres_executable("postgres") + " -D " + 
Glib::shell_quote(dbdir_data)
+  const auto dbdir_config = Glib::build_filename(dbdir, "config");
+  const auto dbdir_hba = Glib::build_filename(dbdir_config, "pg_hba.conf");
+  const auto dbdir_pid = Glib::build_filename(dbdir, "pid");
+  const auto listen_address = (m_network_shared ? "*" : "localhost");
+  const auto command_postgres_start = get_path_to_postgres_executable("postgres") + " -D " + 
Glib::shell_quote(dbdir_data)
                                   + " -p " + port_as_text
                                   + " -h " + listen_address
                                   + " -c hba_file=" + Glib::shell_quote(dbdir_hba)
@@ -405,7 +404,7 @@ Backend::StartupErrors PostgresSelfHosted::startup(const SlotProgress& slot_prog
 
   // Make sure to use double quotes for the executable path, because the
   // CreateProcess() API used on Windows does not support single quotes.
-  const std::string command_check_postgres_has_started = get_path_to_postgres_executable("pg_ctl") + " 
status -D " + Glib::shell_quote(dbdir_data);
+  const auto command_check_postgres_has_started = get_path_to_postgres_executable("pg_ctl") + " status -D " 
+ Glib::shell_quote(dbdir_data);
 
   //For postgres 8.1, this is "postmaster is running".
   //For postgres 8.2, this is "server is running".
@@ -417,7 +416,7 @@ Backend::StartupErrors PostgresSelfHosted::startup(const SlotProgress& slot_prog
   const std::string second_command_success_text = "is running"; //TODO: This is not a stable API. Also, 
watch out for localisation.
 
   //The first command does not return, but the second command can check whether it succeeded:
-  const bool result = 
Glom::Spawn::execute_command_line_and_wait_until_second_command_returns_success(command_postgres_start, 
command_check_postgres_has_started, slot_progress, second_command_success_text);
+  const auto result = 
Glom::Spawn::execute_command_line_and_wait_until_second_command_returns_success(command_postgres_start, 
command_check_postgres_has_started, slot_progress, second_command_success_text);
   if(!result)
   {
     std::cerr << G_STRFUNC << ": Error while attempting to self-host a database." << std::endl;
@@ -480,7 +479,7 @@ bool PostgresSelfHosted::cleanup(const SlotProgress& slot_progress)
   const auto dbdir = Glib::filename_from_uri(dbdir_uri);
   g_assert(!dbdir.empty());
 
-  const std::string dbdir_data = Glib::build_filename(dbdir, FILENAME_DATA);
+  const auto dbdir_data = Glib::build_filename(dbdir, FILENAME_DATA);
 
 
   // TODO: Detect other instances on the same computer, and use a different port number,
@@ -493,8 +492,8 @@ bool PostgresSelfHosted::cleanup(const SlotProgress& slot_progress)
   // TODO: Warn about connected clients on other computers? Warn those other users?
   // Make sure to use double quotes for the executable path, because the
   // CreateProcess() API used on Windows does not support single quotes.
-  const std::string command_postgres_stop = get_path_to_postgres_executable("pg_ctl") + " -D " + 
Glib::shell_quote(dbdir_data) + " stop -m fast";
-  const bool result = Glom::Spawn::execute_command_line_and_wait(command_postgres_stop, slot_progress);
+  const auto command_postgres_stop = get_path_to_postgres_executable("pg_ctl") + " -D " + 
Glib::shell_quote(dbdir_data) + " stop -m fast";
+  const auto result = Glom::Spawn::execute_command_line_and_wait(command_postgres_stop, slot_progress);
   if(!result)
   {
     std::cerr << G_STRFUNC << ": Error while attempting to stop self-hosting of the database. Trying again." 
 << std::endl;
@@ -511,7 +510,7 @@ bool PostgresSelfHosted::cleanup(const SlotProgress& slot_progress)
     
     //I've seen it fail when running under valgrind, and there are reports of failures in bug #420962.
     //Maybe it will help to try again:
-    const bool result = Glom::Spawn::execute_command_line_and_wait(command_postgres_stop, slot_progress);
+    const auto result = Glom::Spawn::execute_command_line_and_wait(command_postgres_stop, slot_progress);
     if(!result)
     {
       std::cerr << G_STRFUNC << ": Error while attempting (for a second time) to stop self-hosting of the 
database."  << std::endl;
@@ -540,14 +539,14 @@ bool PostgresSelfHosted::set_network_shared(const SlotProgress& /* slot_progress
 
   // Choose the configuration contents based on 
   // whether we want to be network-shared:
-  //const float postgresql_version = get_postgresql_utils_version_as_number(slot_progress);
+  //const auto postgresql_version = get_postgresql_utils_version_as_number(slot_progress);
   //std::cout << "DEBUG: postgresql_version=" << postgresql_version << std::endl;
 
   default_conf_contents = m_network_shared ? DEFAULT_CONFIG_PG_HBA_REMOTE : DEFAULT_CONFIG_PG_HBA_LOCAL;
 
   //std::cout << "DEBUG: default_conf_contents=" << default_conf_contents << std::endl;
 
-  const bool hba_conf_creation_succeeded = create_text_file(dbdir_uri_config + "/pg_hba.conf", 
default_conf_contents);
+  const auto hba_conf_creation_succeeded = create_text_file(dbdir_uri_config + "/pg_hba.conf", 
default_conf_contents);
   g_assert(hba_conf_creation_succeeded);
   if(!hba_conf_creation_succeeded)
     return false;
@@ -636,7 +635,7 @@ bool PostgresSelfHosted::create_database(const SlotProgress& slot_progress, cons
 unsigned int PostgresSelfHosted::discover_first_free_port(unsigned int start_port, unsigned int end_port)
 {
   //Open a socket so we can try to bind it to a port:
-  const int fd = socket(AF_INET, SOCK_STREAM, 0);
+  const auto fd = socket(AF_INET, SOCK_STREAM, 0);
   if(fd == -1)
   {
 #ifdef G_OS_WIN32
@@ -658,7 +657,7 @@ unsigned int PostgresSelfHosted::discover_first_free_port(unsigned int start_por
   {
     sa.sin_port = htons(port_to_try);
 
-    const int result = bind(fd, (sockaddr*)&sa, sizeof(sa));
+    const auto result = bind(fd, (sockaddr*)&sa, sizeof(sa));
     bool available = false;
     if(result == 0)
        available = true;
diff --git a/glom/libglom/connectionpool_backends/sqlite.cc b/glom/libglom/connectionpool_backends/sqlite.cc
index 8a41ae7..25448b4 100644
--- a/glom/libglom/connectionpool_backends/sqlite.cc
+++ b/glom/libglom/connectionpool_backends/sqlite.cc
@@ -69,7 +69,7 @@ Glib::RefPtr<Gnome::Gda::Connection> Sqlite::connect(const Glib::ustring& databa
       // Convert URI to path, for GDA connection string
       const auto database_directory = db_dir->get_path();
 
-      const Glib::ustring cnc_string = "DB_DIR=" + DbUtils::gda_cnc_string_encode(database_directory) + 
+      const auto cnc_string = "DB_DIR=" + DbUtils::gda_cnc_string_encode(database_directory) + 
         ";DB_NAME=" + DbUtils::gda_cnc_string_encode(database);
       const auto auth_string = Glib::ustring::compose("USERNAME=%1;PASSWORD=%2", 
         DbUtils::gda_cnc_string_encode(username), DbUtils::gda_cnc_string_encode(password));
@@ -346,7 +346,7 @@ bool Sqlite::recreate_table(const Glib::RefPtr<Gnome::Gda::Connection>& connecti
 
     if(!trans_fields.empty())
     {
-      const Glib::ustring query_insert = "INSERT INTO " + DbUtils::escape_sql_id(TEMPORARY_TABLE_NAME) + " 
SELECT " + trans_fields + " FROM " + DbUtils::escape_sql_id(table_name);
+      const auto query_insert = "INSERT INTO " + DbUtils::escape_sql_id(TEMPORARY_TABLE_NAME) + " SELECT " + 
trans_fields + " FROM " + DbUtils::escape_sql_id(table_name);
       //std::cout << "debug: query_insert=" << query_insert << std::endl;
       connection->statement_execute_non_select(query_insert);
       connection->statement_execute_non_select("DROP TABLE " + DbUtils::escape_sql_id(table_name));
diff --git a/glom/libglom/data_structure/glomconversions.cc b/glom/libglom/data_structure/glomconversions.cc
index 2179ab1..797886c 100644
--- a/glom/libglom/data_structure/glomconversions.cc
+++ b/glom/libglom/data_structure/glomconversions.cc
@@ -237,7 +237,7 @@ bool Conversions::sanity_check_date_text_representation_uses_4_digit_years(bool
   //See if the year appears in full in that date.
   //There are probably some locales for which this fails.
   //Please tell us if there are.
-  const Glib::ustring::size_type pos = date_text.find("2008");
+  const auto pos = date_text.find("2008");
   if(pos == Glib::ustring::npos)
   {
     //Note to translators: If you see this error in the terminal at startup then you need to translate the 
%x elsewhere.
@@ -270,7 +270,7 @@ Glib::ustring Conversions::format_tm(const tm& tm_data, const std::locale& local
 
   // Get a time_put face:
   typedef std::time_put<char> type_time_put;
-  const type_time_put& tp = std::use_facet<type_time_put>(locale);
+  const auto& tp = std::use_facet<type_time_put>(locale);
 
   //type_iterator begin(the_stream);
   tp.put(the_stream /* iter to beginning of stream */, the_stream, ' ' /* fill */, &tm_data, format, format 
+ strlen(format) /* 'E' */ /* use locale's alternative format */);
@@ -299,7 +299,7 @@ Glib::ustring Conversions::format_tm(const tm& tm_data, const std::locale& local
   /*
   //This is based on the code in Glib::Date::format_string(), which only deals with dates, but not times:
 
-  const std::string locale_format = Glib::locale_from_utf8("%X"); //%x means "is replaced by the locale's 
appropriate time representation".
+  const auto locale_format = Glib::locale_from_utf8("%X"); //%x means "is replaced by the locale's 
appropriate time representation".
   gsize bufsize = std::max<gsize>(2 * locale_format.size(), 128);
 
   do
@@ -659,7 +659,7 @@ Gnome::Gda::Value Conversions::parse_value(Field::glom_field_type glom_type, con
     if(!(numeric_format.m_currency_symbol.empty()))
     {
       //Remove the currency symbol:
-      const Glib::ustring prefix = text_to_parse.substr(0, numeric_format.m_currency_symbol.size());
+      const auto prefix = text_to_parse.substr(0, numeric_format.m_currency_symbol.size());
       if(text_to_parse.substr(0, numeric_format.m_currency_symbol.size()) == 
numeric_format.m_currency_symbol)
       {
         text_to_parse = text_to_parse.substr(numeric_format.m_currency_symbol.size());
@@ -745,8 +745,8 @@ tm Conversions::parse_date(const Glib::ustring& text, const std::locale& locale,
   //because std::get_time() stupidly parses _only_ that format.
   //Some implementations parse extra formats, in unspecified/non-standard ways, but not g++'s libstdc++
   //So just use the fallback instead. It's probably good enough.
-  const bool is_iso_locale = (locale == std::locale::classic());
-  const bool skip_time_get = !is_iso_locale && (strcmp(GLOM_NON_TRANSLATED_LOCALE_DATE_FORMAT, 
glom_get_locale_date_format()) != 0);
+  const auto is_iso_locale = (locale == std::locale::classic());
+  const auto skip_time_get = !is_iso_locale && (strcmp(GLOM_NON_TRANSLATED_LOCALE_DATE_FORMAT, 
glom_get_locale_date_format()) != 0);
 
   std::ios_base::iostate err = std::ios_base::goodbit;  //The initialization is essential because time_get 
seems to a) not initialize this output argument and b) check its value.
 
@@ -762,7 +762,7 @@ tm Conversions::parse_date(const Glib::ustring& text, const std::locale& locale,
     typedef std::time_get<char> type_time_get;
     typedef type_time_get::iter_type type_iterator;
 
-    const type_time_get& tg = std::use_facet<type_time_get>(locale);
+    const auto& tg = std::use_facet<type_time_get>(locale);
 
     type_iterator the_begin(the_stream);
     type_iterator the_end;
@@ -897,7 +897,7 @@ tm Conversions::parse_time(const Glib::ustring& text, const std::locale& locale,
   // Get a time_get facet:
   typedef std::istreambuf_iterator<char, std::char_traits<char> > type_iterator;
   typedef std::time_get<char, type_iterator> type_time_get;
-  const type_time_get& tg = std::use_facet<type_time_get>(locale);
+  const auto& tg = std::use_facet<type_time_get>(locale);
 
   type_iterator the_begin(the_stream);
   type_iterator the_end;
@@ -985,7 +985,7 @@ tm Conversions::parse_tm(const Glib::ustring& text, const std::locale& locale, c
   // Get a time_get facet:
   typedef std::istreambuf_iterator<char, std::char_traits<char> > type_iterator;
   typedef std::time_get<char, type_iterator> type_time_get;
-  const type_time_get& tg = std::use_facet<type_time_get>(locale);
+  const auto& tg = std::use_facet<type_time_get>(locale);
 
   the_stream << text;
 
@@ -1077,12 +1077,12 @@ static bool vtype_is_numeric(GType vtype)
 
 Gnome::Gda::Value Conversions::convert_value(const Gnome::Gda::Value& value, Field::glom_field_type 
target_glom_type)
 {
-  const GType gvalue_type_target = Field::get_gda_type_for_glom_type(target_glom_type);
-  const GType gvalue_type_source = value.get_value_type();
+  const auto gvalue_type_target = Field::get_gda_type_for_glom_type(target_glom_type);
+  const auto gvalue_type_source = value.get_value_type();
   if(gvalue_type_source == gvalue_type_target)
     return value; //No conversion necessary, and no loss of precision.
   
-  const Field::glom_field_type source_glom_type = Field::get_glom_type_for_gda_type(gvalue_type_source);
+  const auto source_glom_type = Field::get_glom_type_for_gda_type(gvalue_type_source);
   if(source_glom_type == target_glom_type)
   {
     //Try to return the canonical type, 
@@ -1090,13 +1090,13 @@ Gnome::Gda::Value Conversions::convert_value(const Gnome::Gda::Value& value, Fie
     if((target_glom_type == Field::TYPE_NUMERIC) && 
       (vtype_is_numeric(gvalue_type_source)))
     {
-      const double number = get_double_for_gda_value_numeric(value);
+      const auto number = get_double_for_gda_value_numeric(value);
       return parse_value(number);
     }
   }
 
   //Fallback for other conversions:
-  const Glib::ustring text = get_text_for_gda_value(source_glom_type, value, std::locale::classic(), 
NumericFormat(), true /* iso_format */);
+  const auto text = get_text_for_gda_value(source_glom_type, value, std::locale::classic(), NumericFormat(), 
true /* iso_format */);
   bool test = false;
   return parse_value(target_glom_type, text, test, true /* iso_format */);
 }
diff --git a/glom/libglom/data_structure/has_title_singular.cc 
b/glom/libglom/data_structure/has_title_singular.cc
index acc57ff..4d9d8ca 100644
--- a/glom/libglom/data_structure/has_title_singular.cc
+++ b/glom/libglom/data_structure/has_title_singular.cc
@@ -85,7 +85,7 @@ Glib::ustring HasTitleSingular::get_title_singular_with_fallback(const Glib::ust
   
   //If it this is also a regular TranslatableItem (usually it is), 
   //then try getting the regular title instead.
-  const TranslatableItem* translatable = dynamic_cast<const TranslatableItem*>(this);
+  const auto translatable = dynamic_cast<const TranslatableItem*>(this);
   if(translatable)
     return translatable->get_title_or_name(locale);
 
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 0f6c270..618dfea 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -691,7 +691,7 @@ bool set_table_privileges_groups_from_document(const Document* document)
   const auto document_groups = document->get_groups();
 
   //Get the list of tables:
-  //const Document::type_listConstTableInfo table_list = document->get_tables();
+  //const auto table_list = document->get_tables();
 
   bool result = true;
 
@@ -733,7 +733,7 @@ static Glib::ustring remove_quotes(const Glib::ustring& str)
     return str;
 
   const auto size = str.size();
-  const Glib::ustring::size_type posQuoteEnd = str.find(quote, 1);
+  const auto posQuoteEnd = str.find(quote, 1);
   if(posQuoteEnd != (size - 1))
     return str;
 
@@ -890,8 +890,8 @@ type_vec_fields get_fields_for_table_from_database(const Glib::ustring& table_na
       GdaMetaTable* meta_table = GDA_META_TABLE(meta_dbobject);
 
       //Examine each field:
-      guint row = 0;
-      const gulong rows_count = data_model_fields->get_n_rows();
+      auto row = 0;
+      const auto rows_count = data_model_fields->get_n_rows();
       while(row < rows_count)
       {
         Glib::RefPtr<Gnome::Gda::Column> field_info = Gnome::Gda::Column::create();
diff --git a/glom/libglom/document/bakery/document.cc b/glom/libglom/document/bakery/document.cc
index c79fdf3..6e69d77 100644
--- a/glom/libglom/document/bakery/document.cc
+++ b/glom/libglom/document/bakery/document.cc
@@ -54,7 +54,7 @@ Glib::ustring Document::get_file_uri_with_extension(const Glib::ustring& uri)
   if(!m_file_extension.empty())  //If there is an extension to enforce.
   {
     bool bAddExt = false;
-    const Glib::ustring strExt = '.' + get_file_extension();
+    const auto strExt = '.' + get_file_extension();
 
     if(result.size() < strExt.size()) //It can't have the ext already if it's not long enough.
     {
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index c1e7c56..980e67c 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -967,7 +967,7 @@ void Document::change_field_name(const Glib::ustring& table_name, const Glib::us
     //Look at each table:
     for(const auto& the_pair : m_tables)
     {
-      const std::shared_ptr<DocumentTableInfo> infoInner = the_pair.second;
+      const auto infoInner = the_pair.second;
       if(!infoInner)
         continue;
 
@@ -1055,7 +1055,7 @@ void Document::change_table_name(const Glib::ustring& table_name_old, const Glib
     //so we copy the whole thing and put it back in the map under a different key:
 
     //iterFindTable->first = table_name_new;
-    const std::shared_ptr<DocumentTableInfo> doctableinfo = iterFindTable->second;
+    const auto doctableinfo = iterFindTable->second;
     m_tables.erase(iterFindTable);
 
     if(doctableinfo && doctableinfo->m_info)
@@ -1068,7 +1068,7 @@ void Document::change_table_name(const Glib::ustring& table_name_old, const Glib
     for(const auto& the_pair : m_tables)
     {
       //Look at each relationship in the table:
-      const std::shared_ptr<DocumentTableInfo> doctableinfo = the_pair.second;
+      const auto doctableinfo = the_pair.second;
       if(!doctableinfo)
         continue;
 
@@ -1190,7 +1190,7 @@ Document::type_listTableInfo Document::get_tables(bool plus_system_prefs)
 
   for(const auto& the_pair : m_tables)
   {
-    const std::shared_ptr<DocumentTableInfo> doctableinfo = the_pair.second;
+    const auto doctableinfo = the_pair.second;
     if(doctableinfo)
       result.push_back(doctableinfo->m_info);
 
@@ -1283,7 +1283,7 @@ void Document::set_tables(const type_listTableInfo& tables)
   bool something_changed = false;
   for(const auto& the_pair : m_tables)
   {
-    const std::shared_ptr<DocumentTableInfo> doctableinfo = the_pair.second;
+    const auto doctableinfo = the_pair.second;
     if(!doctableinfo)
       continue;
 
@@ -1347,7 +1347,7 @@ void Document::fill_layout_field_details(const Glib::ustring& parent_table_name,
       bool choice_show_all = false;
       layout_withformatting->m_formatting.get_choices_related(choice_relationship, choice_layout_first, 
choice_extra_layouts, choice_sort_fields, choice_show_all);
       
-      const Glib::ustring table_name = (choice_relationship ? choice_relationship->get_to_table() : 
Glib::ustring());
+      const auto table_name = (choice_relationship ? choice_relationship->get_to_table() : Glib::ustring());
       if(choice_layout_first)
         choice_layout_first->set_full_field_details( get_field(table_name, choice_layout_first->get_name()) 
);
       fill_layout_field_details(parent_table_name, choice_extra_layouts); //recurse
@@ -1370,7 +1370,7 @@ void Document::fill_layout_field_details(const Glib::ustring& parent_table_name,
         bool choice_show_all = false;
         field->m_default_formatting.get_choices_related(choice_relationship, choice_layout_first, 
choice_extra_layouts, choice_sort_fields, choice_show_all);
         
-        const Glib::ustring table_name = (choice_relationship ? choice_relationship->get_to_table() : 
Glib::ustring());
+        const auto table_name = (choice_relationship ? choice_relationship->get_to_table() : 
Glib::ustring());
         if(choice_layout_first)
           choice_layout_first->set_full_field_details( get_field(table_name, 
choice_layout_first->get_name()) );
         fill_layout_field_details(parent_table_name, choice_extra_layouts); //recurse
@@ -1955,7 +1955,7 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
 
   //Alignment. Not-specified means auto.
   Formatting::HorizontalAlignment alignment = Formatting::HORIZONTAL_ALIGNMENT_AUTO;
-  const Glib::ustring alignment_str = XmlUtils::get_node_attribute_value (element, 
GLOM_ATTRIBUTE_FORMAT_HORIZONTAL_ALIGNMENT);
+  const auto alignment_str = XmlUtils::get_node_attribute_value (element, 
GLOM_ATTRIBUTE_FORMAT_HORIZONTAL_ALIGNMENT);
   if(alignment_str == GLOM_ATTRIBUTE_FORMAT_HORIZONTAL_ALIGNMENT_LEFT)
     alignment = Formatting::HORIZONTAL_ALIGNMENT_LEFT;
   else if(alignment_str == GLOM_ATTRIBUTE_FORMAT_HORIZONTAL_ALIGNMENT_RIGHT)
@@ -1981,7 +1981,7 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
         auto listNodesCustomChoices = nodeChoiceList->get_children(GLOM_NODE_FORMAT_CUSTOM_CHOICE);
         for(const auto& node : listNodesCustomChoices)
         {
-          const xmlpp::Element* element = dynamic_cast<const xmlpp::Element*>(node);
+          const auto element = dynamic_cast<const xmlpp::Element*>(node);
           if(element)
           {
             if(field_type == Field::TYPE_INVALID)
@@ -2149,7 +2149,7 @@ void Document::load_after_sort_by(const xmlpp::Element* node, const Glib::ustrin
   auto listNodes = node->get_children(GLOM_NODE_DATA_LAYOUT_ITEM_FIELD);
   for(const auto& node : listNodes)
   {
-    const xmlpp::Element* element = dynamic_cast<const xmlpp::Element*>(node);
+    const auto element = dynamic_cast<const xmlpp::Element*>(node);
     if(element)
     {
       auto item = std::make_shared<LayoutItem_Field>();
@@ -2190,7 +2190,7 @@ void Document::load_after_layout_group(const xmlpp::Element* node, const Glib::u
     std::shared_ptr<LayoutItem> item_added;
 
     //Create the layout item:
-    const xmlpp::Element* element = dynamic_cast<const xmlpp::Element*>(node);
+    const auto element = dynamic_cast<const xmlpp::Element*>(node);
     if(element)
     {
       if(element->get_name() == GLOM_NODE_DATA_LAYOUT_ITEM_FIELD)
@@ -2489,7 +2489,7 @@ void Document::load_after_translations(const xmlpp::Element* element, const std:
     auto listNodesTranslations = nodeTranslations->get_children(GLOM_NODE_TRANSLATION);
     for(const auto& node : listNodesTranslations)
     {
-      const xmlpp::Element* element = dynamic_cast<const xmlpp::Element*>(node);
+      const auto element = dynamic_cast<const xmlpp::Element*>(node);
       if(element)
       {
         const auto locale = XmlUtils::get_node_attribute_value(element, GLOM_ATTRIBUTE_TRANSLATION_LOCALE);
@@ -2844,7 +2844,7 @@ bool Document::load_after(int& failure_code)
         if(nodeTable)
         {
           const auto table_name = XmlUtils::get_node_attribute_value(nodeTable, GLOM_ATTRIBUTE_NAME);
-          const std::shared_ptr<DocumentTableInfo> doctableinfo = m_tables[table_name];
+          const auto doctableinfo = m_tables[table_name];
 
           //Layouts:
           const auto nodeDataLayouts = XmlUtils::get_node_child_named(nodeTable, GLOM_NODE_DATA_LAYOUTS);
@@ -2868,7 +2868,7 @@ bool Document::load_after(int& failure_code)
                   xmlpp::Node::NodeList listNodes = nodeGroups->get_children(GLOM_NODE_DATA_LAYOUT_GROUP);
                   for(const auto& item : listNodes)
                   {
-                    const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(item);
+                    const auto node = dynamic_cast<const xmlpp::Element*>(item);
                     if(node)
                     {
                       const auto group_name = XmlUtils::get_node_attribute_value(node, GLOM_ATTRIBUTE_NAME);
@@ -2919,7 +2919,7 @@ bool Document::load_after(int& failure_code)
                   xmlpp::Node::NodeList listNodes = nodeGroups->get_children(GLOM_NODE_DATA_LAYOUT_GROUP);
                   for(const auto& item : listNodes)
                   {
-                    const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(item);
+                    const auto node = dynamic_cast<const xmlpp::Element*>(item);
                     if(node)
                     {
                       std::shared_ptr<LayoutGroup> group = report->get_layout_group();
@@ -2969,7 +2969,7 @@ bool Document::load_after(int& failure_code)
                 xmlpp::Node::NodeList listRules = node->get_children(GLOM_NODE_HORIZONTAL_RULE);
                 for(const auto& item : listRules)
                 {
-                  const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(item);
+                  const auto node = dynamic_cast<const xmlpp::Element*>(item);
                   if(!node)
                     continue;
 
@@ -2982,7 +2982,7 @@ bool Document::load_after(int& failure_code)
                 listRules = node->get_children(GLOM_NODE_VERTICAL_RULE);
                 for(const auto& item : listRules)
                 {
-                  const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(item);
+                  const auto node = dynamic_cast<const xmlpp::Element*>(item);
                   if(!node)
                     continue;
 
@@ -3008,7 +3008,7 @@ bool Document::load_after(int& failure_code)
                   xmlpp::Node::NodeList listNodes = nodeGroups->get_children(GLOM_NODE_DATA_LAYOUT_GROUP);
                   for(const auto& item : listNodes)
                   {
-                    const xmlpp::Element* node = dynamic_cast<const xmlpp::Element*>(item);
+                    const auto node = dynamic_cast<const xmlpp::Element*>(item);
                     if(node)
                     {
                       std::shared_ptr<LayoutGroup> group = print_layout->get_layout_group();
@@ -3728,7 +3728,7 @@ bool Document::save_before()
             xmlpp::Element* nodeExampleRow = nodeExampleRows->add_child(GLOM_NODE_EXAMPLE_ROW);
             if(!row_data.empty())
             {
-              const unsigned int row_data_size = row_data.size();
+              const auto row_data_size = row_data.size();
               for(unsigned int i = 0; i < row_data_size; ++i)
               {
                 std::shared_ptr<const Field> field = doctableinfo->m_fields[i];
@@ -4445,7 +4445,7 @@ Document::type_list_translatables Document::get_translatable_items()
       //Custom Choices, if any:
       if(field->get_glom_type() == Field::TYPE_TEXT) //Choices for other field types could not be translated.
       {
-        const Glib::ustring this_hint = hint + ", Parent Field: " + field->get_name();   
+        const auto this_hint = hint + ", Parent Field: " + field->get_name();   
         type_list_translatables list_choice_items;
         Document::fill_translatable_custom_choices(field->m_default_formatting, list_choice_items, 
this_hint);
         add_to_translatable_list(result, list_choice_items);
@@ -4467,7 +4467,7 @@ Document::type_list_translatables Document::get_translatable_items()
       add_to_translatable_list(result, report, hint);
       
       //Translatable report items:
-      const Glib::ustring this_hint = hint + ", Parent Report: " + report->get_name();
+      const auto this_hint = hint + ", Parent Report: " + report->get_name();
       type_list_translatables list_layout_items = get_translatable_report_items(table_name, report_name, 
this_hint);
       add_to_translatable_list(result, list_layout_items);
     }
@@ -4483,7 +4483,7 @@ Document::type_list_translatables Document::get_translatable_items()
       add_to_translatable_list(result, print_layout, hint);
       
       //Translatable print layout items:
-      const Glib::ustring this_hint = hint + ", Print Layout: " + print_layout->get_name();
+      const auto this_hint = hint + ", Print Layout: " + print_layout->get_name();
       type_list_translatables list_layout_items = get_translatable_print_layout_items(table_name, 
print_layout_name, this_hint);
       add_to_translatable_list(result, list_layout_items);
     }
@@ -4572,7 +4572,7 @@ void Document::fill_translatable_layout_items(const std::shared_ptr<LayoutItem_F
   //Only text fields can have translated choice values:
   if(layout_field->get_glom_type() == Field::TYPE_TEXT)
   {
-    const Glib::ustring choice_hint = hint + ", Parent Field: " + layout_field->get_name();
+    const auto choice_hint = hint + ", Parent Field: " + layout_field->get_name();
     fill_translatable_custom_choices(layout_field->m_formatting, the_list, hint);
   }
 }
diff --git a/glom/libglom/python_embed/pygdavalue_conversions.cc 
b/glom/libglom/python_embed/pygdavalue_conversions.cc
index 4897fe7..9b6a2b9 100644
--- a/glom/libglom/python_embed/pygdavalue_conversions.cc
+++ b/glom/libglom/python_embed/pygdavalue_conversions.cc
@@ -191,7 +191,7 @@ boost::python::object glom_pygda_value_as_boost_pyobject(const Glib::ValueBase&
         if(gdabinary)
           ret = boost::python::object((const char*)gdabinary->data); /* TODO: Use the size. TODO: Check for 
null GdaBinary. */
     } else if(value_type == GDA_TYPE_BLOB) {
-        const GdaBlob* gdablob = gda_value_get_blob (boxed);
+        const auto gdablob = gda_value_get_blob (boxed);
         if(gdablob && gdablob->op)
         {
           if(gda_blob_op_read_all(const_cast<GdaBlobOp*>(gdablob->op), const_cast<GdaBlob*>(gdablob)))
@@ -204,7 +204,7 @@ boost::python::object glom_pygda_value_as_boost_pyobject(const Glib::ValueBase&
 #if PY_VERSION_HEX >= 0x02040000
     } else if(value_type == G_TYPE_DATE) {
 
-        const GDate* val = (const GDate*)g_value_get_boxed(boxed);
+        const auto val = (const GDate*)g_value_get_boxed(boxed);
         if(val)
         {
           //Note that the g_date_get* functions give what we expect, but direct struct field access does not.
diff --git a/glom/libglom/utils.cc b/glom/libglom/utils.cc
index 0c4aad1..8c0e471 100644
--- a/glom/libglom/utils.cc
+++ b/glom/libglom/utils.cc
@@ -1501,7 +1501,7 @@ LayoutGroup::type_list_const_items Utils::get_layout_items_plus_primary_key(cons
     return items;
   }
 
-  const std::shared_ptr<Field> field_primary_key = document->get_field_primary_key(table_name);
+  const auto field_primary_key = document->get_field_primary_key(table_name);
   if(!field_primary_key)
   {
     std::cerr << G_STRFUNC << ": Could not find the primary key." << std::endl;
@@ -1530,7 +1530,7 @@ LayoutGroup::type_list_items Utils::get_layout_items_plus_primary_key(const Layo
     return items;
   }
 
-  const std::shared_ptr<Field> field_primary_key = document->get_field_primary_key(table_name);
+  const auto field_primary_key = document->get_field_primary_key(table_name);
   if(!field_primary_key)
   {
     std::cerr << G_STRFUNC << ": Could not find the primary key." << std::endl;
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index eaf98ed..7f1bfb9 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -696,7 +696,7 @@ void DbAddDel::construct_specified_columns()
 
   for(auto iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
   {
-    const std::shared_ptr<LayoutItem> layout_item = m_column_items[model_column_index]; //TODO: Inefficient.
+    const auto layout_item = m_column_items[model_column_index]; //TODO: Inefficient.
     if(layout_item) //column_info.m_visible)
     {
       no_columns_used = false;
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index ace2f86..a7f3e20 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -786,7 +786,7 @@ void Canvas_PrintLayout::fill_with_data(const Glib::RefPtr<Goocanvas::Group>& ca
         if(relationship)
         {
           const Document* document = get_document();
-          const std::shared_ptr<Field> from_field = DbUtils::get_fields_for_table_one_field(document,
+          const auto from_field = DbUtils::get_fields_for_table_one_field(document,
             relationship->get_from_table(), relationship->get_from_field());
           const Gnome::Gda::Value from_key_value = get_field_value_in_database(from_field, found_set, 0 /* 
TODO: window */);
           fill_with_data_portal(canvas_item, from_key_value);
diff --git a/tests/test_selfhosting_new_then_lookup.cc b/tests/test_selfhosting_new_then_lookup.cc
index ec83967..9e15bd0 100644
--- a/tests/test_selfhosting_new_then_lookup.cc
+++ b/tests/test_selfhosting_new_then_lookup.cc
@@ -176,7 +176,7 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   }
 
   //Lookup the value from the related record.
-  const std::shared_ptr<Glom::Field> field_source = 
+  const auto field_source = 
     document.get_field(relationship->get_to_table(), field->get_lookup_field());
   const auto value = Glom::DbUtils::get_lookup_value(&document, 
     table_name, relationship, field_source, Gnome::Gda::Value(2));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]