diff options
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 13 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/Makefile.am | 2 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/Makefile.in | 47 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/db.c | 13 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/db.h | 3 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/pathsearch.c | 7 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/pathsearch.h | 2 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/readable.c | 60 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/readable.h | 5 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/tex-file.c | 4 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/truncate.c | 68 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/truncate.h | 33 | ||||
-rw-r--r-- | Build/source/texk/ptexenc/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/ptexenc/ptexenc.c | 9 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/lkpselib.c | 6 |
16 files changed, 112 insertions, 168 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index af229dd3000..4fed51f29cd 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,16 @@ +2012-12-13 Peter Breitenlohner <peb@mppmu.mpg.de> + + Resolve remaining const related problems. + * db.[ch] (kpathsea_db_search_list): Make arg3 non-const. + * pathsearch.[ch] (kpathsea_path_search_list_generic, + dir_list_search_list): Make arg3 non-const. + * tex-file.c: Remove casts 'string*' => 'const_string*'. + * readable.[ch] (kpathsea_readable_file): Make arg non-const. + Include code to truncate too-long filename components. + + * truncate.[ch] (kpathsea_truncate_filename): Files removed. + * Makefile.am: Drop truncate.c and truncate.h. + 2012-12-12 Peter Breitenlohner <peb@mppmu.mpg.de> Somewhat disentangle path search functions. diff --git a/Build/source/texk/kpathsea/Makefile.am b/Build/source/texk/kpathsea/Makefile.am index ded6f6accbc..627538d4822 100644 --- a/Build/source/texk/kpathsea/Makefile.am +++ b/Build/source/texk/kpathsea/Makefile.am @@ -67,7 +67,6 @@ libkpathsea_la_SOURCES = \ tex-hush.c \ tex-make.c \ tilde.c \ - truncate.c \ uppercasify.c \ variable.c \ version.c \ @@ -175,7 +174,6 @@ noinst_HEADERS = \ fn.h \ fontmap.h \ tilde.h \ - truncate.h \ xopendir.h \ xstat.h diff --git a/Build/source/texk/kpathsea/Makefile.in b/Build/source/texk/kpathsea/Makefile.in index 996ef7210f9..0c996d411ba 100644 --- a/Build/source/texk/kpathsea/Makefile.in +++ b/Build/source/texk/kpathsea/Makefile.in @@ -149,11 +149,11 @@ am__libkpathsea_la_SOURCES_DIST = tex-file.c absolute.c atou.c cnf.c \ getopt.c getopt1.c hash.c kdefault.c kpathsea.c line.c \ magstep.c make-suffix.c path-elt.c pathsearch.c proginit.c \ progname.c readable.c rm-suffix.c str-list.c str-llist.c \ - tex-glyph.c tex-hush.c tex-make.c tilde.c truncate.c \ - uppercasify.c variable.c version.c xbasename.c xcalloc.c \ - xdirname.c xfopen.c xfseek.c xftell.c xgetcwd.c xmalloc.c \ - xopendir.c xputenv.c xrealloc.c xstat.c xstrdup.c mingw32.c \ - xfseeko.c xftello.c win32lib.c knj.c + tex-glyph.c tex-hush.c tex-make.c tilde.c uppercasify.c \ + variable.c version.c xbasename.c xcalloc.c xdirname.c xfopen.c \ + xfseek.c xftell.c xgetcwd.c xmalloc.c xopendir.c xputenv.c \ + xrealloc.c xstat.c xstrdup.c mingw32.c xfseeko.c xftello.c \ + win32lib.c knj.c @MINGW32_TRUE@@WIN32_TRUE@am__objects_1 = libkpathsea_la-mingw32.lo \ @MINGW32_TRUE@@WIN32_TRUE@ libkpathsea_la-xfseeko.lo \ @MINGW32_TRUE@@WIN32_TRUE@ libkpathsea_la-xftello.lo @@ -180,16 +180,16 @@ am_libkpathsea_la_OBJECTS = libkpathsea_la-tex-file.lo \ libkpathsea_la-str-list.lo libkpathsea_la-str-llist.lo \ libkpathsea_la-tex-glyph.lo libkpathsea_la-tex-hush.lo \ libkpathsea_la-tex-make.lo libkpathsea_la-tilde.lo \ - libkpathsea_la-truncate.lo libkpathsea_la-uppercasify.lo \ - libkpathsea_la-variable.lo libkpathsea_la-version.lo \ - libkpathsea_la-xbasename.lo libkpathsea_la-xcalloc.lo \ - libkpathsea_la-xdirname.lo libkpathsea_la-xfopen.lo \ - libkpathsea_la-xfseek.lo libkpathsea_la-xftell.lo \ - libkpathsea_la-xgetcwd.lo libkpathsea_la-xmalloc.lo \ - libkpathsea_la-xopendir.lo libkpathsea_la-xputenv.lo \ - libkpathsea_la-xrealloc.lo libkpathsea_la-xstat.lo \ - libkpathsea_la-xstrdup.lo $(am__objects_1) $(am__objects_2) \ - $(am__objects_3) $(am__objects_4) + libkpathsea_la-uppercasify.lo libkpathsea_la-variable.lo \ + libkpathsea_la-version.lo libkpathsea_la-xbasename.lo \ + libkpathsea_la-xcalloc.lo libkpathsea_la-xdirname.lo \ + libkpathsea_la-xfopen.lo libkpathsea_la-xfseek.lo \ + libkpathsea_la-xftell.lo libkpathsea_la-xgetcwd.lo \ + libkpathsea_la-xmalloc.lo libkpathsea_la-xopendir.lo \ + libkpathsea_la-xputenv.lo libkpathsea_la-xrealloc.lo \ + libkpathsea_la-xstat.lo libkpathsea_la-xstrdup.lo \ + $(am__objects_1) $(am__objects_2) $(am__objects_3) \ + $(am__objects_4) libkpathsea_la_OBJECTS = $(am_libkpathsea_la_OBJECTS) libkpathsea_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -440,10 +440,10 @@ libkpathsea_la_SOURCES = tex-file.c absolute.c atou.c cnf.c concat.c \ getopt1.c hash.c kdefault.c kpathsea.c line.c magstep.c \ make-suffix.c path-elt.c pathsearch.c proginit.c progname.c \ readable.c rm-suffix.c str-list.c str-llist.c tex-glyph.c \ - tex-hush.c tex-make.c tilde.c truncate.c uppercasify.c \ - variable.c version.c xbasename.c xcalloc.c xdirname.c xfopen.c \ - xfseek.c xftell.c xgetcwd.c xmalloc.c xopendir.c xputenv.c \ - xrealloc.c xstat.c xstrdup.c $(am__append_1) $(am__append_2) \ + tex-hush.c tex-make.c tilde.c uppercasify.c variable.c \ + version.c xbasename.c xcalloc.c xdirname.c xfopen.c xfseek.c \ + xftell.c xgetcwd.c xmalloc.c xopendir.c xputenv.c xrealloc.c \ + xstat.c xstrdup.c $(am__append_1) $(am__append_2) \ $(am__append_3) $(am__append_5) kpseincludedir = ${includedir}/kpathsea nodist_kpseinclude_HEADERS = \ @@ -507,7 +507,6 @@ noinst_HEADERS = \ fn.h \ fontmap.h \ tilde.h \ - truncate.h \ xopendir.h \ xstat.h @@ -770,7 +769,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-tex-hush.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-tex-make.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-tilde.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-truncate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-uppercasify.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-variable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libkpathsea_la-version.Plo@am__quote@ @@ -1074,13 +1072,6 @@ libkpathsea_la-tilde.lo: tilde.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkpathsea_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkpathsea_la-tilde.lo `test -f 'tilde.c' || echo '$(srcdir)/'`tilde.c -libkpathsea_la-truncate.lo: truncate.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkpathsea_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libkpathsea_la-truncate.lo -MD -MP -MF $(DEPDIR)/libkpathsea_la-truncate.Tpo -c -o libkpathsea_la-truncate.lo `test -f 'truncate.c' || echo '$(srcdir)/'`truncate.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libkpathsea_la-truncate.Tpo $(DEPDIR)/libkpathsea_la-truncate.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='truncate.c' object='libkpathsea_la-truncate.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkpathsea_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libkpathsea_la-truncate.lo `test -f 'truncate.c' || echo '$(srcdir)/'`truncate.c - libkpathsea_la-uppercasify.lo: uppercasify.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkpathsea_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libkpathsea_la-uppercasify.lo -MD -MP -MF $(DEPDIR)/libkpathsea_la-uppercasify.Tpo -c -o libkpathsea_la-uppercasify.lo `test -f 'uppercasify.c' || echo '$(srcdir)/'`uppercasify.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libkpathsea_la-uppercasify.Tpo $(DEPDIR)/libkpathsea_la-uppercasify.Plo diff --git a/Build/source/texk/kpathsea/db.c b/Build/source/texk/kpathsea/db.c index 1b79a646a51..41aeb80835a 100644 --- a/Build/source/texk/kpathsea/db.c +++ b/Build/source/texk/kpathsea/db.c @@ -43,11 +43,16 @@ #define DB_NAME_LC "ls-r" #endif +static char db_name[] = DB_NAME; +#ifndef WIN32 +static char db_name_lc[] = DB_NAME_LC; +#endif + /* read ls-R only on WIN32 */ -static const_string db_names[] = { - DB_NAME, +static string db_names[] = { + db_name, #ifndef WIN32 - DB_NAME_LC, + db_name_lc, #endif NULL }; @@ -583,7 +588,7 @@ kpathsea_db_search (kpathsea kpse, const_string name, } str_list_type * -kpathsea_db_search_list (kpathsea kpse, const_string* names, +kpathsea_db_search_list (kpathsea kpse, string* names, const_string path_elt, boolean all) { const_string *db_dirs, *orig_dirs; diff --git a/Build/source/texk/kpathsea/db.h b/Build/source/texk/kpathsea/db.h index 8c06cb85edc..b77b1f04b0c 100644 --- a/Build/source/texk/kpathsea/db.h +++ b/Build/source/texk/kpathsea/db.h @@ -38,8 +38,9 @@ extern void kpathsea_init_db (kpathsea kpse); extern str_list_type *kpathsea_db_search (kpathsea kpse, const_string name, const_string path_elt, boolean all); +/* Note: NAMES[i] is not modified. */ extern str_list_type *kpathsea_db_search_list (kpathsea kpse, - const_string* names, + string* names, const_string path_elt, boolean all); diff --git a/Build/source/texk/kpathsea/pathsearch.c b/Build/source/texk/kpathsea/pathsearch.c index cd19415a1b2..f5eb216b2a4 100644 --- a/Build/source/texk/kpathsea/pathsearch.c +++ b/Build/source/texk/kpathsea/pathsearch.c @@ -157,8 +157,9 @@ dir_list_search (kpathsea kpse, str_llist_type *dirs, const_string name, return ret; } +/* Note: NAMES[i] is not modified. */ static str_list_type -dir_list_search_list (kpathsea kpse, str_llist_type *dirs, const_string* names, +dir_list_search_list (kpathsea kpse, str_llist_type *dirs, string* names, boolean search_all) { str_llist_elt_type *elt; @@ -408,11 +409,11 @@ search (kpathsea kpse, const_string path, const_string original_name, string * kpathsea_path_search_list_generic (kpathsea kpse, - const_string path, const_string* names, + const_string path, string* names, boolean must_exist, boolean all) { str_list_type ret_list; - const_string* namep; + string* namep; string elt; boolean done = false; boolean all_absolute = true; diff --git a/Build/source/texk/kpathsea/pathsearch.h b/Build/source/texk/kpathsea/pathsearch.h index 5cac02666d0..d54d019e262 100644 --- a/Build/source/texk/kpathsea/pathsearch.h +++ b/Build/source/texk/kpathsea/pathsearch.h @@ -92,7 +92,7 @@ extern KPSEDLL string *kpathsea_all_path_search /* Search for any of the NAMES in PATH, and allow specifying both MUST_EXIST and ALL. */ extern string *kpathsea_path_search_list_generic (kpathsea kpse, - const_string path, const_string* names, boolean must_exist, boolean all); + const_string path, string* names, boolean must_exist, boolean all); #endif /* MAKE_KPSE_DLL */ diff --git a/Build/source/texk/kpathsea/readable.c b/Build/source/texk/kpathsea/readable.c index c32b2302d15..d62957e5ba0 100644 --- a/Build/source/texk/kpathsea/readable.c +++ b/Build/source/texk/kpathsea/readable.c @@ -17,11 +17,13 @@ along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include <kpathsea/config.h> +#include <kpathsea/c-namemx.h> +#include <kpathsea/c-pathch.h> +#include <kpathsea/c-pathmx.h> #include <kpathsea/c-stat.h> #include <kpathsea/pathsearch.h> #include <kpathsea/readable.h> #include <kpathsea/tex-hush.h> -#include <kpathsea/truncate.h> /* If access can read FN, run stat (assigning to stat buffer ST) and @@ -62,38 +64,59 @@ READABLE(const_string fn, unsigned int st) (access (fn, R_OK) == 0 && stat (fn, &(st)) == 0 && !S_ISDIR (st.st_mode)) #endif + /* POSIX invented the brain-damage of not necessarily truncating filename components; the system's behavior is defined by the value of - the symbol _POSIX_NO_TRUNC, but you can't change it dynamically! - - We may or may not return NAME. It's up to the caller not to assume - the return value is modifiable. */ - + the symbol _POSIX_NO_TRUNC, but you can't change it dynamically! */ string -kpathsea_readable_file (kpathsea kpse, const_string name) +kpathsea_readable_file (kpathsea kpse, string name) { - string ret; - #ifdef WIN32 unsigned int st = 0; #else /* ! WIN32 */ struct stat st; #endif - kpathsea_normalize_path(kpse, (string)name); + kpathsea_normalize_path (kpse, name); if (READABLE (name, st)) { - ret = (string) name; + return name; #ifdef ENAMETOOLONG } else if (errno == ENAMETOOLONG) { - ret = kpathsea_truncate_filename (kpse, name); + /* Truncate any too-long components in NAME. */ + unsigned c_len = 0; /* Length of current component. */ + char *s = name; /* Position in current component. */ + char *t = name; /* End of allowed length. */ + + for (; *s; s++) { + if (c_len <= NAME_MAX) + t = s; +#if defined(WIN32) + if (IS_KANJI (s)) { + s++; + c_len += 2; + continue; + } +#endif + if (IS_DIR_SEP (*s) || IS_DEVICE_SEP (*s)) { + if (c_len > NAME_MAX) { + /* Truncate if past the max for a component. */ + memmove (t, s, strlen (s) + 1); + s = t; + } + /* At a directory delimiter, reset component length. */ + c_len = 0; + } else + c_len++; + } + if (c_len > NAME_MAX) + /* Truncate if past the max for last component. */ + *t = 0; /* Perhaps some other error will occur with the truncated name, so let's call access again. */ - if (!READABLE (ret, st)) { /* Failed. */ - if (ret != name) free (ret); - ret = NULL; - } + if (READABLE (name, st)) /* Success. */ + return name; #endif /* ENAMETOOLONG */ } else { /* Some other error. */ if (errno == EACCES) { /* Maybe warn them if permissions are bad. */ @@ -101,14 +124,13 @@ kpathsea_readable_file (kpathsea kpse, const_string name) perror (name); } } - ret = NULL; } - return ret; + return NULL; } #if defined (KPSE_COMPAT_API) string -kpse_readable_file (const_string name) +kpse_readable_file (string name) { return kpathsea_readable_file (kpse_def, name); } diff --git a/Build/source/texk/kpathsea/readable.h b/Build/source/texk/kpathsea/readable.h index 43e1e385f75..ca766c0141d 100644 --- a/Build/source/texk/kpathsea/readable.h +++ b/Build/source/texk/kpathsea/readable.h @@ -26,11 +26,10 @@ ENAMETOOLONG, truncate any too-long path components, and if the result is a readable file, return that. Otherwise return NULL. */ -extern KPSEDLL string kpathsea_readable_file (kpathsea kpse, - const_string name); +extern KPSEDLL string kpathsea_readable_file (kpathsea kpse, string name); #if defined (KPSE_COMPAT_API) -extern KPSEDLL string kpse_readable_file (const_string name); +extern KPSEDLL string kpse_readable_file (string name); #endif #endif /* not KPATHSEA_READABLE_H */ diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index 77088e1e539..323e744c48d 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -1081,7 +1081,7 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name, /* Search, trying to minimize disk-pounding. */ ret = kpathsea_path_search_list_generic (kpse, FMT_INFO.path, - (const_string*) target, false, all); + target, false, all); /* Do we need to pound the disk? */ if (! *ret && must_exist) { @@ -1100,7 +1100,7 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name, } target[count] = NULL; ret = kpathsea_path_search_list_generic (kpse, FMT_INFO.path, - (const_string*) target, true, all); + target, true, all); } /* Free the list we created. */ diff --git a/Build/source/texk/kpathsea/truncate.c b/Build/source/texk/kpathsea/truncate.c deleted file mode 100644 index 17427e97ceb..00000000000 --- a/Build/source/texk/kpathsea/truncate.c +++ /dev/null @@ -1,68 +0,0 @@ -/* truncate.c: truncate too-long components in a filename. - - Copyright 1993, 1995, 2008, 2010, 2011 Karl Berry. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, see <http://www.gnu.org/licenses/>. */ - -#include <kpathsea/config.h> - -#include <kpathsea/c-namemx.h> -#include <kpathsea/c-pathch.h> -#include <kpathsea/c-pathmx.h> -#include <kpathsea/truncate.h> - - -/* Truncate any too-long components in NAME, returning the result. It's - too bad this is necessary. See comments in readable.c for why. */ - -string -kpathsea_truncate_filename (kpathsea kpse, const_string name) -{ - unsigned c_len = 0; /* Length of current component. */ - unsigned ret_len = 0; /* Length of constructed result. */ - - /* Allocate enough space. */ - string ret = (string) xmalloc (strlen (name) + 1); - - (void)kpse; /* currenty not used */ - - for (; *name; name++) - { -#if defined(WIN32) - if (IS_KANJI(name)) { - if (c_len < NAME_MAX) { - ret[ret_len++] = *name++; - ret[ret_len++] = *name; - } - c_len += 2; - continue; - } -#endif - if (IS_DIR_SEP (*name) || IS_DEVICE_SEP (*name)) - { /* At a directory delimiter, reset component length. */ - c_len = 0; - } - else if (c_len > NAME_MAX) - { /* If past the max for a component, ignore this character. */ - continue; - } - - /* Copy this character. */ - ret[ret_len++] = *name; - c_len++; - } - ret[ret_len] = 0; - - return ret; -} diff --git a/Build/source/texk/kpathsea/truncate.h b/Build/source/texk/kpathsea/truncate.h deleted file mode 100644 index a6f36382f21..00000000000 --- a/Build/source/texk/kpathsea/truncate.h +++ /dev/null @@ -1,33 +0,0 @@ -/* truncate.h: truncate too-long components in a filename. - - Copyright 1993, 2008, 2010, 2011 Karl Berry. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, see <http://www.gnu.org/licenses/>. */ - -#ifndef KPATHSEA_TRUNCATE_H -#define KPATHSEA_TRUNCATE_H - -#ifdef MAKE_KPSE_DLL /* libkpathsea internal only */ - -#include <kpathsea/c-proto.h> -#include <kpathsea/types.h> - -/* Truncate any component in NAME longer than the system NAME_MAX, and - return the result as a malloced string. If none, return a copy of - NAME. */ -extern string kpathsea_truncate_filename (kpathsea kpse, const_string name); - -#endif /* MAKE_KPSE_DLL */ - -#endif /* not KPATHSEA_TRUNCATE_H */ diff --git a/Build/source/texk/ptexenc/ChangeLog b/Build/source/texk/ptexenc/ChangeLog index d377de77ba2..87d3808dd42 100644 --- a/Build/source/texk/ptexenc/ChangeLog +++ b/Build/source/texk/ptexenc/ChangeLog @@ -1,5 +1,9 @@ 2012-11-20 Peter Breitenlohner <peb@mppmu.mpg.de> + * ptexenc.c: Use kpse_readable_file() with non-const arg. + +2012-11-20 Peter Breitenlohner <peb@mppmu.mpg.de> + * Makefile.am: Avoid use of deprecated INCLUDES. 2012-09-04 Peter Breitenlohner <peb@mppmu.mpg.de> diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c index ed178a77b53..4c1d6acc11d 100644 --- a/Build/source/texk/ptexenc/ptexenc.c +++ b/Build/source/texk/ptexenc/ptexenc.c @@ -817,6 +817,7 @@ static void nkf_check(void) /* 'mode' must be read */ FILE *nkf_open(const char *path, const char *mode) { char buff[PATH_MAX * 2 + 20]; /* 20 is enough gaps */ + char *name; FILE *fp; if (in_filter == NULL) { @@ -830,10 +831,14 @@ FILE *nkf_open(const char *path, const char *mode) { } if (in_filter[0] == '\0') return fopen(path, mode); - path = kpse_readable_file(path); - if (path == NULL) return NULL; /* can't read */ + name = xstrdup(path); + if (kpse_readable_file(name) == NULL) { + free(name); + return NULL; /* can't read */ + } sprintf(buff, "%.*s < '%.*s'", PATH_MAX, in_filter, PATH_MAX, path); + free(name); /* fprintf(stderr, "\n`%s`", buff); */ fp = popen(buff , "r"); if (piped_num < NOFILE) piped_fp[piped_num++] = fp; diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 979392e7942..526f104c48f 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,5 +1,9 @@ 2012-11-20 Peter Breitenlohner <peb@mppmu.mpg.de> + * lua/lkpselib.c: Use kpse_readable_file() with non-const arg. + +2012-11-20 Peter Breitenlohner <peb@mppmu.mpg.de> + * lua/lepdflib.cc: No need to test for Annot::decRefCnt with poppler 0.18 or better. diff --git a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c index 11283167ec0..6a64799771a 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c @@ -764,17 +764,19 @@ static int lua_kpse_version(lua_State * L) static int readable_file(lua_State * L) { - const char *name = luaL_checkstring(L, 1); + char *name = xstrdup(luaL_checkstring(L, 1)); TEST_PROGRAM_NAME_SET; lua_pushstring(L, kpse_readable_file(name)); + free(name); return 1; } static int lua_kpathsea_readable_file(lua_State * L) { kpathsea *kp = (kpathsea *) luaL_checkudata(L, 1, KPATHSEA_METATABLE); - const char *name = luaL_checkstring(L, 2); + char *name = xstrdup(luaL_checkstring(L, 2)); lua_pushstring(L, kpathsea_readable_file(*kp, name)); + free(name); return 1; } |