# define VIR_BUFFER_INITIALIZER { 0, 0, 0, 0, NULL }
struct _virBuffer {
- unsigned int size;
- unsigned int use;
+ size_t size;
+ size_t use;
unsigned int error; /* errno value, or -1 for usage error */
int indent;
char *content;
# define virBufferCheckError(buf) \
virBufferCheckErrorInternal(buf, VIR_FROM_THIS, __FILE__, __FUNCTION__, \
__LINE__)
-unsigned int virBufferUse(const virBuffer *buf);
+size_t virBufferUse(const virBuffer *buf);
void virBufferAdd(virBufferPtr buf, const char *str, int len);
void virBufferAddBuffer(virBufferPtr buf, virBufferPtr toadd);
void virBufferAddChar(virBufferPtr buf, char c);
char *addstr = NULL, *bufret = NULL;
int ret = -1;
const struct testInfo *info = data;
+ int len;
virBufferAddChar(buf, 'a');
* which was the case after the above addchar at the time of the bug.
* This test is a bit fragile, since it relies on virBuffer internals.
*/
- if (virAsprintf(&addstr, "%*s", buf->size - buf->use - 1, "a") < 0)
+ len = buf->size - buf->use - 1;
+ if (virAsprintf(&addstr, "%*s", len, "a") < 0)
goto out;
if (info->doEscape)