[glom] Replace some NULLs with 0 because this is C++, not C.



commit f927bc81ec6c05f3645e64bb0f25490ab6610ea8
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Sep 25 10:02:20 2009 +0200

    Replace some NULLs with 0 because this is C++, not C.
    
    * glom/libglom/connectionpool_backends/postgres_self.cc:
    * glom/libglom/spawn_with_feedback.cc: Replace NULLs with 0.

 ChangeLog                                          |    8 ++++++
 glom/libglom/connectionpool_backends/postgres.cc   |    2 +-
 .../connectionpool_backends/postgres_self.cc       |    8 +++---
 glom/libglom/spawn_with_feedback.cc                |   26 ++++++++++----------
 4 files changed, 26 insertions(+), 18 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 11b6d00..6c2c631 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-25  Murray Cumming  <murrayc murrayc com>
+
+	Replace some NULLs with 0 because this is C++, not C.
+
+	* glom/libglom/connectionpool_backends/postgres.cc:
+	* glom/libglom/connectionpool_backends/postgres_self.cc:
+	* glom/libglom/spawn_with_feedback.cc: Replace NULLs with 0.
+
 2009-09-24  Murray Cumming  <murrayc murrayc com>
 
 	Self-Hosting: Use the new ident configuration for PostgreSQL 8.4.
