From bd22bb0deddb236fbdfa8c5797cfd7f15c1a0c73 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Wed, 8 Jan 2020 16:02:50 +0000 Subject: Const correctness handle / RedactionInfo. Helps us CHECK that they're always constructed with valid RedactionInfo etc. Test: atest FuseDaemonHostTest Test: atest fuse_node_test Bug: 147274248 Change-Id: I2cc369574d14136521201b4c8b99fe22e7ec0463 --- jni/node-inl.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'jni/node-inl.h') diff --git a/jni/node-inl.h b/jni/node-inl.h index 5db14134e..487583cea 100644 --- a/jni/node-inl.h +++ b/jni/node-inl.h @@ -34,17 +34,21 @@ namespace mediaprovider { namespace fuse { struct handle { - explicit handle(const std::string& path) : path(path), fd(-1), ri(nullptr), cached(true){}; + explicit handle(const std::string& path, int fd, const RedactionInfo* ri, bool cached) + : path(path), fd(fd), ri(ri), cached(cached) { + CHECK(ri != nullptr); + } + const std::string path; - int fd; - std::unique_ptr ri; - bool cached; + const int fd; + const std::unique_ptr ri; + const bool cached; ~handle() { close(fd); } }; struct dirhandle { - explicit dirhandle(DIR* dir) : d(dir), next_off(0){}; + explicit dirhandle(DIR* dir) : d(dir), next_off(0) { CHECK(dir != nullptr); } DIR* const d; off_t next_off; -- cgit v1.2.3-59-g8ed1b