diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-02-28 00:09:35 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-02-28 00:09:35 +0000 |
commit | 9eeb15369401d4f3f07d209e0298665394ed125a (patch) | |
tree | a759217b5f340ab359ceaf22e7feec7770b70cc9 | |
parent | f567ba9b2c68b5c79e8d00ced203e99a2125443f (diff) |
zziplib: support old solaris
git-svn-id: svn://tug.org/texlive/trunk@46760 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/libs/zziplib/TLpatches/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/libs/zziplib/TLpatches/patch-04-solaris-strnlen | 22 | ||||
-rw-r--r-- | Build/source/libs/zziplib/zziplib-src/zzip/__string.h | 12 |
3 files changed, 38 insertions, 0 deletions
diff --git a/Build/source/libs/zziplib/TLpatches/ChangeLog b/Build/source/libs/zziplib/TLpatches/ChangeLog index 0412cc0bfae..f6ecab4e9fb 100644 --- a/Build/source/libs/zziplib/TLpatches/ChangeLog +++ b/Build/source/libs/zziplib/TLpatches/ChangeLog @@ -1,3 +1,7 @@ +2018-02-28 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * patch-04-solaris-strnlen: Add to support old solaris. + 2018-02-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * Import zziplib-0.13.68. diff --git a/Build/source/libs/zziplib/TLpatches/patch-04-solaris-strnlen b/Build/source/libs/zziplib/TLpatches/patch-04-solaris-strnlen new file mode 100644 index 00000000000..f9fb4d43aa0 --- /dev/null +++ b/Build/source/libs/zziplib/TLpatches/patch-04-solaris-strnlen @@ -0,0 +1,22 @@ +diff -ur zziplib-0.13.68.orig/zzip/__string.h zziplib-0.13.68/zzip/__string.h +--- zziplib-0.13.68.orig/zzip/__string.h Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/zzip/__string.h Wed Feb 28 08:54:17 2018 +@@ -18,6 +18,18 @@ + #define _zzip_strndup strndup + #else + ++#if defined(sun) || defined(__sun) ++static size_t my_strnlen(const char* str, size_t maxlen) ++{ ++ char *p = memchr(str, 0, maxlen); ++ if (p == NULL) ++ return maxlen; ++ else ++ return (p - str); ++} ++#define strnlen(x,y) my_strnlen((x),(y)) ++#endif /* sun || __sun */ ++ + /* if your system does not have strndup: */ + zzip__new__ static char * + _zzip_strndup(char const *p, size_t maxlen) diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/__string.h b/Build/source/libs/zziplib/zziplib-src/zzip/__string.h index 351b0c14162..294ac3943cf 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/__string.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/__string.h @@ -18,6 +18,18 @@ #define _zzip_strndup strndup #else +#if defined(sun) || defined(__sun) +static size_t my_strnlen(const char* str, size_t maxlen) +{ + char *p = memchr(str, 0, maxlen); + if (p == NULL) + return maxlen; + else + return (p - str); +} +#define strnlen(x,y) my_strnlen((x),(y)) +#endif /* sun || __sun */ + /* if your system does not have strndup: */ zzip__new__ static char * _zzip_strndup(char const *p, size_t maxlen) |