Loading logd/LogStatistics.h +12 −9 Original line number Original line Diff line number Diff line Loading @@ -17,11 +17,12 @@ #ifndef _LOGD_LOG_STATISTICS_H__ #ifndef _LOGD_LOG_STATISTICS_H__ #define _LOGD_LOG_STATISTICS_H__ #define _LOGD_LOG_STATISTICS_H__ #include <memory> #include <ctype.h> #include <stdlib.h> #include <stdlib.h> #include <sys/types.h> #include <sys/types.h> #include <algorithm> // std::max #include <algorithm> // std::max #include <memory> #include <string> // std::string #include <string> // std::string #include <unordered_map> #include <unordered_map> Loading Loading @@ -211,14 +212,16 @@ struct EntryBase { EntryBaseConstants::total_len EntryBaseConstants::total_len - name.length() - drop_len - 1); - name.length() - drop_len - 1); if (pruned.length()) { std::string ret = android::base::StringPrintf("%s%*s%*s", return android::base::StringPrintf("%s%*s%*s\n", name.c_str(), name.c_str(), (int)size_len, size.c_str(), (int)size_len, size.c_str(), (int)drop_len, pruned.c_str()); (int)drop_len, pruned.c_str()); } else { // remove any trailing spaces return android::base::StringPrintf("%s%*s\n", name.c_str(), size_t pos = ret.size(); (int)size_len, size.c_str()); size_t len = 0; } while (pos && isspace(ret[--pos])) ++len; if (len) ret.erase(pos + 1, len); return ret + "\n"; } } }; }; Loading Loading
logd/LogStatistics.h +12 −9 Original line number Original line Diff line number Diff line Loading @@ -17,11 +17,12 @@ #ifndef _LOGD_LOG_STATISTICS_H__ #ifndef _LOGD_LOG_STATISTICS_H__ #define _LOGD_LOG_STATISTICS_H__ #define _LOGD_LOG_STATISTICS_H__ #include <memory> #include <ctype.h> #include <stdlib.h> #include <stdlib.h> #include <sys/types.h> #include <sys/types.h> #include <algorithm> // std::max #include <algorithm> // std::max #include <memory> #include <string> // std::string #include <string> // std::string #include <unordered_map> #include <unordered_map> Loading Loading @@ -211,14 +212,16 @@ struct EntryBase { EntryBaseConstants::total_len EntryBaseConstants::total_len - name.length() - drop_len - 1); - name.length() - drop_len - 1); if (pruned.length()) { std::string ret = android::base::StringPrintf("%s%*s%*s", return android::base::StringPrintf("%s%*s%*s\n", name.c_str(), name.c_str(), (int)size_len, size.c_str(), (int)size_len, size.c_str(), (int)drop_len, pruned.c_str()); (int)drop_len, pruned.c_str()); } else { // remove any trailing spaces return android::base::StringPrintf("%s%*s\n", name.c_str(), size_t pos = ret.size(); (int)size_len, size.c_str()); size_t len = 0; } while (pos && isspace(ret[--pos])) ++len; if (len) ret.erase(pos + 1, len); return ret + "\n"; } } }; }; Loading