Avoid warnings on Windows
authorTor Lillqvist <tml@iki.fi>
Thu, 22 Oct 2009 00:22:54 +0000 (03:22 +0300)
committerRalf Habacker <ralf.habacker@freenet.de>
Tue, 1 Dec 2009 09:27:54 +0000 (10:27 +0100)
Remove unused functions, or put in #if 0 if potentially useful. Make
internal functions used just in one file static. Use -Werror after all
also on Windows. Construct the installation root from the location of
the dbus DLL, not from the location of the program .exe of the
process.

dbus/dbus-internals.c
dbus/dbus-nonce.c
dbus/dbus-sysdeps-thread-win.c
dbus/dbus-sysdeps-util-win.c
dbus/dbus-sysdeps-win.c
tools/Makefile.am

index 0ec2897..edf7de6 100644 (file)
@@ -310,18 +310,21 @@ _dbus_verbose_init (void)
 {
   if (!verbose_initted)
     {
-      char *p = _dbus_getenv ("DBUS_VERBOSE"); 
+      const char *p = _dbus_getenv ("DBUS_VERBOSE");
       verbose = p != NULL && *p == '1';
       verbose_initted = TRUE;
 #ifdef DBUS_USE_OUTPUT_DEBUG_STRING
-      GetModuleFileName(0,module_name,sizeof(module_name)-1);
-      p = strrchr(module_name,'.');
-      if (p)
-        *p ='\0';
-      p = strrchr(module_name,'\\');
-      if (p)
-        strcpy(module_name,p+1);
-      strcat(module_name,": ");
+      {
+        char *last_period, *last_slash;
+        GetModuleFileName(0,module_name,sizeof(module_name)-1);
+        last_period = _mbsrchr(module_name,'.');
+        if (last_period)
+          *last_period ='\0';
+        last_slash = _mbsrchr(module_name,'\\');
+        if (last_slash)
+          strcpy(module_name,last_slash+1);
+        strcat(module_name,": ");
+      }
 #endif
     }
 }
index 14afc2e..cf1424c 100644 (file)
@@ -133,12 +133,6 @@ _dbus_read_nonce (const DBusString *fname, DBusString *nonce, DBusError* error)
   return TRUE;
 }
 
-static int
-accept_with_nonce (int listen_fd, const DBusString *nonce)
-{
-
-}
-
 int
 _dbus_accept_with_noncefile (int listen_fd, const DBusNonceFile *noncefile)
 {
index 891b1bb..4c4d22f 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "dbus-internals.h"
 #include "dbus-sysdeps.h"
+#include "dbus-sysdeps-win.h"
 #include "dbus-threads.h"
 #include "dbus-list.h"
 
index fe277e4..81ce82d 100644 (file)
@@ -70,7 +70,7 @@ _dbus_become_daemon (const DBusString *pidfile,
  * @param error return location for errors
  * @returns #FALSE on failure
  */
-dbus_bool_t
+static dbus_bool_t
 _dbus_write_pid_file (const DBusString *filename,
                       unsigned long     pid,
                       DBusError        *error)
@@ -224,22 +224,6 @@ _dbus_change_to_daemon_user  (const char    *user,
   return TRUE;
 }
 
-/**
- * Changes the user and group the bus is running as.
- *
- * @param uid the new user ID
- * @param gid the new group ID
- * @param error return location for errors
- * @returns #FALSE on failure
- */
-dbus_bool_t
-_dbus_change_identity  (dbus_uid_t     uid,
-                        dbus_gid_t     gid,
-                        DBusError     *error)
-{
-  return TRUE;
-}
-
 /** Checks if user is at the console
 *
 * @param username user to check
@@ -542,7 +526,7 @@ DIR;
 * The DIR typedef is not compatible with Unix.
 **********************************************************************/
 
-DIR * _dbus_opendir(const char *dir)
+static DIR * _dbus_opendir(const char *dir)
 {
   DIR *dp;
   char *filespec;
@@ -575,7 +559,7 @@ DIR * _dbus_opendir(const char *dir)
   return dp;
 }
 
-struct dirent * _dbus_readdir(DIR *dp)
+static struct dirent * _dbus_readdir(DIR *dp)
   {
     if (!dp || dp->finished)
       return NULL;
@@ -600,7 +584,7 @@ struct dirent * _dbus_readdir(DIR *dp)
   }
 
 
-int _dbus_closedir(DIR *dp)
+static int _dbus_closedir(DIR *dp)
 {
   if (!dp)
     return 0;
index da8a8ef..7c68955 100644 (file)
@@ -742,15 +742,6 @@ out1:
 /** @} end of sysdeps-win */
 
 
-/** Gets our UID
- * @returns process UID
- */
-dbus_uid_t
-_dbus_getuid (void)
-{
-       return DBUS_UID_UNSET;
-}
-
 /**
  * The only reason this is separate from _dbus_getpid() is to allow it
  * on Windows for logging but not for other purposes.
@@ -767,7 +758,7 @@ _dbus_pid_for_log (void)
  * @param points to sid buffer, need to be freed with LocalFree()
  * @returns process sid
  */
-dbus_bool_t
+static dbus_bool_t
 _dbus_getsid(char **sid)
 {
   HANDLE process_token = NULL;
@@ -811,31 +802,6 @@ failed:
   return retval;
 }
 
-
-#ifdef DBUS_BUILD_TESTS
-/** Gets our GID
- * @returns process GID
- */
-dbus_gid_t
-_dbus_getgid (void)
-{
-       return DBUS_GID_UNSET;
-}
-
-#if 0
-dbus_bool_t
-_dbus_domain_test (const char *test_data_dir)
-{
-  if (!_dbus_test_oom_handling ("spawn_nonexistent",
-                                check_spawn_nonexistent,
-                                NULL))
-    return FALSE;
-}
-
-#endif
-
-#endif //DBUS_BUILD_TESTS
-
 /************************************************************************
  
  pipes
@@ -1886,7 +1852,7 @@ _dbus_concat_dir_and_file (DBusString       *dir,
                             _dbus_string_get_length (dir));
 }
 
-/*---------------- DBusCredentials ----------------------------------
+/*---------------- DBusCredentials ----------------------------------*/
 
 /**
  * Adds the credentials corresponding to the given username.
@@ -2971,6 +2937,8 @@ _dbus_daemon_init(const char *host, dbus_uint32_t port)
   _dbus_global_unlock( lock );
 }
 
+#if 0
+
 void
 _dbus_daemon_release()
 {
@@ -2992,6 +2960,8 @@ _dbus_daemon_release()
   _dbus_global_unlock( lock );
 }
 
+#endif
+
 static dbus_bool_t
 _dbus_get_autolaunch_shm(DBusString *adress)
 {
@@ -3303,7 +3273,7 @@ _dbus_get_is_errno_eagain_or_ewouldblock (void)
  * @param len length of buffer
  * @returns #FALSE on failure
  */
-dbus_bool_t 
+static dbus_bool_t
 _dbus_get_install_root(char *prefix, int len)
 {
     //To find the prefix, we cut the filename and also \bin\ if present
@@ -3312,7 +3282,7 @@ _dbus_get_install_root(char *prefix, int len)
     DWORD pathLength;
     char *lastSlash;
     SetLastError( 0 );
-    pathLength = GetModuleFileName(NULL, prefix, len);
+    pathLength = GetModuleFileName(_dbus_win_get_dll_hmodule(), prefix, len);
     if ( pathLength == 0 || GetLastError() != 0 ) {
         *prefix = '\0';
         return FALSE;
index 08b5d6a..9cf3d72 100644 (file)
@@ -1,6 +1,6 @@
 configdir=$(sysconfdir)/dbus-1
 
-INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_X_CFLAGS) -DDBUS_LOCALEDIR=\"@EXPANDED_DATADIR@/locale\" -DDBUS_COMPILATION -DDBUS_DAEMONDIR=\"@DBUS_DAEMONDIR@\" -DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/lib/dbus/machine-id"\"
+INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_X_CFLAGS) -DDBUS_LOCALEDIR=\"@EXPANDED_DATADIR@/locale\" -DDBUS_COMPILATION -DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/lib/dbus/machine-id"\"
 
 extra_bin_programs=
 if DBUS_UNIX