1
Index: sunpinyin/src/portability.cpp
2
===================================================================
3
--- sunpinyin.orig/src/portability.cpp 2012-03-30 17:55:51.000000000 +0800
4
+++ sunpinyin/src/portability.cpp 2012-03-30 17:59:24.869968967 +0800
9
-#if !defined (HAVE_STRNDUP)
11
-strndup(const char *s, size_t n)
20
- nMost = std::min(strlen(s) + 1, n + 1);
22
- nMost = min(strlen(s) + 1, n + 1);
24
- p = (char*)malloc(nMost);
25
- memcpy(p, s, nMost);
26
- p[nMost - 1] = '\0';
30
-#endif //HAVE_STRNDUP
32
Index: sunpinyin/src/portability.h
33
===================================================================
34
--- sunpinyin.orig/src/portability.h 2012-03-30 17:55:51.000000000 +0800
35
+++ sunpinyin/src/portability.h 2012-03-30 18:01:23.390556674 +0800
40
-#if !defined (HAVE_STRNDUP)
41
-extern "C" char *strndup(const char *s, size_t n);
42
-#endif //HAVE_STRNDUP