Corretti errori vari
git-svn-id: svn://10.65.10.50/trunk@2536 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b92a6dfacb
commit
fef0dc534c
@ -12,7 +12,7 @@
|
||||
#define MAX_SIZE (100000l)
|
||||
|
||||
TMemo_file::TMemo_file(const char* a) :
|
||||
_fname(a), _fp(NULL), _isnew(NULL)
|
||||
_fname(a), _fp(NULL), _isnew(FALSE)
|
||||
{
|
||||
// handles: open file or create
|
||||
_fname.ext("mem");
|
||||
@ -23,7 +23,7 @@ _fname(a), _fp(NULL), _isnew(NULL)
|
||||
}
|
||||
|
||||
if (_fp == NULL)
|
||||
error_box("File memo %s non creato per errori di disco", _fname);
|
||||
error_box("File memo %s non creato per errori di disco", (const char *) _fname);
|
||||
|
||||
// read (write) header
|
||||
if (_isnew)
|
||||
@ -99,7 +99,7 @@ bool TMemo_file::get_field(TTextfile& t, long id)
|
||||
for (long cnt = 0; cnt < _next_ofs; cnt += size)
|
||||
{
|
||||
if (fread(__tmp_string, sizeof(char), (int)size, _fp) != (size_t)size)
|
||||
error_box("%s: unexpected end of file", _fname);
|
||||
error_box("%s: unexpected end of file", (const char *) _fname);
|
||||
|
||||
// move block into text
|
||||
for(long j = 0; j <= size; j++)
|
||||
@ -160,7 +160,7 @@ long TMemo_file::set_field(TTextfile& t, long id)
|
||||
fseek(_fp, oo, SEEK_CUR);
|
||||
break;
|
||||
}
|
||||
if (ok) error_box("file error in %s", _fname);
|
||||
if (ok) error_box("file error in %s", (const char *) _fname);
|
||||
in_mid = TRUE;
|
||||
}
|
||||
}
|
||||
@ -174,7 +174,11 @@ long TMemo_file::set_field(TTextfile& t, long id)
|
||||
fseek(_fp, 0, SEEK_END);
|
||||
|
||||
// lock file
|
||||
#if XVT_OS == XVT_OS_WIN && XVT_CC == XVT_CC_MSV80
|
||||
_locking(_fileno(_fp), _LK_LOCK, MAX_SIZE);
|
||||
#else
|
||||
locking(fileno(_fp), LK_LOCK, MAX_SIZE);
|
||||
#endif
|
||||
|
||||
fwrite(&id, sizeof(long), 1, _fp);
|
||||
// will overwrite later with byte count
|
||||
@ -208,7 +212,12 @@ long TMemo_file::set_field(TTextfile& t, long id)
|
||||
fseek(_fp, 0, SEEK_SET);
|
||||
fwrite(&_id_max, sizeof(long), 1, _fp);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN && XVT_CC == XVT_CC_MSV80
|
||||
_locking(_fileno(_fp), _LK_UNLCK, MAX_SIZE);
|
||||
#else
|
||||
locking(fileno(_fp), LK_UNLCK, MAX_SIZE);
|
||||
#endif
|
||||
|
||||
|
||||
fflush(_fp);
|
||||
ret = _find_id(id) ? id : -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user