-
-
Notifications
You must be signed in to change notification settings - Fork 857
Allow truncation to work within VFileFromMemory #3455
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
Conversation
Truncation here is limited to buffer size (allowing for shrinking but not growing the buffer size)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious what this is useful for.
The intent of this is mainly for VFileFromMemory. I'm trying to work on removing Although in hindsight, this also doesn't really work well unless write is also able to "expand" the size until the buffer size (for RTC writes), so that'd need to be updated too. |
…" size until the buffer size
if (size + vfm->offset > vfm->size) { | ||
vfm->size = size + vfm->offset; | ||
if (vfm->size > vfm->bufferSize) { | ||
vfm->size = vfm->bufferSize; | ||
size = vfm->size - vfm->offset; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this wound up in the wrong PR, or at least the wrong commit. Could you fixup the history at least?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's have VFileFromMemory write "expand" size until the buffer size
. Is this better as separate commits or separate PRs? (or squashing all the history into one commit?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same PR is fine, but one of the commits is basically "back out half of the last commit, and also this", so instead just splitting out the first half and then doing a fixup in to the previous commit would be preferable.
Truncation here is limited to buffer size (allowing for shrinking but not growing the VFile size)