diff options
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/tex-file.c | 20 |
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 |