diff options
-rw-r--r-- | usr.bin/make/buf.c | 32 | ||||
-rw-r--r-- | usr.bin/make/buf.h | 30 | ||||
-rw-r--r-- | usr.bin/make/var_modify.c | 2 |
3 files changed, 32 insertions, 32 deletions
diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c index 3d43423..190b2aa 100644 --- a/usr.bin/make/buf.c +++ b/usr.bin/make/buf.c @@ -93,7 +93,7 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ void -Buf_OvAddByte(Buffer bp, int byte) +Buf_OvAddByte(Buffer bp, Byte byte) { bp->left = 0; @@ -122,7 +122,7 @@ Buf_OvAddByte(Buffer bp, int byte) *----------------------------------------------------------------------- */ void -Buf_AddBytes(Buffer bp, int numBytes, const Byte *bytesPtr) +Buf_AddBytes(Buffer bp, size_t numBytes, const Byte *bytesPtr) { BufExpand(bp, numBytes); @@ -151,7 +151,7 @@ Buf_AddBytes(Buffer bp, int numBytes, const Byte *bytesPtr) *----------------------------------------------------------------------- */ void -Buf_UngetByte(Buffer bp, int byte) +Buf_UngetByte(Buffer bp, Byte byte) { if (bp->outPtr != bp->buffer) { @@ -171,7 +171,7 @@ Buf_UngetByte(Buffer bp, int byte) * usually push back many bytes when they're doing it a byte at * a time... */ - int numBytes = bp->inPtr - bp->outPtr; + size_t numBytes = bp->inPtr - bp->outPtr; Byte *newBuf; newBuf = emalloc(bp->size + BUF_UNGET_INC); @@ -201,18 +201,18 @@ Buf_UngetByte(Buffer bp, int byte) *----------------------------------------------------------------------- */ void -Buf_UngetBytes(Buffer bp, int numBytes, Byte *bytesPtr) +Buf_UngetBytes(Buffer bp, size_t numBytes, Byte *bytesPtr) { - if (bp->outPtr - bp->buffer >= numBytes) { + if ((size_t)(bp->outPtr - bp->buffer) >= numBytes) { bp->outPtr -= numBytes; memcpy(bp->outPtr, bytesPtr, numBytes); } else if (bp->outPtr == bp->inPtr) { Buf_AddBytes(bp, numBytes, bytesPtr); } else { - int curNumBytes = bp->inPtr - bp->outPtr; + size_t curNumBytes = bp->inPtr - bp->outPtr; Byte *newBuf; - int newBytes = max(numBytes, BUF_UNGET_INC); + size_t newBytes = max(numBytes, BUF_UNGET_INC); newBuf = emalloc(bp->size + newBytes); memcpy(newBuf + newBytes, bp->outPtr, curNumBytes + 1); @@ -274,10 +274,10 @@ Buf_GetByte(Buffer bp) *----------------------------------------------------------------------- */ int -Buf_GetBytes(Buffer bp, int numBytes, Byte *bytesPtr) +Buf_GetBytes(Buffer bp, size_t numBytes, Byte *bytesPtr) { - if (bp->inPtr - bp->outPtr < numBytes) + if ((size_t)(bp->inPtr - bp->outPtr) < numBytes) numBytes = bp->inPtr - bp->outPtr; memcpy(bytesPtr, bp->outPtr, numBytes); @@ -305,7 +305,7 @@ Buf_GetBytes(Buffer bp, int numBytes, Byte *bytesPtr) *----------------------------------------------------------------------- */ Byte * -Buf_GetAll(Buffer bp, int *numBytesPtr) +Buf_GetAll(Buffer bp, size_t *numBytesPtr) { if (numBytesPtr != NULL) @@ -328,10 +328,10 @@ Buf_GetAll(Buffer bp, int *numBytesPtr) *----------------------------------------------------------------------- */ void -Buf_Discard(Buffer bp, int numBytes) +Buf_Discard(Buffer bp, size_t numBytes) { - if (bp->inPtr - bp->outPtr <= numBytes) { + if ((size_t)(bp->inPtr - bp->outPtr) <= numBytes) { bp->inPtr = bp->outPtr = bp->buffer; bp->left = bp->size; *bp->inPtr = 0; @@ -353,7 +353,7 @@ Buf_Discard(Buffer bp, int numBytes) * *----------------------------------------------------------------------- */ -int +size_t Buf_Size(Buffer buf) { @@ -376,7 +376,7 @@ Buf_Size(Buffer buf) *----------------------------------------------------------------------- */ Buffer -Buf_Init(int size) +Buf_Init(size_t size) { Buffer bp; /* New Buffer */ @@ -430,7 +430,7 @@ Buf_Destroy(Buffer buf, Boolean freeData) *----------------------------------------------------------------------- */ void -Buf_ReplaceLastByte(Buffer buf, int byte) +Buf_ReplaceLastByte(Buffer buf, Byte byte) { if (buf->inPtr == buf->outPtr) Buf_AddByte(buf, byte); diff --git a/usr.bin/make/buf.h b/usr.bin/make/buf.h index 7006153..3f948ed 100644 --- a/usr.bin/make/buf.h +++ b/usr.bin/make/buf.h @@ -53,11 +53,11 @@ typedef char Byte; typedef struct Buffer { - int size; /* Current size of the buffer */ - int left; /* Space left (== size - (inPtr - buffer)) */ - Byte *buffer; /* The buffer itself */ - Byte *inPtr; /* Place to write to */ - Byte *outPtr; /* Place to read from */ + size_t size; /* Current size of the buffer */ + size_t left; /* Space left (== size - (inPtr - buffer)) */ + Byte *buffer; /* The buffer itself */ + Byte *inPtr; /* Place to write to */ + Byte *outPtr; /* Place to read from */ } *Buffer; /* Buf_AddByte adds a single byte to a buffer. */ @@ -67,17 +67,17 @@ typedef struct Buffer { #define BUF_ERROR 256 -void Buf_OvAddByte(Buffer, int); -void Buf_AddBytes(Buffer, int, const Byte *); -void Buf_UngetByte(Buffer, int); -void Buf_UngetBytes(Buffer, int, Byte *); +void Buf_OvAddByte(Buffer, Byte); +void Buf_AddBytes(Buffer, size_t, const Byte *); +void Buf_UngetByte(Buffer, Byte); +void Buf_UngetBytes(Buffer, size_t, Byte *); int Buf_GetByte(Buffer); -int Buf_GetBytes(Buffer, int, Byte *); -Byte *Buf_GetAll(Buffer, int *); -void Buf_Discard(Buffer, int); -int Buf_Size(Buffer); -Buffer Buf_Init(int); +int Buf_GetBytes(Buffer, size_t, Byte *); +Byte *Buf_GetAll(Buffer, size_t *); +void Buf_Discard(Buffer, size_t); +size_t Buf_Size(Buffer); +Buffer Buf_Init(size_t); void Buf_Destroy(Buffer, Boolean); -void Buf_ReplaceLastByte(Buffer, int); +void Buf_ReplaceLastByte(Buffer, Byte); #endif /* _BUF_H */ diff --git a/usr.bin/make/var_modify.c b/usr.bin/make/var_modify.c index 2a7043e..3d51f6a 100644 --- a/usr.bin/make/var_modify.c +++ b/usr.bin/make/var_modify.c @@ -408,7 +408,7 @@ VarSubstitute(const char *word, Boolean addSpace, Buffer buf, void *patternp) * buffer. */ Boolean done; - int origSize; + size_t origSize; done = FALSE; origSize = Buf_Size(buf); |