os: fix fseek error
This commit is contained in:
parent
8a0922e8a7
commit
b3085f24a2
|
@ -440,10 +440,10 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
|
||||||
#endif
|
#endif
|
||||||
assert(pFile->fd >= 0); // Please check if you have closed the file.
|
assert(pFile->fd >= 0); // Please check if you have closed the file.
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
size_t pos = _lseek(pFile->fd, 0, SEEK_CUR);
|
size_t pos = _lseeki64(pFile->fd, 0, SEEK_CUR);
|
||||||
_lseek(pFile->fd, offset, SEEK_SET);
|
_lseeki64(pFile->fd, offset, SEEK_SET);
|
||||||
int64_t ret = _read(pFile->fd, buf, count);
|
int64_t ret = _read(pFile->fd, buf, count);
|
||||||
_lseek(pFile->fd, pos, SEEK_SET);
|
_lseeki64(pFile->fd, pos, SEEK_SET);
|
||||||
#else
|
#else
|
||||||
int64_t ret = pread(pFile->fd, buf, count, offset);
|
int64_t ret = pread(pFile->fd, buf, count, offset);
|
||||||
#endif
|
#endif
|
||||||
|
@ -493,7 +493,7 @@ int64_t taosLSeekFile(TdFilePtr pFile, int64_t offset, int32_t whence) {
|
||||||
#endif
|
#endif
|
||||||
assert(pFile->fd >= 0); // Please check if you have closed the file.
|
assert(pFile->fd >= 0); // Please check if you have closed the file.
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
int64_t ret = _lseek(pFile->fd, offset, whence);
|
int64_t ret = _lseeki64(pFile->fd, offset, whence);
|
||||||
#else
|
#else
|
||||||
int64_t ret = lseek(pFile->fd, offset, whence);
|
int64_t ret = lseek(pFile->fd, offset, whence);
|
||||||
#endif
|
#endif
|
||||||
|
@ -637,7 +637,7 @@ int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, in
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
|
||||||
_lseek(pFileIn->fd, (int32_t)(*offset), 0);
|
_lseeki64(pFileIn->fd, *offset, 0);
|
||||||
int64_t writeLen = 0;
|
int64_t writeLen = 0;
|
||||||
uint8_t buffer[_SEND_FILE_STEP_] = {0};
|
uint8_t buffer[_SEND_FILE_STEP_] = {0};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue