texlive[45377] Build/source/texk/kpathsea: kpathsea: slightly improve
commits+kakuto at tug.org
commits+kakuto at tug.org
Fri Sep 22 07:26:41 CEST 2017
Revision: 45377
http://tug.org/svn/texlive?view=revision&revision=45377
Author: kakuto
Date: 2017-09-22 07:26:40 +0200 (Fri, 22 Sep 2017)
Log Message:
-----------
kpathsea: slightly improve my yesterday's changes (W32 only)
Modified Paths:
--------------
trunk/Build/source/texk/kpathsea/ChangeLog
trunk/Build/source/texk/kpathsea/tex-file.c
Modified: trunk/Build/source/texk/kpathsea/ChangeLog
===================================================================
--- trunk/Build/source/texk/kpathsea/ChangeLog 2017-09-22 00:22:30 UTC (rev 45376)
+++ trunk/Build/source/texk/kpathsea/ChangeLog 2017-09-22 05:26:40 UTC (rev 45377)
@@ -1,3 +1,8 @@
+2017-09-22 Akira Kakuto <kakuto at fuk.kindai.ac.jp>
+
+ * tex-file.c: Use a standard API function GetLongPathName()
+ instead of the custom kpathsea_getlongpath() (W32 only).
+
2017-09-20 Akira Kakuto <kakuto at fuk.kindai.ac.jp>
* tex-file.c: Fix to return actual file names (W32 only).
Modified: trunk/Build/source/texk/kpathsea/tex-file.c
===================================================================
--- trunk/Build/source/texk/kpathsea/tex-file.c 2017-09-22 00:22:30 UTC (rev 45376)
+++ trunk/Build/source/texk/kpathsea/tex-file.c 2017-09-22 05:26:40 UTC (rev 45377)
@@ -1011,9 +1011,8 @@
kpse_file_format_type format,
boolean must_exist, boolean all)
{
-#if defined(_WIN32) && !defined(__MINGW32__)
+#if defined(_WIN32)
char tmpbuffer[512];
- char tmpbuffer2[512];
#endif
string *target, name;
const_string *ext;
@@ -1137,20 +1136,23 @@
}
free (name);
-#if defined(_WIN32) && !defined(__MINGW32__)
+#if defined(_WIN32)
if (ret && *ret) {
+ size_t cplen;
if (all) {
for (count = 0; ret[count] != NULL; count++) {
- strcpy (tmpbuffer2, ret[count]);
- if (kpathsea_getlongpath (kpse, tmpbuffer, tmpbuffer2, 500) &&
- strlen (tmpbuffer) == strlen (ret[count]))
+ if ((cplen = GetLongPathName (ret[count], tmpbuffer, 500))) {
+ if (cplen > strlen (ret[count]))
+ ret[count] = realloc (ret[count], cplen + 1);
strcpy (ret[count], tmpbuffer);
+ }
}
} else {
- strcpy (tmpbuffer2, *ret);
- if (kpathsea_getlongpath (kpse, tmpbuffer, tmpbuffer2, 500) &&
- strlen (tmpbuffer) == strlen (*ret))
+ if ((cplen = GetLongPathName (*ret, tmpbuffer, 500))) {
+ if (cplen > strlen (*ret))
+ *ret = realloc (*ret, cplen + 1);
strcpy (*ret, tmpbuffer);
+ }
}
}
#endif
More information about the tex-live-commits
mailing list