-
-
Notifications
You must be signed in to change notification settings - Fork 725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tb_buffer_memncpyp会错误地改变目标缓冲区的大小 #208
Comments
是这样的,命名上稍微有点歧义,它不是常规的 memcpy ,目前是会 copy 完,自动收缩大小的。。其实应该算是 copy + init 。。复制过去,重新赋值整个 buffer 就比如 buffer 现在 size 100 多了。。再去这么 copy 下。也是整个完整重新赋值成 "abcde", size 变为 6 。。
tb_buffer_ 接口主要用于 buffer 的自动大小控制,自动分配,自动收缩。。而灵活 memcpy/memmov 不是主要目的,想要精细的 memcpy 。。可以自己 resize 后,走原生 tb_memcpy 去做 |
我前几日对 tb_buffer_memnsetp 也提了类似bug报告:#207 |
那个是 bug, hellAA 但是,写超了,不应该去 增长 size 变成 hellAAAAAA |
暂时没啥必要,如果用 memcpy,直接 tb_memcpy 就行了,tb_buffer 并没有简化多少,它主要是用来维护 buffer size 分配的 |
上述代码会产生如下输出:
The text was updated successfully, but these errors were encountered: