From f940655fc3e16613c7dcec4537b16544366a6de1 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 2 Dec 2008 01:26:01 +0000 Subject: Rather less memory corruption. svn path=/trunk/libcss/; revision=5869 --- src/parse/properties.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/parse/properties.c b/src/parse/properties.c index 3e5ca88..b531f90 100644 --- a/src/parse/properties.c +++ b/src/parse/properties.c @@ -880,17 +880,17 @@ css_error parse_background_position(css_language *c, /* Copy the bytecode to it */ memcpy((*result)->bytecode, &opv, sizeof(opv)); if ((flags & FLAG_INHERIT) == false) { + uint8_t *ptr = ((uint8_t *) (*result)->bytecode) + sizeof(opv); if (value[0] == BACKGROUND_POSITION_HORZ_SET) { - memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv), - &length[0], sizeof(length)); - memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv) + - sizeof(length), &unit[0], sizeof(unit)); + memcpy(ptr, &length[0], sizeof(length[0])); + ptr += sizeof(length[0]); + memcpy(ptr, &unit[0], sizeof(unit[0])); + ptr += sizeof(unit[0]); } if (value[1] == BACKGROUND_POSITION_VERT_SET) { - memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv), - &length[1], sizeof(length)); - memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv) + - sizeof(length), &unit[1], sizeof(unit)); + memcpy(ptr, &length[1], sizeof(length[1])); + ptr += sizeof(length[1]); + memcpy(ptr, &unit[1], sizeof(unit[1])); } } -- cgit v1.2.3