[glom/glom-1-16] Use array notation where appropriate



commit b8014435615219d49fb990dd162df9456c3fa741
Author: David King <davidk openismus com>
Date:   Mon Oct 11 12:05:16 2010 +0200

    Use array notation where appropriate
    
    * glom/dialog_connection.[cc|h]:
    * glom/dialog_existing_or_new.[cc|h]:
    * glom/dialog_invalid_data.[cc|h]:
    * glom/libglom/connectionpool_backends/backend.cc:
    * glom/libglom/connectionpool_backends/postgres.cc:
    * glom/libglom/connectionpool_backends/postgres_self.cc:
    * glom/libglom/connectionpool_backends/sqlite.cc:
    * glom/utils_ui.cc: Use array notation when initializing constant
    character arrays.

 ChangeLog                                          |   14 ++++++++++++++
 glom/dialog_connection.cc                          |    2 +-
 glom/dialog_connection.h                           |    2 +-
 glom/dialog_existing_or_new.cc                     |   10 +++++-----
 glom/dialog_existing_or_new.h                      |    2 +-
 glom/dialog_invalid_data.cc                        |    2 +-
 glom/dialog_invalid_data.h                         |    2 +-
 glom/libglom/connectionpool_backends/backend.cc    |    4 ++--
 glom/libglom/connectionpool_backends/postgres.cc   |    4 ++--
 .../connectionpool_backends/postgres_self.cc       |    4 ++--
 glom/libglom/connectionpool_backends/sqlite.cc     |    4 ++--
 glom/utils_ui.cc                                   |    6 +++---
 12 files changed, 35 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 15f6730..a403009 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2010-10-11  David King  <davidk openismus com>
 
+	Use array notation where appropriate
+
+	* glom/dialog_connection.[cc|h]:
+	* glom/dialog_existing_or_new.[cc|h]:
+	* glom/dialog_invalid_data.[cc|h]:
+	* glom/libglom/connectionpool_backends/backend.cc:
+	* glom/libglom/connectionpool_backends/postgres.cc:
+	* glom/libglom/connectionpool_backends/postgres_self.cc:
+	* glom/libglom/connectionpool_backends/sqlite.cc:
+	* glom/utils_ui.cc: Use array notation when initializing constant
+	character arrays.
+
+2010-10-11  David King  <davidk openismus com>
+
 	Use unsigned integers where appropriate
 
 	* glom/libglom/connectionpool_backends/postgres.[cc|h]:
