From: Christian P. <cp...@us...> - 2004-12-30 19:37:01
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28635/src/System Modified Files: Pipe.posix.cpp File.posix.cpp Log Message: Renamed IODevice::commit() to sync(). Added File::resize(). Index: File.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/File.posix.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- File.posix.cpp 30 Dec 2004 17:07:00 -0000 1.7 +++ File.posix.cpp 30 Dec 2004 19:36:48 -0000 1.8 @@ -239,11 +239,11 @@ return false; } -void File::commit() const throw(IO::IOError) +void File::sync() const throw(IO::IOError) { int ret = fsync((int)_handle); if(ret == -1) - throw IO::IOError(errno, "Could not commit file to disk", P_SOURCEINFO); + throw IO::IOError(errno, "Could not sync file to disk", P_SOURCEINFO); } offset_t File::size() const throw(IO::IOError) @@ -256,6 +256,13 @@ return buff.st_size; } +void File::resize(size_t sz) throw(IO::IOError) +{ + int ret = ftruncate((int)_handle, sz); + if(ret == -1) + throw IO::IOError(errno, "Could not truncate file", P_SOURCEINFO); +} + File& File::operator=(const File& f) throw(IO::IOError) { int handle = ::dup((int)f._handle); Index: Pipe.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Pipe.posix.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Pipe.posix.cpp 30 Dec 2004 19:01:38 -0000 1.5 +++ Pipe.posix.cpp 30 Dec 2004 19:36:48 -0000 1.6 @@ -125,7 +125,7 @@ return ret; } -void Pipe::commit() const throw(IO::IOError) +void Pipe::sync() const throw(IO::IOError) { int ret = fsync((int)_handle); if(ret == -1) |