113 |
} |
} |
114 |
|
|
115 |
/* We must have: 0 <= offset < b->total_size */ |
/* We must have: 0 <= offset < b->total_size */ |
116 |
int eb_read(EditBuffer *b, int offset, u8 *buf, int size) |
int eb_read(EditBuffer *b, int offset, void *buf, int size) |
117 |
{ |
{ |
118 |
return eb_rw(b, offset, buf, size, 0); |
return eb_rw(b, offset, buf, size, 0); |
119 |
} |
} |
120 |
|
|
121 |
/* Note: eb_write can be used to insert after the end of the buffer */ |
/* Note: eb_write can be used to insert after the end of the buffer */ |
122 |
void eb_write(EditBuffer *b, int offset, u8 *buf, int size) |
void eb_write(EditBuffer *b, int offset, void *buf_arg, int size) |
123 |
{ |
{ |
124 |
int len, left; |
int len, left; |
125 |
|
u8 *buf = buf_arg; |
126 |
|
|
127 |
len = eb_rw(b, offset, buf, size, 1); |
len = eb_rw(b, offset, buf, size, 1); |
128 |
left = size - len; |
left = size - len; |
331 |
|
|
332 |
/* Insert 'size' bytes from 'buf' into 'b' at offset 'offset'. We must |
/* Insert 'size' bytes from 'buf' into 'b' at offset 'offset'. We must |
333 |
have : 0 <= offset <= b->total_size */ |
have : 0 <= offset <= b->total_size */ |
334 |
void eb_insert(EditBuffer *b, int offset, const u8 *buf, int size) |
void eb_insert(EditBuffer *b, int offset, const void *buf, int size) |
335 |
{ |
{ |
336 |
eb_addlog(b, LOGOP_INSERT, offset, size); |
eb_addlog(b, LOGOP_INSERT, offset, size); |
337 |
|
|