Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c57c50d authored by Chris Manton's avatar Chris Manton
Browse files

flatbuffers: Add privacy filter for boolean type FilterTypeBool

Bug: 216499488
Tag: #refactor
Test: gd/cert/run
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: I8a58f7c29dfc176557a00935be1b1c9fccd95d24
parent 46b8808b
Loading
Loading
Loading
Loading
+15 −1
Original line number Original line Diff line number Diff line
@@ -108,7 +108,21 @@ const reflection::Object* internal::FindReflectionObject(
bool internal::FilterTypeBool(const reflection::Field& field, flatbuffers::Table* table, PrivacyLevel privacy_level) {
bool internal::FilterTypeBool(const reflection::Field& field, flatbuffers::Table* table, PrivacyLevel privacy_level) {
  ASSERT(table != nullptr);
  ASSERT(table != nullptr);


  // TODO(cmanton) Figure out boolean filtering
  const bool default_val = flatbuffers::GetFieldDefaultI<int8_t>(field);
  flatbuffers::voffset_t field_offset = field.offset();

  // boolean privacy levels are simpler.
  switch (privacy_level) {
    case kPrivate:
    case kOpaque:
    case kAnonymized:
      flatbuffers::SetField<int8_t>(table, field, default_val);
      internal::ScrubFromTable(table, field_offset);
      break;
    default:
    case kAny:
      break;
  }
  return kFieldHasBeenFiltered;
  return kFieldHasBeenFiltered;
}
}