16 typedef __int64 ssize_t;
83 fp=open((
char*)(
filename), O_RDWR | O_CREAT | O_TRUNC |
86 fp=open((
char*)(
filename), O_RDWR | O_CREAT | O_TRUNC |
91 cerr <<
"Error trying to open file " <<
filename
92 <<
" in class fixed_smartlist2 " <<
endl;
97 lseek(
fp, 0L, SEEK_CUR);
106 #if defined(__MINGW64__) || (defined(_WIN64) && defined(_MSC_VER))
107 assert(n <= INT_MAX);
112 if (nw <= -1 || (
size_t)nw != n)
128 lseek(
fp,0L,SEEK_SET);
130 unsigned int nbytes = 0;
131 ssize_t ret =
::read(
fp,&nbytes,
sizeof(
unsigned int));
135 cerr <<
"Error -- record size in file seems to be larger than"
136 " the buffer it was created from " <<
endl
137 <<
" buffer size is " <<
bufsize <<
" record size is supposedly "
147 lseek(
fp,(off_t)
sizeof(off_t),SEEK_CUR);
162 lseek(
fp,0L,SEEK_SET);
182 cout <<
"Need to increase buffsize in list" <<
endl;
235 unsigned int nbytes = (
unsigned int)_nbytes;
239 off_t
pos=lseek(
fp,0L,SEEK_CUR);
242 ssize_t ret =
::write(
fp,&nbytes,
sizeof(
unsigned int));
275 unsigned int nbytes = (
unsigned int)_nbytes;
279 off_t
pos=lseek(
fp,0L,SEEK_CUR);
282 ssize_t ret =
::write(
fp, &nbytes,
sizeof(
unsigned int));
324 off_t ipos=lseek(
fp,0L,SEEK_CUR);
333 lseek(
fp,-((off_t)
sizeof(off_t)),SEEK_CUR);
335 off_t ret2 = lseek(
fp,-((off_t)
sizeof(off_t)),SEEK_CUR);
338 ssize_t ret =
read(
fp,&pos,
sizeof(off_t));
343 lseek(
fp,pos,SEEK_SET);
345 ret2 = lseek(
fp,pos,SEEK_SET);
352 ssize_t result =
::read(
fp,&_nbytes,
sizeof(
int));
353 assert(result != -1);
356 const size_t nbytes = (size_t)_nbytes;
359 cerr <<
"Error -- record size in file seems to be larger than"
360 " the buffer it was created from " <<
endl
361 <<
" buffer size is " <<
bufsize <<
" record size is supposedly "
366 #if defined(__MINGW64__) || (defined(_WIN64) && defined(_MSC_VER))
374 cerr <<
"Error: read only " << nr <<
" of " << nbytes <<
"bytes.\n";
379 size_t ns = nbytes /
sizeof(int);
387 lseek(
fp,pos,SEEK_SET);
389 off_t ret = lseek(
fp,pos,SEEK_SET);
400 lseek(
fp, (off_t)
sizeof(off_t), SEEK_CUR);
402 off_t ret = lseek(
fp, (off_t)
sizeof(off_t), SEEK_CUR);
417 if ( list.bptr+nsize-1 > list.buffend)
419 cerr <<
" Trying to write outside list buffer" <<
endl;
422 memcpy(list.bptr,p,nsize);
433 if ( list.bptr+nsize-1 > list.buffend)
435 cerr <<
" Trying to write outside list buffer" <<
endl;
438 memcpy(p,list.bptr,nsize);
452 cerr <<
" Sanity error in fixed_smartlist2::operator -= (int)" <<
endl;
478 cerr <<
" Sanity error in fixed_smartlist2::operator -= (int)" <<
endl;
509 if ((
unsigned int)nsize>
bufsize)
511 cout <<
"Need to increase buffsize in list" <<
endl;
552 off_t
pos=lseek(
fp,0L,SEEK_SET);
561 nw =
::read(
fp,&nbytes,
sizeof(
int));
564 nw =
::read(
fp, buffer + offset, (
size_t)nbytes);
void read(const test_smartlist &, void *, int nsize)
void initialize(void)
Description not yet available.
void write_buffer(void)
Description not yet available.
void memcpy(test_smartlist &dest, void *source, const size_t nsize)
memcpy for test_smartlist
void write_buffer_one_less(void)
Description not yet available.
fixed_smartlist2(void)
Default constructor.
void operator++(void)
Description not yet available.
#define ADUNCONST(type, obj)
Creates a shallow copy of obj that is not CONST.
void operator-=(int)
Description not yet available.
int adptr_diff(void *x, void *y)
void allocate(const size_t bufsize, const adstring &filename)
Description not yet available.
#define AD_ALLOCATE(ptr, type, n, classname)
void save_end(void)
Description not yet available.
Description not yet available.
Description not yet available.
void operator--(void)
Description not yet available.
prnstream & endl(prnstream &)
void restore_end(void)
Set to end of file ptr.
void operator+=(int)
Description not yet available.
static int get_passnumber(void)
size_t pos(const adstring &substr, const adstring &s)
Description not yet available.
Description not yet available.
void write(const size_t n)
void read_buffer(void)
Read buffer.
void check_buffer_size(const size_t)
Description not yet available.