Merge pull request #99 from haberman/dataquality
Fixed bug where "-n 0" didn't work properly.
diff --git a/src/bloaty.cc b/src/bloaty.cc
index 514d1f0..ca39a07 100644
--- a/src/bloaty.cc
+++ b/src/bloaty.cc
@@ -1682,7 +1682,11 @@
} else if (args.TryParseOption("--disassemble", &option)) {
options->mutable_disassemble_function()->assign(std::string(option));
} else if (args.TryParseIntegerOption("-n", &int_option)) {
- options->set_max_rows_per_level(int_option);
+ if (int_option == 0) {
+ options->set_max_rows_per_level(INT64_MAX);
+ } else {
+ options->set_max_rows_per_level(int_option);
+ }
} else if (args.TryParseOption("-s", &option)) {
if (option == "vm") {
options->set_sort_by(Options::SORTBY_VMSIZE);
diff --git a/src/bloaty.proto b/src/bloaty.proto
index 5a17d67..8b771ef 100644
--- a/src/bloaty.proto
+++ b/src/bloaty.proto
@@ -38,7 +38,7 @@
// The maximum number of rows to show at each level before collapsing the rest
// into '[Other]'.
- optional int32 max_rows_per_level = 4 [default = 20];
+ optional int64 max_rows_per_level = 4 [default = 20];
enum Demangle {
DEMANGLE_SHORT = 0;
diff --git a/tests/bloaty_test.cc b/tests/bloaty_test.cc
index 9f8a3be..c0d7340 100644
--- a/tests/bloaty_test.cc
+++ b/tests/bloaty_test.cc
@@ -48,7 +48,8 @@
uint64_t size;
ASSERT_TRUE(GetFileSize(file, &size));
- RunBloaty({"bloaty", file});
+ // Test "-n 0" which should return an unlimited number of rows.
+ RunBloaty({"bloaty", "-n", "0", file});
EXPECT_GT(top_row_->vmsize, 64);
EXPECT_LT(top_row_->vmsize, 300);
EXPECT_EQ(top_row_->filesize, size);