~ubuntu-branches/ubuntu/trusty/sunpinyin/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/strndup_in_cxx.patch

  • Committer: Package Import Robot
  • Author(s): YunQiang Su
  • Date: 2012-03-30 15:31:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120330153155-ep92npxp3mucniyt
Tags: 2.0.3+git20120222-1
* Team upload: git snapshot 20120222.
   - fix breaks if LDFLAGS in environment contains
       multiple words (Closese #646001).
   - rm patches merged to upstream:
       append-os-environ-toenv.patch
       fix-ftbfs-on-sh.patch
       remove-10-candidate-words-limitation.patch
   - refresh disable-lm-dict-compile.patch.
* Bump stardard version to 3.9.3: no modify needed.
* add libsunpinyin3-dbg and python-sunpinyin packages.
* debian/compat to 9, multiarch it.
* rewrite debian/rules with dh 7 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
@@ -265,26 +265,4 @@
 
6
     return sz;
 
7
 }
 
8
 
 
9
-#if !defined (HAVE_STRNDUP)
 
10
-extern "C" char *
 
11
-strndup(const char *s, size_t n)
 
12
-{
 
13
-    size_t nMost;
 
14
-    char *p = NULL;
 
15
-
 
16
-    if (!s)
 
17
-        return NULL;
 
18
-
 
19
-#ifdef __cplusplus
 
20
-    nMost = std::min(strlen(s) + 1, n + 1);
 
21
-#else
 
22
-    nMost = min(strlen(s) + 1, n + 1);
 
23
-#endif
 
24
-    p = (char*)malloc(nMost);
 
25
-    memcpy(p, s, nMost);
 
26
-    p[nMost - 1] = '\0';
 
27
-
 
28
-    return p;
 
29
-}
 
30
-#endif //HAVE_STRNDUP
 
31
 
 
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
 
36
@@ -326,8 +326,4 @@
 
37
 }
 
38
 #endif
 
39
 
 
40
-#if !defined (HAVE_STRNDUP)
 
41
-extern "C" char *strndup(const char *s, size_t n);
 
42
-#endif //HAVE_STRNDUP
 
43
-
 
44
 #endif