summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2012-05-04 12:14:36 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2012-05-04 12:14:36 +0000
commit2a8d998930e5daeee074fb3eada5ddddef143c2c (patch)
tree44158545228fca8b5679d37aa00003bf832bdc1e /Build/source/texk
parent1493f9ba483a0489bbfb1597ae39f832ec75d093 (diff)
rewrite xftell64 and xfseek64 for W32
git-svn-id: svn://tug.org/texlive/trunk@26188 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog4
-rw-r--r--Build/source/texk/kpathsea/win32lib.c38
2 files changed, 28 insertions, 14 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 160e322e6f4..04fa0557f77 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-04 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * win32lib.c: rewrite xftell64 and xfseek64 for W32.
+
2012-04-30 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* win32lib.c: further rewrite win32_system().
diff --git a/Build/source/texk/kpathsea/win32lib.c b/Build/source/texk/kpathsea/win32lib.c
index 270cce659cc..6a346ebfdde 100644
--- a/Build/source/texk/kpathsea/win32lib.c
+++ b/Build/source/texk/kpathsea/win32lib.c
@@ -281,26 +281,36 @@ int __cdecl kpathsea_win32_pclose (kpathsea kpse, FILE *f)
/* large file support */
-void
-xfseek64 (FILE *f, __int64 offset, int wherefrom, const char *filename)
-{
- fflush(f);
- if (_lseeki64(fileno(f), offset, wherefrom) < (__int64)0)
- FATAL_PERROR(filename);
-}
-
__int64
xftell64 (FILE *f, const char *filename)
{
- __int64 where;
- fflush(f);
- where = _telli64(fileno(f));
- if (where < (__int64)0)
- FATAL_PERROR(filename);
+ __int64 where, filepos;
+ int fd;
+
+ fd = fileno(f);
+ if(f->_cnt < 0)
+ f->_cnt = 0;
+ if((filepos = _lseeki64(fd, (__int64)0, SEEK_CUR)) < (__int64)0) {
+ FATAL_PERROR(filename);
+ return (__int64)(-1);
+ }
+ where = filepos - f->_cnt;
+ return where;
+}
- return where;
+void
+xfseek64 (FILE *f, __int64 offset, int wherefrom, const char *filename)
+{
+ if(wherefrom == SEEK_CUR) {
+ offset += xftell64(f, filename);
+ wherefrom = SEEK_SET;
+ }
+ fflush(f);
+ if (_lseeki64(fileno(f), offset, wherefrom) < (__int64)0)
+ FATAL_PERROR(filename);
}
+
/* special TeXLive Ghostscript */
static int is_dir (char *buff)