diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-21 08:58:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-21 08:58:57 +0800 |
commit | 1c16d0994d08f1a6c396bc46833d0bfdade29422 (patch) | |
tree | 28e243f694254f925a2da4d33c4a088d28a1f223 /src/nvim/fileio.c | |
parent | efe5ce6fa8f9335029673b4a07421d084fe0324e (diff) | |
download | rneovim-1c16d0994d08f1a6c396bc46833d0bfdade29422.tar.gz rneovim-1c16d0994d08f1a6c396bc46833d0bfdade29422.tar.bz2 rneovim-1c16d0994d08f1a6c396bc46833d0bfdade29422.zip |
refactor: change char_u to uint8_t or char in sha256.c/undo.c (#21914)
Use uint8_t for bytes in hashes as it doesn't make sense for them to be signed.
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index c05eb41b6d..a4105e379f 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -1554,7 +1554,7 @@ rewind_retry: break; } if (read_undo_file) { - sha256_update(&sha_ctx, (char_u *)line_start, (size_t)len); + sha256_update(&sha_ctx, (uint8_t *)line_start, (size_t)len); } lnum++; if (--read_count == 0) { @@ -1610,7 +1610,7 @@ rewind_retry: break; } if (read_undo_file) { - sha256_update(&sha_ctx, (char_u *)line_start, (size_t)len); + sha256_update(&sha_ctx, (uint8_t *)line_start, (size_t)len); } lnum++; if (--read_count == 0) { @@ -1667,7 +1667,7 @@ failed: error = true; } else { if (read_undo_file) { - sha256_update(&sha_ctx, (char_u *)line_start, (size_t)len); + sha256_update(&sha_ctx, (uint8_t *)line_start, (size_t)len); } read_no_eol_lnum = ++lnum; } @@ -3196,7 +3196,7 @@ restore_backup: // Keep it fast! ptr = ml_get_buf(buf, lnum, false) - 1; if (write_undo_file) { - sha256_update(&sha_ctx, (char_u *)ptr + 1, (uint32_t)(strlen(ptr + 1) + 1)); + sha256_update(&sha_ctx, (uint8_t *)ptr + 1, (uint32_t)(strlen(ptr + 1) + 1)); } while ((c = *++ptr) != NUL) { if (c == NL) { @@ -3605,10 +3605,10 @@ nofail: // When writing the whole file and 'undofile' is set, also write the undo // file. if (retval == OK && write_undo_file) { - char hash[UNDO_HASH_SIZE]; + uint8_t hash[UNDO_HASH_SIZE]; - sha256_finish(&sha_ctx, (char_u *)hash); - u_write_undo(NULL, false, buf, (char_u *)hash); + sha256_finish(&sha_ctx, hash); + u_write_undo(NULL, false, buf, hash); } if (!should_abort(retval)) { |