mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 02:46:31 +00:00
vim-patch:8.2.2777: Vim9: blob operations not tested in all ways
Problem: Vim9: blob operations not tested in all ways. Solution: Run tests with CheckLegacyAndVim9Success(). Make blob assign with index work.51e933261b
Cherry-pick related changes from patches 8.2.{0633,0634}. N/A patches for version.c: vim-patch:8.2.2779: memory access error in remove() for blob Problem: Memory access error in remove() for blob. Solution: Adjust length for memmove().f7e92aae15
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -2750,6 +2750,23 @@ int tv_blob_set_range(blob_T *dest, long n1, long n2, typval_T *src)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/// Store one byte "byte" in blob "blob" at "idx".
|
||||
/// Append one byte if needed.
|
||||
void tv_blob_set_append(blob_T *blob, int idx, uint8_t byte)
|
||||
{
|
||||
garray_T *gap = &blob->bv_ga;
|
||||
|
||||
// Allow for appending a byte. Setting a byte beyond
|
||||
// the end is an error otherwise.
|
||||
if (idx <= gap->ga_len) {
|
||||
if (idx == gap->ga_len) {
|
||||
ga_grow(gap, 1);
|
||||
gap->ga_len++;
|
||||
}
|
||||
tv_blob_set(blob, idx, byte);
|
||||
}
|
||||
}
|
||||
|
||||
/// "remove({blob})" function
|
||||
void tv_blob_remove(typval_T *argvars, typval_T *rettv, const char *arg_errmsg)
|
||||
{
|
||||
|
Reference in New Issue
Block a user