Revision: 75658
http://sourceforge.net/p/brlcad/code/75658
Author: starseeker
Date: 2020-05-01 14:17:02 +0000 (Fri, 01 May 2020)
Log Message:
-----------
Don't write a file if there is nothing to write
Modified Paths:
--------------
brlcad/trunk/src/gtools/gchecker.cpp
Modified: brlcad/trunk/src/gtools/gchecker.cpp
===================================================================
--- brlcad/trunk/src/gtools/gchecker.cpp 2020-05-01 14:01:45 UTC (rev
75657)
+++ brlcad/trunk/src/gtools/gchecker.cpp 2020-05-01 14:17:02 UTC (rev
75658)
@@ -363,14 +363,17 @@
pair_avg_sizes[*p_it] = ssum/(double)scnt;
}
- std::string ofile = std::string("ck.") +
std::string(bu_vls_cstr(&gbasename)) + std::string(".overlaps");
- std::ofstream of(ofile);
- std::map<std::pair<std::string, std::string>, double>::iterator a_it;
- for (a_it = pair_avg_sizes.begin(); a_it != pair_avg_sizes.end(); a_it++) {
- bu_log("%s + %s: %f\n", a_it->first.first.c_str(),
a_it->first.second.c_str(), a_it->second);
- of << a_it->first.first.c_str() << " " << a_it->first.second.c_str() <<
" " << std::fixed << std::setprecision(5) << a_it->second << "\n";
+ // If we have something to write out, do so
+ if (pair_avg_sizes.size()) {
+ std::string ofile = std::string("ck.") +
std::string(bu_vls_cstr(&gbasename)) + std::string(".overlaps");
+ std::ofstream of(ofile);
+ std::map<std::pair<std::string, std::string>, double>::iterator a_it;
+ for (a_it = pair_avg_sizes.begin(); a_it != pair_avg_sizes.end();
a_it++) {
+ bu_log("%s + %s: %f\n", a_it->first.first.c_str(),
a_it->first.second.c_str(), a_it->second);
+ of << a_it->first.first.c_str() << " " <<
a_it->first.second.c_str() << " " << std::fixed << std::setprecision(5) <<
a_it->second << "\n";
+ }
+ of.close();
}
- of.close();
// Remove the copy of the .g file
std::remove(bu_vls_cstr(&gbasename));
@@ -379,6 +382,8 @@
bu_vls_free(&gfile);
bu_vls_free(&gbasename);
bu_vls_free(&wdir);
+
+ return 0;
}
// Local Variables:
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits