From 12967a06121b543af796f16a4cb54878b86df815 Mon Sep 17 00:00:00 2001 From: Christopher Hoffman Date: Tue, 23 Sep 2025 14:58:32 +0000 Subject: [PATCH] client: clean up warnings in fscrypt Fix warnings/errors in ceph API tests that are present in FSCrypt.cc src/client/FSCrypt.cc:90:6: error: variable 'olen' set but not used [-Werror,-Wunused-but-set-variable] 90 | int olen = 0; | ^ src/client/FSCrypt.cc:91:6: error: variable 'line' set but not used [-Werror,-Wunused-but-set-variable] 91 | int line = 0; | ^ src/client/FSCrypt.cc:945:2: error: is this the way to do it? [-Werror,-W#warnings] 945 | #warning is this the way to do it? Signed-off-by: Christopher Hoffman --- src/client/FSCrypt.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/client/FSCrypt.cc b/src/client/FSCrypt.cc index 60538079629c9..090f97af17f3a 100644 --- a/src/client/FSCrypt.cc +++ b/src/client/FSCrypt.cc @@ -86,9 +86,8 @@ static int set_str_val(char **pdst, const char *end, char c) static int b64_encode(char *dst, char * const dst_end, const char *src, const char *end) { + char *orig_dst = dst; - int olen = 0; - int line = 0; #define SET_DST(c) do { \ int __ret = set_str_val(&dst, dst_end, c); \ @@ -117,8 +116,6 @@ static int b64_encode(char *dst, char * const dst_end, const char *src, const ch } else { SET_DST(encode_bits(((a & 3) << 4))); } - olen += 4; - line += 4; } *dst = '\0'; return (dst - orig_dst); @@ -942,7 +939,7 @@ int FSCryptFDataDenc::decrypt_bl(uint64_t off, uint64_t len, uint64_t pos, const has_hole = true; break; } -#warning is this the way to do it? + uint64_t needed_pos = (pos > off ? pos : off); void *data_pos = bl->c_str() + needed_pos - start_block_off; if (!has_hole && *(uint64_t *)data_pos == 0) { -- 2.39.5