summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/BStream.h2
-rw-r--r--includes/Buffer.h4
-rw-r--r--includes/Handle.h52
-rw-r--r--includes/Input.h4
-rw-r--r--includes/Output.h4
5 files changed, 35 insertions, 31 deletions
diff --git a/includes/BStream.h b/includes/BStream.h
index 2fa842e..fd00b83 100644
--- a/includes/BStream.h
+++ b/includes/BStream.h
@@ -13,7 +13,7 @@ class BStream : public Handle {
virtual bool canRead();
virtual const char * getName();
virtual ssize_t read(void * buf, size_t count) throw (GeneralException);
- virtual off_t getSize();
+ virtual off64_t getSize();
int peekNextByte();
String readString(bool putNL = false);
bool isEmpty() { return m_availBytes == 0; }
diff --git a/includes/Buffer.h b/includes/Buffer.h
index a903ec9..c0d269a 100644
--- a/includes/Buffer.h
+++ b/includes/Buffer.h
@@ -17,14 +17,14 @@ class Buffer : public SeekableHandle {
virtual bool canRead();
virtual bool canWrite();
virtual const char * getName();
- virtual off_t getSize();
+ virtual off64_t getSize();
const uint8_t * getBuffer() { return m_buffer + rtell(); }
void reset();
void rewind() { rseek(0); wseek(0); }
private:
uint8_t * m_buffer = NULL;
bool m_fromConst = false;
- off_t m_bufSize = 0, m_numBlocks = 0;
+ off64_t m_bufSize = 0, m_numBlocks = 0;
};
};
diff --git a/includes/Handle.h b/includes/Handle.h
index 29cdb08..176f4bb 100644
--- a/includes/Handle.h
+++ b/includes/Handle.h
@@ -6,6 +6,10 @@
#include <Printer.h>
#include <BString.h>
+#ifdef _MSC_VER
+typedef __int64 off64_t;
+#endif
+
namespace Balau {
class FileSystem {
@@ -52,17 +56,17 @@ class Handle {
virtual bool canWrite();
virtual ssize_t read(void * buf, size_t count) throw (GeneralException) WARN_UNUSED_RESULT;
virtual ssize_t write(const void * buf, size_t count) throw (GeneralException) WARN_UNUSED_RESULT;
- virtual void rseek(off_t offset, int whence = SEEK_SET) throw (GeneralException);
- virtual void wseek(off_t offset, int whence = SEEK_SET) throw (GeneralException);
- virtual off_t rtell() throw (GeneralException);
- virtual off_t wtell() throw (GeneralException);
- virtual off_t getSize();
+ virtual void rseek(off64_t offset, int whence = SEEK_SET) throw (GeneralException);
+ virtual void wseek(off64_t offset, int whence = SEEK_SET) throw (GeneralException);
+ virtual off64_t rtell() throw (GeneralException);
+ virtual off64_t wtell() throw (GeneralException);
+ virtual off64_t getSize();
virtual time_t getMTime();
virtual bool isPendingComplete() { return true; }
// helpers
- off_t tell() { return rtell(); }
- void seek(off_t offset, int whence = SEEK_SET) { rseek(offset, whence); }
+ off64_t tell() { return rtell(); }
+ void seek(off64_t offset, int whence = SEEK_SET) { rseek(offset, whence); }
Future<uint8_t> readU8();
Future<uint16_t> readU16();
@@ -175,16 +179,16 @@ class SeekableHandle : public Handle {
public:
SeekableHandle() : m_wOffset(0), m_rOffset(0) { }
virtual bool canSeek();
- virtual void rseek(off_t offset, int whence = SEEK_SET) throw (GeneralException);
- virtual void wseek(off_t offset, int whence = SEEK_SET) throw (GeneralException);
- virtual off_t rtell() throw (GeneralException);
- virtual off_t wtell() throw (GeneralException);
+ virtual void rseek(off64_t offset, int whence = SEEK_SET) throw (GeneralException);
+ virtual void wseek(off64_t offset, int whence = SEEK_SET) throw (GeneralException);
+ virtual off64_t rtell() throw (GeneralException);
+ virtual off64_t wtell() throw (GeneralException);
virtual bool isEOF();
protected:
- off_t getWOffset() { return m_wOffset; }
- off_t getROffset() { return m_rOffset; }
+ off64_t getWOffset() { return m_wOffset; }
+ off64_t getROffset() { return m_rOffset; }
private:
- off_t m_wOffset, m_rOffset;
+ off64_t m_wOffset, m_rOffset;
};
class ReadOnly : public Handle {
@@ -199,11 +203,11 @@ class ReadOnly : public Handle {
virtual const char * getName() { return m_io->getName(); }
virtual ssize_t read(void * buf, size_t count) throw (GeneralException) { return m_io->read(buf, count); }
virtual ssize_t write(const void * buf, size_t count) throw (GeneralException) { throw GeneralException("Can't write"); }
- virtual void rseek(off_t offset, int whence = SEEK_SET) throw (GeneralException) { m_io->rseek(offset, whence); }
- virtual void wseek(off_t offset, int whence = SEEK_SET) throw (GeneralException) { throw GeneralException("Can't write"); }
- virtual off_t rtell() throw (GeneralException) { return m_io->rtell(); }
- virtual off_t wtell() throw (GeneralException) { throw GeneralException("Can't write"); }
- virtual off_t getSize() { return m_io->getSize(); }
+ virtual void rseek(off64_t offset, int whence = SEEK_SET) throw (GeneralException) { m_io->rseek(offset, whence); }
+ virtual void wseek(off64_t offset, int whence = SEEK_SET) throw (GeneralException) { throw GeneralException("Can't write"); }
+ virtual off64_t rtell() throw (GeneralException) { return m_io->rtell(); }
+ virtual off64_t wtell() throw (GeneralException) { throw GeneralException("Can't write"); }
+ virtual off64_t getSize() { return m_io->getSize(); }
virtual time_t getMTime() { return m_io->getMTime(); }
private:
IO<Handle> m_io;
@@ -221,11 +225,11 @@ class WriteOnly : public Handle {
virtual const char * getName() { return m_io->getName(); }
virtual ssize_t read(void * buf, size_t count) throw (GeneralException) { throw GeneralException("Can't read"); }
virtual ssize_t write(const void * buf, size_t count) throw (GeneralException) { return m_io->write(buf, count); }
- virtual void rseek(off_t offset, int whence = SEEK_SET) throw (GeneralException) { throw GeneralException("Can't read"); }
- virtual void wseek(off_t offset, int whence = SEEK_SET) throw (GeneralException) { return m_io->wseek(offset, whence); }
- virtual off_t rtell() throw (GeneralException) { throw GeneralException("Can't read"); }
- virtual off_t wtell() throw (GeneralException) { return m_io->wtell(); }
- virtual off_t getSize() { return m_io->getSize(); }
+ virtual void rseek(off64_t offset, int whence = SEEK_SET) throw (GeneralException) { throw GeneralException("Can't read"); }
+ virtual void wseek(off64_t offset, int whence = SEEK_SET) throw (GeneralException) { return m_io->wseek(offset, whence); }
+ virtual off64_t rtell() throw (GeneralException) { throw GeneralException("Can't read"); }
+ virtual off64_t wtell() throw (GeneralException) { return m_io->wtell(); }
+ virtual off64_t getSize() { return m_io->getSize(); }
virtual time_t getMTime() { return m_io->getMTime(); }
private:
IO<Handle> m_io;
diff --git a/includes/Input.h b/includes/Input.h
index be9e4cf..a9bfa8c 100644
--- a/includes/Input.h
+++ b/includes/Input.h
@@ -14,7 +14,7 @@ class Input : public SeekableHandle {
virtual bool isClosed();
virtual bool canRead();
virtual const char * getName();
- virtual off_t getSize();
+ virtual off64_t getSize();
virtual time_t getMTime();
virtual bool isPendingComplete();
const char * getFName() { return m_fname.to_charp(); }
@@ -22,7 +22,7 @@ class Input : public SeekableHandle {
int m_fd = -1;
String m_name;
String m_fname;
- off_t m_size = -1;
+ off64_t m_size = -1;
time_t m_mtime = -1;
void * m_pendingOp = NULL;
};
diff --git a/includes/Output.h b/includes/Output.h
index c80cf40..59a157e 100644
--- a/includes/Output.h
+++ b/includes/Output.h
@@ -13,7 +13,7 @@ class Output : public SeekableHandle {
virtual bool isClosed();
virtual bool canWrite();
virtual const char * getName();
- virtual off_t getSize();
+ virtual off64_t getSize();
virtual time_t getMTime();
virtual bool isPendingComplete();
const char * getFName() { return m_fname.to_charp(); }
@@ -21,7 +21,7 @@ class Output : public SeekableHandle {
int m_fd = -1;
String m_name;
String m_fname;
- off_t m_size = -1;
+ off64_t m_size = -1;
time_t m_mtime = -1;
void * m_pendingOp = NULL;
};