mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
add a few more gcc warning flags and fix quite a few problems found by doing so
This commit is contained in:
parent
047eb52b52
commit
b7026bf248
99 changed files with 810 additions and 776 deletions
|
|
@ -40,7 +40,7 @@ const pa_envelope_def ramp_down = {
|
|||
.n_points = 2,
|
||||
.points_x = { 100*PA_USEC_PER_MSEC, 300*PA_USEC_PER_MSEC },
|
||||
.points_y = {
|
||||
.f = { 1.0, 0.2 },
|
||||
.f = { 1.0f, 0.2f },
|
||||
.i = { 0x10000, 0x10000/5 }
|
||||
}
|
||||
};
|
||||
|
|
@ -49,7 +49,7 @@ const pa_envelope_def ramp_up = {
|
|||
.n_points = 2,
|
||||
.points_x = { 100*PA_USEC_PER_MSEC, 300*PA_USEC_PER_MSEC },
|
||||
.points_y = {
|
||||
.f = { 0.2, 1.0 },
|
||||
.f = { 0.2f, 1.0f },
|
||||
.i = { 0x10000/5, 0x10000 }
|
||||
}
|
||||
};
|
||||
|
|
@ -58,7 +58,7 @@ const pa_envelope_def ramp_down2 = {
|
|||
.n_points = 2,
|
||||
.points_x = { 50*PA_USEC_PER_MSEC, 900*PA_USEC_PER_MSEC },
|
||||
.points_y = {
|
||||
.f = { 0.8, 0.7 },
|
||||
.f = { 0.8f, 0.7f },
|
||||
.i = { 0x10000*4/5, 0x10000*7/10 }
|
||||
}
|
||||
};
|
||||
|
|
@ -67,7 +67,7 @@ const pa_envelope_def ramp_up2 = {
|
|||
.n_points = 2,
|
||||
.points_x = { 50*PA_USEC_PER_MSEC, 900*PA_USEC_PER_MSEC },
|
||||
.points_y = {
|
||||
.f = { 0.7, 0.9 },
|
||||
.f = { 0.7f, 0.9f },
|
||||
.i = { 0x10000*7/10, 0x10000*9/10 }
|
||||
}
|
||||
};
|
||||
|
|
@ -140,7 +140,7 @@ static pa_memblock * generate_block(pa_mempool *pool, const pa_sample_spec *ss)
|
|||
unsigned n_samples;
|
||||
|
||||
block = pa_memblock_new(pool, pa_bytes_per_second(ss));
|
||||
n_samples = pa_memblock_get_length(block) / pa_sample_size(ss);
|
||||
n_samples = (unsigned) (pa_memblock_get_length(block) / pa_sample_size(ss));
|
||||
|
||||
d = pa_memblock_acquire(block);
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ static pa_memblock * generate_block(pa_mempool *pool, const pa_sample_spec *ss)
|
|||
float *f;
|
||||
|
||||
for (f = d; n_samples > 0; n_samples--, f++)
|
||||
*f = PA_MAYBE_FLOAT32_SWAP(ss->format == PA_SAMPLE_FLOAT32RE, 1.0);
|
||||
*f = PA_MAYBE_FLOAT32_SWAP(ss->format == PA_SAMPLE_FLOAT32RE, 1.0f);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
pa_memchunk_reset(&c);
|
||||
|
||||
srand(time(NULL));
|
||||
srand((unsigned) time(NULL));
|
||||
|
||||
for (;;) {
|
||||
ssize_t r;
|
||||
|
|
@ -62,7 +62,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
l = pa_memblock_get_length(c.memblock) - c.index;
|
||||
|
||||
l = l <= 1 ? l : rand() % (l-1) +1 ;
|
||||
l = l <= 1 ? l : (size_t) rand() % (l-1) +1;
|
||||
|
||||
p = pa_memblock_acquire(c.memblock);
|
||||
|
||||
|
|
@ -74,11 +74,11 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
pa_memblock_release(c.memblock);
|
||||
|
||||
c.length = r;
|
||||
c.length = (size_t) r;
|
||||
pa_mcalign_push(a, &c);
|
||||
fprintf(stderr, "Read %ld bytes\n", (long)r);
|
||||
|
||||
c.index += r;
|
||||
c.index += (size_t) r;
|
||||
|
||||
if (c.index >= pa_memblock_get_length(c.memblock)) {
|
||||
pa_memblock_unref(c.memblock);
|
||||
|
|
|
|||
|
|
@ -166,16 +166,16 @@ static pa_memblock* generate_block(pa_mempool *pool, const pa_sample_spec *ss) {
|
|||
case PA_SAMPLE_FLOAT32RE: {
|
||||
float *u = d;
|
||||
|
||||
u[0] = 0.0;
|
||||
u[1] = -1.0;
|
||||
u[2] = 1.0;
|
||||
u[3] = 4711;
|
||||
u[4] = 0.222;
|
||||
u[5] = 0.33;
|
||||
u[6] = -.3;
|
||||
u[7] = 99;
|
||||
u[8] = -0.555;
|
||||
u[9] = -.123;
|
||||
u[0] = 0.0f;
|
||||
u[1] = -1.0f;
|
||||
u[2] = 1.0f;
|
||||
u[3] = 4711.0f;
|
||||
u[4] = 0.222f;
|
||||
u[5] = 0.33f;
|
||||
u[6] = -.3f;
|
||||
u[7] = 99.0f;
|
||||
u[8] = -0.555f;
|
||||
u[9] = -.123f;
|
||||
|
||||
if (ss->format == PA_SAMPLE_FLOAT32RE)
|
||||
for (i = 0; i < 10; i++)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ int main(int argc, char*argv[]) {
|
|||
}
|
||||
|
||||
/* ... and play it */
|
||||
if (pa_simple_write(s, buf, r, &error) < 0) {
|
||||
if (pa_simple_write(s, buf, (size_t) r, &error) < 0) {
|
||||
fprintf(stderr, __FILE__": pa_simple_write() failed: %s\n", pa_strerror(error));
|
||||
goto finish;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ static ssize_t loop_write(int fd, const void*data, size_t size) {
|
|||
|
||||
ret += r;
|
||||
data = (const uint8_t*) data + r;
|
||||
size -= r;
|
||||
size -= (size_t) r;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -80,6 +80,9 @@ int main(int argc, char*argv[]) {
|
|||
goto finish;
|
||||
}
|
||||
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
/* And write it to STDOUT */
|
||||
if ((r = loop_write(STDOUT_FILENO, buf, sizeof(buf))) <= 0) {
|
||||
fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));
|
||||
|
|
|
|||
|
|
@ -166,16 +166,16 @@ static pa_memblock* generate_block(pa_mempool *pool, const pa_sample_spec *ss) {
|
|||
case PA_SAMPLE_FLOAT32RE: {
|
||||
float *u = d;
|
||||
|
||||
u[0] = 0.0;
|
||||
u[1] = -1.0;
|
||||
u[2] = 1.0;
|
||||
u[3] = 4711;
|
||||
u[4] = 0.222;
|
||||
u[5] = 0.33;
|
||||
u[6] = -.3;
|
||||
u[7] = 99;
|
||||
u[8] = -0.555;
|
||||
u[9] = -.123;
|
||||
u[0] = 0.0f;
|
||||
u[1] = -1.0f;
|
||||
u[2] = 1.0f;
|
||||
u[3] = 4711.0f;
|
||||
u[4] = 0.222f;
|
||||
u[5] = 0.33f;
|
||||
u[6] = -.3f;
|
||||
u[7] = 99.0f;
|
||||
u[8] = -0.555f;
|
||||
u[9] = -.123f;
|
||||
|
||||
if (ss->format == PA_SAMPLE_FLOAT32RE)
|
||||
for (i = 0; i < 10; i++)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ static void* work(void *p) {
|
|||
pa_assert_se(pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m) == 0);
|
||||
|
||||
CPU_ZERO(&mask);
|
||||
CPU_SET(PA_PTR_TO_INT(p), &mask);
|
||||
CPU_SET((size_t) PA_PTR_TO_INT(p), &mask);
|
||||
pa_assert_se(pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0);
|
||||
|
||||
for (;;) {
|
||||
|
|
@ -65,17 +65,17 @@ static void* work(void *p) {
|
|||
pa_assert_se(clock_gettime(CLOCK_REALTIME, &end) == 0);
|
||||
|
||||
nsec =
|
||||
(uint64_t) ((((double) rand())*(msec_upper-msec_lower)*PA_NSEC_PER_MSEC)/RAND_MAX) +
|
||||
(uint64_t) (msec_lower*PA_NSEC_PER_MSEC);
|
||||
(uint64_t) ((((double) rand())*(double)(msec_upper-msec_lower)*PA_NSEC_PER_MSEC)/RAND_MAX) +
|
||||
(uint64_t) ((uint64_t) msec_lower*PA_NSEC_PER_MSEC);
|
||||
|
||||
pa_log_notice("CPU%i: Freezing for %ims", PA_PTR_TO_INT(p), (int) (nsec/PA_NSEC_PER_MSEC));
|
||||
|
||||
end.tv_sec += nsec / PA_NSEC_PER_SEC;
|
||||
end.tv_nsec += nsec % PA_NSEC_PER_SEC;
|
||||
end.tv_sec += (time_t) (nsec / PA_NSEC_PER_SEC);
|
||||
end.tv_nsec += (long int) (nsec % PA_NSEC_PER_SEC);
|
||||
|
||||
while ((pa_usec_t) end.tv_nsec > PA_NSEC_PER_SEC) {
|
||||
end.tv_sec++;
|
||||
end.tv_nsec -= PA_NSEC_PER_SEC;
|
||||
end.tv_nsec -= (long int) PA_NSEC_PER_SEC;
|
||||
}
|
||||
|
||||
do {
|
||||
|
|
@ -88,7 +88,7 @@ static void* work(void *p) {
|
|||
int main(int argc, char*argv[]) {
|
||||
int n;
|
||||
|
||||
srand(time(NULL));
|
||||
srand((unsigned) time(NULL));
|
||||
|
||||
if (argc >= 3) {
|
||||
msec_lower = atoi(argv[1]);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ int main(int argc, char*argv[]) {
|
|||
for (x = 0, u = 0; x < PA_USEC_PER_SEC * 10; x += PA_USEC_PER_MSEC) {
|
||||
|
||||
while (u < PA_ELEMENTSOF(msec) && (pa_usec_t) msec[u]*PA_USEC_PER_MSEC < x) {
|
||||
pa_smoother_put(s, msec[u]*PA_USEC_PER_MSEC, msec[u+1]*PA_USEC_PER_MSEC);
|
||||
pa_smoother_put(s, (pa_usec_t) msec[u] * PA_USEC_PER_MSEC, (pa_usec_t) msec[u+1] * PA_USEC_PER_MSEC);
|
||||
printf("%i\t\t%i\n", msec[u], msec[u+1]);
|
||||
u += 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ int main(int argc, char *argv[]) {
|
|||
uint8_t *zero;
|
||||
|
||||
pa_assert_se(argc >= 2);
|
||||
pa_assert_se((granularity = atoi(argv[1])) >= 1);
|
||||
pa_assert_se((granularity = (size_t) atoi(argv[1])) >= 1);
|
||||
pa_assert_se((i = (argc >= 3) ? fopen(argv[2], "r") : stdin));
|
||||
pa_assert_se((o = (argc >= 4) ? fopen(argv[3], "w") : stdout));
|
||||
|
||||
|
|
@ -53,11 +53,11 @@ int main(int argc, char *argv[]) {
|
|||
if (found)
|
||||
pa_assert_se(fwrite(buffer, granularity, k, o) == k);
|
||||
else {
|
||||
for (p = buffer; (p-buffer)/granularity < k; p += granularity)
|
||||
for (p = buffer; ((size_t) (p-buffer)/granularity) < k; p += granularity)
|
||||
if (memcmp(p, zero, granularity)) {
|
||||
size_t left;
|
||||
found = TRUE;
|
||||
left = k - (p-buffer)/granularity;
|
||||
left = (size_t) (k - (size_t) (p-buffer)/granularity);
|
||||
pa_assert_se(fwrite(p, granularity, left, o) == left);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ static void stream_state_callback(pa_stream *s, void *userdata) {
|
|||
|
||||
fprintf(stderr, "Writing data to stream %i.\n", i);
|
||||
|
||||
r = pa_stream_write(s, data, sizeof(data), nop_free_cb, sizeof(data) * i, PA_SEEK_ABSOLUTE);
|
||||
r = pa_stream_write(s, data, sizeof(data), nop_free_cb, (int64_t) sizeof(data) * (int64_t) i, PA_SEEK_ABSOLUTE);
|
||||
assert(r == 0);
|
||||
|
||||
/* Be notified when this stream is drained */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue