Ejemplo n.º 1
0
int AddWinMsgRend(WinMsgBuf *winmsg, const char *str, uint64_t r)
{
	if (winmsg->numrend >= MAX_WINMSG_REND || str < winmsg->buf || str >= winmsg->buf + MAXSTR)
		return -1;

	wmb_rendadd(winmsg, r, str - winmsg->buf);
	return 0;
}
Ejemplo n.º 2
0
/* Merges the contents of another null-terminated buffer and its renditions. The
 * return value is a pointer to the first character of WMB's buffer. */
char *wmbc_mergewmb(WinMsgBufContext *wmbc, WinMsgBuf *wmb)
{
	char *p;
	size_t offset = wmbc_offset(wmbc);
	int ri;

	/* import buffer contents into our own at our current position */
	assert(wmb);
	p = wmbc_strcpy(wmbc, wmb->buf);

	/* merge renditions, adjusting them to reflect their new offset */
	for (ri = 0; ri < wmb->numrend; ri++) {
		wmb_rendadd(wmbc->buf, wmb->rend[ri], offset + wmb->rendpos[ri]);
	}

	return p;
}