fix signedness warnings

This commit is contained in:
Alexandre Ratchov 2012-10-24 14:53:37 +02:00
parent ea0d66a62d
commit ab4a96fb39
7 changed files with 24 additions and 27 deletions

View File

@ -72,7 +72,7 @@ abuf_done(struct abuf *buf)
* Get a pointer to the readable block
*/
unsigned char *
abuf_rgetblk(struct abuf *buf, unsigned int *rsize)
abuf_rgetblk(struct abuf *buf, int *rsize)
{
unsigned int count;
@ -87,10 +87,10 @@ abuf_rgetblk(struct abuf *buf, unsigned int *rsize)
* Discard the block at the start postion.
*/
void
abuf_rdiscard(struct abuf *buf, unsigned int count)
abuf_rdiscard(struct abuf *buf, int count)
{
#ifdef DEBUG
if (count > buf->used) {
if (count < 0 || count > buf->used) {
log_puts("abuf_rdiscard: bad count = ");
log_putu(count);
log_puts("\n");
@ -107,10 +107,10 @@ abuf_rdiscard(struct abuf *buf, unsigned int count)
* Commit the data written at the end postion.
*/
void
abuf_wcommit(struct abuf *buf, unsigned int count)
abuf_wcommit(struct abuf *buf, int count)
{
#ifdef DEBUG
if (count > (buf->len - buf->used)) {
if (count < 0 || count > (buf->len - buf->used)) {
log_puts("abuf_wcommit: bad count = ");
log_putu(count);
log_puts("\n");
@ -124,9 +124,9 @@ abuf_wcommit(struct abuf *buf, unsigned int count)
* Get a pointer to the writable block
*/
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;
if (end >= buf->len)

View File

@ -18,19 +18,19 @@
#define ABUF_H
struct abuf {
unsigned int bpf; /* bytes per frames */
unsigned int start; /* offset (frames) where stored data starts */
unsigned int used; /* frames stored in the buffer */
unsigned int len; /* total size of the buffer (frames) */
int bpf; /* bytes per frames */
int start; /* offset (frames) where stored data starts */
int used; /* frames stored in the buffer */
int len; /* total size of the buffer (frames) */
unsigned char *data;
};
void abuf_init(struct abuf *, unsigned int, unsigned int);
void abuf_done(struct abuf *);
void abuf_log(struct abuf *);
unsigned char *abuf_rgetblk(struct abuf *, unsigned int *);
unsigned char *abuf_wgetblk(struct abuf *, unsigned int *);
void abuf_rdiscard(struct abuf *, unsigned int);
void abuf_wcommit(struct abuf *, unsigned int);
unsigned char *abuf_rgetblk(struct abuf *, int *);
unsigned char *abuf_wgetblk(struct abuf *, int *);
void abuf_rdiscard(struct abuf *, int);
void abuf_wcommit(struct abuf *, int);
#endif /* !defined(ABUF_H) */

View File

@ -442,13 +442,11 @@ filelist_init(void)
it.it_interval.tv_usec = TIMER_USEC;
it.it_value.tv_sec = 0;
it.it_value.tv_usec = TIMER_USEC;
#if 0
if (setitimer(ITIMER_REAL, &it, NULL) < 0) {
perror("setitimer");
exit(1);
}
log_sync = 0;
#endif
timo_init();
}

View File

@ -235,7 +235,7 @@ int
midi_in(struct midi *ep)
{
unsigned char c, *idata;
unsigned int i, icount;
int i, icount;
if (ep->ibuf.used == 0)
return 0;
@ -309,7 +309,7 @@ void
midi_out(struct midi *oep, unsigned char *idata, int icount)
{
unsigned char *odata;
unsigned ocount;
int ocount;
while (icount > 0) {
if (oep->obuf.used == oep->obuf.len) {

View File

@ -102,7 +102,7 @@ miofile_in(void *arg)
struct miofile *f = arg;
struct midi *ep = f->port->midi;
unsigned char *data;
unsigned int n, count;
int n, count;
for (;;) {
data = abuf_wgetblk(&ep->ibuf, &count);
@ -124,7 +124,7 @@ miofile_out(void *arg)
struct miofile *f = arg;
struct midi *ep = f->port->midi;
unsigned char *data;
unsigned int n, count;
int n, count;
for (;;) {
data = abuf_rgetblk(&ep->obuf, &count);

View File

@ -23,6 +23,7 @@
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <limits.h>
#include <pwd.h>
#include <signal.h>

View File

@ -507,9 +507,8 @@ int
sock_rdata(struct sock *f)
{
struct abuf *buf;
unsigned int count;
char *data;
int n;
unsigned char *data;
int n, count;
#ifdef DEBUG
if (f->rtodo == 0) {
@ -581,10 +580,9 @@ int
sock_wdata(struct sock *f)
{
static unsigned char dummy[AMSG_DATAMAX];
int n;
char *data = NULL;
unsigned int count;
unsigned char *data = NULL;
struct abuf *buf = NULL;
int n, count;
#ifdef DEBUG
if (f->wtodo == 0) {