Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.

Commit cd22ccf

Browse files
hhellyerrnchamberlain
authored andcommitted
mac: Fix compilation errors
Revert to using node-gyp default C++ libraries for building node-report on Mac. Remove use of std::prev as that requires libc++. PR-URL: #56 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent a590cd9 commit cd22ccf

2 files changed

Lines changed: 11 additions & 22 deletions

File tree

binding.gyp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
"libraries": [ "dbghelp.lib", "Netapi32.lib", "PsApi.lib" ],
1414
"dll_files": [ "dbghelp.dll", "Netapi32.dll", "PsApi.dll" ],
1515
}],
16-
["OS=='mac'", {
17-
"xcode_settings": {
18-
'CLANG_CXX_LIBRARY': 'libc++',
19-
'CLANG_CXX_LANGUAGE_STANDARD':'c++11',
20-
}
21-
}],
2216
],
2317
"defines": [
2418
'NODEREPORT_VERSION="<!(node -p \"require(\'./package.json\').version\")"'

src/node_report.cc

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -264,26 +264,21 @@ void SetVersionString(Isolate* isolate) {
264264
// (ares: 1.10.1-DEV, http_parser: 2.7.0, icu: 57.1, modules: 48,
265265
// openssl: 1.0.2j, uv: 1.9.1, v8: 5.1.281.84, zlib: 1.2.8)
266266
const size_t wrap = 80;
267-
size_t line_length = 1;
268267
version_string += "(";
268+
const char* separator = "";
269+
std::string versions = "";
269270
for (auto it : comp_versions) {
270-
std::string component_name = it.first;
271-
std::string component_version = it.second;
272-
size_t length = component_name.length() + component_version.length() + 2;
273-
if (line_length + length + 1 >= wrap) {
274-
version_string += "\n ";
275-
line_length = 1;
276-
}
277-
version_string += component_name;
278-
version_string += ": ";
279-
version_string += component_version;
280-
line_length += length;
281-
if (it != *std::prev(comp_versions.end())) {
282-
version_string += ", ";
283-
line_length += 2;
271+
std::string comp_version_string = it.first;
272+
comp_version_string += ": ";
273+
comp_version_string += it.second;
274+
versions += separator;
275+
if (wrap - (versions.length() % wrap) < comp_version_string.length()) {
276+
versions += "\n ";
284277
}
278+
separator = ", ";
279+
versions += comp_version_string;
285280
}
286-
version_string += ")\n";
281+
version_string += versions + ")\n";
287282
}
288283

289284
/*******************************************************************************

0 commit comments

Comments
 (0)