mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-15 08:56:34 -05:00
win32: Make some unused-variable warnings go away
This commit is contained in:
parent
3adc43b8fe
commit
5818a2c63e
15 changed files with 49 additions and 29 deletions
|
|
@ -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) {
|
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;
|
pa_daemon_conf *c = data;
|
||||||
int32_t rtprio;
|
int32_t rtprio;
|
||||||
|
|
||||||
|
|
@ -478,16 +482,15 @@ static int parse_rtprio(const char *filename, unsigned line, const char *section
|
||||||
pa_assert(rvalue);
|
pa_assert(rvalue);
|
||||||
pa_assert(data);
|
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)) {
|
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);
|
pa_log("[%s:%u] Invalid realtime priority '%s'.", filename, line, rvalue);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
c->realtime_priority = (int) rtprio;
|
c->realtime_priority = (int) rtprio;
|
||||||
|
# endif
|
||||||
|
#endif /* OS_IS_WIN32 */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -748,7 +748,9 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conf->daemonize) {
|
if (conf->daemonize) {
|
||||||
|
#ifdef HAVE_FORK
|
||||||
pid_t child;
|
pid_t child;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pa_stdio_acquire() < 0) {
|
if (pa_stdio_acquire() < 0) {
|
||||||
pa_log(_("Failed to acquire stdio."));
|
pa_log(_("Failed to acquire stdio."));
|
||||||
|
|
|
||||||
|
|
@ -175,10 +175,10 @@ static void update_rule(struct rule *r) {
|
||||||
if (stat(fn, &st) == 0)
|
if (stat(fn, &st) == 0)
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
else {
|
else {
|
||||||
|
#ifdef DT_DIR
|
||||||
DIR *desktopfiles_dir;
|
DIR *desktopfiles_dir;
|
||||||
struct dirent *dir;
|
struct dirent *dir;
|
||||||
|
|
||||||
#ifdef DT_DIR
|
|
||||||
/* Let's try a more aggressive search, but only one level */
|
/* Let's try a more aggressive search, but only one level */
|
||||||
if ((desktopfiles_dir = opendir(DESKTOPFILEDIR))) {
|
if ((desktopfiles_dir = opendir(DESKTOPFILEDIR))) {
|
||||||
while ((dir = readdir(desktopfiles_dir))) {
|
while ((dir = readdir(desktopfiles_dir))) {
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,9 @@ int pa__init(pa_module*m) {
|
||||||
pa_iochannel *io;
|
pa_iochannel *io;
|
||||||
pa_modargs *ma;
|
pa_modargs *ma;
|
||||||
pa_bool_t exit_on_eof = FALSE;
|
pa_bool_t exit_on_eof = FALSE;
|
||||||
|
#ifndef OS_IS_WIN32
|
||||||
int fd;
|
int fd;
|
||||||
|
#endif
|
||||||
|
|
||||||
pa_assert(m);
|
pa_assert(m);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -790,11 +790,10 @@ void pa_command_stream_event(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
if (pa_streq(event, PA_STREAM_EVENT_FORMAT_LOST)) {
|
if (pa_streq(event, PA_STREAM_EVENT_FORMAT_LOST)) {
|
||||||
/* Let client know what the running time was when the stream had to be
|
/* Let client know what the running time was when the stream had to be killed */
|
||||||
* killed */
|
pa_usec_t stream_time;
|
||||||
pa_usec_t time;
|
if (pa_stream_get_time(s, &stream_time) == 0)
|
||||||
if (pa_stream_get_time(s, &time) == 0)
|
pa_proplist_setf(pl, "stream-time", "%llu", (unsigned long long) stream_time);
|
||||||
pa_proplist_setf(pl, "stream-time", "%llu", (unsigned long long) time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->event_callback)
|
if (s->event_callback)
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ struct timeval *pa_gettimeofday(struct timeval *tv) {
|
||||||
#else
|
#else
|
||||||
#define EPOCHFILETIME (116444736000000000LL)
|
#define EPOCHFILETIME (116444736000000000LL)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
LARGE_INTEGER li;
|
LARGE_INTEGER li;
|
||||||
int64_t t;
|
int64_t t;
|
||||||
|
|
@ -61,6 +62,7 @@ struct timeval *pa_gettimeofday(struct timeval *tv) {
|
||||||
t /= 10; /* In microseconds */
|
t /= 10; /* In microseconds */
|
||||||
tv->tv_sec = (time_t) (t / PA_USEC_PER_SEC);
|
tv->tv_sec = (time_t) (t / PA_USEC_PER_SEC);
|
||||||
tv->tv_usec = (suseconds_t) (t % PA_USEC_PER_SEC);
|
tv->tv_usec = (suseconds_t) (t % PA_USEC_PER_SEC);
|
||||||
|
}
|
||||||
#elif defined(HAVE_GETTIMEOFDAY)
|
#elif defined(HAVE_GETTIMEOFDAY)
|
||||||
pa_assert_se(gettimeofday(tv, NULL) == 0);
|
pa_assert_se(gettimeofday(tv, NULL) == 0);
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -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 *pa_get_home_dir(char *s, size_t l) {
|
||||||
char *e, *dir;
|
char *e;
|
||||||
|
|
||||||
#ifdef HAVE_PWD_H
|
#ifdef HAVE_PWD_H
|
||||||
|
char *dir;
|
||||||
struct passwd *r;
|
struct passwd *r;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include <pulsecore/macro.h>
|
#include <pulsecore/macro.h>
|
||||||
#include <pulsecore/socket.h>
|
#include <pulsecore/socket.h>
|
||||||
|
#include <pulsecore/core-util.h>
|
||||||
|
|
||||||
#include "arpa-inet.h"
|
#include "arpa-inet.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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_card *card;
|
||||||
pa_bool_t nl;
|
pa_bool_t nl;
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
char txt[256];
|
|
||||||
time_t now;
|
time_t now;
|
||||||
|
#ifdef HAVE_CTIME_R
|
||||||
|
char txt[256];
|
||||||
|
#endif
|
||||||
|
|
||||||
pa_core_assert_ref(c);
|
pa_core_assert_ref(c);
|
||||||
pa_assert(t);
|
pa_assert(t);
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ void pa_make_fd_cloexec(int fd) {
|
||||||
/** Creates a directory securely */
|
/** Creates a directory securely */
|
||||||
int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
|
int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int r, saved_errno, fd;
|
int r, saved_errno;
|
||||||
|
|
||||||
pa_assert(dir);
|
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;
|
return -1;
|
||||||
|
|
||||||
#if defined(HAVE_FSTAT) && !defined(OS_IS_WIN32)
|
#if defined(HAVE_FSTAT) && !defined(OS_IS_WIN32)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
if ((fd = open(dir,
|
if ((fd = open(dir,
|
||||||
#ifdef O_CLOEXEC
|
#ifdef O_CLOEXEC
|
||||||
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
|
#endif
|
||||||
|
|
||||||
pa_assert_se(pa_close(fd) >= 0);
|
pa_assert_se(pa_close(fd) >= 0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LSTAT
|
#ifdef HAVE_LSTAT
|
||||||
|
|
@ -728,7 +731,7 @@ int pa_make_realtime(int rtprio) {
|
||||||
pa_log_info("Successfully acquired real-time thread priority.");
|
pa_log_info("Successfully acquired real-time thread priority.");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#elif _POSIX_PRIORITY_SCHEDULING
|
#elif defined(_POSIX_PRIORITY_SCHEDULING)
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
if (set_scheduler(rtprio) >= 0) {
|
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.*/
|
/* Try to parse a boolean string value.*/
|
||||||
int pa_parse_boolean(const char *v) {
|
int pa_parse_boolean(const char *v) {
|
||||||
const char *expr;
|
|
||||||
pa_assert(v);
|
pa_assert(v);
|
||||||
|
|
||||||
/* First we check language independant */
|
/* First we check language independant */
|
||||||
|
|
@ -896,6 +898,8 @@ int pa_parse_boolean(const char *v) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef HAVE_LANGINFO_H
|
#ifdef HAVE_LANGINFO_H
|
||||||
|
{
|
||||||
|
const char *expr;
|
||||||
/* And then we check language dependant */
|
/* And then we check language dependant */
|
||||||
if ((expr = nl_langinfo(YESEXPR)))
|
if ((expr = nl_langinfo(YESEXPR)))
|
||||||
if (expr[0])
|
if (expr[0])
|
||||||
|
|
@ -906,6 +910,7 @@ int pa_parse_boolean(const char *v) {
|
||||||
if (expr[0])
|
if (expr[0])
|
||||||
if (pa_match(expr, v) > 0)
|
if (pa_match(expr, v) > 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
errno = EINVAL;
|
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 *pa_get_runtime_dir(void) {
|
||||||
char *d, *k = NULL, *p = NULL, *t = NULL, *mid;
|
char *d, *k = NULL, *p = NULL, *t = NULL, *mid;
|
||||||
struct stat st;
|
|
||||||
mode_t m;
|
mode_t m;
|
||||||
|
|
||||||
/* The runtime directory shall contain dynamic data that needs NOT
|
/* The runtime directory shall contain dynamic data that needs NOT
|
||||||
|
|
@ -1641,10 +1645,10 @@ char *pa_get_runtime_dir(void) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hmm, so this symlink is still around, make sure nobody fools
|
/* Hmm, so this symlink is still around, make sure nobody fools us */
|
||||||
* us */
|
|
||||||
|
|
||||||
#ifdef HAVE_LSTAT
|
#ifdef HAVE_LSTAT
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
if (lstat(p, &st) < 0) {
|
if (lstat(p, &st) < 0) {
|
||||||
|
|
||||||
if (errno != ENOENT) {
|
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.");
|
pa_log_info("Hmm, runtime path exists, but points to an invalid directory. Changing runtime directory.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pa_xfree(p);
|
pa_xfree(p);
|
||||||
|
|
@ -2203,7 +2208,7 @@ void *pa_will_need(const void *p, size_t l) {
|
||||||
#endif
|
#endif
|
||||||
const void *a;
|
const void *a;
|
||||||
size_t size;
|
size_t size;
|
||||||
int r;
|
int r = ENOTSUP;
|
||||||
size_t bs;
|
size_t bs;
|
||||||
|
|
||||||
pa_assert(p);
|
pa_assert(p);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsock2.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) {
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||||
WSADATA data;
|
WSADATA data;
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,11 @@ static int random_proper(void *ret_data, size_t length) {
|
||||||
#ifdef OS_IS_WIN32
|
#ifdef OS_IS_WIN32
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
HCRYPTPROV hCryptProv = 0;
|
||||||
|
|
||||||
pa_assert(ret_data);
|
pa_assert(ret_data);
|
||||||
pa_assert(length > 0);
|
pa_assert(length > 0);
|
||||||
|
|
||||||
HCRYPTPROV hCryptProv = NULL;
|
|
||||||
|
|
||||||
if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
|
if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
|
||||||
if(CryptGenRandom(hCryptProv, length, ret_data))
|
if(CryptGenRandom(hCryptProv, length, ret_data))
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,10 @@ static char *segment_name(char *fn, size_t l, unsigned id) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
|
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];
|
char fn[32];
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
pa_assert(m);
|
pa_assert(m);
|
||||||
pa_assert(size > 0);
|
pa_assert(size > 0);
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,9 @@ void pa_socket_peer_to_string(int fd, char *c, size_t l) {
|
||||||
#ifndef OS_IS_WIN32
|
#ifndef OS_IS_WIN32
|
||||||
pa_assert_se(fstat(fd, &st) == 0);
|
pa_assert_se(fstat(fd, &st) == 0);
|
||||||
|
|
||||||
if (S_ISSOCK(st.st_mode)) {
|
if (S_ISSOCK(st.st_mode))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
union {
|
union {
|
||||||
struct sockaddr_storage storage;
|
struct sockaddr_storage storage;
|
||||||
struct sockaddr sa;
|
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");
|
pa_snprintf(c, l, "Unknown network client");
|
||||||
return;
|
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");
|
pa_snprintf(c, l, "STDIN/STDOUT client");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,10 @@
|
||||||
#include "start-child.h"
|
#include "start-child.h"
|
||||||
|
|
||||||
int pa_start_child_for_read(const char *name, const char *argv1, pid_t *pid) {
|
int pa_start_child_for_read(const char *name, const char *argv1, pid_t *pid) {
|
||||||
|
#ifdef HAVE_FORK
|
||||||
pid_t child;
|
pid_t child;
|
||||||
int pipe_fds[2] = { -1, -1 };
|
int pipe_fds[2] = { -1, -1 };
|
||||||
|
|
||||||
#ifdef HAVE_FORK
|
|
||||||
if (pipe(pipe_fds) < 0) {
|
if (pipe(pipe_fds) < 0) {
|
||||||
pa_log("pipe() failed: %s", pa_cstrerror(errno));
|
pa_log("pipe() failed: %s", pa_cstrerror(errno));
|
||||||
goto fail;
|
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);
|
execl(name, name, argv1, NULL);
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
pa_close_pipe(pipe_fds);
|
pa_close_pipe(pipe_fds);
|
||||||
|
#endif /* HAVE_FORK */
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue