From 931b835bdbe0b1de9b2ff0f40977ae52065e6c44 Mon Sep 17 00:00:00 2001 From: Andrea Bulgarelli Date: Wed, 26 Feb 2014 09:40:12 +0100 Subject: [PATCH] File seek and ftell as long --- include/File.h | 10 +++++----- include/InputFile.h | 2 +- src/File.cpp | 8 ++++---- src/InputFile.cpp | 2 +- version | 1 + 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/File.h b/include/File.h index f383563..a99c83e 100644 --- a/include/File.h +++ b/include/File.h @@ -78,11 +78,11 @@ public: /// Sets the position into file. /// \pre The file must be opened. - virtual dword setpos(dword offset) throw(PacketExceptionIO*); + virtual long setpos(long offset) throw(PacketExceptionIO*); /// Gets the current file position. /// \pre The file must be opened. - virtual dword getpos(); + virtual long getpos(); /// Stores the current position /// \pre The file must be opened. @@ -96,7 +96,7 @@ public: virtual bool isEOF(); /// \pre The file must be opened. - int setFirstPos() throw(PacketExceptionIO*); + long setFirstPos() throw(PacketExceptionIO*); /// Changes directory. The path is in the filename of file opened. /// \pre The file name must be set. @@ -128,9 +128,9 @@ protected: FILE* fp; - dword bookmarkPos; + long bookmarkPos; - dword startPosition; + long startPosition; char* filename; diff --git a/include/InputFile.h b/include/InputFile.h index fe9abb2..8b04847 100644 --- a/include/InputFile.h +++ b/include/InputFile.h @@ -46,7 +46,7 @@ public: return 0; }; - virtual dword setpos(dword offset) throw(PacketExceptionIO*); + virtual dword setpos(long offset) throw(PacketExceptionIO*); protected: diff --git a/src/File.cpp b/src/File.cpp index 7861101..96045dc 100644 --- a/src/File.cpp +++ b/src/File.cpp @@ -233,9 +233,9 @@ char* File::getLastLineRead() } -dword File::setpos(dword offset) throw(PacketExceptionIO*) +long File::setpos(long offset) throw(PacketExceptionIO*) { - dword f; + long f; //clearerr(fp); f = fseek(fp, offset, 0); if(feof(fp)) @@ -247,7 +247,7 @@ dword File::setpos(dword offset) throw(PacketExceptionIO*) -dword File::getpos() +long File::getpos() { return ftell(fp); } @@ -283,7 +283,7 @@ bool File::isEOF() -int File::setFirstPos() throw(PacketExceptionIO*) +long File::setFirstPos() throw(PacketExceptionIO*) { return setpos(startPosition); } diff --git a/src/InputFile.cpp b/src/InputFile.cpp index 2e15db0..ab49893 100644 --- a/src/InputFile.cpp +++ b/src/InputFile.cpp @@ -75,6 +75,6 @@ char* InputFile::readString() throw(PacketExceptionIO*) return c; } -dword InputFile::setpos(dword offset) throw(PacketExceptionIO*) { +dword InputFile::setpos(long offset) throw(PacketExceptionIO*) { return file->setpos(offset); } diff --git a/version b/version index e69de29..ad1be3c 100644 --- a/version +++ b/version @@ -0,0 +1 @@ +3.0.0 -- GitLab