Skip to content

Commit

Permalink
Merge pull request #53 from sp-nitech/minmax
Browse files Browse the repository at this point in the history
Fix minmax
  • Loading branch information
takenori-y authored Dec 13, 2023
2 parents d837ec8 + 055fb48 commit 4383f36
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/main/minmax.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ int main(int argc, char* argv[]) {
}
} else if (kFindValueFromVectorSequenceForEachDimension ==
way_to_find_value) {
bool empty(true);
while (sptk::ReadStream(false, 0, 0, vector_length, &data, &input_stream,
NULL)) {
for (int vector_index(0); vector_index < vector_length; ++vector_index) {
Expand All @@ -354,13 +355,17 @@ int main(int argc, char* argv[]) {
return 1;
}
}
if (empty) empty = false;
}
if (!WriteMinMaxValues(minmax_accumulation, buffer, num_best, output_format,
output_stream_pointer)) {
std::ostringstream error_message;
error_message << "Failed to write values";
sptk::PrintErrorMessage("minmax", error_message);
return 1;
// Write value if at least one data is given.
if (!empty) {
if (!WriteMinMaxValues(minmax_accumulation, buffer, num_best,
output_format, output_stream_pointer)) {
std::ostringstream error_message;
error_message << "Failed to write values";
sptk::PrintErrorMessage("minmax", error_message);
return 1;
}
}
}

Expand Down

0 comments on commit 4383f36

Please sign in to comment.