mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Patch from Mats Palmgren for bug 424558 (r=me).
This commit is contained in:
parent
e0c72a18bd
commit
9718113bc4
@ -555,13 +555,18 @@ SprintEnsureBuffer(Sprinter *sp, size_t len)
|
|||||||
static ptrdiff_t
|
static ptrdiff_t
|
||||||
SprintPut(Sprinter *sp, const char *s, size_t len)
|
SprintPut(Sprinter *sp, const char *s, size_t len)
|
||||||
{
|
{
|
||||||
ptrdiff_t offset;
|
ptrdiff_t offset = sp->size; /* save old size */
|
||||||
char *bp;
|
char *bp = sp->base; /* save old base */
|
||||||
|
|
||||||
/* Allocate space for s, including the '\0' at the end. */
|
/* Allocate space for s, including the '\0' at the end. */
|
||||||
if (!SprintEnsureBuffer(sp, len))
|
if (!SprintEnsureBuffer(sp, len))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (sp->base != bp && /* buffer was realloc'ed */
|
||||||
|
s >= bp && s < bp + offset) { /* s was within the buffer */
|
||||||
|
s = sp->base + (s - bp); /* this is where it lives now */
|
||||||
|
}
|
||||||
|
|
||||||
/* Advance offset and copy s into sp's buffer. */
|
/* Advance offset and copy s into sp's buffer. */
|
||||||
offset = sp->offset;
|
offset = sp->offset;
|
||||||
sp->offset += len;
|
sp->offset += len;
|
||||||
|
Loading…
Reference in New Issue
Block a user