-
Notifications
You must be signed in to change notification settings - Fork 45
mac: Fix compilation errors against Node > v5 #56
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,26 +264,21 @@ void SetVersionString(Isolate* isolate) { | |
// (ares: 1.10.1-DEV, http_parser: 2.7.0, icu: 57.1, modules: 48, | ||
// openssl: 1.0.2j, uv: 1.9.1, v8: 5.1.281.84, zlib: 1.2.8) | ||
const size_t wrap = 80; | ||
size_t line_length = 1; | ||
version_string += "("; | ||
const char* separator = ""; | ||
std::string versions = ""; | ||
for (auto it : comp_versions) { | ||
std::string component_name = it.first; | ||
std::string component_version = it.second; | ||
size_t length = component_name.length() + component_version.length() + 2; | ||
if (line_length + length + 1 >= wrap) { | ||
version_string += "\n "; | ||
line_length = 1; | ||
} | ||
version_string += component_name; | ||
version_string += ": "; | ||
version_string += component_version; | ||
line_length += length; | ||
if (it != *std::prev(comp_versions.end())) { | ||
version_string += ", "; | ||
line_length += 2; | ||
std::string comp_version_string = it.first; | ||
comp_version_string += ": "; | ||
comp_version_string += it.second; | ||
versions += separator; | ||
if (wrap - (versions.length() % wrap) < comp_version_string.length()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The separator is unconditionally appended before the wrapping check, so could take the line over the wrap if the line was right up against the wrap prior to the separator being appended. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it matters, the line stays at a sensible length. We don't worry about wrapping elsewhere in the file and plenty of other lines go over 80 characters (OS version and stack trace at least) and we don't wrap those. (Wrapping the stack trace would be horrible.) Possibly we should just remove the wrapping code for consistency or give each version it's own line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had one component/version per line originally in #30 but was talked out of it. |
||
versions += "\n "; | ||
} | ||
separator = ", "; | ||
versions += comp_version_string; | ||
} | ||
version_string += ")\n"; | ||
version_string += versions + ")\n"; | ||
} | ||
|
||
/******************************************************************************* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can shorten this line by using
-p
instead of-e
: