#include <signal.h>
#endif
-#ifdef SOCKS_64BIT_BUG
-typedef struct __s64_iobuffer {
- struct __s64_iobuffer *next, *last; /* Queue pointer */
- PerlIO *fp; /* assigned file pointer */
- int cnt; /* Buffer counter */
- int size; /* Buffer size */
- int *buffer; /* the buffer */
-} S64_IOB;
-
-#endif
-
bool
Perl_do_open(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
int rawmode, int rawperm, PerlIO *supplied_fp)
** without checking the ungetc buffer.
**/
+/* Not very thread-safe? */
static S64_IOB *s64_buffer = (S64_IOB *) NULL;
/* initialize the buffer area */
/* delete a buffered stream pointer */
void Perl_do_s64_delete_buffer( PerlIO *f) {
- S64_IOB *ptr = _s64_get_buffer(f);
+ S64_IOB *ptr = S_s64_get_buffer(f);
if( ptr) {
/* fix the stream pointer according to the bytes buffered */
/* required, if this is called in a seek-context */
/* SOCKS 64 bit getc replacement */
int Perl_do_s64_getc( PerlIO *f) {
- S64_IOB *ptr = _s64_get_buffer(f);
+ S64_IOB *ptr = S_s64_get_buffer(f);
if( ptr) {
if( ptr->cnt)
return( ptr->buffer[--ptr->cnt]);
/* SOCKS 64 bit ungetc replacement */
int Perl_do_s64_ungetc( int ch, PerlIO *f) {
- S64_IOB *ptr = _s64_get_buffer(f);
+ S64_IOB *ptr = S_s64_get_buffer(f);
- if( !ptr) ptr=_s64_create_buffer(f);
+ if( !ptr) ptr = S_s64_create_buffer(f);
if( !ptr) return( EOF);
if( !ptr->buffer || (ptr->buffer && ptr->cnt >= ptr->size))
- if( !_s64_malloc( ptr)) return( EOF);
+ if( !S_s64_malloc( ptr)) return( EOF);
ptr->buffer[ptr->cnt++] = ch;
return( ch);
SSize_t Perl_do_s64_fread(void *buf, SSize_t count, PerlIO* f) {
SSize_t len = 0;
char *bufptr = (char *) buf;
- S64_IOB *ptr = _s64_get_buffer(f);
+ S64_IOB *ptr = S_s64_get_buffer(f);
if( ptr) {
while( ptr->cnt && count) {
*bufptr++ = ptr->buffer[--ptr->cnt];
/* SOCKS 64 bit fseek replacement */
int Perl_do_s64_seek(PerlIO* f, Off_t offset, int whence) {
- S64_IOB *ptr = _s64_get_buffer(f);
+ S64_IOB *ptr = S_s64_get_buffer(f);
/* Simply clear the buffer and seek if the position is absolute */
if( SEEK_SET == whence || SEEK_END == whence) {
/* SOCKS 64 bit ftell replacement */
Off_t Perl_do_s64_tell(PerlIO* f) {
Off_t offset = 0;
- S64_IOB *ptr = _s64_get_buffer(f);
+ S64_IOB *ptr = S_s64_get_buffer(f);
if( ptr)
offset = ptr->cnt;
return( ftello(f) - offset);