mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
only copy when arg size lager than new content size
This commit is contained in:
parent
bef0a22ba9
commit
8b9b124bd5
@ -101,8 +101,9 @@ uint8_t* content_setContent(uint8_t* self, uint8_t* content, uint16_t size) {
|
|||||||
/* malloc */
|
/* malloc */
|
||||||
return content_init("", ARG_TYPE_NONE, content, size, NULL);
|
return content_init("", ARG_TYPE_NONE, content, size, NULL);
|
||||||
}
|
}
|
||||||
/* no alloc */
|
|
||||||
if (content_getSize(self) == size) {
|
/* only copy */
|
||||||
|
if (content_getSize(self) >= size) {
|
||||||
__platform_memcpy(((__arg*)self)->content, content, size);
|
__platform_memcpy(((__arg*)self)->content, content, size);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user