- // TODO: no eof in GnuWin32
-
-#ifdef __LINUX__
-
- int iRc = Tell() == Length();
-
-#else
-
-#if defined(__GNUWIN32__)
- int iRc = -1;
-#else
- int iRc = eof(m_fd);
-#endif
-
-#endif
+ int iRc;
+
+ #if defined(__UNIX__) || defined(__GNUWIN32__)
+ // @@ this doesn't work, of course, on unseekable file descriptors
+ off_t ofsCur = Tell(),
+ ofsMax = Length();
+ if ( ofsCur == ofsInvalid || ofsMax == ofsInvalid )
+ iRc = -1;
+ else
+ iRc = ofsCur == ofsMax;
+ #else // Windows and "native" compiler
+ iRc = eof(m_fd);
+ #endif // Windows/Unix