mirror of https://github.com/xemu-project/xemu.git
hw/audio/es1370: change variable type and name
Change the type of the variable temp to size_t to avoid a type cast. While at it, rename the variable name to to_transfer. This improves the readability of the code. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: BALATON Zoltan <balaton@eik.bme.hu> Message-Id: <20230917065813.6692-7-vr_qemu@t-online.de>
This commit is contained in:
parent
02e7de686a
commit
ca98851835
|
@ -605,6 +605,7 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
|
||||||
int max, int *irq)
|
int max, int *irq)
|
||||||
{
|
{
|
||||||
uint8_t tmpbuf[4096];
|
uint8_t tmpbuf[4096];
|
||||||
|
size_t to_transfer;
|
||||||
uint32_t addr = d->frame_addr;
|
uint32_t addr = d->frame_addr;
|
||||||
int sc = d->scount & 0xffff;
|
int sc = d->scount & 0xffff;
|
||||||
int csc = d->scount >> 16;
|
int csc = d->scount >> 16;
|
||||||
|
@ -616,16 +617,16 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
|
||||||
}
|
}
|
||||||
int left = ((size - cnt + 1) << 2) + d->leftover;
|
int left = ((size - cnt + 1) << 2) + d->leftover;
|
||||||
int transferred = 0;
|
int transferred = 0;
|
||||||
int temp = MIN (max, MIN (left, csc_bytes));
|
|
||||||
int index = d - &s->chan[0];
|
int index = d - &s->chan[0];
|
||||||
|
|
||||||
|
to_transfer = MIN(max, MIN(left, csc_bytes));
|
||||||
addr += (cnt << 2) + d->leftover;
|
addr += (cnt << 2) + d->leftover;
|
||||||
|
|
||||||
if (index == ADC_CHANNEL) {
|
if (index == ADC_CHANNEL) {
|
||||||
while (temp > 0) {
|
while (to_transfer > 0) {
|
||||||
int acquired, to_copy;
|
int acquired, to_copy;
|
||||||
|
|
||||||
to_copy = MIN ((size_t) temp, sizeof (tmpbuf));
|
to_copy = MIN(to_transfer, sizeof(tmpbuf));
|
||||||
acquired = AUD_read (s->adc_voice, tmpbuf, to_copy);
|
acquired = AUD_read (s->adc_voice, tmpbuf, to_copy);
|
||||||
if (!acquired) {
|
if (!acquired) {
|
||||||
break;
|
break;
|
||||||
|
@ -633,23 +634,23 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
|
||||||
|
|
||||||
pci_dma_write (&s->dev, addr, tmpbuf, acquired);
|
pci_dma_write (&s->dev, addr, tmpbuf, acquired);
|
||||||
|
|
||||||
temp -= acquired;
|
to_transfer -= acquired;
|
||||||
addr += acquired;
|
addr += acquired;
|
||||||
transferred += acquired;
|
transferred += acquired;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SWVoiceOut *voice = s->dac_voice[index];
|
SWVoiceOut *voice = s->dac_voice[index];
|
||||||
|
|
||||||
while (temp > 0) {
|
while (to_transfer > 0) {
|
||||||
int copied, to_copy;
|
int copied, to_copy;
|
||||||
|
|
||||||
to_copy = MIN ((size_t) temp, sizeof (tmpbuf));
|
to_copy = MIN(to_transfer, sizeof(tmpbuf));
|
||||||
pci_dma_read (&s->dev, addr, tmpbuf, to_copy);
|
pci_dma_read (&s->dev, addr, tmpbuf, to_copy);
|
||||||
copied = AUD_write (voice, tmpbuf, to_copy);
|
copied = AUD_write (voice, tmpbuf, to_copy);
|
||||||
if (!copied) {
|
if (!copied) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
temp -= copied;
|
to_transfer -= copied;
|
||||||
addr += copied;
|
addr += copied;
|
||||||
transferred += copied;
|
transferred += copied;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue