From: Tor Lillqvist Date: Thu, 22 Oct 2009 00:22:54 +0000 (+0300) Subject: Avoid warnings on Windows X-Git-Tag: dbus-1.3.1~147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=459c19b9dd157cd360c3082d015a4c5ae4689cf8;p=thirdparty%2Fdbus.git Avoid warnings on Windows 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. --- diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 0ec289731..edf7de6d5 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -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 } } diff --git a/dbus/dbus-nonce.c b/dbus/dbus-nonce.c index 14afc2ef7..cf1424c33 100644 --- a/dbus/dbus-nonce.c +++ b/dbus/dbus-nonce.c @@ -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) { diff --git a/dbus/dbus-sysdeps-thread-win.c b/dbus/dbus-sysdeps-thread-win.c index 891b1bbdf..4c4d22f34 100644 --- a/dbus/dbus-sysdeps-thread-win.c +++ b/dbus/dbus-sysdeps-thread-win.c @@ -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" diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index fe277e4a2..81ce82dff 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -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; diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index da8a8ef84..7c68955e5 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -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; diff --git a/tools/Makefile.am b/tools/Makefile.am index 08b5d6a51..9cf3d721a 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -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