[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lzip-bug] Request for help with Windows version of Plzip.
From: |
wrotycz |
Subject: |
Re: [Lzip-bug] Request for help with Windows version of Plzip. |
Date: |
Sun, 12 Jan 2020 04:21:20 +0100 |
User-agent: |
GWP-Draft |
I just (re)discovered this thread and few questions arose.
1)
> I guess they don't work, and you have just been lucky until now. But sooner or later the seek of one thread will be executed between the seek and the read of another thread, and corrupt data will result.
2)
So, what I mean is - instead of defining pread()/pwrite() for all windows environments:
#if defined(__MSVCRT__) && defined(WITH_MINGW)
#include <windows.h>
#warning "Parallel I/O is not guaranteed to work on Windows."
ssize_t pread( ... ) { ... }
ssize_t pwrite( ... ) { ... }
#endif // __MSVCRT__
distinguish between them: '///' my comments
#if defined (_WIN32) || defined (_WIN64) ///__MSVCRT__ /// not sure if cygwin defines __MSVCRT__
// windows section
#if defined (__CYGWIN__) && !defined (WITH_MINGW_HACK)
// use shipped pread()/pwite()
#else
#if defined (WITH_MINGW_HACK)
///#if defined (__MINGW__) && defined (WITH_MINGW_HACK) /// maybe there is no point in separating migw here any more if someone wants to use pread_win_hack() with cygwin, that's fine.
#warning "Parallel I/O is not guaranteed to work on Windows."
ssize_t pread_win_hack( ... ) { ... }
ssize_t pwrite_win_hack( ... ) { ... }
#define pread pread_win_hack
#define pwrite pwrite_win_hack
#else
#error "no functional pread()/pwrite() on this platform"
#endif // #if defined (__MINGW__)
#endif // #if defined (__CYGWIN__)
#endif // #if defined (_WIN32)...
3) This is just loosely related but I won't make new thread.
Description of preadblock() in `$plzip/decompress.cc' states
// Returns the number of bytes really read.
// If (returned value < size) and (errno == 0), means EOF was reached.
Zero indicates end of file. Only if read()/pread() returns 0 one know it's end of file.
- Re: [Lzip-bug] Request for help with Windows version of Plzip.,
wrotycz <=