3 Copyright (C) 2005 and later Cockos Incorporated
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
22 This file provides the WDL_FileRead object, which can be used to read files.
23 On windows systems it supports reading synchronous, asynchronous, memory mapped, and asynchronous unbuffered.
24 On non-windows systems it acts as a wrapper for fopen()/etc.
30 #ifndef _WDL_FILEREAD_H_
31 #define _WDL_FILEREAD_H_
40 #if defined(_WIN32) && !defined(WDL_NO_WIN32_FILEREAD)
41 #ifndef WDL_WIN32_NATIVE_READ
42 #define WDL_WIN32_NATIVE_READ
45 #ifdef WDL_WIN32_NATIVE_READ
46 #undef WDL_WIN32_NATIVE_READ
49 #if !defined(WDL_NO_POSIX_FILEREAD)
50 #define WDL_POSIX_NATIVE_READ
51 #include <sys/fcntl.h>
53 #include <sys/errno.h>
56 #include <sys/param.h>
57 #include <sys/mount.h>
66 #define WDL_FILEREAD_POSTYPE __int64
68 #define WDL_FILEREAD_POSTYPE long long
73 #ifdef WDL_WIN32_NATIVE_READ
76 class WDL_FileRead__ReadEnt
79 WDL_FileRead__ReadEnt(int sz
, char *buf
)
82 memset(&m_ol
,0,sizeof(m_ol
));
83 m_ol
.hEvent
=CreateEvent(NULL
,TRUE
,TRUE
,NULL
);
86 ~WDL_FileRead__ReadEnt()
88 CloseHandle(m_ol
.hEvent
);
98 #if defined(_WIN32) && !defined(WDL_NO_SUPPORT_UTF8)
99 BOOL
HasUTF8(const char *_str
)
101 const unsigned char *str
= (const unsigned char *)_str
;
102 if (!str
) return FALSE
;
105 unsigned char c
= *str
;
108 if (c
<= 0xDF && str
[1] >=0x80 && str
[1] <= 0xBF) return TRUE
;
109 else if (c
<= 0xEF && str
[1] >=0x80 && str
[1] <= 0xBF && str
[2] >=0x80 && str
[2] <= 0xBF) return TRUE
;
110 else if (c
<= 0xF4 && str
[1] >=0x80 && str
[1] <= 0xBF && str
[2] >=0x80 && str
[2] <= 0xBF) return TRUE
;
119 // allow_async=1 for unbuffered async, 2 for buffered async, =-1 for unbuffered sync
120 // async aspect is unused on OS X, but the buffered mode affects F_NOCACHE
121 WDL_FileRead(const char *filename
, int allow_async
=1, int bufsize
=8192, int nbufs
=4, unsigned int mmap_minsize
=0, unsigned int mmap_maxsize
=0) : m_bufspace(4096 WDL_HEAPBUF_TRACEPARM("WDL_FileRead"))
123 m_async_hashaderr
=false;
124 m_sync_bufmode_used
=m_sync_bufmode_pos
=0;
125 m_async_readpos
=m_file_position
=0;
127 m_fsize_maychange
=false;
128 m_syncrd_firstbuf
=true;
130 m_mmap_totalbufmode
=0;
132 #define WDL_UNBUF_ALIGN 8192
133 if (bufsize
&(WDL_UNBUF_ALIGN
-1)) bufsize
=(bufsize
&~(WDL_UNBUF_ALIGN
-1))+WDL_UNBUF_ALIGN
; // ensure bufsize is multiple of 4kb
135 #ifdef WDL_WIN32_NATIVE_READ
138 bool isNT
= GetVersion()<0x80000000;
139 m_async
= isNT
? allow_async
: 0;
141 int flags
=FILE_ATTRIBUTE_NORMAL
;
144 flags
|=FILE_FLAG_OVERLAPPED
;
145 if (m_async
==1) flags
|=FILE_FLAG_NO_BUFFERING
;
147 else if (nbufs
*bufsize
>=WDL_UNBUF_ALIGN
&& !mmap_maxsize
&& m_async
==-1)
148 flags
|=FILE_FLAG_NO_BUFFERING
; // non-async mode unbuffered if we do our own buffering
150 #ifndef WDL_NO_SUPPORT_UTF8
151 m_fh
= INVALID_HANDLE_VALUE
;
152 if (isNT
&& HasUTF8(filename
)) // only convert to wide if there are UTF-8 chars
154 int szreq
=MultiByteToWideChar(CP_UTF8
,MB_ERR_INVALID_CHARS
,filename
,-1,NULL
,0);
157 WDL_TypedBuf
<WCHAR
> wfilename
;
158 wfilename
.Resize(szreq
+10);
160 if (MultiByteToWideChar(CP_UTF8
,MB_ERR_INVALID_CHARS
,filename
,-1,wfilename
.Get(),wfilename
.GetSize()))
162 m_fh
= CreateFileW(wfilename
.Get(),GENERIC_READ
,FILE_SHARE_READ
,NULL
,OPEN_EXISTING
,flags
,NULL
);
163 if (m_fh
== INVALID_HANDLE_VALUE
&& GetLastError()==ERROR_SHARING_VIOLATION
)
165 m_fh
= CreateFileW(wfilename
.Get(),GENERIC_READ
,FILE_SHARE_READ
|FILE_SHARE_WRITE
,NULL
,OPEN_EXISTING
,flags
,NULL
);
166 m_fsize_maychange
=true;
172 WCHAR wfilename
[1024];
174 if (MultiByteToWideChar(CP_UTF8
,MB_ERR_INVALID_CHARS
,filename
,-1,wfilename
,1024))
176 m_fh
= CreateFileW(wfilename
,GENERIC_READ
,FILE_SHARE_READ
,NULL
,OPEN_EXISTING
,flags
,NULL
);
177 if (m_fh
== INVALID_HANDLE_VALUE
&& GetLastError()==ERROR_SHARING_VIOLATION
)
179 m_fh
= CreateFileW(wfilename
,GENERIC_READ
,FILE_SHARE_READ
|FILE_SHARE_WRITE
,NULL
,OPEN_EXISTING
,flags
,NULL
);
180 m_fsize_maychange
=true;
185 if (m_fh
== INVALID_HANDLE_VALUE
)
188 m_fh
= CreateFileA(filename
,GENERIC_READ
,FILE_SHARE_READ
,NULL
,OPEN_EXISTING
,flags
,NULL
);
189 if (m_fh
== INVALID_HANDLE_VALUE
&& GetLastError()==ERROR_SHARING_VIOLATION
)
191 m_fh
= CreateFileA(filename
,GENERIC_READ
,FILE_SHARE_READ
|FILE_SHARE_WRITE
,NULL
,OPEN_EXISTING
,flags
,NULL
);
192 m_fsize_maychange
=true;
196 if (m_fh
!= INVALID_HANDLE_VALUE
)
199 DWORD l
=GetFileSize(m_fh
,&h
);
200 m_fsize
=(((WDL_FILEREAD_POSTYPE
)h
)<<32)|l
;
202 if (!h
&& l
< mmap_maxsize
&& m_async
<=0)
204 if (l
>= mmap_minsize
)
206 m_mmap_fmap
=CreateFileMapping(m_fh
,NULL
,PAGE_READONLY
,NULL
,0,NULL
);
209 m_mmap_view
=MapViewOfFile(m_mmap_fmap
,FILE_MAP_READ
,0,0,(int)m_fsize
);
212 CloseHandle(m_mmap_fmap
);
215 else m_fsize_maychange
=false;
220 m_mmap_totalbufmode
= malloc(l
);
222 ReadFile(m_fh
,m_mmap_totalbufmode
,l
,&sz
,NULL
);
223 m_fsize_maychange
=false;
229 m_async_bufsize
=bufsize
;
231 char *bptr
=(char *)m_bufspace
.Resize(nbufs
*bufsize
+ (WDL_UNBUF_ALIGN
-1));
232 int a
=((int)(INT_PTR
)bptr
)&(WDL_UNBUF_ALIGN
-1);
233 if (a
) bptr
+= WDL_UNBUF_ALIGN
-a
;
234 for (x
= 0; x
< nbufs
; x
++)
236 WDL_FileRead__ReadEnt
*t
=new WDL_FileRead__ReadEnt(m_async_bufsize
,bptr
);
238 bptr
+=m_async_bufsize
;
241 else if (!m_mmap_view
&& !m_mmap_totalbufmode
&& nbufs
*bufsize
>=WDL_UNBUF_ALIGN
)
243 m_bufspace
.Resize(nbufs
*bufsize
+(WDL_UNBUF_ALIGN
-1));
247 #elif defined(WDL_POSIX_NATIVE_READ)
248 m_filedes_locked
=false;
250 m_filedes
=open(filename
,O_RDONLY
);
253 if (flock(m_filedes
,LOCK_SH
|LOCK_NB
)>=0) // get shared lock
254 m_filedes_locked
=true;
256 m_fsize_maychange
=true; // if couldnt get shared lock, then it may change
259 if (allow_async
==1 || allow_async
==-1)
262 if (fstatfs(m_filedes
,&sfs
)||(sfs
.f_flags
&MNT_LOCAL
)) // don't use F_NOCACHE on nfs/smb/afp mounts, we need caching there!
263 fcntl(m_filedes
,F_NOCACHE
,1);
266 m_fsize
=lseek(m_filedes
,0,SEEK_END
);
267 lseek(m_filedes
,0,SEEK_SET
);
269 if (m_fsize
< mmap_maxsize
)
271 if (m_fsize
>= mmap_minsize
)
273 m_mmap_view
= mmap(NULL
,m_fsize
,PROT_READ
,MAP_SHARED
,m_filedes
,0);
274 if (m_mmap_view
== MAP_FAILED
) m_mmap_view
= 0;
275 else m_fsize_maychange
=false;
279 m_mmap_totalbufmode
= malloc(m_fsize
);
280 m_fsize
= pread(m_filedes
,m_mmap_totalbufmode
,m_fsize
,0);
281 m_fsize_maychange
=false;
286 if (!m_mmap_view
&& !m_mmap_totalbufmode
&& m_filedes
>=0 && nbufs
*bufsize
>=WDL_UNBUF_ALIGN
)
287 m_bufspace
.Resize(nbufs
*bufsize
+(WDL_UNBUF_ALIGN
-1));
290 m_fp
=fopen(filename
,"rb");
293 fseek(m_fp
,0,SEEK_END
);
295 fseek(m_fp
,0,SEEK_SET
);
297 if (m_fp
&& nbufs
*bufsize
>=WDL_UNBUF_ALIGN
)
298 m_bufspace
.Resize(nbufs
*bufsize
+(WDL_UNBUF_ALIGN
-1));
304 free(m_mmap_totalbufmode
);
305 m_mmap_totalbufmode
=0;
307 #ifdef WDL_WIN32_NATIVE_READ
309 for (x
= 0; x
< m_empties
.GetSize();x
++) delete m_empties
.Get(x
);
311 for (x
= 0; x
< m_full
.GetSize();x
++) delete m_full
.Get(x
);
313 for (x
= 0; x
< m_pending
.GetSize();x
++)
315 WaitForSingleObject(m_pending
.Get(x
)->m_ol
.hEvent
,INFINITE
);
316 delete m_pending
.Get(x
);
320 if (m_mmap_view
) UnmapViewOfFile(m_mmap_view
);
323 if (m_mmap_fmap
) CloseHandle(m_mmap_fmap
);
326 if (m_fh
!= INVALID_HANDLE_VALUE
) CloseHandle(m_fh
);
327 m_fh
=INVALID_HANDLE_VALUE
;
328 #elif defined(WDL_POSIX_NATIVE_READ)
329 if (m_mmap_view
) munmap(m_mmap_view
,m_fsize
);
333 if (m_filedes_locked
) flock(m_filedes
,LOCK_UN
); // release shared lock
338 if (m_fp
) fclose(m_fp
);
346 #ifdef WDL_WIN32_NATIVE_READ
347 return (m_fh
!= INVALID_HANDLE_VALUE
);
348 #elif defined(WDL_POSIX_NATIVE_READ)
349 return m_filedes
>= 0;
355 #ifdef WDL_WIN32_NATIVE_READ
359 while (m_pending
.GetSize())
361 WDL_FileRead__ReadEnt
*ent
=m_pending
.Get(0);
364 if (!ent
->m_size
&& !GetOverlappedResult(m_fh
,&ent
->m_ol
,&s
,FALSE
)) break;
366 if (!ent
->m_size
) ent
->m_size
=s
;
371 if (m_empties
.GetSize()>0)
373 if (m_async_readpos
< m_file_position
) m_async_readpos
= m_file_position
;
375 if (m_async
==1) m_async_readpos
&= ~((WDL_FILEREAD_POSTYPE
) WDL_UNBUF_ALIGN
-1);
377 if (m_async_readpos
>= m_fsize
) return 0;
379 const int rdidx
=m_empties
.GetSize()-1;
380 WDL_FileRead__ReadEnt
*t
=m_empties
.Get(rdidx
);
382 ResetEvent(t
->m_ol
.hEvent
);
384 *(WDL_FILEREAD_POSTYPE
*)&t
->m_ol
.Offset
= m_async_readpos
;
386 m_async_readpos
+= m_async_bufsize
;
388 if (ReadFile(m_fh
,t
->m_buf
,m_async_bufsize
,&dw
,&t
->m_ol
))
394 if (GetLastError() != ERROR_IO_PENDING
) return 1;
398 m_empties
.Delete(rdidx
);
404 int AsyncRead(char *buf
, int maxlen
)
408 if (m_file_position
+maxlen
> m_fsize
)
410 maxlen
=(int) (m_fsize
-m_file_position
);
412 if (maxlen
<1) return 0;
414 int errcnt
=!!m_async_hashaderr
;
417 while (m_full
.GetSize() > 0)
419 WDL_FileRead__ReadEnt
*ti
=m_full
.Get(0);
420 WDL_FILEREAD_POSTYPE tiofs
=*(WDL_FILEREAD_POSTYPE
*)&ti
->m_ol
.Offset
;
421 if (m_file_position
>= tiofs
&& m_file_position
< tiofs
+ ti
->m_size
)
423 if (maxlen
< 1) break;
425 int l
=ti
->m_size
-(int) (m_file_position
-tiofs
);
426 if (l
> maxlen
) l
=maxlen
;
428 memcpy(buf
,(char *)ti
->m_buf
+m_file_position
- tiofs
,l
);
430 m_file_position
+= l
;
441 if (maxlen
> 0 && m_async_readpos
!= m_file_position
)
444 for (x
= 0; x
< m_pending
.GetSize(); x
++)
446 WDL_FileRead__ReadEnt
*ent
=m_pending
.Get(x
);
447 WDL_FILEREAD_POSTYPE tiofs
=*(WDL_FILEREAD_POSTYPE
*)&ent
->m_ol
.Offset
;
448 if (m_file_position
>= tiofs
&& m_file_position
< tiofs
+ m_async_bufsize
) break;
450 if (x
== m_pending
.GetSize())
452 m_async_readpos
=m_file_position
;
458 if (maxlen
> 0 && m_pending
.GetSize() && !m_full
.GetSize())
460 WDL_FileRead__ReadEnt
*ent
=m_pending
.Get(0);
463 if (ent
->m_size
) m_full
.Add(ent
);
466 // WaitForSingleObject(ent->m_ol.hEvent,INFINITE);
469 if (GetOverlappedResult(m_fh
,&ent
->m_ol
,&s
,TRUE
) && s
)
474 else // failed read, set the error flag
483 while (maxlen
> 0 && (m_pending
.GetSize()||m_full
.GetSize()) && !errcnt
);
484 if (!errcnt
) RunReads();
485 else m_async_hashaderr
=true;
492 void *GetMappedView(int offs
, int *len
)
494 if (!m_mmap_view
&& !m_mmap_totalbufmode
) return 0;
496 int maxl
=(int) (m_fsize
-(WDL_FILEREAD_POSTYPE
)offs
);
497 if (*len
> maxl
) *len
=maxl
;
499 return (char *)m_mmap_view
+ offs
;
501 return (char *)m_mmap_totalbufmode
+ offs
;
504 int Read(void *buf
, int len
)
506 if (m_mmap_view
||m_mmap_totalbufmode
)
508 int maxl
=(int) (m_fsize
-m_file_position
);
509 if (maxl
> len
) maxl
=len
;
510 if (maxl
< 0) maxl
=0;
514 memcpy(buf
,(char *)m_mmap_view
+ (int)m_file_position
,maxl
);
516 memcpy(buf
,(char *)m_mmap_totalbufmode
+ (int)m_file_position
,maxl
);
519 m_file_position
+=maxl
;
523 if (m_fsize_maychange
) GetSize(); // update m_fsize
525 #ifdef WDL_WIN32_NATIVE_READ
526 if (m_fh
== INVALID_HANDLE_VALUE
||len
<1) return 0;
530 return AsyncRead((char *)buf
,len
);
532 #elif defined(WDL_POSIX_NATIVE_READ)
533 if (m_filedes
<0 || len
<1) return 0;
536 if (!m_fp
|| len
<1) return 0;
540 if (m_bufspace
.GetSize()>=WDL_UNBUF_ALIGN
*2-1)
543 int sz
=m_bufspace
.GetSize()-(WDL_UNBUF_ALIGN
-1);
544 char *srcbuf
=(char *)m_bufspace
.Get(); // read size
545 if (((int)(INT_PTR
)srcbuf
)&(WDL_UNBUF_ALIGN
-1)) srcbuf
+= WDL_UNBUF_ALIGN
-(((int)(INT_PTR
)srcbuf
)&(WDL_UNBUF_ALIGN
-1));
548 int a
=m_sync_bufmode_used
-m_sync_bufmode_pos
;
549 if (a
>(len
-rdout
)) a
=(len
-rdout
);
552 memcpy((char*)buf
+rdout
,srcbuf
+m_sync_bufmode_pos
,a
);
554 m_sync_bufmode_pos
+=a
;
560 m_sync_bufmode_used
=0;
561 m_sync_bufmode_pos
=0;
564 if (m_syncrd_firstbuf
) // this is a scheduling mechanism to avoid having reads on various files always happening at the same time -- not needed in async modes, only in sync with large buffers
566 m_syncrd_firstbuf
=false;
567 int a
= thissz
/WDL_UNBUF_ALIGN
;
570 static int rrs
; // may not be ideal on multithread, but having it incorrect isnt a big deal.
571 if (a
>7) thissz
>>= (rrs
++)&3;
572 else thissz
>>= (rrs
++)&1;
576 #ifdef WDL_WIN32_NATIVE_READ
580 if (m_file_position
&(WDL_UNBUF_ALIGN
-1))
582 int offs
= (int)(m_file_position
&(WDL_UNBUF_ALIGN
-1));
583 LONG high
=(LONG
) ((m_file_position
-offs
)>>32);
584 SetFilePointer(m_fh
,(LONG
)((m_file_position
-offs
)&((WDL_FILEREAD_POSTYPE
)0xFFFFFFFF)),&high
,FILE_BEGIN
);
585 m_sync_bufmode_pos
=offs
;
588 if (!ReadFile(m_fh
,srcbuf
,thissz
,&o
,NULL
) || o
<1 || m_sync_bufmode_pos
>=(int)o
)
592 #elif defined(WDL_POSIX_NATIVE_READ)
594 o
=pread(m_filedes
,srcbuf
,thissz
,m_filedes_rdpos
);
595 if (o
>0) m_filedes_rdpos
+=o
;
596 if (o
<1 || m_sync_bufmode_pos
>=o
) break;
600 o
=fread(srcbuf
,1,thissz
,m_fp
);
601 if (o
<1 || m_sync_bufmode_pos
>=o
) break;
603 m_sync_bufmode_used
=o
;
611 #ifdef WDL_WIN32_NATIVE_READ
613 ReadFile(m_fh
,buf
,len
,&dw
,NULL
);
616 #elif defined(WDL_POSIX_NATIVE_READ)
618 int ret
=pread(m_filedes
,buf
,len
,m_filedes_rdpos
);
619 if (ret
>0) m_filedes_rdpos
+=ret
;
620 m_file_position
+=ret
;
623 int ret
=fread(buf
,1,len
,m_fp
);
624 m_file_position
+=ret
;
631 WDL_FILEREAD_POSTYPE
GetSize()
633 #ifdef WDL_WIN32_NATIVE_READ
634 if (m_fh
== INVALID_HANDLE_VALUE
) return 0;
635 #elif defined(WDL_POSIX_NATIVE_READ)
636 if (m_filedes
<0) return -1;
639 if (!m_fp
) return -1;
642 if (m_fsize_maychange
)
644 #ifdef WDL_WIN32_NATIVE_READ
646 DWORD l
=GetFileSize(m_fh
,&h
);
647 m_fsize
=(((WDL_FILEREAD_POSTYPE
)h
)<<32)|l
;
648 #elif defined(WDL_POSIX_NATIVE_READ)
650 if (!fstat(m_filedes
,&st
)) m_fsize
= st
.st_size
;
658 WDL_FILEREAD_POSTYPE
GetPosition()
660 #ifdef WDL_WIN32_NATIVE_READ
661 if (m_fh
== INVALID_HANDLE_VALUE
) return -1;
662 #elif defined(WDL_POSIX_NATIVE_READ)
663 if (m_filedes
<0) return -1;
665 if (!m_fp
) return -1;
667 return m_file_position
;
670 bool SetPosition(WDL_FILEREAD_POSTYPE pos
) // returns 0 on success
672 m_async_hashaderr
=false;
674 #ifdef WDL_WIN32_NATIVE_READ
675 if (m_fh
== INVALID_HANDLE_VALUE
) return true;
676 #elif defined(WDL_POSIX_NATIVE_READ)
677 if (m_filedes
<0) return true;
679 if (!m_fp
) return true;
682 if (m_fsize_maychange
) GetSize();
685 if (pos
> m_fsize
) pos
=m_fsize
;
686 WDL_FILEREAD_POSTYPE oldpos
=m_file_position
;
687 if (m_file_position
!=pos
) m_file_position
=pos
;
690 if (m_mmap_view
||m_mmap_totalbufmode
) return false;
692 #ifdef WDL_WIN32_NATIVE_READ
695 WDL_FileRead__ReadEnt
*ent
;
697 if (pos
> m_async_readpos
|| !(ent
=m_full
.Get(0)) || pos
< *(WDL_FILEREAD_POSTYPE
*)&ent
->m_ol
.Offset
)
707 if (m_bufspace
.GetSize()>=WDL_UNBUF_ALIGN
*2-1)
709 if (pos
>= oldpos
-m_sync_bufmode_pos
&& pos
< oldpos
-m_sync_bufmode_pos
+ m_sync_bufmode_used
)
711 int diff
=(int) (pos
-oldpos
);
712 m_sync_bufmode_pos
+=diff
;
716 m_sync_bufmode_pos
=m_sync_bufmode_used
=0;
719 m_syncrd_firstbuf
=true;
720 #ifdef WDL_WIN32_NATIVE_READ
721 LONG high
=(LONG
) (m_file_position
>>32);
722 return SetFilePointer(m_fh
,(LONG
)(m_file_position
&((WDL_FILEREAD_POSTYPE
)0xFFFFFFFF)),&high
,FILE_BEGIN
)==0xFFFFFFFF && GetLastError() != NO_ERROR
;
723 #elif defined(WDL_POSIX_NATIVE_READ)
724 m_filedes_rdpos
= m_file_position
;
727 return !!fseek(m_fp
,m_file_position
,SEEK_SET
);
731 WDL_HeapBuf m_bufspace
;
732 int m_sync_bufmode_used
, m_sync_bufmode_pos
;
734 WDL_FILEREAD_POSTYPE m_file_position
,m_async_readpos
;
735 WDL_FILEREAD_POSTYPE m_fsize
;
738 void *m_mmap_totalbufmode
;
740 #ifdef WDL_WIN32_NATIVE_READ
741 HANDLE
GetHandle() { return m_fh
; }
745 int m_async
; // 1=nobuf, 2=buffered async, -1=unbuffered sync
748 WDL_PtrList
<WDL_FileRead__ReadEnt
> m_empties
;
749 WDL_PtrList
<WDL_FileRead__ReadEnt
> m_pending
;
750 WDL_PtrList
<WDL_FileRead__ReadEnt
> m_full
;
752 #elif defined(WDL_POSIX_NATIVE_READ)
753 WDL_FILEREAD_POSTYPE m_filedes_rdpos
;
755 bool m_filedes_locked
;
757 int GetHandle() { return m_filedes
; }
761 int GetHandle() { return fileno(m_fp
); }
764 bool m_fsize_maychange
;
765 bool m_syncrd_firstbuf
;
766 bool m_async_hashaderr
;