2001-02-04 01:28:45 +00:00
|
|
|
#include "byte.h"
|
|
|
|
#include "buffer.h"
|
|
|
|
|
2006-11-07 17:56:05 +00:00
|
|
|
int buffer_putalign(buffer* b,const char* buf,size_t len) {
|
2014-03-14 19:42:54 +00:00
|
|
|
size_t tmp;
|
2001-11-25 22:37:38 +00:00
|
|
|
while (len>(tmp=b->a-b->p)) {
|
2001-02-04 01:28:45 +00:00
|
|
|
byte_copy(b->x+b->p, tmp, buf);
|
|
|
|
b->p+=tmp;
|
|
|
|
buf+=tmp;
|
|
|
|
len-=tmp;
|
|
|
|
if (buffer_flush(b)<0) return -1;
|
|
|
|
}
|
|
|
|
byte_copy(b->x+b->p, len, buf);
|
|
|
|
b->p+=len;
|
|
|
|
return 0;
|
|
|
|
}
|