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.
This commit is contained in:
Tor Lillqvist 2009-10-22 03:22:54 +03:00 committed by Ralf Habacker
parent 2213a8511a
commit 459c19b9dd
6 changed files with 26 additions and 74 deletions

View file

@ -310,18 +310,21 @@ _dbus_verbose_init (void)
{ {
if (!verbose_initted) if (!verbose_initted)
{ {
char *p = _dbus_getenv ("DBUS_VERBOSE"); const char *p = _dbus_getenv ("DBUS_VERBOSE");
verbose = p != NULL && *p == '1'; verbose = p != NULL && *p == '1';
verbose_initted = TRUE; verbose_initted = TRUE;
#ifdef DBUS_USE_OUTPUT_DEBUG_STRING #ifdef DBUS_USE_OUTPUT_DEBUG_STRING
GetModuleFileName(0,module_name,sizeof(module_name)-1); {
p = strrchr(module_name,'.'); char *last_period, *last_slash;
if (p) GetModuleFileName(0,module_name,sizeof(module_name)-1);
*p ='\0'; last_period = _mbsrchr(module_name,'.');
p = strrchr(module_name,'\\'); if (last_period)
if (p) *last_period ='\0';
strcpy(module_name,p+1); last_slash = _mbsrchr(module_name,'\\');
strcat(module_name,": "); if (last_slash)
strcpy(module_name,last_slash+1);
strcat(module_name,": ");
}
#endif #endif
} }
} }

View file

@ -133,12 +133,6 @@ _dbus_read_nonce (const DBusString *fname, DBusString *nonce, DBusError* error)
return TRUE; return TRUE;
} }
static int
accept_with_nonce (int listen_fd, const DBusString *nonce)
{
}
int int
_dbus_accept_with_noncefile (int listen_fd, const DBusNonceFile *noncefile) _dbus_accept_with_noncefile (int listen_fd, const DBusNonceFile *noncefile)
{ {

View file

@ -23,6 +23,7 @@
#include "dbus-internals.h" #include "dbus-internals.h"
#include "dbus-sysdeps.h" #include "dbus-sysdeps.h"
#include "dbus-sysdeps-win.h"
#include "dbus-threads.h" #include "dbus-threads.h"
#include "dbus-list.h" #include "dbus-list.h"

View file

@ -70,7 +70,7 @@ _dbus_become_daemon (const DBusString *pidfile,
* @param error return location for errors * @param error return location for errors
* @returns #FALSE on failure * @returns #FALSE on failure
*/ */
dbus_bool_t static dbus_bool_t
_dbus_write_pid_file (const DBusString *filename, _dbus_write_pid_file (const DBusString *filename,
unsigned long pid, unsigned long pid,
DBusError *error) DBusError *error)
@ -224,22 +224,6 @@ _dbus_change_to_daemon_user (const char *user,
return TRUE; 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 /** Checks if user is at the console
* *
* @param username user to check * @param username user to check
@ -542,7 +526,7 @@ DIR;
* The DIR typedef is not compatible with Unix. * The DIR typedef is not compatible with Unix.
**********************************************************************/ **********************************************************************/
DIR * _dbus_opendir(const char *dir) static DIR * _dbus_opendir(const char *dir)
{ {
DIR *dp; DIR *dp;
char *filespec; char *filespec;
@ -575,7 +559,7 @@ DIR * _dbus_opendir(const char *dir)
return dp; return dp;
} }
struct dirent * _dbus_readdir(DIR *dp) static struct dirent * _dbus_readdir(DIR *dp)
{ {
if (!dp || dp->finished) if (!dp || dp->finished)
return NULL; 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) if (!dp)
return 0; return 0;

View file

@ -742,15 +742,6 @@ out1:
/** @} end of sysdeps-win */ /** @} 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 * The only reason this is separate from _dbus_getpid() is to allow it
* on Windows for logging but not for other purposes. * 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() * @param points to sid buffer, need to be freed with LocalFree()
* @returns process sid * @returns process sid
*/ */
dbus_bool_t static dbus_bool_t
_dbus_getsid(char **sid) _dbus_getsid(char **sid)
{ {
HANDLE process_token = NULL; HANDLE process_token = NULL;
@ -811,31 +802,6 @@ failed:
return retval; 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 pipes
@ -1886,7 +1852,7 @@ _dbus_concat_dir_and_file (DBusString *dir,
_dbus_string_get_length (dir)); _dbus_string_get_length (dir));
} }
/*---------------- DBusCredentials ---------------------------------- /*---------------- DBusCredentials ----------------------------------*/
/** /**
* Adds the credentials corresponding to the given username. * 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 ); _dbus_global_unlock( lock );
} }
#if 0
void void
_dbus_daemon_release() _dbus_daemon_release()
{ {
@ -2992,6 +2960,8 @@ _dbus_daemon_release()
_dbus_global_unlock( lock ); _dbus_global_unlock( lock );
} }
#endif
static dbus_bool_t static dbus_bool_t
_dbus_get_autolaunch_shm(DBusString *adress) _dbus_get_autolaunch_shm(DBusString *adress)
{ {
@ -3303,7 +3273,7 @@ _dbus_get_is_errno_eagain_or_ewouldblock (void)
* @param len length of buffer * @param len length of buffer
* @returns #FALSE on failure * @returns #FALSE on failure
*/ */
dbus_bool_t static dbus_bool_t
_dbus_get_install_root(char *prefix, int len) _dbus_get_install_root(char *prefix, int len)
{ {
//To find the prefix, we cut the filename and also \bin\ if present //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; DWORD pathLength;
char *lastSlash; char *lastSlash;
SetLastError( 0 ); SetLastError( 0 );
pathLength = GetModuleFileName(NULL, prefix, len); pathLength = GetModuleFileName(_dbus_win_get_dll_hmodule(), prefix, len);
if ( pathLength == 0 || GetLastError() != 0 ) { if ( pathLength == 0 || GetLastError() != 0 ) {
*prefix = '\0'; *prefix = '\0';
return FALSE; return FALSE;

View file

@ -1,6 +1,6 @@
configdir=$(sysconfdir)/dbus-1 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= extra_bin_programs=
if DBUS_UNIX if DBUS_UNIX