diff options
author | 2024-06-22 15:41:53 -0700 | |
---|---|---|
committer | 2024-07-07 10:58:27 -0700 | |
commit | 2bf4c772393460d1830fbed203a65197e5999a6c (patch) | |
tree | a2d42bfe5193ec7a603aa2b540beae56ed6493cf /floss | |
parent | ace0cd51f43c3b1f8709ae962899b3f539cb0965 (diff) |
Format: apply clang rules
Restore SpacesBeforeTrailingComments to 2 to match current style
Then run clang-format -i **/**.{c,h,cc,cpp,hpp}
Then fix a bunch of typo (reported by gerrit)
Then fix unnecessary multiline string
Then fix whitespace for disabled clang format (reported by cpplint)
This is no-op
Bug: 311772251
Test: mmm packages/modules/Bluetooth
Flag: Exempt Format only
Change-Id: If135447803a40a2a07d4630ba2195e08ef8d250c
Diffstat (limited to 'floss')
-rw-r--r-- | floss/android-base/include/android-base/parseint.h | 28 | ||||
-rw-r--r-- | floss/android-base/include/android-base/properties.h | 3 | ||||
-rw-r--r-- | floss/android-base/properties.cc | 3 | ||||
-rw-r--r-- | floss/libflags/get_flags.cc | 10 | ||||
-rw-r--r-- | floss/libflags/include/server_configurable_flags/get_flags.h | 6 |
5 files changed, 21 insertions, 29 deletions
diff --git a/floss/android-base/include/android-base/parseint.h b/floss/android-base/include/android-base/parseint.h index c4144fde84..e072f9828f 100644 --- a/floss/android-base/include/android-base/parseint.h +++ b/floss/android-base/include/android-base/parseint.h @@ -34,8 +34,7 @@ namespace base { template <typename T> bool ParseUint(const char* s, T* out, T max = std::numeric_limits<T>::max(), bool allow_suffixes = false) { - static_assert(std::is_unsigned<T>::value, - "ParseUint can only be used with unsigned types"); + static_assert(std::is_unsigned<T>::value, "ParseUint can only be used with unsigned types"); while (isspace(*s)) { s++; } @@ -52,7 +51,9 @@ bool ParseUint(const char* s, T* out, T max = std::numeric_limits<T>::max(), errno = 0; char* end; unsigned long long int result = strtoull(s, &end, base); - if (errno != 0) return false; + if (errno != 0) { + return false; + } if (end == s) { errno = EINVAL; return false; @@ -60,10 +61,8 @@ bool ParseUint(const char* s, T* out, T max = std::numeric_limits<T>::max(), if (*end != '\0') { const char* suffixes = "bkmgtpe"; const char* suffix; - if ((!allow_suffixes || - (suffix = strchr(suffixes, tolower(*end))) == nullptr) || - __builtin_mul_overflow(result, 1ULL << (10 * (suffix - suffixes)), - &result)) { + if ((!allow_suffixes || (suffix = strchr(suffixes, tolower(*end))) == nullptr) || + __builtin_mul_overflow(result, 1ULL << (10 * (suffix - suffixes)), &result)) { errno = EINVAL; return false; } @@ -80,22 +79,19 @@ bool ParseUint(const char* s, T* out, T max = std::numeric_limits<T>::max(), // TODO: string_view template <typename T> -bool ParseUint(const std::string& s, T* out, - T max = std::numeric_limits<T>::max(), +bool ParseUint(const std::string& s, T* out, T max = std::numeric_limits<T>::max(), bool allow_suffixes = false) { return ParseUint(s.c_str(), out, max, allow_suffixes); } template <typename T> -bool ParseByteCount(const char* s, T* out, - T max = std::numeric_limits<T>::max()) { +bool ParseByteCount(const char* s, T* out, T max = std::numeric_limits<T>::max()) { return ParseUint(s, out, max, true); } // TODO: string_view template <typename T> -bool ParseByteCount(const std::string& s, T* out, - T max = std::numeric_limits<T>::max()) { +bool ParseByteCount(const std::string& s, T* out, T max = std::numeric_limits<T>::max()) { return ParseByteCount(s.c_str(), out, max); } @@ -106,8 +102,7 @@ bool ParseByteCount(const std::string& s, T* out, template <typename T> bool ParseInt(const char* s, T* out, T min = std::numeric_limits<T>::min(), T max = std::numeric_limits<T>::max()) { - static_assert(std::is_signed<T>::value, - "ParseInt can only be used with signed types"); + static_assert(std::is_signed<T>::value, "ParseInt can only be used with signed types"); while (isspace(*s)) { s++; } @@ -135,8 +130,7 @@ bool ParseInt(const char* s, T* out, T min = std::numeric_limits<T>::min(), // TODO: string_view template <typename T> -bool ParseInt(const std::string& s, T* out, - T min = std::numeric_limits<T>::min(), +bool ParseInt(const std::string& s, T* out, T min = std::numeric_limits<T>::min(), T max = std::numeric_limits<T>::max()) { return ParseInt(s.c_str(), out, min, max); } diff --git a/floss/android-base/include/android-base/properties.h b/floss/android-base/include/android-base/properties.h index 23a94fc537..cd1c1d48bb 100644 --- a/floss/android-base/include/android-base/properties.h +++ b/floss/android-base/include/android-base/properties.h @@ -23,8 +23,7 @@ namespace base { // Returns the current value of the system property `key`, // or `default_value` if the property is empty or doesn't exist. -std::string GetProperty(const std::string& key, - const std::string& default_value); +std::string GetProperty(const std::string& key, const std::string& default_value); // Sets the system property `key` to `value`. bool SetProperty(const std::string& key, const std::string& value); diff --git a/floss/android-base/properties.cc b/floss/android-base/properties.cc index dea892b6c4..45e293ba92 100644 --- a/floss/android-base/properties.cc +++ b/floss/android-base/properties.cc @@ -21,8 +21,7 @@ namespace android { namespace base { -std::string GetProperty(const std::string& key, - const std::string& default_value) { +std::string GetProperty(const std::string& key, const std::string& default_value) { return bluetooth::os::GetSystemProperty(key).value_or(default_value); } diff --git a/floss/libflags/get_flags.cc b/floss/libflags/get_flags.cc index 233662ac6d..661a2c92be 100644 --- a/floss/libflags/get_flags.cc +++ b/floss/libflags/get_flags.cc @@ -20,11 +20,11 @@ namespace server_configurable_flags { -std::string GetServerConfigurableFlag( - const std::string& experiment_category_name, - const std::string& experiment_flag_name, const std::string& default_value) { - std::string prop_name = "persist.device_config." + experiment_category_name + - "." + experiment_flag_name; +std::string GetServerConfigurableFlag(const std::string& experiment_category_name, + const std::string& experiment_flag_name, + const std::string& default_value) { + std::string prop_name = + "persist.device_config." + experiment_category_name + "." + experiment_flag_name; return bluetooth::os::GetSystemProperty(prop_name).value_or(default_value); } } // namespace server_configurable_flags diff --git a/floss/libflags/include/server_configurable_flags/get_flags.h b/floss/libflags/include/server_configurable_flags/get_flags.h index 04f413e749..1cc7ecbc75 100644 --- a/floss/libflags/include/server_configurable_flags/get_flags.h +++ b/floss/libflags/include/server_configurable_flags/get_flags.h @@ -20,8 +20,8 @@ namespace server_configurable_flags { -std::string GetServerConfigurableFlag( - const std::string& experiment_category_name, - const std::string& experiment_flag_name, const std::string& default_value); +std::string GetServerConfigurableFlag(const std::string& experiment_category_name, + const std::string& experiment_flag_name, + const std::string& default_value); } // namespace server_configurable_flags |