| Index: runtime/platform/c99_support_win.h
|
| ===================================================================
|
| --- runtime/platform/c99_support_win.h (revision 20895)
|
| +++ runtime/platform/c99_support_win.h (working copy)
|
| @@ -9,6 +9,7 @@
|
| // functions. Define them here.
|
|
|
| #include <float.h>
|
| +#include <string.h>
|
|
|
| static const unsigned __int64 kQuietNaNMask =
|
| static_cast<unsigned __int64>(0xfff) << 51;
|
| @@ -64,4 +65,18 @@
|
| }
|
| }
|
|
|
| +// size_t used to match function signature on other platforms.
|
| +static inline char* strndup(const char* s, size_t n) {
|
| + size_t len = strlen(s);
|
| + if (n < len) {
|
| + len = n;
|
| + }
|
| + char* result = reinterpret_cast<char*>(malloc(len + 1));
|
| + if (!result) {
|
| + return NULL;
|
| + }
|
| + result[len] = '\0';
|
| + return reinterpret_cast<char*>(memcpy(result, s, len));
|
| +}
|
| +
|
| #endif // PLATFORM_C99_SUPPORT_WIN_H_
|
|
|