diff --git a/glom/dialog_connection.cc b/glom/dialog_connection.cc
index e5d7639..97d22d7 100644
--- a/glom/dialog_connection.cc
+++ b/glom/dialog_connection.cc
@@ -32,7 +32,7 @@
 namespace Glom
 {
 
-const char* Dialog_Connection::glade_id("dialog_connection");
+const char Dialog_Connection::glade_id[] = "dialog_connection";
 const bool Dialog_Connection::glade_developer(false);
 
 Dialog_Connection::Dialog_Connection(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder)
diff --git a/glom/dialog_connection.h b/glom/dialog_connection.h
index 0f3e667..8da4605 100644
--- a/glom/dialog_connection.h
+++ b/glom/dialog_connection.h
@@ -36,7 +36,7 @@ class Dialog_Connection
     public Base_DB
 {
 public:
-  static const char* glade_id;
+  static const char glade_id[];
   static const bool glade_developer;
 
   Dialog_Connection(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index ef5dd53..6d186b3 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -49,11 +49,11 @@
 namespace
 {
 
-const char* RECENT_DUMMY_TEXT = N_("No recently used documents available.");
-const char* NETWORK_DUMMY_TEXT = N_("No sessions found on the local network.");
+const char RECENT_DUMMY_TEXT[] = N_("No recently used documents available.");
+const char NETWORK_DUMMY_TEXT[] = N_("No sessions found on the local network.");
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-const char* TEMPLATE_DUMMY_TEXT = N_("No templates available.");
+const char TEMPLATE_DUMMY_TEXT[] = N_("No templates available.");
 #endif
 
 //TODO_Performance: A DomParser or XmlReader might be faster, or even a regex.
@@ -101,7 +101,7 @@ private:
 namespace Glom
 {
 
-const char* Dialog_ExistingOrNew::glade_id("dialog_existing_or_new");
+const char Dialog_ExistingOrNew::glade_id[] = "dialog_existing_or_new";
 const bool Dialog_ExistingOrNew::glade_developer(false);
 
 Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder)
@@ -166,7 +166,7 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
   if(!Glib::file_test(path, Glib::FILE_TEST_EXISTS))
     path = GLOM_DOCDIR_EXAMPLES;
 #else
-  const char *const path = GLOM_DOCDIR_EXAMPLES;
+  const char path[] = GLOM_DOCDIR_EXAMPLES;
 #endif //G_OS_WIN32
 
   //Show the installed example files,
diff --git a/glom/dialog_existing_or_new.h b/glom/dialog_existing_or_new.h
index 558b280..872b71f 100644
--- a/glom/dialog_existing_or_new.h
+++ b/glom/dialog_existing_or_new.h
@@ -46,7 +46,7 @@ class Dialog_ExistingOrNew
   : public Gtk::Dialog
 {
 public:
-  static const char* glade_id;
+  static const char glade_id[];
   static const bool glade_developer;
 
   enum Action {
diff --git a/glom/dialog_invalid_data.cc b/glom/dialog_invalid_data.cc
index f7829f8..67dcfcf 100644
--- a/glom/dialog_invalid_data.cc
+++ b/glom/dialog_invalid_data.cc
@@ -26,7 +26,7 @@
 namespace Glom
 {
 
-const char* Dialog_InvalidData::glade_id("dialog_data_invalid_format");
+const char Dialog_InvalidData::glade_id[] = "dialog_data_invalid_format";
 const bool Dialog_InvalidData::glade_developer(false);
 
 /** Show the dialog.
diff --git a/glom/dialog_invalid_data.h b/glom/dialog_invalid_data.h
index 093281d..dfb5c7e 100644
--- a/glom/dialog_invalid_data.h
+++ b/glom/dialog_invalid_data.h
@@ -37,7 +37,7 @@ bool glom_show_dialog_invalid_data(Field::glom_field_type glom_type);
 class Dialog_InvalidData : public Gtk::Dialog
 {
 public:
-  static const char* glade_id;
+  static const char glade_id[];
   static const bool glade_developer;
 
   Dialog_InvalidData(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
diff --git a/glom/libglom/connectionpool_backends/backend.cc b/glom/libglom/connectionpool_backends/backend.cc
index c65449f..65facc6 100644
--- a/glom/libglom/connectionpool_backends/backend.cc
+++ b/glom/libglom/connectionpool_backends/backend.cc
@@ -247,8 +247,8 @@ bool Backend::drop_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection
 //this once instead of twice when changing the primary key. armin.
 bool Backend::change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const type_vec_const_fields& old_fields, const type_vec_const_fields& new_fields, std::auto_ptr<Glib::Error>& error)
 {
-  static const char* TRANSACTION_NAME = "glom_change_columns_transaction";
-  static const gchar* TEMP_COLUMN_NAME = "glom_temp_column"; // TODO: Find a unique name.
+  static const char TRANSACTION_NAME[] = "glom_change_columns_transaction";
+  static const char TEMP_COLUMN_NAME[] = "glom_temp_column"; // TODO: Find a unique name.
 
   if(!begin_transaction(connection, TRANSACTION_NAME, Gnome::Gda::TRANSACTION_ISOLATION_UNKNOWN, error)) return false; // TODO: What does the transaction isolation do?
 
diff --git a/glom/libglom/connectionpool_backends/postgres.cc b/glom/libglom/connectionpool_backends/postgres.cc
index b0f644f..cddec01 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -194,8 +194,8 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
 
 bool Postgres::change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const type_vec_const_fields& old_fields, const type_vec_const_fields& new_fields, std::auto_ptr<Glib::Error>& error)
 {
-  static const char* TRANSACTION_NAME = "glom_change_columns_transaction";
-  static const gchar* TEMP_COLUMN_NAME = "glom_temp_column"; // TODO: Find a unique name.
+  static const char TRANSACTION_NAME[] = "glom_change_columns_transaction";
+  static const char TEMP_COLUMN_NAME[] = "glom_temp_column"; // TODO: Find a unique name.
 
   if(!begin_transaction(connection, TRANSACTION_NAME, Gnome::Gda::TRANSACTION_ISOLATION_UNKNOWN, error)) return false; // TODO: What does the transaction isolation do?
 
diff --git a/glom/libglom/connectionpool_backends/postgres_self.cc b/glom/libglom/connectionpool_backends/postgres_self.cc
index e720e45..b5dcb35 100644
--- a/glom/libglom/connectionpool_backends/postgres_self.cc
+++ b/glom/libglom/connectionpool_backends/postgres_self.cc
@@ -266,7 +266,7 @@ Glib::ustring PostgresSelfHosted::get_postgresql_utils_version(const SlotProgres
   Glib::RefPtr<Glib::Regex> regex;
 
   //We want the characters at the end:
-  const gchar* VERSION_REGEX = "pg_ctl \\(PostgreSQL\\) (.*)";
+  const gchar VERSION_REGEX[] = "pg_ctl \\(PostgreSQL\\) (.*)";
 
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
@@ -318,7 +318,7 @@ float PostgresSelfHosted::get_postgresql_utils_version_as_number(const SlotProgr
   Glib::RefPtr<Glib::Regex> regex;
 
   //We want the characters at the end:
-  const gchar* VERSION_REGEX = "^(\\d*)\\.(\\d*)";
+  const gchar VERSION_REGEX[] = "^(\\d*)\\.(\\d*)";
 
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
   try
diff --git a/glom/libglom/connectionpool_backends/sqlite.cc b/glom/libglom/connectionpool_backends/sqlite.cc
index 08ebc73..3d0d676 100644
--- a/glom/libglom/connectionpool_backends/sqlite.cc
+++ b/glom/libglom/connectionpool_backends/sqlite.cc
@@ -187,8 +187,8 @@ bool Sqlite::add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::Serve
 
 bool Sqlite::recreate_table(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const type_vec_strings& fields_removed, const type_vec_const_fields& fields_added, const type_mapFieldChanges& fields_changed, std::auto_ptr<Glib::Error>& error)
 {
-  static const gchar* TEMPORARY_TABLE_NAME = "GLOM_TEMP_TABLE"; // TODO: Make sure this is unique.
-  static const gchar* TRANSACTION_NAME = "GLOM_RECREATE_TABLE_TRANSACTION";
+  static const gchar TEMPORARY_TABLE_NAME[] = "GLOM_TEMP_TABLE"; // TODO: Make sure this is unique.
+  static const gchar TRANSACTION_NAME[] = "GLOM_RECREATE_TABLE_TRANSACTION";
 
   Glib::RefPtr<Gnome::Gda::MetaStore> store = connection->get_meta_store();
   Glib::RefPtr<Gnome::Gda::MetaStruct> metastruct = Gnome::Gda::MetaStruct::create(store, Gnome::Gda::META_STRUCT_FEATURE_NONE);
diff --git a/glom/utils_ui.cc b/glom/utils_ui.cc
index cbdc316..75eabf8 100644
--- a/glom/utils_ui.cc
+++ b/glom/utils_ui.cc
@@ -135,9 +135,9 @@ void Utils::show_help(const Glib::ustring& id)
 
   try
   {
-    const char *const path = GLOM_DATADIR G_DIR_SEPARATOR_S "gnome"
-                                          G_DIR_SEPARATOR_S "help"
-                                          G_DIR_SEPARATOR_S "glom";
+    const char path[] = GLOM_DATADIR G_DIR_SEPARATOR_S "gnome"
+                                     G_DIR_SEPARATOR_S "help"
+                                     G_DIR_SEPARATOR_S "glom";
     std::string help_file = locate_help_file(path, "glom.xml");
     if(help_file.empty())
     {



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