Fixed windows files > 2Gb
This commit is contained in:
parent
c583e7b914
commit
64e6a53c0b
|
@ -59,8 +59,9 @@ void File::Redim(unsigned int elem) {
|
||||||
if(elem > size) {
|
if(elem > size) {
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
LONG zero = 0;
|
||||||
if(INVALID_SET_FILE_POINTER ==
|
if(INVALID_SET_FILE_POINTER ==
|
||||||
SetFilePointer(fp, elem - 1, 0, FILE_BEGIN))
|
SetFilePointer(fp, elem - 1, &zero, FILE_BEGIN))
|
||||||
#else
|
#else
|
||||||
if(-1 == fseek(fp, elem - 1, SEEK_SET))
|
if(-1 == fseek(fp, elem - 1, SEEK_SET))
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,7 +80,8 @@ void File::Redim(unsigned int elem) {
|
||||||
int fd = fileno(fp);
|
int fd = fileno(fp);
|
||||||
ftruncate(fd, elem);
|
ftruncate(fd, elem);
|
||||||
#else
|
#else
|
||||||
SetFilePointer(fp, elem, 0, FILE_BEGIN);
|
LONG zero = 0;
|
||||||
|
SetFilePointer(fp, elem, &zero, FILE_BEGIN);
|
||||||
SetEndOfFile(fp);
|
SetEndOfFile(fp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -88,7 +90,8 @@ void File::Redim(unsigned int elem) {
|
||||||
|
|
||||||
void File::SetPosition(unsigned int pos) {
|
void File::SetPosition(unsigned int pos) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
SetFilePointer(fp, pos, 0, FILE_BEGIN);
|
LONG zero = 0;
|
||||||
|
SetFilePointer(fp, pos, &zero, FILE_BEGIN);
|
||||||
#else
|
#else
|
||||||
fseek(fp, pos, SEEK_SET);
|
fseek(fp, pos, SEEK_SET);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue