mirror of https://github.com/ericonr/sndio.git
fix signedness warnings
This commit is contained in:
parent
ea0d66a62d
commit
ab4a96fb39
|
@ -72,7 +72,7 @@ abuf_done(struct abuf *buf)
|
||||||
* Get a pointer to the readable block
|
* Get a pointer to the readable block
|
||||||
*/
|
*/
|
||||||
unsigned char *
|
unsigned char *
|
||||||
abuf_rgetblk(struct abuf *buf, unsigned int *rsize)
|
abuf_rgetblk(struct abuf *buf, int *rsize)
|
||||||
{
|
{
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
||||||
|
@ -87,10 +87,10 @@ abuf_rgetblk(struct abuf *buf, unsigned int *rsize)
|
||||||
* Discard the block at the start postion.
|
* Discard the block at the start postion.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
abuf_rdiscard(struct abuf *buf, unsigned int count)
|
abuf_rdiscard(struct abuf *buf, int count)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (count > buf->used) {
|
if (count < 0 || count > buf->used) {
|
||||||
log_puts("abuf_rdiscard: bad count = ");
|
log_puts("abuf_rdiscard: bad count = ");
|
||||||
log_putu(count);
|
log_putu(count);
|
||||||
log_puts("\n");
|
log_puts("\n");
|
||||||
|
@ -107,10 +107,10 @@ abuf_rdiscard(struct abuf *buf, unsigned int count)
|
||||||
* Commit the data written at the end postion.
|
* Commit the data written at the end postion.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
abuf_wcommit(struct abuf *buf, unsigned int count)
|
abuf_wcommit(struct abuf *buf, int count)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (count > (buf->len - buf->used)) {
|
if (count < 0 || count > (buf->len - buf->used)) {
|
||||||
log_puts("abuf_wcommit: bad count = ");
|
log_puts("abuf_wcommit: bad count = ");
|
||||||
log_putu(count);
|
log_putu(count);
|
||||||
log_puts("\n");
|
log_puts("\n");
|
||||||
|
@ -124,9 +124,9 @@ abuf_wcommit(struct abuf *buf, unsigned int count)
|
||||||
* Get a pointer to the writable block
|
* Get a pointer to the writable block
|
||||||
*/
|
*/
|
||||||
unsigned char *
|
unsigned char *
|
||||||
abuf_wgetblk(struct abuf *buf, unsigned int *rsize)
|
abuf_wgetblk(struct abuf *buf, int *rsize)
|
||||||
{
|
{
|
||||||
unsigned int end, avail, count;
|
int end, avail, count;
|
||||||
|
|
||||||
end = buf->start + buf->used;
|
end = buf->start + buf->used;
|
||||||
if (end >= buf->len)
|
if (end >= buf->len)
|
||||||
|
|
|
@ -18,19 +18,19 @@
|
||||||
#define ABUF_H
|
#define ABUF_H
|
||||||
|
|
||||||
struct abuf {
|
struct abuf {
|
||||||
unsigned int bpf; /* bytes per frames */
|
int bpf; /* bytes per frames */
|
||||||
unsigned int start; /* offset (frames) where stored data starts */
|
int start; /* offset (frames) where stored data starts */
|
||||||
unsigned int used; /* frames stored in the buffer */
|
int used; /* frames stored in the buffer */
|
||||||
unsigned int len; /* total size of the buffer (frames) */
|
int len; /* total size of the buffer (frames) */
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
void abuf_init(struct abuf *, unsigned int, unsigned int);
|
void abuf_init(struct abuf *, unsigned int, unsigned int);
|
||||||
void abuf_done(struct abuf *);
|
void abuf_done(struct abuf *);
|
||||||
void abuf_log(struct abuf *);
|
void abuf_log(struct abuf *);
|
||||||
unsigned char *abuf_rgetblk(struct abuf *, unsigned int *);
|
unsigned char *abuf_rgetblk(struct abuf *, int *);
|
||||||
unsigned char *abuf_wgetblk(struct abuf *, unsigned int *);
|
unsigned char *abuf_wgetblk(struct abuf *, int *);
|
||||||
void abuf_rdiscard(struct abuf *, unsigned int);
|
void abuf_rdiscard(struct abuf *, int);
|
||||||
void abuf_wcommit(struct abuf *, unsigned int);
|
void abuf_wcommit(struct abuf *, int);
|
||||||
|
|
||||||
#endif /* !defined(ABUF_H) */
|
#endif /* !defined(ABUF_H) */
|
||||||
|
|
|
@ -442,13 +442,11 @@ filelist_init(void)
|
||||||
it.it_interval.tv_usec = TIMER_USEC;
|
it.it_interval.tv_usec = TIMER_USEC;
|
||||||
it.it_value.tv_sec = 0;
|
it.it_value.tv_sec = 0;
|
||||||
it.it_value.tv_usec = TIMER_USEC;
|
it.it_value.tv_usec = TIMER_USEC;
|
||||||
#if 0
|
|
||||||
if (setitimer(ITIMER_REAL, &it, NULL) < 0) {
|
if (setitimer(ITIMER_REAL, &it, NULL) < 0) {
|
||||||
perror("setitimer");
|
perror("setitimer");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
log_sync = 0;
|
log_sync = 0;
|
||||||
#endif
|
|
||||||
timo_init();
|
timo_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ int
|
||||||
midi_in(struct midi *ep)
|
midi_in(struct midi *ep)
|
||||||
{
|
{
|
||||||
unsigned char c, *idata;
|
unsigned char c, *idata;
|
||||||
unsigned int i, icount;
|
int i, icount;
|
||||||
|
|
||||||
if (ep->ibuf.used == 0)
|
if (ep->ibuf.used == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -309,7 +309,7 @@ void
|
||||||
midi_out(struct midi *oep, unsigned char *idata, int icount)
|
midi_out(struct midi *oep, unsigned char *idata, int icount)
|
||||||
{
|
{
|
||||||
unsigned char *odata;
|
unsigned char *odata;
|
||||||
unsigned ocount;
|
int ocount;
|
||||||
|
|
||||||
while (icount > 0) {
|
while (icount > 0) {
|
||||||
if (oep->obuf.used == oep->obuf.len) {
|
if (oep->obuf.used == oep->obuf.len) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ miofile_in(void *arg)
|
||||||
struct miofile *f = arg;
|
struct miofile *f = arg;
|
||||||
struct midi *ep = f->port->midi;
|
struct midi *ep = f->port->midi;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
unsigned int n, count;
|
int n, count;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
data = abuf_wgetblk(&ep->ibuf, &count);
|
data = abuf_wgetblk(&ep->ibuf, &count);
|
||||||
|
@ -124,7 +124,7 @@ miofile_out(void *arg)
|
||||||
struct miofile *f = arg;
|
struct miofile *f = arg;
|
||||||
struct midi *ep = f->port->midi;
|
struct midi *ep = f->port->midi;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
unsigned int n, count;
|
int n, count;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
data = abuf_rgetblk(&ep->obuf, &count);
|
data = abuf_rgetblk(&ep->obuf, &count);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <grp.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
|
@ -507,9 +507,8 @@ int
|
||||||
sock_rdata(struct sock *f)
|
sock_rdata(struct sock *f)
|
||||||
{
|
{
|
||||||
struct abuf *buf;
|
struct abuf *buf;
|
||||||
unsigned int count;
|
unsigned char *data;
|
||||||
char *data;
|
int n, count;
|
||||||
int n;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (f->rtodo == 0) {
|
if (f->rtodo == 0) {
|
||||||
|
@ -581,10 +580,9 @@ int
|
||||||
sock_wdata(struct sock *f)
|
sock_wdata(struct sock *f)
|
||||||
{
|
{
|
||||||
static unsigned char dummy[AMSG_DATAMAX];
|
static unsigned char dummy[AMSG_DATAMAX];
|
||||||
int n;
|
unsigned char *data = NULL;
|
||||||
char *data = NULL;
|
|
||||||
unsigned int count;
|
|
||||||
struct abuf *buf = NULL;
|
struct abuf *buf = NULL;
|
||||||
|
int n, count;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (f->wtodo == 0) {
|
if (f->wtodo == 0) {
|
||||||
|
|
Loading…
Reference in New Issue