win32: Make some unused-variable warnings go away

This commit is contained in:
Maarten Bosmans 2011-06-23 22:21:03 +02:00 committed by Colin Guthrie
parent 3adc43b8fe
commit 5818a2c63e
15 changed files with 49 additions and 29 deletions

View file

@ -470,6 +470,10 @@ static int parse_nice_level(const char *filename, unsigned line, const char *sec
}
static int parse_rtprio(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
#ifdef OS_IS_WIN32
pa_log("[%s:%u] Realtime priority not available on win32.", filename, line);
#else
# ifdef HAVE_SCHED_H
pa_daemon_conf *c = data;
int32_t rtprio;
@ -478,16 +482,15 @@ static int parse_rtprio(const char *filename, unsigned line, const char *section
pa_assert(rvalue);
pa_assert(data);
#ifndef OS_IS_WIN32
# ifdef HAVE_SCHED_H
if (pa_atoi(rvalue, &rtprio) < 0 || rtprio < sched_get_priority_min(SCHED_FIFO) || rtprio > sched_get_priority_max(SCHED_FIFO)) {
pa_log("[%s:%u] Invalid realtime priority '%s'.", filename, line, rvalue);
return -1;
}
# endif
#endif
c->realtime_priority = (int) rtprio;
# endif
#endif /* OS_IS_WIN32 */
return 0;
}

View file

@ -748,7 +748,9 @@ int main(int argc, char *argv[]) {
}
if (conf->daemonize) {
#ifdef HAVE_FORK
pid_t child;
#endif
if (pa_stdio_acquire() < 0) {
pa_log(_("Failed to acquire stdio."));

View file

@ -175,10 +175,10 @@ static void update_rule(struct rule *r) {
if (stat(fn, &st) == 0)
found = TRUE;
else {
#ifdef DT_DIR
DIR *desktopfiles_dir;
struct dirent *dir;
#ifdef DT_DIR
/* Let's try a more aggressive search, but only one level */
if ((desktopfiles_dir = opendir(DESKTOPFILEDIR))) {
while ((dir = readdir(desktopfiles_dir))) {

View file

@ -72,7 +72,9 @@ int pa__init(pa_module*m) {
pa_iochannel *io;
pa_modargs *ma;
pa_bool_t exit_on_eof = FALSE;
#ifndef OS_IS_WIN32
int fd;
#endif
pa_assert(m);

View file

@ -790,11 +790,10 @@ void pa_command_stream_event(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
goto finish;
if (pa_streq(event, PA_STREAM_EVENT_FORMAT_LOST)) {
/* Let client know what the running time was when the stream had to be
* killed */
pa_usec_t time;
if (pa_stream_get_time(s, &time) == 0)
pa_proplist_setf(pl, "stream-time", "%llu", (unsigned long long) time);
/* Let client know what the running time was when the stream had to be killed */
pa_usec_t stream_time;
if (pa_stream_get_time(s, &stream_time) == 0)
pa_proplist_setf(pl, "stream-time", "%llu", (unsigned long long) stream_time);
}
if (s->event_callback)

View file

@ -49,6 +49,7 @@ struct timeval *pa_gettimeofday(struct timeval *tv) {
#else
#define EPOCHFILETIME (116444736000000000LL)
#endif
{
FILETIME ft;
LARGE_INTEGER li;
int64_t t;
@ -61,6 +62,7 @@ struct timeval *pa_gettimeofday(struct timeval *tv) {
t /= 10; /* In microseconds */
tv->tv_sec = (time_t) (t / PA_USEC_PER_SEC);
tv->tv_usec = (suseconds_t) (t % PA_USEC_PER_SEC);
}
#elif defined(HAVE_GETTIMEOFDAY)
pa_assert_se(gettimeofday(tv, NULL) == 0);
#else

View file

@ -131,9 +131,9 @@ char *pa_get_host_name(char *s, size_t l) {
}
char *pa_get_home_dir(char *s, size_t l) {
char *e, *dir;
char *e;
#ifdef HAVE_PWD_H
char *dir;
struct passwd *r;
#endif

View file

@ -29,6 +29,7 @@
#include <pulsecore/macro.h>
#include <pulsecore/socket.h>
#include <pulsecore/core-util.h>
#include "arpa-inet.h"

View file

@ -1574,8 +1574,10 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
pa_card *card;
pa_bool_t nl;
uint32_t idx;
char txt[256];
time_t now;
#ifdef HAVE_CTIME_R
char txt[256];
#endif
pa_core_assert_ref(c);
pa_assert(t);

View file

@ -219,7 +219,7 @@ void pa_make_fd_cloexec(int fd) {
/** Creates a directory securely */
int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
struct stat st;
int r, saved_errno, fd;
int r, saved_errno;
pa_assert(dir);
@ -238,6 +238,8 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
return -1;
#if defined(HAVE_FSTAT) && !defined(OS_IS_WIN32)
{
int fd;
if ((fd = open(dir,
#ifdef O_CLOEXEC
O_CLOEXEC|
@ -276,6 +278,7 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
#endif
pa_assert_se(pa_close(fd) >= 0);
}
#endif
#ifdef HAVE_LSTAT
@ -728,7 +731,7 @@ int pa_make_realtime(int rtprio) {
pa_log_info("Successfully acquired real-time thread priority.");
return 0;
#elif _POSIX_PRIORITY_SCHEDULING
#elif defined(_POSIX_PRIORITY_SCHEDULING)
int p;
if (set_scheduler(rtprio) >= 0) {
@ -886,7 +889,6 @@ int pa_match(const char *expr, const char *v) {
/* Try to parse a boolean string value.*/
int pa_parse_boolean(const char *v) {
const char *expr;
pa_assert(v);
/* First we check language independant */
@ -896,6 +898,8 @@ int pa_parse_boolean(const char *v) {
return 0;
#ifdef HAVE_LANGINFO_H
{
const char *expr;
/* And then we check language dependant */
if ((expr = nl_langinfo(YESEXPR)))
if (expr[0])
@ -906,6 +910,7 @@ int pa_parse_boolean(const char *v) {
if (expr[0])
if (pa_match(expr, v) > 0)
return 0;
}
#endif
errno = EINVAL;
@ -1561,7 +1566,6 @@ static int make_random_dir_and_link(mode_t m, const char *k) {
char *pa_get_runtime_dir(void) {
char *d, *k = NULL, *p = NULL, *t = NULL, *mid;
struct stat st;
mode_t m;
/* The runtime directory shall contain dynamic data that needs NOT
@ -1641,10 +1645,10 @@ char *pa_get_runtime_dir(void) {
goto fail;
}
/* Hmm, so this symlink is still around, make sure nobody fools
* us */
/* Hmm, so this symlink is still around, make sure nobody fools us */
#ifdef HAVE_LSTAT
{
struct stat st;
if (lstat(p, &st) < 0) {
if (errno != ENOENT) {
@ -1664,6 +1668,7 @@ char *pa_get_runtime_dir(void) {
pa_log_info("Hmm, runtime path exists, but points to an invalid directory. Changing runtime directory.");
}
}
#endif
pa_xfree(p);
@ -2203,7 +2208,7 @@ void *pa_will_need(const void *p, size_t l) {
#endif
const void *a;
size_t size;
int r;
int r = ENOTSUP;
size_t bs;
pa_assert(p);

View file

@ -31,7 +31,7 @@
#include <windows.h>
#include <winsock2.h>
extern pa_win32_get_toplevel(HANDLE handle);
extern char *pa_win32_get_toplevel(HANDLE handle);
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
WSADATA data;

View file

@ -49,11 +49,11 @@ static int random_proper(void *ret_data, size_t length) {
#ifdef OS_IS_WIN32
int ret = -1;
HCRYPTPROV hCryptProv = 0;
pa_assert(ret_data);
pa_assert(length > 0);
HCRYPTPROV hCryptProv = NULL;
if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
if(CryptGenRandom(hCryptProv, length, ret_data))
ret = 0;

View file

@ -98,8 +98,10 @@ static char *segment_name(char *fn, size_t l, unsigned id) {
#endif
int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
#ifdef HAVE_SHM_OPEN
char fn[32];
int fd = -1;
#endif
pa_assert(m);
pa_assert(size > 0);

View file

@ -72,8 +72,9 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
#ifndef OS_IS_WIN32
pa_assert_se(fstat(fd, &st) == 0);
if (S_ISSOCK(st.st_mode)) {
if (S_ISSOCK(st.st_mode))
#endif
{
union {
struct sockaddr_storage storage;
struct sockaddr sa;
@ -118,10 +119,11 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
}
}
#ifndef OS_IS_WIN32
pa_snprintf(c, l, "Unknown network client");
return;
} else if (S_ISCHR(st.st_mode) && (fd == 0 || fd == 1)) {
}
#ifndef OS_IS_WIN32
else if (S_ISCHR(st.st_mode) && (fd == 0 || fd == 1)) {
pa_snprintf(c, l, "STDIN/STDOUT client");
return;
}

View file

@ -45,10 +45,10 @@
#include "start-child.h"
int pa_start_child_for_read(const char *name, const char *argv1, pid_t *pid) {
#ifdef HAVE_FORK
pid_t child;
int pipe_fds[2] = { -1, -1 };
#ifdef HAVE_FORK
if (pipe(pipe_fds) < 0) {
pa_log("pipe() failed: %s", pa_cstrerror(errno));
goto fail;
@ -106,10 +106,10 @@ int pa_start_child_for_read(const char *name, const char *argv1, pid_t *pid) {
execl(name, name, argv1, NULL);
_exit(1);
}
#endif
fail:
pa_close_pipe(pipe_fds);
#endif /* HAVE_FORK */
return -1;
}