style: cppcheck — const-correctness in file_send_special and test_chunk
CI / lint (push) Successful in 1m7s
CI / sanitizers (address) (push) Successful in 53s
CI / sanitizers (undefined) (push) Successful in 53s
CI / fuzz-build (push) Successful in 21s
CI / coverage (push) Successful in 44s
CI / valgrind (push) Successful in 37s
CI / build-and-test (push) Successful in 4m41s

file_send_special now takes const File*; test_chunk declares the deserialized
Chunk* const.  cppcheck (--error-exitcode=1) now exits clean; clang-format
clean; unit 29/29.
This commit is contained in:
2026-09-08 22:53:47 +02:00
parent 5a00a4fe2b
commit 90ccf297d7
3 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
* frame: the destination path, the metadata frame (whose mode's S_IFMT bits * frame: the destination path, the metadata frame (whose mode's S_IFMT bits
* carry the node kind) and the device rdev major/minor. The receiver validates * carry the node kind) and the device rdev major/minor. The receiver validates
* the kind and rdev and recreates the node (privilege-gating the mknod). */ * the kind and rdev and recreates the node (privilege-gating the mknod). */
bool file_send_special(File* file, int file_descriptor, bool use_metadata) { bool file_send_special(const File* file, int file_descriptor, bool use_metadata) {
if (!file || !file_wire_path(file)) if (!file || !file_wire_path(file))
return false; return false;
if (!send_status(file_descriptor, STATUS_SPECIAL)) if (!send_status(file_descriptor, STATUS_SPECIAL))
+1 -1
View File
@@ -6,7 +6,7 @@
/* Client-side file send path. */ /* Client-side file send path. */
bool file_send_special(File* file, int file_descriptor, bool use_metadata); bool file_send_special(const File* file, int file_descriptor, bool use_metadata);
bool file_send_single_calls(File* file, int file_descriptor, bool use_metadata, bool file_send_single_calls(File* file, int file_descriptor, bool use_metadata,
int compression_level, bool send_path); int compression_level, bool send_path);
bool file_send_single_calls_with_skip(File* file, int file_descriptor, bool use_metadata, bool file_send_single_calls_with_skip(File* file, int file_descriptor, bool use_metadata,
+1 -2
View File
@@ -273,9 +273,8 @@ static void test_chunk_special_rdev_out_of_range_rejected() {
EXPECT_NOT_NULL(chunk); EXPECT_NOT_NULL(chunk);
Data* serialized = chunk_serialize(chunk, true); Data* serialized = chunk_serialize(chunk, true);
EXPECT_NOT_NULL(serialized); EXPECT_NOT_NULL(serialized);
Chunk* deserialized = chunk_deserialize(serialized, true); const Chunk* deserialized = chunk_deserialize(serialized, true);
EXPECT_NULL(deserialized); EXPECT_NULL(deserialized);
data_destroy(serialized); data_destroy(serialized);
chunk_destroy(chunk); chunk_destroy(chunk);
} }