Пример #1
0
/**
 * Add bytes to the buffer.
 */
void
Buf_AddBytes(Buffer *bp, size_t len, const char bytes[])
{
	BufExpand(bp, len);

	memcpy(bp->end, bytes, len);
	bp->end += len;
	*bp->end = '\0';
}
Пример #2
0
/**
 * Add a single byte to the buffer.
 */
inline void
Buf_AddByte(Buffer *bp, char byte)
{
	BufExpand(bp, 1);

	*bp->end = byte;
	bp->end++;
	*bp->end = '\0';
}
Пример #3
0
/**
 * Add a single byte to the buffer.
 */
void
Buf_AddByte(Buffer *bp, Byte byte)
{

	BufExpand(bp, 1);

	*bp->end = byte;
	bp->end++;
	*bp->end = '\0';
}
Пример #4
0
/*-
 *-----------------------------------------------------------------------
 * Buf_AddBytes --
 *	Add a number of bytes to the buffer.
 *
 * Results:
 *	None.
 *
 * Side Effects:
 *	Guess what?
 *
 *-----------------------------------------------------------------------
 */
void
Buf_AddBytes(Buffer bp, int numBytes, const Byte *bytesPtr)
{

    BufExpand(bp, numBytes);

    memcpy(bp->inPtr, bytesPtr, numBytes);
    bp->inPtr += numBytes;
    bp->left -= numBytes;

    /*
     * Null-terminate
     */
    *bp->inPtr = 0;
}
Пример #5
0
/*-
 *-----------------------------------------------------------------------
 * Buf_OvAddByte --
 *	Add a single byte to the buffer.  left is zero or negative.
 *
 * Results:
 *	None.
 *
 * Side Effects:
 *	The buffer may be expanded.
 *
 *-----------------------------------------------------------------------
 */
void
Buf_OvAddByte(Buffer bp, int byte)
{
    int nbytes = 1;
    bp->left = 0;
    BufExpand(bp, nbytes);

    *bp->inPtr++ = byte;
    bp->left--;

    /*
     * Null-terminate
     */
    *bp->inPtr = 0;
}