Remove kBytesFieldAtoms from atoms_info
Bug: 150415347 Test: m Test: bit statsd_test:* Change-Id: I2e55b445121a39e3bf12164cd9123561e8b5bd4c
This commit is contained in:
@@ -357,30 +357,7 @@ void writeFieldValueTreeToStreamHelper(int tagId, const std::vector<FieldValue>&
|
||||
protoOutput->write(FIELD_TYPE_FLOAT | fieldNum, dim.mValue.float_value);
|
||||
break;
|
||||
case STRING: {
|
||||
bool isBytesField = false;
|
||||
// Bytes field is logged via string format in log_msg format. So here we check
|
||||
// if this string field is a byte field.
|
||||
std::map<int, std::vector<int>>::const_iterator itr;
|
||||
if (depth == 0 && (itr = AtomsInfo::kBytesFieldAtoms.find(tagId)) !=
|
||||
AtomsInfo::kBytesFieldAtoms.end()) {
|
||||
const std::vector<int>& bytesFields = itr->second;
|
||||
for (int bytesField : bytesFields) {
|
||||
if (bytesField == fieldNum) {
|
||||
// This is a bytes field
|
||||
isBytesField = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isBytesField) {
|
||||
if (dim.mValue.str_value.length() > 0) {
|
||||
protoOutput->write(FIELD_TYPE_MESSAGE | fieldNum,
|
||||
(const char*)dim.mValue.str_value.c_str(),
|
||||
dim.mValue.str_value.length());
|
||||
}
|
||||
} else {
|
||||
protoOutput->write(FIELD_TYPE_STRING | fieldNum, dim.mValue.str_value);
|
||||
}
|
||||
protoOutput->write(FIELD_TYPE_STRING | fieldNum, dim.mValue.str_value);
|
||||
break;
|
||||
}
|
||||
case STORAGE:
|
||||
|
||||
@@ -55,8 +55,7 @@ AtomDecl::AtomDecl(const AtomDecl &that)
|
||||
resetState(that.resetState),
|
||||
nested(that.nested),
|
||||
uidField(that.uidField),
|
||||
whitelisted(that.whitelisted),
|
||||
binaryFields(that.binaryFields) {}
|
||||
whitelisted(that.whitelisted) {}
|
||||
|
||||
AtomDecl::AtomDecl(int c, const string& n, const string& m)
|
||||
:code(c),
|
||||
@@ -422,10 +421,6 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Binary field validity is already checked above.
|
||||
if (isBinaryField) {
|
||||
atomDecl->binaryFields.push_back(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
return errorCount;
|
||||
|
||||
@@ -147,8 +147,6 @@ struct AtomDecl {
|
||||
|
||||
bool whitelisted = false;
|
||||
|
||||
vector<int> binaryFields;
|
||||
|
||||
AtomDecl();
|
||||
AtomDecl(const AtomDecl& that);
|
||||
AtomDecl(int code, const string& name, const string& message);
|
||||
|
||||
@@ -47,9 +47,6 @@ static void write_atoms_info_header_body(FILE* out, const Atoms& atoms) {
|
||||
fprintf(out,
|
||||
" const static std::map<int, StateAtomFieldOptions> "
|
||||
"kStateAtomsFieldOptions;\n");
|
||||
fprintf(out,
|
||||
" const static std::map<int, std::vector<int>> "
|
||||
"kBytesFieldAtoms;\n");
|
||||
fprintf(out,
|
||||
" const static std::set<int> kWhitelistedAtoms;\n");
|
||||
fprintf(out, "};\n");
|
||||
@@ -175,35 +172,6 @@ static void write_atoms_info_cpp_body(FILE* out, const Atoms& atoms) {
|
||||
"const std::map<int, StateAtomFieldOptions> "
|
||||
"AtomsInfo::kStateAtomsFieldOptions = "
|
||||
"getStateAtomFieldOptions();\n");
|
||||
|
||||
fprintf(out,
|
||||
"static std::map<int, std::vector<int>> "
|
||||
"getBinaryFieldAtoms() {\n");
|
||||
fprintf(out, " std::map<int, std::vector<int>> options;\n");
|
||||
for (set<AtomDecl>::const_iterator atom = atoms.decls.begin();
|
||||
atom != atoms.decls.end(); atom++) {
|
||||
if (atom->binaryFields.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
fprintf(out,
|
||||
"\n // Adding binary fields for atom "
|
||||
"(%d)%s\n",
|
||||
atom->code, atom->name.c_str());
|
||||
|
||||
for (const auto& field : atom->binaryFields) {
|
||||
fprintf(out, " options[%d /* %s */].push_back(%d);\n",
|
||||
atom->code, make_constant_name(atom->name).c_str(), field);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(out, " return options;\n");
|
||||
fprintf(out, "}\n");
|
||||
|
||||
fprintf(out,
|
||||
"const std::map<int, std::vector<int>> "
|
||||
"AtomsInfo::kBytesFieldAtoms = "
|
||||
"getBinaryFieldAtoms();\n");
|
||||
|
||||
}
|
||||
|
||||
int write_atoms_info_header(FILE* out, const Atoms &atoms, const string& namespaceStr) {
|
||||
|
||||
Reference in New Issue
Block a user