[parchive2-cvs] library/src/slice file_slice.cc,1.24,1.25
Status: Pre-Alpha
Brought to you by:
coppit
|
From: <jm...@us...> - 2003-05-07 03:14:01
|
Update of /cvsroot/parchive2/library/src/slice
In directory sc8-pr-cvs1:/tmp/cvs-serv29371/src/slice
Modified Files:
file_slice.cc
Log Message:
put in tests for files being opened, written to, and read from in test_file_slice.cc. Also did handling for files not able to be opened, read from, or written to. Just asserted false if the above failed.
Index: file_slice.cc
===================================================================
RCS file: /cvsroot/parchive2/library/src/slice/file_slice.cc,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** file_slice.cc 7 May 2003 01:39:22 -0000 1.24
--- file_slice.cc 7 May 2003 03:13:54 -0000 1.25
***************
*** 75,79 ****
{
if (!(*file).is_open()) {
! (*file).open(ios::in|ios::binary);
}
--- 75,81 ----
{
if (!(*file).is_open()) {
! (*file).open(ios::in|ios::binary);
! if(!(*file).is_open())
! assert(false);
}
***************
*** 88,92 ****
(*file).seekg(offset);
! (*file).read(slice_bytes, size);
// Make sure we zero pad the rest
--- 90,95 ----
(*file).seekg(offset);
! if(((*file).read(slice_bytes, size)) == NULL)
! assert(false);
// Make sure we zero pad the rest
***************
*** 106,118 ****
// unless we throw an exception
if (!(*file).is_open()) {
! (*file).open(ios::out|ios::binary);
}
!
if (!(*file).is_open()) {
! // Call with append to create
! (*file).open(ios::out|ios::binary|ios::app);
(*file).close();
// Now open normally, instead of always writing to the end
(*file).open(ios::out|ios::binary);
}
--- 109,127 ----
// unless we throw an exception
if (!(*file).is_open()) {
! (*file).open(ios::out|ios::binary);
! if(!(*file).is_open())
! assert(false);
}
!
if (!(*file).is_open()) {
! // Call with append to create
! (*file).open(ios::out|ios::binary|ios::app);
! if(!(*file).is_open())
! assert(false);
(*file).close();
// Now open normally, instead of always writing to the end
(*file).open(ios::out|ios::binary);
+ if(!(*file).is_open())
+ assert(false);
}
***************
*** 123,127 ****
(*file).seekp(offset);
! (*file).write(slice_bytes, size);
dirty = false;
--- 132,137 ----
(*file).seekp(offset);
! if(((*file).write(slice_bytes, size)) == NULL)
! assert(false);
dirty = false;
|