mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
tests: Be careful with data types to avoid cast
use unsigned and size_t for counters and packet length, resp. Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
parent
974fd3bcfd
commit
72e5671ece
1 changed files with 9 additions and 9 deletions
|
|
@ -32,23 +32,23 @@
|
||||||
#include <pulsecore/iochannel.h>
|
#include <pulsecore/iochannel.h>
|
||||||
#include <pulsecore/memblock.h>
|
#include <pulsecore/memblock.h>
|
||||||
|
|
||||||
static int packets_received;
|
static unsigned packets_received;
|
||||||
static int packets_checksum;
|
static unsigned packets_checksum;
|
||||||
static int packets_length;
|
static size_t packets_length;
|
||||||
|
|
||||||
static void packet_received(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) {
|
static void packet_received(pa_pstream *p, pa_packet *packet, const pa_ancil *ancil, void *userdata) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
fail_unless(packets_length == (int) packet->length);
|
fail_unless(packets_length == packet->length);
|
||||||
packets_received++;
|
packets_received++;
|
||||||
for (i = 0; i < packet->length; i++)
|
for (i = 0; i < packet->length; i++)
|
||||||
packets_checksum += packet->data[i];
|
packets_checksum += packet->data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void packet_test(int npackets, int plength, pa_mainloop *ml, pa_pstream *p1, pa_pstream *p2) {
|
static void packet_test(unsigned npackets, size_t plength, pa_mainloop *ml, pa_pstream *p1, pa_pstream *p2) {
|
||||||
pa_packet *packet = pa_packet_new(plength);
|
pa_packet *packet = pa_packet_new(plength);
|
||||||
int i;
|
unsigned i;
|
||||||
int psum = 0, totalsum = 0;
|
unsigned psum = 0, totalsum = 0;
|
||||||
pa_log_info("Sending %d packets of length %d", npackets, plength);
|
pa_log_info("Sending %d packets of length %zd", npackets, plength);
|
||||||
packets_received = 0;
|
packets_received = 0;
|
||||||
packets_checksum = 0;
|
packets_checksum = 0;
|
||||||
packets_length = plength;
|
packets_length = plength;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue