summaryrefslogtreecommitdiff
path: root/perlsdio.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-11-20 15:01:20 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-11-20 15:01:20 +0000
commitfab3f3a7f976d725f583a7763e7babd286095cf9 (patch)
tree07f26dac9ced6a2425c0b67ca15739fb2f8c6b3f /perlsdio.h
parenta5853b9e86d38374fad201966e6795c310045564 (diff)
downloadperl-fab3f3a7f976d725f583a7763e7babd286095cf9.tar.gz
Add a workaround to SOCKS 64-bit problems.
p4raw-id: //depot/perl@7774
Diffstat (limited to 'perlsdio.h')
-rw-r--r--perlsdio.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/perlsdio.h b/perlsdio.h
index 4b866345ff..9e668f6184 100644
--- a/perlsdio.h
+++ b/perlsdio.h
@@ -18,7 +18,11 @@
#define PerlIO_open fopen
#define PerlIO_fdopen fdopen
#define PerlIO_reopen freopen
-#define PerlIO_close(f) fclose(f)
+#ifdef SOCKS_64BIT_BUG
+# define PerlIO_close(f) (Perl_do_s64_delete_buffer(f), fclose(f))
+#else
+# define PerlIO_close(f) fclose(f)
+#endif
#define PerlIO_puts(f,s) fputs(s,f)
#define PerlIO_putc(f,c) fputc(c,f)
#if defined(VMS)
@@ -42,9 +46,15 @@
# define PerlIO_read(f,buf,count) \
(feof(f) ? 0 : (SSize_t)fread(buf,1,count,f))
#else
-# define PerlIO_ungetc(f,c) ungetc(c,f)
-# define PerlIO_getc(f) getc(f)
-# define PerlIO_read(f,buf,count) (SSize_t)fread(buf,1,count,f)
+# ifdef SOCKS_64BIT_BUG
+# define PerlIO_getc(f) Perl_do_s64_getc(f)
+# define PerlIO_ungetc(f,c) Perl_do_s64_ungetc(c,f)
+# define PerlIO_read(f,buf,count) Perl_do_s64_fread(buf,count,f)
+# else
+# define PerlIO_getc(f) getc(f)
+# define PerlIO_ungetc(f,c) ungetc(c,f)
+# define PerlIO_read(f,buf,count) (SSize_t)fread(buf,1,count,f)
+# endif /* SOCKS_64BIT_BUG */
#endif
#define PerlIO_eof(f) feof(f)
#define PerlIO_getname(f,b) fgetname(f,b)
@@ -52,12 +62,20 @@
#define PerlIO_fileno(f) fileno(f)
#define PerlIO_clearerr(f) clearerr(f)
#define PerlIO_flush(f) Fflush(f)
-#define PerlIO_tell(f) ftell(f)
+#ifdef SOCKS_64BIT_BUG
+# define PerlIO_tell(f) Perl_do_s64_tell(f)
+#else
+# define PerlIO_tell(f) ftell(f)
+#endif
#if defined(VMS) && !defined(__DECC)
/* Old VAXC RTL doesn't reset EOF on seek; Perl folk seem to expect this */
# define PerlIO_seek(f,o,w) (((f) && (*f) && ((*f)->_flag &= ~_IOEOF)),fseek(f,o,w))
#else
-# define PerlIO_seek(f,o,w) fseek(f,o,w)
+# ifdef SOCKS_64BIT_BUG
+# define PerlIO_seek(f,o,w) Perl_do_s64_seek(f,o,w)
+# else
+# define PerlIO_seek(f,o,w) fseek(f,o,w)
+# endif
#endif
#ifdef HAS_FGETPOS
#define PerlIO_getpos(f,p) fgetpos(f,p)