Index: src/platform-macos.cc |
=================================================================== |
--- src/platform-macos.cc (revision 1141) |
+++ src/platform-macos.cc (working copy) |
@@ -199,12 +199,14 @@ |
// Stupid implementation of strndup since macos isn't born with |
// one. |
size_t len = strlen(str); |
- if (len <= n) |
+ if (len <= n) { |
return StrDup(str); |
+ } |
char* result = new char[n+1]; |
size_t i; |
- for (i = 0; i <= n; i++) |
+ for (i = 0; i <= n; i++) { |
result[i] = str[i]; |
+ } |
result[i] = '\0'; |
return result; |
} |