summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-09-22 05:26:40 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-09-22 05:26:40 +0000
commitdb3afb336a1aa5f604f2b03abf1adfd2dfe6a69a (patch)
tree5185e53e135189cb3fdba17056066180b5cfed22 /Build
parent286599d3e895e587f09a0a708d05f332e363ba2c (diff)
kpathsea: slightly improve my yesterday's changes (W32 only)
git-svn-id: svn://tug.org/texlive/trunk@45377 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog5
-rw-r--r--Build/source/texk/kpathsea/tex-file.c20
2 files changed, 16 insertions, 9 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 03c0b90f4a7..35f13c6f909 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-22 Akira Kakuto <kakuto@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@fuk.kindai.ac.jp>
* tex-file.c: Fix to return actual file names (W32 only).
diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c
index ad52874218d..07d3a91d446 100644
--- a/Build/source/texk/kpathsea/tex-file.c
+++ b/Build/source/texk/kpathsea/tex-file.c
@@ -1011,9 +1011,8 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name,
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 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name,
}
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