summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-12-01 15:26:37 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2013-12-01 15:26:37 +0000
commitd1f96f6033d08c0e712307ddc9bc1f63a8540742 (patch)
tree83ef3cb926b8fe2d6759170d6eb5e1f3a6c65986 /Build/source/texk/kpathsea
parentb91ea14a043007a08ec25199870aa0a3a3fbbc1f (diff)
Revert
git-svn-id: svn://tug.org/texlive/trunk@32289 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog5
-rw-r--r--Build/source/texk/kpathsea/elt-dirs.c15
-rw-r--r--Build/source/texk/kpathsea/knj.c81
-rw-r--r--Build/source/texk/kpathsea/knj.h22
-rw-r--r--Build/source/texk/kpathsea/progname.c3
-rw-r--r--Build/source/texk/kpathsea/readable.c5
6 files changed, 8 insertions, 123 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 5a13eeb174b..c6ec4f39ed1 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,8 +1,3 @@
-2013-12-01 TANAKA Takuji <KXD02663@nifty.ne.jp>
-
- * elt-dirs.c, knj.c, knj.h, progname.c, readble.c: Support KANJI
- file name in (e)up-TeX on Windows.
-
2013-09-22 Karl Berry <karl@tug.org>
* mktexlsr: output normal msgs to stdout, not stderr.
diff --git a/Build/source/texk/kpathsea/elt-dirs.c b/Build/source/texk/kpathsea/elt-dirs.c
index 271b693b5dc..7d61d850086 100644
--- a/Build/source/texk/kpathsea/elt-dirs.c
+++ b/Build/source/texk/kpathsea/elt-dirs.c
@@ -104,9 +104,7 @@ static void expand_elt (kpathsea, str_llist_type *, string, unsigned);
#ifdef WIN32
/* Shared across recursive calls, it acts like a stack. */
-static char dirname[MAX_PATH*2];
-static wchar_t dirnamew[MAX_PATH];
-static char *potname;
+static char dirname[MAX_PATH];
#endif
static void
@@ -133,8 +131,7 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, string elt,
#if defined (WIN32)
strcpy(dirname, FN_STRING(name));
strcat(dirname, "/*.*"); /* "*.*" or "*" -- seems equivalent. */
- get_wstring_from_fsyscp(dirname, dirnamew);
- hnd = FindFirstFileW(dirnamew, &find_file_data);
+ hnd = FindFirstFile(dirname, &find_file_data);
if (hnd == INVALID_HANDLE_VALUE) {
fn_free(&name);
@@ -154,13 +151,11 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, string elt,
}
proceed = 1;
while (proceed) {
- if (find_file_data.cFileName[0] != L'.') {
+ if (find_file_data.cFileName[0] != '.') {
int links;
/* Construct the potential subdirectory name. */
- potname = get_fsyscp_from_wstring(find_file_data.cFileName, potname=NULL);
- fn_str_grow (&name, potname);
- free(potname);
+ fn_str_grow (&name, find_file_data.cFileName);
/* Maybe we have cached the leafness of this directory.
The function will return 0 if unknown,
@@ -202,7 +197,7 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, string elt,
}
fn_shrink_to (&name, elt_length);
}
- proceed = FindNextFileW (hnd, &find_file_data);
+ proceed = FindNextFile (hnd, &find_file_data);
}
/* Update the leafness of name. */
kpathsea_dir_links(kpse, FN_STRING(name), nlinks);
diff --git a/Build/source/texk/kpathsea/knj.c b/Build/source/texk/kpathsea/knj.c
index e4f9639d1c6..bdf7d5cbf75 100644
--- a/Build/source/texk/kpathsea/knj.c
+++ b/Build/source/texk/kpathsea/knj.c
@@ -1,7 +1,6 @@
/* knj.c: check for 2-Byte Kanji (CP 932, SJIS) codes.
Copyright 2010, 2011 Akira Kakuto.
- Copyright 2013 TANAKA Takuji.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -17,9 +16,8 @@
along with this library; if not, see <http://www.gnu.org/licenses/>. */
#include <kpathsea/config.h>
-#include <kpathsea/debug.h>
-int is_cp932_system, file_system_codepage;
+int is_cp932_system;
int isknj(int c)
{
@@ -50,80 +48,3 @@ int isknj2(int c)
return(0);
}
}
-
-/*
- Get wide string from multibyte string.
-*/
-wchar_t *
-get_wstring_from_mbstring(int cp, const char *mbstr, wchar_t *wstr)
-{
- int len;
-
- len = MultiByteToWideChar(cp, 0, mbstr, -1, wstr, 0);
- if (len==0) {
- FATAL("cannot convert string to wide string");
- }
- if (wstr==NULL) {
- wstr = xmalloc(sizeof(wchar_t)*(len+1));
- }
- len = MultiByteToWideChar(cp, 0, mbstr, -1, wstr, len+1);
- if (len==0) {
- FATAL("cannot convert multibyte string to wide string");
- }
- return wstr;
-}
-
-/*
- Get multibyte string from wide string.
-*/
-char *
-get_mbstring_from_wstring(int cp, const wchar_t *wstr, char *mbstr)
-{
- int len;
-
- len = WideCharToMultiByte(cp, 0, wstr, -1, mbstr, 0, NULL, NULL);
- if (len==0) {
- FATAL("cannot convert string to wide string");
- }
- if (mbstr==NULL) {
- mbstr = xmalloc(len+1);
- }
- len = WideCharToMultiByte(cp, 0, wstr, -1, mbstr, len+1, NULL, NULL);
- if (len==0) {
- FATAL("cannot convert wide string to multibyte string");
- }
- return mbstr;
-}
-
-/*
- xfopen by file system codepage
-*/
-FILE *
-fsyscp_xfopen (const char *filename, const char *mode)
-{
- FILE *f;
- wchar_t *fnamew, modew[4];
-#if defined (KPSE_COMPAT_API)
- kpathsea kpse = kpse_def;
-#endif
-
- assert(filename && mode);
-
- fnamew = get_wstring_from_fsyscp(filename, fnamew=NULL);
- get_wstring_from_fsyscp(mode, modew);
- f = _wfopen(fnamew, modew);
- if (f == NULL)
- FATAL_PERROR(filename);
-#if defined (KPSE_COMPAT_API)
- if (KPATHSEA_DEBUG_P (KPSE_DEBUG_FOPEN)) {
- DEBUGF_START ();
- fprintf (stderr, "fsyscp_xfopen(%s [", filename);
- WriteConsoleW( GetStdHandle( STD_ERROR_HANDLE ), fnamew, wcslen( fnamew ), NULL, NULL );
- fprintf (stderr, "], %s) => 0x%lx\n", mode, (unsigned long) f);
- DEBUGF_END ();
- }
-#endif
- free(fnamew);
-
- return f;
-}
diff --git a/Build/source/texk/kpathsea/knj.h b/Build/source/texk/kpathsea/knj.h
index 2f5b6b2a8d4..8f1cd919687 100644
--- a/Build/source/texk/kpathsea/knj.h
+++ b/Build/source/texk/kpathsea/knj.h
@@ -1,7 +1,6 @@
/* knj.h: check for 2-Byte Kanji (CP 932, SJIS) codes.
Copyright 2010, 2011 Akira Kakuto.
- Copyright 2013 TANAKA Takuji.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,22 +23,10 @@ extern "C" {
#endif
extern KPSEDLL int is_cp932_system;
-extern KPSEDLL int file_system_codepage;
extern KPSEDLL int isknj(int c);
extern KPSEDLL int isknj2(int c);
-extern KPSEDLL wchar_t* get_wstring_from_utf8(const char *mbstr, wchar_t *wstr);
-extern KPSEDLL wchar_t* get_wstring_from_fsyscp(const char *mbstr, wchar_t *wstr);
-extern KPSEDLL wchar_t* get_wstring_from_mbstring(int cp, const char *mbstr, wchar_t *wstr);
-
-extern KPSEDLL char* get_utf8_from_wstring(const wchar_t *wstr, char mbstr);
-extern KPSEDLL char* get_fsyscp_from_wstring(const wchar_t *wstr, char mbstr);
-extern KPSEDLL char* get_mbstring_from_wstring(int cp, const wchar_t *wstr, char *mbstr);
-
-extern KPSEDLL FILE* fsyscp_xfopen(const char *filename, const char *mode);
- //extern KPSEDLL FILE* fsyscp_xfopen(const_string filename, const_string mode);
-
#ifdef __cplusplus
}
#endif
@@ -47,13 +34,4 @@ extern KPSEDLL FILE* fsyscp_xfopen(const char *filename, const char *mode);
/* True if P points to a 2-Byte Kanji (CP 932, SJIS) code. */
#define IS_KANJI(p) is_cp932_system && isknj(*(p)) && isknj2(*(p+1))
-/* Get wide string from multibyte string in UTF-8 */
-#define get_wstring_from_utf8(mb,w) get_wstring_from_mbstring(CP_UTF8,mb,w)
-/* Get multibyte string in UTF-8 from wide string */
-#define get_utf8_from_wstring(w,mb) get_mbstring_from_wstring(CP_UTF8,w,mb)
-/* Get wide string from multibyte string in file system codepage */
-#define get_wstring_from_fsyscp(mb,w) get_wstring_from_mbstring(file_system_codepage,mb,w)
-/* Get multibyte string in file system codepage from wide string */
-#define get_fsyscp_from_wstring(w,mb) get_mbstring_from_wstring(file_system_codepage,w,mb)
-
#endif /* not KPATHSEA_KNJ_H */
diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c
index 5952936579b..ba43bd8679f 100644
--- a/Build/source/texk/kpathsea/progname.c
+++ b/Build/source/texk/kpathsea/progname.c
@@ -501,13 +501,12 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0,
}
#if defined(WIN32)
- cp = GetACP();
+ cp = GetOEMCP();
if (cp == 932 || cp == 936 || cp == 950) {
is_cp932_system = cp;
}
else
is_cp932_system = 0;
- file_system_codepage = AreFileApisANSI() ? GetACP() : GetOEMCP();
#if defined(__MINGW32__)
/* Set various info about user. Among many things,
diff --git a/Build/source/texk/kpathsea/readable.c b/Build/source/texk/kpathsea/readable.c
index 181b80c3b87..d62957e5ba0 100644
--- a/Build/source/texk/kpathsea/readable.c
+++ b/Build/source/texk/kpathsea/readable.c
@@ -40,9 +40,7 @@
static boolean
READABLE(const_string fn, unsigned int st)
{
- wchar_t *fnw;
- fnw = get_wstring_from_fsyscp(fn, fnw=NULL);
- if ((st = GetFileAttributesW(fnw)) != 0xFFFFFFFF) {
+ if ((st = GetFileAttributes(fn)) != 0xFFFFFFFF) {
/* succeeded */
errno = 0;
} else {
@@ -58,7 +56,6 @@ READABLE(const_string fn, unsigned int st)
break;
}
}
- free(fnw);
return ((st != 0xFFFFFFFF) &&
!(st & FILE_ATTRIBUTE_DIRECTORY));
}