[glom] Windows build: ifdef out the use of getpass().



commit cc1c1b74c225d257050370a6039116a88d5ab19f
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Apr 11 09:28:31 2012 +0200

    Windows build: ifdef out the use of getpass().
    
    * glom/glom_create_from_example.cc:
    * glom/glom_test_connection.cc: And show a warning
    on stderr. This is better than disabling all the functionality
    in this file, and lets us fix it easily if we ever have a
    getpass() function on Windows.
    Bug #672881 (alien)

 ChangeLog                        |   11 +++++++++++
 glom/glom_create_from_example.cc |    6 ++++++
 glom/glom_test_connection.cc     |    7 ++++++-
 3 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 35c83a6..a3e83cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2012-04-11  Murray Cumming  <murrayc murrayc com>
 
+	Windows build: ifdef out the use of getpass().
+
+	* glom/glom_create_from_example.cc:
+	* glom/glom_test_connection.cc: And show a warning
+	on stderr. This is better than disabling all the functionality
+	in this file, and lets us fix it easily if we ever have a
+	getpass() function on Windows.
+	Bug #672881 (alien)
+
+2012-04-11  Murray Cumming  <murrayc murrayc com>
+
 	Windows build: Add some includes.
 
 	* glom/dialog_existing_or_new.cc: As suggested by 
diff --git a/glom/glom_create_from_example.cc b/glom/glom_create_from_example.cc
index bfd6e6d..f951434 100644
--- a/glom/glom_create_from_example.cc
+++ b/glom/glom_create_from_example.cc
@@ -422,7 +422,13 @@ int main(int argc, char* argv[])
     //TODO: Support alternatives such as using a file.
     const Glib::ustring prompt = Glib::ustring::compose(
       _("Please enter the PostgreSQL server's password for the user %1: "), group.m_arg_server_username);
+
+#ifdef G_OS_WIN32
+    const char* password = "";
+    std::cerr << _("Error: getpass() is not implemented in the Windows build. The connection will fail." << std::endl;
+#else
     const char* password = ::getpass(prompt.c_str());
+#endif
 
     //Central hosting:
     connection_pool->set_user(group.m_arg_server_username);
diff --git a/glom/glom_test_connection.cc b/glom/glom_test_connection.cc
index dadd725..f72d213 100644
--- a/glom/glom_test_connection.cc
+++ b/glom/glom_test_connection.cc
@@ -164,8 +164,13 @@ int main(int argc, char* argv[])
   //TODO: Support alternatives such as using a file.
   const Glib::ustring prompt = Glib::ustring::compose(
     _("Please enter the PostgreSQL server's password for the user %1: "), group.m_arg_server_username);
-  const char* password = ::getpass(prompt.c_str());
 
+#ifdef G_OS_WIN32
+  const char* password = "";
+  std::cerr << _("Error: getpass() is not implemented in the Windows build. The connection will fail." << std::endl;
+#else
+  const char* password = ::getpass(prompt.c_str());
+#endif
 
   //Setup the connection, assuming that we are testing central hosting:
   Glom::ConnectionPool* connection_pool = Glom::ConnectionPool::get_instance();



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