Use uint64_t instead of long long as API type for consistent reason.
Bug: 74118023
Test: manual
Change-Id: Icd5f506c76d3a008a79cb6c9d2061962ca7fdd40
diff --git a/cmds/incident_helper/src/ih_util.cpp b/cmds/incident_helper/src/ih_util.cpp
index 847b26a..5b413e9 100644
--- a/cmds/incident_helper/src/ih_util.cpp
+++ b/cmds/incident_helper/src/ih_util.cpp
@@ -440,7 +440,7 @@
Message::startSession(ProtoOutputStream* proto, const string& name)
{
uint64_t fieldId = mTable->mFields[name];
- long long token = proto->start(fieldId);
+ uint64_t token = proto->start(fieldId);
mPreviousField = name;
mTokens.push(token);
}
diff --git a/cmds/incident_helper/src/ih_util.h b/cmds/incident_helper/src/ih_util.h
index 53f4438..c4eda4a 100644
--- a/cmds/incident_helper/src/ih_util.h
+++ b/cmds/incident_helper/src/ih_util.h
@@ -194,7 +194,7 @@
private:
Table* mTable;
std::string mPreviousField;
- stack<long long> mTokens;
+ stack<uint64_t> mTokens;
map<std::string, Message*> mSubMessages;
};
diff --git a/cmds/incident_helper/src/parsers/CpuFreqParser.cpp b/cmds/incident_helper/src/parsers/CpuFreqParser.cpp
index fde17bd..43a12f6 100644
--- a/cmds/incident_helper/src/parsers/CpuFreqParser.cpp
+++ b/cmds/incident_helper/src/parsers/CpuFreqParser.cpp
@@ -65,10 +65,10 @@
proto.write(CpuFreqProto::JIFFY_HZ, (int)jiffyHz);
for (int i=0; i<numCpus; i++) {
- long long token = proto.start(CpuFreqProto::CPU_FREQS);
+ uint64_t token = proto.start(CpuFreqProto::CPU_FREQS);
proto.write(CpuFreqProto::Stats::CPU_NAME, header[i+1]);
for (vector<pair<int, long long>>::iterator it = cpucores[i].begin(); it != cpucores[i].end(); it++) {
- long long stateToken = proto.start(CpuFreqProto::Stats::TIMES);
+ uint64_t stateToken = proto.start(CpuFreqProto::Stats::TIMES);
proto.write(CpuFreqProto::Stats::TimeInState::STATE_KHZ, it->first);
proto.write(CpuFreqProto::Stats::TimeInState::TIME_JIFFY, it->second);
proto.end(stateToken);
diff --git a/cmds/incident_helper/src/parsers/CpuInfoParser.cpp b/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
index b2b431c..eed68b9 100644
--- a/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
+++ b/cmds/incident_helper/src/parsers/CpuInfoParser.cpp
@@ -28,7 +28,7 @@
const int count, const char* names[], const uint64_t ids[])
{
record_t record = parseRecord(line, delimiter);
- long long token = proto->start(fieldId);
+ uint64_t token = proto->start(fieldId);
for (int i=0; i<(int)record.size(); i++) {
for (int j=0; j<count; j++) {
if (stripSuffix(&record[i], names[j], true)) {
@@ -138,7 +138,7 @@
continue;
}
- long long token = proto.start(CpuInfoProto::TASKS);
+ uint64_t token = proto.start(CpuInfoProto::TASKS);
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d fails to insert field %s with value %s\n",
diff --git a/cmds/incident_helper/src/parsers/EventLogTagsParser.cpp b/cmds/incident_helper/src/parsers/EventLogTagsParser.cpp
index 73e37bd..4fd6b06 100644
--- a/cmds/incident_helper/src/parsers/EventLogTagsParser.cpp
+++ b/cmds/incident_helper/src/parsers/EventLogTagsParser.cpp
@@ -41,7 +41,7 @@
continue;
}
- long long token = proto.start(EventLogTagMapProto::EVENT_LOG_TAGS);
+ uint64_t token = proto.start(EventLogTagMapProto::EVENT_LOG_TAGS);
proto.write(EventLogTag::TAG_NUMBER, toInt(tagNumber));
proto.write(EventLogTag::TAG_NAME, tagName);
@@ -52,7 +52,7 @@
// If the parts doesn't contains pipe, then skips it.
continue;
}
- long long descriptorToken = proto.start(EventLogTag::VALUE_DESCRIPTORS);
+ uint64_t descriptorToken = proto.start(EventLogTag::VALUE_DESCRIPTORS);
proto.write(EventLogTag::ValueDescriptor::NAME, valueDescriptor[0]);
proto.write(EventLogTag::ValueDescriptor::TYPE, toInt(valueDescriptor[1]));
if (valueDescriptor.size() == 3) {
diff --git a/cmds/incident_helper/src/parsers/KernelWakesParser.cpp b/cmds/incident_helper/src/parsers/KernelWakesParser.cpp
index 28816ea..85beaf0 100644
--- a/cmds/incident_helper/src/parsers/KernelWakesParser.cpp
+++ b/cmds/incident_helper/src/parsers/KernelWakesParser.cpp
@@ -59,7 +59,7 @@
continue;
}
- long long token = proto.start(KernelWakeSourcesProto::WAKEUP_SOURCES);
+ uint64_t token = proto.start(KernelWakeSourcesProto::WAKEUP_SOURCES);
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d has bad value %s of %s\n",
diff --git a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
index ab4382a..0615c74 100644
--- a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
+++ b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
@@ -64,7 +64,7 @@
record_t record = parseRecord(line, COMMA_DELIMITER);
if (migrateTypeSession && record.size() == 3) {
- long long token = proto.start(PageTypeInfoProto::MIGRATE_TYPES);
+ uint64_t token = proto.start(PageTypeInfoProto::MIGRATE_TYPES);
// expect part 0 starts with "Node"
if (stripPrefix(&record[0], "Node")) {
proto.write(PageTypeInfoProto::MigrateType::NODE, toInt(record[0]));
@@ -93,7 +93,7 @@
proto.end(token);
} else if (!blockHeader.empty() && record.size() == 2) {
- long long token = proto.start(PageTypeInfoProto::BLOCKS);
+ uint64_t token = proto.start(PageTypeInfoProto::BLOCKS);
if (stripPrefix(&record[0], "Node")) {
proto.write(PageTypeInfoProto::Block::NODE, toInt(record[0]));
} else return BAD_VALUE;
diff --git a/cmds/incident_helper/src/parsers/ProcrankParser.cpp b/cmds/incident_helper/src/parsers/ProcrankParser.cpp
index c1c458e..4763b48 100644
--- a/cmds/incident_helper/src/parsers/ProcrankParser.cpp
+++ b/cmds/incident_helper/src/parsers/ProcrankParser.cpp
@@ -66,7 +66,7 @@
continue;
}
- long long token = proto.start(ProcrankProto::PROCESSES);
+ uint64_t token = proto.start(ProcrankProto::PROCESSES);
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d has bad value %s of %s\n",
@@ -77,22 +77,22 @@
}
// add summary
- long long token = proto.start(ProcrankProto::SUMMARY);
+ uint64_t token = proto.start(ProcrankProto::SUMMARY);
if (!total.empty()) {
record = parseRecord(total);
- long long token = proto.start(ProcrankProto::Summary::TOTAL);
+ uint64_t token = proto.start(ProcrankProto::Summary::TOTAL);
for (int i=(int)record.size(); i>0; i--) {
table.insertField(&proto, header[header.size() - i].c_str(), record[record.size() - i].c_str());
}
proto.end(token);
}
if (!zram.empty()) {
- long long token = proto.start(ProcrankProto::Summary::ZRAM);
+ uint64_t token = proto.start(ProcrankProto::Summary::ZRAM);
proto.write(ProcrankProto::Summary::Zram::RAW_TEXT, zram);
proto.end(token);
}
if (!ram.empty()) {
- long long token = proto.start(ProcrankProto::Summary::RAM);
+ uint64_t token = proto.start(ProcrankProto::Summary::RAM);
proto.write(ProcrankProto::Summary::Ram::RAW_TEXT, ram);
proto.end(token);
}
diff --git a/cmds/incident_helper/src/parsers/PsParser.cpp b/cmds/incident_helper/src/parsers/PsParser.cpp
index 420775f..8d64064 100644
--- a/cmds/incident_helper/src/parsers/PsParser.cpp
+++ b/cmds/incident_helper/src/parsers/PsParser.cpp
@@ -71,7 +71,7 @@
continue;
}
- long long token = proto.start(PsProto::PROCESSES);
+ uint64_t token = proto.start(PsProto::PROCESSES);
for (int i=0; i<(int)record.size(); i++) {
if (!table.insertField(&proto, header[i], record[i])) {
fprintf(stderr, "[%s]Line %d has bad value %s of %s\n",
diff --git a/cmds/incident_helper/src/parsers/SystemPropertiesParser.cpp b/cmds/incident_helper/src/parsers/SystemPropertiesParser.cpp
index 7b0ac0b..eba536b 100644
--- a/cmds/incident_helper/src/parsers/SystemPropertiesParser.cpp
+++ b/cmds/incident_helper/src/parsers/SystemPropertiesParser.cpp
@@ -207,7 +207,7 @@
sysProp.endSession(&proto);
for (auto it = extras.begin(); it != extras.end(); it++) {
- long long token = proto.start(SystemPropertiesProto::EXTRA_PROPERTIES);
+ uint64_t token = proto.start(SystemPropertiesProto::EXTRA_PROPERTIES);
proto.write(SystemPropertiesProto::Property::NAME, it->first);
proto.write(SystemPropertiesProto::Property::VALUE, it->second);
proto.end(token);
diff --git a/cmds/incidentd/src/PrivacyBuffer.cpp b/cmds/incidentd/src/PrivacyBuffer.cpp
index ee57f4d..73ee1cb 100644
--- a/cmds/incidentd/src/PrivacyBuffer.cpp
+++ b/cmds/incidentd/src/PrivacyBuffer.cpp
@@ -91,7 +91,7 @@
// current field is message type and its sub-fields have extra privacy policies
uint32_t msgSize = mData.readRawVarint();
size_t start = mData.rp()->pos();
- long long token = mProto.start(encode_field_id(policy));
+ uint64_t token = mProto.start(encode_field_id(policy));
while (mData.rp()->pos() - start != msgSize) {
status_t err = stripField(policy, spec, depth + 1);
if (err != NO_ERROR) return err;
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index 334d77c..46243c05 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -735,7 +735,7 @@
lastTimestamp.tv_nsec = msg.entry_v1.nsec;
// format a BinaryLogEntry
- long long token = proto.start(LogProto::BINARY_LOGS);
+ uint64_t token = proto.start(LogProto::BINARY_LOGS);
proto.write(BinaryLogEntry::SEC, msg.entry_v1.sec);
proto.write(BinaryLogEntry::NANOSEC, msg.entry_v1.nsec);
proto.write(BinaryLogEntry::UID, (int)msg.entry_v4.uid);
@@ -745,7 +745,7 @@
get4LE(reinterpret_cast<uint8_t const*>(msg.msg())));
do {
elem = android_log_read_next(context);
- long long elemToken = proto.start(BinaryLogEntry::ELEMS);
+ uint64_t elemToken = proto.start(BinaryLogEntry::ELEMS);
switch (elem.type) {
case EVENT_TYPE_INT:
proto.write(BinaryLogEntry::Elem::TYPE,
@@ -797,7 +797,7 @@
lastTimestamp.tv_nsec = entry.tv_nsec;
// format a TextLogEntry
- long long token = proto.start(LogProto::TEXT_LOGS);
+ uint64_t token = proto.start(LogProto::TEXT_LOGS);
proto.write(TextLogEntry::SEC, (long long)entry.tv_sec);
proto.write(TextLogEntry::NANOSEC, (long long)entry.tv_nsec);
proto.write(TextLogEntry::PRIORITY, (int)entry.priority);
diff --git a/cmds/statsd/src/StatsLogProcessor.cpp b/cmds/statsd/src/StatsLogProcessor.cpp
index e98b54d..3127e94 100644
--- a/cmds/statsd/src/StatsLogProcessor.cpp
+++ b/cmds/statsd/src/StatsLogProcessor.cpp
@@ -249,14 +249,14 @@
ProtoOutputStream proto;
// Start of ConfigKey.
- long long configKeyToken = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_CONFIG_KEY);
+ uint64_t configKeyToken = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_CONFIG_KEY);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_UID, key.GetUid());
proto.write(FIELD_TYPE_INT64 | FIELD_ID_ID, (long long)key.GetId());
proto.end(configKeyToken);
// End of ConfigKey.
// Start of ConfigMetricsReport (reports).
- long long reportsToken =
+ uint64_t reportsToken =
proto.start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_REPORTS);
int64_t lastReportTimeNs = it->second->getLastReportTimeNs();
diff --git a/cmds/statsd/src/guardrail/StatsdStats.cpp b/cmds/statsd/src/guardrail/StatsdStats.cpp
index 22faaa1..d626d90 100644
--- a/cmds/statsd/src/guardrail/StatsdStats.cpp
+++ b/cmds/statsd/src/guardrail/StatsdStats.cpp
@@ -455,7 +455,7 @@
}
void addConfigStatsToProto(const ConfigStats& configStats, ProtoOutputStream* proto) {
- long long token =
+ uint64_t token =
proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_CONFIG_STATS);
proto->write(FIELD_TYPE_INT32 | FIELD_ID_CONFIG_STATS_UID, configStats.uid);
proto->write(FIELD_TYPE_INT64 | FIELD_ID_CONFIG_STATS_ID, (long long)configStats.id);
@@ -487,7 +487,7 @@
}
for (const auto& pair : configStats.matcher_stats) {
- long long tmpToken = proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
+ uint64_t tmpToken = proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
FIELD_ID_CONFIG_STATS_MATCHER_STATS);
proto->write(FIELD_TYPE_INT64 | FIELD_ID_MATCHER_STATS_ID, (long long)pair.first);
proto->write(FIELD_TYPE_INT32 | FIELD_ID_MATCHER_STATS_COUNT, pair.second);
@@ -495,7 +495,7 @@
}
for (const auto& pair : configStats.condition_stats) {
- long long tmpToken = proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
+ uint64_t tmpToken = proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
FIELD_ID_CONFIG_STATS_CONDITION_STATS);
proto->write(FIELD_TYPE_INT64 | FIELD_ID_CONDITION_STATS_ID, (long long)pair.first);
proto->write(FIELD_TYPE_INT32 | FIELD_ID_CONDITION_STATS_COUNT, pair.second);
@@ -503,7 +503,7 @@
}
for (const auto& pair : configStats.metric_stats) {
- long long tmpToken = proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
+ uint64_t tmpToken = proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
FIELD_ID_CONFIG_STATS_METRIC_STATS);
proto->write(FIELD_TYPE_INT64 | FIELD_ID_METRIC_STATS_ID, (long long)pair.first);
proto->write(FIELD_TYPE_INT32 | FIELD_ID_METRIC_STATS_COUNT, pair.second);
@@ -511,7 +511,7 @@
}
for (const auto& pair : configStats.alert_stats) {
- long long tmpToken = proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
+ uint64_t tmpToken = proto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
FIELD_ID_CONFIG_STATS_ALERT_STATS);
proto->write(FIELD_TYPE_INT64 | FIELD_ID_ALERT_STATS_ID, (long long)pair.first);
proto->write(FIELD_TYPE_INT32 | FIELD_ID_ALERT_STATS_COUNT, pair.second);
@@ -539,7 +539,7 @@
const size_t atomCounts = mPushedAtomStats.size();
for (size_t i = 2; i < atomCounts; i++) {
if (mPushedAtomStats[i] > 0) {
- long long token =
+ uint64_t token =
proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_ATOM_STATS | FIELD_COUNT_REPEATED);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_ATOM_STATS_TAG, (int32_t)i);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_ATOM_STATS_COUNT, mPushedAtomStats[i]);
@@ -552,20 +552,20 @@
}
if (mAnomalyAlarmRegisteredStats > 0) {
- long long token = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_ANOMALY_ALARM_STATS);
+ uint64_t token = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_ANOMALY_ALARM_STATS);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_ANOMALY_ALARMS_REGISTERED,
mAnomalyAlarmRegisteredStats);
proto.end(token);
}
if (mPeriodicAlarmRegisteredStats > 0) {
- long long token = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_SUBSCRIBER_ALARM_STATS);
+ uint64_t token = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_SUBSCRIBER_ALARM_STATS);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_SUBSCRIBER_ALARMS_REGISTERED,
mPeriodicAlarmRegisteredStats);
proto.end(token);
}
- long long uidMapToken = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_UIDMAP_STATS);
+ uint64_t uidMapToken = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_UIDMAP_STATS);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_UID_MAP_SNAPSHOTS, mUidMapStats.snapshots);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_UID_MAP_CHANGES, mUidMapStats.changes);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_UID_MAP_BYTES_USED, mUidMapStats.bytes_used);
@@ -575,7 +575,7 @@
proto.end(uidMapToken);
for (const auto& error : mLoggerErrors) {
- long long token = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_LOGGER_ERROR_STATS |
+ uint64_t token = proto.start(FIELD_TYPE_MESSAGE | FIELD_ID_LOGGER_ERROR_STATS |
FIELD_COUNT_REPEATED);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_LOGGER_STATS_TIME, error.first);
proto.write(FIELD_TYPE_INT32 | FIELD_ID_LOGGER_STATS_ERROR_CODE, error.second);
diff --git a/cmds/statsd/src/metrics/CountMetricProducer.cpp b/cmds/statsd/src/metrics/CountMetricProducer.cpp
index 671c57f..da5ef44 100644
--- a/cmds/statsd/src/metrics/CountMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/CountMetricProducer.cpp
@@ -109,23 +109,23 @@
return;
}
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_ID, (long long)mMetricId);
- long long protoToken = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_COUNT_METRICS);
+ uint64_t protoToken = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_COUNT_METRICS);
for (const auto& counter : mPastBuckets) {
const MetricDimensionKey& dimensionKey = counter.first;
VLOG(" dimension key %s", dimensionKey.c_str());
- long long wrapperToken =
+ uint64_t wrapperToken =
protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_DATA);
// First fill dimension.
- long long dimensionInWhatToken = protoOutput->start(
+ uint64_t dimensionInWhatToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_ID_DIMENSION_IN_WHAT);
writeDimensionToProto(dimensionKey.getDimensionKeyInWhat(), protoOutput);
protoOutput->end(dimensionInWhatToken);
if (dimensionKey.hasDimensionKeyInCondition()) {
- long long dimensionInConditionToken = protoOutput->start(
+ uint64_t dimensionInConditionToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_ID_DIMENSION_IN_CONDITION);
writeDimensionToProto(dimensionKey.getDimensionKeyInCondition(), protoOutput);
protoOutput->end(dimensionInConditionToken);
@@ -134,7 +134,7 @@
// Then fill bucket_info (CountBucketInfo).
for (const auto& bucket : counter.second) {
- long long bucketInfoToken = protoOutput->start(
+ uint64_t bucketInfoToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_BUCKET_INFO);
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_START_BUCKET_ELAPSED_NANOS,
(long long)bucket.mBucketStartNs);
diff --git a/cmds/statsd/src/metrics/DurationMetricProducer.cpp b/cmds/statsd/src/metrics/DurationMetricProducer.cpp
index ac39662..29a892d 100644
--- a/cmds/statsd/src/metrics/DurationMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/DurationMetricProducer.cpp
@@ -235,7 +235,7 @@
}
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_ID, (long long)mMetricId);
- long long protoToken = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_DURATION_METRICS);
+ uint64_t protoToken = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_DURATION_METRICS);
VLOG("Duration metric %lld dump report now...", (long long)mMetricId);
@@ -243,17 +243,17 @@
const MetricDimensionKey& dimensionKey = pair.first;
VLOG(" dimension key %s", dimensionKey.c_str());
- long long wrapperToken =
+ uint64_t wrapperToken =
protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_DATA);
// First fill dimension.
- long long dimensionToken = protoOutput->start(
+ uint64_t dimensionToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_ID_DIMENSION_IN_WHAT);
writeDimensionToProto(dimensionKey.getDimensionKeyInWhat(), protoOutput);
protoOutput->end(dimensionToken);
if (dimensionKey.hasDimensionKeyInCondition()) {
- long long dimensionInConditionToken = protoOutput->start(
+ uint64_t dimensionInConditionToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_ID_DIMENSION_IN_CONDITION);
writeDimensionToProto(dimensionKey.getDimensionKeyInCondition(), protoOutput);
protoOutput->end(dimensionInConditionToken);
@@ -261,7 +261,7 @@
// Then fill bucket_info (DurationBucketInfo).
for (const auto& bucket : pair.second) {
- long long bucketInfoToken = protoOutput->start(
+ uint64_t bucketInfoToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_BUCKET_INFO);
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_START_BUCKET_ELAPSED_NANOS,
(long long)bucket.mBucketStartNs);
diff --git a/cmds/statsd/src/metrics/EventMetricProducer.cpp b/cmds/statsd/src/metrics/EventMetricProducer.cpp
index fff91f6..778eb8e 100644
--- a/cmds/statsd/src/metrics/EventMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/EventMetricProducer.cpp
@@ -131,7 +131,7 @@
return;
}
- long long wrapperToken =
+ uint64_t wrapperToken =
mProto->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_DATA);
const bool truncateTimestamp =
android::util::kNotTruncatingTimestampAtomWhiteList.find(event.GetTagId()) ==
@@ -148,7 +148,7 @@
(long long)getWallClockNs());
}
- long long eventToken = mProto->start(FIELD_TYPE_MESSAGE | FIELD_ID_ATOMS);
+ uint64_t eventToken = mProto->start(FIELD_TYPE_MESSAGE | FIELD_ID_ATOMS);
event.ToProto(*mProto);
mProto->end(eventToken);
mProto->end(wrapperToken);
diff --git a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
index 000c7a7..288f563c 100644
--- a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
@@ -135,23 +135,23 @@
}
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_ID, (long long)mMetricId);
- long long protoToken = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_GAUGE_METRICS);
+ uint64_t protoToken = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_GAUGE_METRICS);
for (const auto& pair : mPastBuckets) {
const MetricDimensionKey& dimensionKey = pair.first;
VLOG(" dimension key %s", dimensionKey.c_str());
- long long wrapperToken =
+ uint64_t wrapperToken =
protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_DATA);
// First fill dimension.
- long long dimensionToken = protoOutput->start(
+ uint64_t dimensionToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_ID_DIMENSION_IN_WHAT);
writeDimensionToProto(dimensionKey.getDimensionKeyInWhat(), protoOutput);
protoOutput->end(dimensionToken);
if (dimensionKey.hasDimensionKeyInCondition()) {
- long long dimensionInConditionToken = protoOutput->start(
+ uint64_t dimensionInConditionToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_ID_DIMENSION_IN_CONDITION);
writeDimensionToProto(dimensionKey.getDimensionKeyInCondition(), protoOutput);
protoOutput->end(dimensionInConditionToken);
@@ -159,7 +159,7 @@
// Then fill bucket_info (GaugeBucketInfo).
for (const auto& bucket : pair.second) {
- long long bucketInfoToken = protoOutput->start(
+ uint64_t bucketInfoToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_BUCKET_INFO);
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_START_BUCKET_ELAPSED_NANOS,
(long long)bucket.mBucketStartNs);
@@ -167,7 +167,7 @@
(long long)bucket.mBucketEndNs);
if (!bucket.mGaugeAtoms.empty()) {
- long long atomsToken =
+ uint64_t atomsToken =
protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_ATOM);
for (const auto& atom : bucket.mGaugeAtoms) {
writeFieldValueTreeToStream(mTagId, *(atom.mFields), protoOutput);
diff --git a/cmds/statsd/src/metrics/MetricsManager.cpp b/cmds/statsd/src/metrics/MetricsManager.cpp
index 0301466..1ca59a3 100644
--- a/cmds/statsd/src/metrics/MetricsManager.cpp
+++ b/cmds/statsd/src/metrics/MetricsManager.cpp
@@ -186,7 +186,7 @@
// one StatsLogReport per MetricProduer
for (const auto& producer : mAllMetricProducers) {
if (mNoReportMetricIds.find(producer->getMetricId()) == mNoReportMetricIds.end()) {
- long long token =
+ uint64_t token =
protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_METRICS);
producer->onDumpReport(dumpTimeStampNs, protoOutput);
protoOutput->end(token);
diff --git a/cmds/statsd/src/metrics/ValueMetricProducer.cpp b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
index f6bba3d..e88daf7 100644
--- a/cmds/statsd/src/metrics/ValueMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
@@ -142,21 +142,21 @@
return;
}
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_ID, (long long)mMetricId);
- long long protoToken = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_VALUE_METRICS);
+ uint64_t protoToken = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_VALUE_METRICS);
for (const auto& pair : mPastBuckets) {
const MetricDimensionKey& dimensionKey = pair.first;
VLOG(" dimension key %s", dimensionKey.c_str());
- long long wrapperToken =
+ uint64_t wrapperToken =
protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_DATA);
// First fill dimension.
- long long dimensionToken = protoOutput->start(
+ uint64_t dimensionToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_ID_DIMENSION_IN_WHAT);
writeDimensionToProto(dimensionKey.getDimensionKeyInWhat(), protoOutput);
protoOutput->end(dimensionToken);
if (dimensionKey.hasDimensionKeyInCondition()) {
- long long dimensionInConditionToken = protoOutput->start(
+ uint64_t dimensionInConditionToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_ID_DIMENSION_IN_CONDITION);
writeDimensionToProto(dimensionKey.getDimensionKeyInCondition(), protoOutput);
protoOutput->end(dimensionInConditionToken);
@@ -164,7 +164,7 @@
// Then fill bucket_info (ValueBucketInfo).
for (const auto& bucket : pair.second) {
- long long bucketInfoToken = protoOutput->start(
+ uint64_t bucketInfoToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | FIELD_ID_BUCKET_INFO);
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_START_BUCKET_NANOS,
(long long)bucket.mBucketStartNs);
diff --git a/cmds/statsd/src/stats_log_util.cpp b/cmds/statsd/src/stats_log_util.cpp
index 78ebe33..cab61e9 100644
--- a/cmds/statsd/src/stats_log_util.cpp
+++ b/cmds/statsd/src/stats_log_util.cpp
@@ -70,7 +70,7 @@
}
if (depth == valueDepth && valuePrefix == prefix) {
- long long token = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
+ uint64_t token = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED |
DIMENSIONS_VALUE_TUPLE_VALUE);
protoOutput->write(FIELD_TYPE_INT32 | DIMENSIONS_VALUE_FIELD, fieldNum);
switch (dim.mValue.getType()) {
@@ -99,10 +99,10 @@
(*index)++;
} else if (valueDepth > depth && valuePrefix == prefix) {
// Writing the sub tree
- long long dimensionToken = protoOutput->start(
+ uint64_t dimensionToken = protoOutput->start(
FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | DIMENSIONS_VALUE_TUPLE_VALUE);
protoOutput->write(FIELD_TYPE_INT32 | DIMENSIONS_VALUE_FIELD, fieldNum);
- long long tupleToken =
+ uint64_t tupleToken =
protoOutput->start(FIELD_TYPE_MESSAGE | DIMENSIONS_VALUE_VALUE_TUPLE);
writeDimensionToProtoHelper(dims, index, valueDepth, dim.mField.getPrefix(valueDepth),
protoOutput);
@@ -123,7 +123,7 @@
}
protoOutput->write(FIELD_TYPE_INT32 | DIMENSIONS_VALUE_FIELD,
dimension.getValues()[0].mField.getTag());
- long long topToken = protoOutput->start(FIELD_TYPE_MESSAGE | DIMENSIONS_VALUE_VALUE_TUPLE);
+ uint64_t topToken = protoOutput->start(FIELD_TYPE_MESSAGE | DIMENSIONS_VALUE_VALUE_TUPLE);
size_t index = 0;
writeDimensionToProtoHelper(dimension.getValues(), &index, 0, 0, protoOutput);
protoOutput->end(topToken);
@@ -189,7 +189,7 @@
(*index)++;
} else if (valueDepth > depth && valuePrefix == prefix) {
// Writing the sub tree
- long long msg_token = 0;
+ uint64_t msg_token = 0ULL;
if (valueDepth == depth + 2) {
msg_token =
protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_COUNT_REPEATED | fieldNum);
@@ -212,7 +212,7 @@
void writeFieldValueTreeToStream(int tagId, const std::vector<FieldValue>& values,
util::ProtoOutputStream* protoOutput) {
- long long atomToken = protoOutput->start(FIELD_TYPE_MESSAGE | tagId);
+ uint64_t atomToken = protoOutput->start(FIELD_TYPE_MESSAGE | tagId);
size_t index = 0;
writeFieldValueTreeToStreamHelper(values, &index, 0, 0, protoOutput);
@@ -257,7 +257,7 @@
void writePullerStatsToStream(const std::pair<int, StatsdStats::PulledAtomStats>& pair,
util::ProtoOutputStream* protoOutput) {
- long long token = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_PULLED_ATOM_STATS |
+ uint64_t token = protoOutput->start(FIELD_TYPE_MESSAGE | FIELD_ID_PULLED_ATOM_STATS |
FIELD_COUNT_REPEATED);
protoOutput->write(FIELD_TYPE_INT32 | FIELD_ID_PULL_ATOM_ID, (int32_t)pair.first);
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_TOTAL_PULL, (long long)pair.second.totalPull);
diff --git a/libs/protoutil/include/android/util/ProtoOutputStream.h b/libs/protoutil/include/android/util/ProtoOutputStream.h
index 52830d3..43ac1ec 100644
--- a/libs/protoutil/include/android/util/ProtoOutputStream.h
+++ b/libs/protoutil/include/android/util/ProtoOutputStream.h
@@ -25,7 +25,7 @@
namespace util {
/**
- * Position of the field type in a (long long) fieldId.
+ * Position of the field type in a 64-bits fieldId.
*/
const uint64_t FIELD_TYPE_SHIFT = 32;
@@ -106,8 +106,8 @@
* Returns a token of this write session.
* Must call end(token) when finish write this sub-message.
*/
- long long start(uint64_t fieldId);
- void end(long long token);
+ uint64_t start(uint64_t fieldId);
+ void end(uint64_t token);
/**
* Returns how many bytes are buffered in ProtoOutputStream.
@@ -139,7 +139,7 @@
bool mCompact;
int mDepth;
int mObjectId;
- long long mExpectedObjectToken;
+ uint64_t mExpectedObjectToken;
inline void writeDoubleImpl(uint32_t id, double val);
inline void writeFloatImpl(uint32_t id, float val);
diff --git a/libs/protoutil/src/ProtoOutputStream.cpp b/libs/protoutil/src/ProtoOutputStream.cpp
index 9d9ffec..a040bd2 100644
--- a/libs/protoutil/src/ProtoOutputStream.cpp
+++ b/libs/protoutil/src/ProtoOutputStream.cpp
@@ -28,7 +28,7 @@
mCompact(false),
mDepth(0),
mObjectId(0),
- mExpectedObjectToken(0LL)
+ mExpectedObjectToken(0ULL)
{
}
@@ -45,7 +45,7 @@
mCompact = false;
mDepth = 0;
mObjectId = 0;
- mExpectedObjectToken = 0LL;
+ mExpectedObjectToken = 0ULL;
}
bool
@@ -222,37 +222,37 @@
* because of the overflow, and only the tokens are compared.
* Bits 0-31 - offset of the first size field in the buffer.
*/
-long long
+uint64_t
makeToken(int tagSize, bool repeated, int depth, int objectId, int sizePos) {
- return ((0x07L & (long long)tagSize) << 61)
+ return ((0x07L & (uint64_t)tagSize) << 61)
| (repeated ? (1LL << 60) : 0)
- | (0x01ffL & (long long)depth) << 51
- | (0x07ffffL & (long long)objectId) << 32
- | (0x0ffffffffL & (long long)sizePos);
+ | (0x01ffL & (uint64_t)depth) << 51
+ | (0x07ffffL & (uint64_t)objectId) << 32
+ | (0x0ffffffffL & (uint64_t)sizePos);
}
/**
* Get the encoded tag size from the token.
*/
-static int getTagSizeFromToken(long long token) {
+static int getTagSizeFromToken(uint64_t token) {
return (int)(0x7 & (token >> 61));
}
/**
* Get the nesting depth of startObject calls from the token.
*/
-static int getDepthFromToken(long long token) {
+static int getDepthFromToken(uint64_t token) {
return (int)(0x01ff & (token >> 51));
}
/**
* Get the location of the childRawSize (the first 32 bit size field) in this object.
*/
-static int getSizePosFromToken(long long token) {
+static int getSizePosFromToken(uint64_t token) {
return (int)token;
}
-long long
+uint64_t
ProtoOutputStream::start(uint64_t fieldId)
{
if ((fieldId & FIELD_TYPE_MASK) != FIELD_TYPE_MESSAGE) {
@@ -275,10 +275,10 @@
}
void
-ProtoOutputStream::end(long long token)
+ProtoOutputStream::end(uint64_t token)
{
if (token != mExpectedObjectToken) {
- ALOGE("Unexpected token: 0x%llx, should be 0x%llx", token, mExpectedObjectToken);
+ ALOGE("Unexpected token: 0x%llx, should be 0x%llx", (long long)token, (long long)mExpectedObjectToken);
return;
}