diff --git a/glom/libglom/connectionpool_backends/postgres.cc b/glom/libglom/connectionpool_backends/postgres.cc
index 28dd965..1373ee8 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -156,7 +156,7 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
       if(posName != Glib::ustring::npos)
       {
         const Glib::ustring versionPart = version_text.substr(namePart.size());
-        m_postgres_server_version = strtof(versionPart.c_str(), NULL);
+        m_postgres_server_version = strtof(versionPart.c_str(), 0);
 
 #ifdef GLOM_CONNECTION_DEBUG
         std::cout << "  Postgres Server version: " << m_postgres_server_version << std::endl;
diff --git a/glom/libglom/connectionpool_backends/postgres_self.cc b/glom/libglom/connectionpool_backends/postgres_self.cc
index eb775c6..490944e 100644
--- a/glom/libglom/connectionpool_backends/postgres_self.cc
+++ b/glom/libglom/connectionpool_backends/postgres_self.cc
@@ -144,7 +144,7 @@ std::string PostgresSelfHosted::get_path_to_postgres_executable(const std::strin
   // share/postgresql which would be nice to separate the postgres stuff
   // from the other shared data. We can perhaps still change this later by
   // building postgres with another prefix than /local/pgsql.
-  gchar* installation_directory = g_win32_get_package_installation_directory_of_module(NULL);
+  gchar* installation_directory = g_win32_get_package_installation_directory_of_module(0);
   std::string test = Glib::build_filename(installation_directory, Glib::build_filename("bin", real_program));
   g_free(installation_directory);
 
@@ -195,7 +195,7 @@ bool PostgresSelfHosted::install_postgres(const SlotProgress& /* slot_progress *
   //Also, Glom will start its own instance of PostgreSQL, on its own port, when it needs to,
   //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", NULL };
+  const gchar *packages[] = { "postgresql-8.1", 0 };
   const bool result = gst_packages_install(parent_window->gobj() /* parent window */, packages);
   if(result)
   {
@@ -769,7 +769,7 @@ bool PostgresSelfHosted::create_text_file(const std::string& file_uri, const std
 #else
   std::auto_ptr<Gio::Error> error;
   stream.create(error);
-  if(error.get() != NULL)
+  if(error.get())
   {
     const Gio::Error& ex = *error.get();
 #endif
@@ -797,7 +797,7 @@ bool PostgresSelfHosted::create_text_file(const std::string& file_uri, const std
   {
 #else
   bytes_written = stream->write(contents.data(), contents_size, error);
-  if(error.get() != NULL)
+  if(error.get())
   {
     Gio::Error& ex = *error.get();
 #endif
diff --git a/glom/libglom/spawn_with_feedback.cc b/glom/libglom/spawn_with_feedback.cc
index 1db1e18..d7a1a48 100644
--- a/glom/libglom/spawn_with_feedback.cc
+++ b/glom/libglom/spawn_with_feedback.cc
@@ -106,10 +106,10 @@ private:
     // it can write to it.
     SECURITY_ATTRIBUTES security_attr;
     security_attr.nLength = sizeof(security_attr);
-    security_attr.lpSecurityDescriptor = NULL;
+    security_attr.lpSecurityDescriptor = 0;
     security_attr.bInheritHandle = TRUE;
 
-    HANDLE result = CreateFile(filename.c_str(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_DELETE, &security_attr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+    HANDLE result = CreateFile(filename.c_str(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_DELETE, &security_attr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
     if(!result) throw SpawnError(win32_error_message());
 #endif // GLIBMM_EXCEPTIONS_ENABLED
@@ -192,11 +192,11 @@ public:
 #ifdef G_OS_WIN32
     startup_info.cb = sizeof(startup_info);
     startup_info.dwFlags = STARTF_USESTDHANDLES;
-    startup_info.lpReserved = NULL;
-    startup_info.lpDesktop = NULL;
-    startup_info.lpTitle = NULL;
+    startup_info.lpReserved = 0;
+    startup_info.lpDesktop = 0;
+    startup_info.lpTitle = 0;
     startup_info.cbReserved2 = 0;
-    startup_info.lpReserved2 = NULL;
+    startup_info.lpReserved2 = 0;
     startup_info.hStdInput = INVALID_HANDLE_VALUE;
 
     if(redirect & REDIRECT_STDOUT)
@@ -214,7 +214,7 @@ public:
     std::copy(command_line.data(), command_line.data() + command_line.length(), command.begin());
     command[command_line.length()] = '\0';
 
-    if(!CreateProcess(NULL, &command[0], NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &startup_info, &process_info))
+    if(!CreateProcess(0, &command[0], 0, 0, TRUE, CREATE_NO_WINDOW, 0, 0, &startup_info, &process_info))
     {
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
       throw SpawnError(win32_error_message());
@@ -229,10 +229,10 @@ public:
       int child_stdout;
       int child_stderr;
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
-      Glib::spawn_async_with_pipes(Glib::get_current_dir(), arguments, Glib::SPAWN_DO_NOT_REAP_CHILD, sigc::slot<void>(), &pid, NULL, redirect & REDIRECT_STDOUT ? &child_stdout : NULL, redirect & REDIRECT_STDERR ? &child_stderr : NULL);
+      Glib::spawn_async_with_pipes(Glib::get_current_dir(), arguments, Glib::SPAWN_DO_NOT_REAP_CHILD, sigc::slot<void>(), &pid, 0, redirect & REDIRECT_STDOUT ? &child_stdout : 0, redirect & REDIRECT_STDERR ? &child_stderr : 0);
 #else
       std::auto_ptr<Glib::Error> error;
-      Glib::spawn_async_with_pipes(Glib::get_current_dir(), arguments, Glib::SPAWN_DO_NOT_REAP_CHILD, sigc::slot<void>(), &pid, NULL, redirect & REDIRECT_STDOUT ? &child_stdout : NULL, redirect & REDIRECT_STDERR ? &child_stderr : NULL, error);
+      Glib::spawn_async_with_pipes(Glib::get_current_dir(), arguments, Glib::SPAWN_DO_NOT_REAP_CHILD, sigc::slot<void>(), &pid, 0, redirect & REDIRECT_STDOUT ? &child_stdout : 0, redirect & REDIRECT_STDERR ? &child_stderr : 0, error);
       if (error.get())
         std::cerr << "Spawn Error: " << error->what() << std::endl;
 #endif
@@ -342,7 +342,7 @@ std::auto_ptr<const SpawnInfo> spawn_async(const Glib::ustring& command_line, in
   return std::auto_ptr<const SpawnInfo>(new SpawnInfo(command_line, redirect));
 }
 
-bool spawn_async_end(std::auto_ptr<const SpawnInfo> info, std::string* stdout_text = NULL, std::string* stderr_text = NULL, int* return_status = NULL)
+bool spawn_async_end(std::auto_ptr<const SpawnInfo> info, std::string* stdout_text = 0, std::string* stderr_text = 0, int* return_status = 0)
 {
   if(stdout_text)
     info->get_stdout(*stdout_text);
@@ -495,7 +495,7 @@ namespace
 #ifdef GLIBMM_EXCEPTIONS_ENABLED
     try
     {
-      return_status = Impl::spawn_sync(second_command, &stdout_output, NULL);
+      return_status = Impl::spawn_sync(second_command, &stdout_output, 0);
     }
     catch(const Impl::SpawnError& ex)
     {
@@ -504,7 +504,7 @@ namespace
       // a row or so.
     }
 #else
-    Impl::spawn_sync(second_command, &stdout_output, NULL);
+    return_status = Impl::spawn_sync(second_command, &stdout_output, 0);
 #endif
 
     if(!success_text.empty())
@@ -598,7 +598,7 @@ bool execute_command_line_and_wait_until_second_command_returns_success(const st
 
   std::string stderr_text;
 
-  const bool success = Impl::spawn_async_end(info, NULL, &stderr_text, NULL);
+  const bool success = Impl::spawn_async_end(info, 0, &stderr_text, 0);
 
   if(success) //response == Gtk::RESPONSE_OK)
   {



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