compile err in windows
This commit is contained in:
parent
9c7640e570
commit
977589dee0
|
@ -136,7 +136,6 @@ typedef int (*__compar_fn_t)(const void *, const void *);
|
||||||
#define in_addr_t unsigned long
|
#define in_addr_t unsigned long
|
||||||
#define socklen_t int
|
#define socklen_t int
|
||||||
#define htobe64 htonll
|
#define htobe64 htonll
|
||||||
#define twrite write
|
|
||||||
#define getpid _getpid
|
#define getpid _getpid
|
||||||
|
|
||||||
struct tm *localtime_r(const time_t *timep, struct tm *result);
|
struct tm *localtime_r(const time_t *timep, struct tm *result);
|
||||||
|
|
|
@ -40,19 +40,19 @@ void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) {
|
||||||
|
|
||||||
#define _SEND_FILE_STEP_ 1000
|
#define _SEND_FILE_STEP_ 1000
|
||||||
|
|
||||||
int taosFSendFileImp(FILE* out_file, FILE* in_file, int64_t* offset, int32_t count) {
|
int64_t taosFSendFile(FILE *out_file, FILE *in_file, int64_t *offset, int64_t count) {
|
||||||
fseek(in_file, (int32_t)(*offset), 0);
|
fseek(in_file, (int32_t)(*offset), 0);
|
||||||
int writeLen = 0;
|
int64_t writeLen = 0;
|
||||||
uint8_t buffer[_SEND_FILE_STEP_] = { 0 };
|
uint8_t buffer[_SEND_FILE_STEP_] = { 0 };
|
||||||
|
|
||||||
for (int len = 0; len < (count - _SEND_FILE_STEP_); len += _SEND_FILE_STEP_) {
|
for (int64_t len = 0; len < (count - _SEND_FILE_STEP_); len += _SEND_FILE_STEP_) {
|
||||||
size_t rlen = fread(buffer, 1, _SEND_FILE_STEP_, in_file);
|
size_t rlen = fread(buffer, 1, _SEND_FILE_STEP_, in_file);
|
||||||
if (rlen <= 0) {
|
if (rlen <= 0) {
|
||||||
return writeLen;
|
return writeLen;
|
||||||
}
|
}
|
||||||
else if (rlen < _SEND_FILE_STEP_) {
|
else if (rlen < _SEND_FILE_STEP_) {
|
||||||
fwrite(buffer, 1, rlen, out_file);
|
fwrite(buffer, 1, rlen, out_file);
|
||||||
return (int)(writeLen + rlen);
|
return (int64_t)(writeLen + rlen);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fwrite(buffer, 1, _SEND_FILE_STEP_, in_file);
|
fwrite(buffer, 1, _SEND_FILE_STEP_, in_file);
|
||||||
|
@ -60,7 +60,7 @@ int taosFSendFileImp(FILE* out_file, FILE* in_file, int64_t* offset, int32_t cou
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int remain = count - writeLen;
|
int64_t remain = count - writeLen;
|
||||||
if (remain > 0) {
|
if (remain > 0) {
|
||||||
size_t rlen = fread(buffer, 1, remain, in_file);
|
size_t rlen = fread(buffer, 1, remain, in_file);
|
||||||
if (rlen <= 0) {
|
if (rlen <= 0) {
|
||||||
|
|
|
@ -772,7 +772,7 @@ int32_t tsBufMerge(STSBuf* pDestBuf, const STSBuf* pSrcBuf) {
|
||||||
int64_t offset = getDataStartOffset();
|
int64_t offset = getDataStartOffset();
|
||||||
int32_t size = (int32_t)pSrcBuf->fileSize - (int32_t)offset;
|
int32_t size = (int32_t)pSrcBuf->fileSize - (int32_t)offset;
|
||||||
|
|
||||||
ssize_t rc = taosFSendFile(pDestBuf->f, pSrcBuf->f, &offset, size);
|
int64_t rc = taosFSendFile(pDestBuf->f, pSrcBuf->f, &offset, size);
|
||||||
|
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
// tscError("failed to merge tsBuf from:%s to %s, reason:%s\n", pSrcBuf->path, pDestBuf->path, strerror(errno));
|
// tscError("failed to merge tsBuf from:%s to %s, reason:%s\n", pSrcBuf->path, pDestBuf->path, strerror(errno));
|
||||||
|
|
|
@ -535,7 +535,7 @@ static int tdRestoreKVStore(SKVStore *pStore) {
|
||||||
ASSERT(pStore->info.size == TD_KVSTORE_HEADER_SIZE);
|
ASSERT(pStore->info.size == TD_KVSTORE_HEADER_SIZE);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
ssize_t tsize = taosRead(pStore->fd, tbuf, sizeof(SKVRecord));
|
int64_t tsize = taosRead(pStore->fd, tbuf, sizeof(SKVRecord));
|
||||||
if (tsize == 0) break;
|
if (tsize == 0) break;
|
||||||
if (tsize < sizeof(SKVRecord)) {
|
if (tsize < sizeof(SKVRecord)) {
|
||||||
uError("failed to read %" PRIzu " bytes from file %s at offset %" PRId64 "since %s", sizeof(SKVRecord), pStore->fname,
|
uError("failed to read %" PRIzu " bytes from file %s at offset %" PRId64 "since %s", sizeof(SKVRecord), pStore->fname,
|
||||||
|
|
Loading…
Reference in New Issue