summaryrefslogtreecommitdiff
path: root/libfscrypt
diff options
context:
space:
mode:
authorThiƩbaud Weksteen <tweek@google.com>2020-10-26 15:33:21 +0100
committerThiƩbaud Weksteen <tweek@google.com>2020-10-26 15:53:59 +0100
commitc54df90ad1295ed169c1a711bbe33fe804e87f4a (patch)
treebf26c83d504334df273378f6633cb2087975d623 /libfscrypt
parent7ebc9e6cd61d5b167ccccbea85f42387370f51a7 (diff)
downloadextras-c54df90ad1295ed169c1a711bbe33fe804e87f4a.tar.gz
libfscrypt: format files
Format *.cpp according to the new .clang-format. The following command was used to generate this change: $ find . \( -name \*.cpp -o -name \*.h \) -exec clang-format \ --style=file -i {} \; Test: mm Bug: 171699326 Change-Id: Id7bc8b74fc6cb5156770210271abb86b0e156089
Diffstat (limited to 'libfscrypt')
-rw-r--r--libfscrypt/fscrypt.cpp12
-rw-r--r--libfscrypt/include/fscrypt/fscrypt.h6
-rw-r--r--libfscrypt/tests/fscrypt_test.cpp13
3 files changed, 18 insertions, 13 deletions
diff --git a/libfscrypt/fscrypt.cpp b/libfscrypt/fscrypt.cpp
index 7126b5ce..f6e97f11 100644
--- a/libfscrypt/fscrypt.cpp
+++ b/libfscrypt/fscrypt.cpp
@@ -98,7 +98,7 @@ static void log_ls(const char* dirname) {
std::array<const char*, 3> argv = {"ls", "-laZ", dirname};
int status = 0;
auto res =
- logwrap_fork_execvp(argv.size(), argv.data(), &status, false, LOG_ALOG, false, nullptr);
+ logwrap_fork_execvp(argv.size(), argv.data(), &status, false, LOG_ALOG, false, nullptr);
if (res != 0) {
PLOG(ERROR) << argv[0] << " " << argv[1] << " " << argv[2] << "failed";
return;
@@ -196,7 +196,7 @@ bool ParseOptionsForApiLevel(unsigned int first_api_level, const std::string& op
} else {
options->filenames_mode = FSCRYPT_MODE_AES_256_CTS;
}
- if (parts.size() > 1 && !parts[1].empty()){
+ if (parts.size() > 1 && !parts[1].empty()) {
if (!LookupModeByName(filenames_modes, parts[1], &options->filenames_mode)) {
LOG(ERROR) << "Invalid file names encryption mode: " << parts[1];
return false;
@@ -244,12 +244,16 @@ bool ParseOptionsForApiLevel(unsigned int first_api_level, const std::string& op
// encryption modes.
if (options->contents_mode == FSCRYPT_MODE_ADIANTUM) {
if (options->filenames_mode != FSCRYPT_MODE_ADIANTUM) {
- LOG(ERROR) << "Adiantum must be both contents and filenames mode or neither, invalid options: " << options_string;
+ LOG(ERROR) << "Adiantum must be both contents and filenames mode or neither, invalid "
+ "options: "
+ << options_string;
return false;
}
options->flags |= FSCRYPT_POLICY_FLAG_DIRECT_KEY;
} else if (options->filenames_mode == FSCRYPT_MODE_ADIANTUM) {
- LOG(ERROR) << "Adiantum must be both contents and filenames mode or neither, invalid options: " << options_string;
+ LOG(ERROR)
+ << "Adiantum must be both contents and filenames mode or neither, invalid options: "
+ << options_string;
return false;
}
diff --git a/libfscrypt/include/fscrypt/fscrypt.h b/libfscrypt/include/fscrypt/fscrypt.h
index 78b12560..f3779d00 100644
--- a/libfscrypt/include/fscrypt/fscrypt.h
+++ b/libfscrypt/include/fscrypt/fscrypt.h
@@ -63,8 +63,8 @@ bool EnsurePolicy(const EncryptionPolicy& policy, const std::string& directory);
inline bool operator==(const EncryptionOptions& lhs, const EncryptionOptions& rhs) {
return (lhs.version == rhs.version) && (lhs.contents_mode == rhs.contents_mode) &&
- (lhs.filenames_mode == rhs.filenames_mode) && (lhs.flags == rhs.flags) &&
- (lhs.use_hw_wrapped_key == rhs.use_hw_wrapped_key);
+ (lhs.filenames_mode == rhs.filenames_mode) && (lhs.flags == rhs.flags) &&
+ (lhs.use_hw_wrapped_key == rhs.use_hw_wrapped_key);
}
inline bool operator!=(const EncryptionOptions& lhs, const EncryptionOptions& rhs) {
@@ -82,4 +82,4 @@ inline bool operator!=(const EncryptionPolicy& lhs, const EncryptionPolicy& rhs)
} // namespace fscrypt
} // namespace android
-#endif // _FSCRYPT_H_
+#endif // _FSCRYPT_H_
diff --git a/libfscrypt/tests/fscrypt_test.cpp b/libfscrypt/tests/fscrypt_test.cpp
index 4fbd742c..70eb1780 100644
--- a/libfscrypt/tests/fscrypt_test.cpp
+++ b/libfscrypt/tests/fscrypt_test.cpp
@@ -38,7 +38,7 @@ const EncryptionOptions TestString(unsigned int first_api_level, const std::stri
}
#define TEST_STRING(first_api_level, instring, outstring) \
- SCOPED_TRACE(instring); \
+ SCOPED_TRACE(instring); \
auto options = TestString(first_api_level, instring, outstring);
TEST(fscrypt, ParseOptions) {
@@ -179,11 +179,12 @@ TEST(fscrypt, ParseOptions) {
}
TEST(fscrypt, ComparePolicies) {
-#define TEST_INEQUALITY(foo, field, value) { \
- auto bar = foo; \
- bar.field = value; \
- EXPECT_NE(foo, bar); \
-}
+#define TEST_INEQUALITY(foo, field, value) \
+ { \
+ auto bar = foo; \
+ bar.field = value; \
+ EXPECT_NE(foo, bar); \
+ }
EncryptionPolicy foo;
foo.key_raw_ref = "foo";
EncryptionOptions foo_options;