- MmsValue_update function now allows adjusting octet-string size of target object

pull/143/head
Michael Zillgith 8 years ago
parent 33fb9206b3
commit f9030a8b4f

@ -239,7 +239,8 @@ MmsValue_update(MmsValue* self, const MmsValue* update)
memcpy(self->value.floatingPoint.buf, update->value.floatingPoint.buf,
self->value.floatingPoint.formatWidth / 8);
}
else return false;
else
return false;
break;
case MMS_INTEGER:
case MMS_UNSIGNED:
@ -254,16 +255,24 @@ MmsValue_update(MmsValue* self, const MmsValue* update)
case MMS_BIT_STRING:
if (self->value.bitString.size == update->value.bitString.size)
memcpy(self->value.bitString.buf, update->value.bitString.buf, bitStringByteSize(self));
else return false;
else
return false;
break;
case MMS_OCTET_STRING:
if (self->value.octetString.maxSize == update->value.octetString.maxSize) {
memcpy(self->value.octetString.buf, update->value.octetString.buf,
update->value.octetString.size);
{
int size = update->value.octetString.size;
self->value.octetString.size = update->value.octetString.size;
if (size > self->value.octetString.maxSize) {
GLOBAL_FREEMEM(self->value.octetString.buf);
self->value.octetString.buf = GLOBAL_MALLOC(size);
self->value.octetString.maxSize = size;
}
size = self->value.octetString.maxSize;
memcpy(self->value.octetString.buf, update->value.octetString.buf, size);
self->value.octetString.size = size;
}
else return false;
break;
case MMS_VISIBLE_STRING:
MmsValue_setVisibleString(self, update->value.visibleString.buf);

Loading…
Cancel
Save