fix timezone range
This commit is contained in:
parent
386af392ea
commit
d368956e3f
|
@ -170,10 +170,14 @@ int32_t parseTimezone(char* str, int64_t* tzOffset) {
|
||||||
hour = strnatoi(&str[i], len);
|
hour = strnatoi(&str[i], len);
|
||||||
i += len + 1;
|
i += len + 1;
|
||||||
} else {
|
} else {
|
||||||
hour = strnatoi(&str[i], 2);
|
hour = strnatoi(&str[i], strlen(&str[i]));
|
||||||
i += 2;
|
i += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hour > 12 || hour < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// return error if there're illegal charaters after min(2 Digits)
|
// return error if there're illegal charaters after min(2 Digits)
|
||||||
char* minStr = &str[i];
|
char* minStr = &str[i];
|
||||||
if (minStr[1] != '\0' && minStr[2] != '\0') {
|
if (minStr[1] != '\0' && minStr[2] != '\0') {
|
||||||
|
|
|
@ -348,15 +348,15 @@ HANDLE taosOpenFileNotStream(const char *path, int32_t tdFileOptions) {
|
||||||
if (h != INVALID_HANDLE_VALUE && (tdFileOptions & TD_FILE_APPEND) && (tdFileOptions & TD_FILE_WRITE)) {
|
if (h != INVALID_HANDLE_VALUE && (tdFileOptions & TD_FILE_APPEND) && (tdFileOptions & TD_FILE_WRITE)) {
|
||||||
SetFilePointer(h, 0, NULL, FILE_END);
|
SetFilePointer(h, 0, NULL, FILE_END);
|
||||||
}
|
}
|
||||||
if (h == INVALID_HANDLE_VALUE) {
|
// if (h == INVALID_HANDLE_VALUE) {
|
||||||
DWORD dwError = GetLastError();
|
// DWORD dwError = GetLastError();
|
||||||
LPVOID lpMsgBuf;
|
// LPVOID lpMsgBuf;
|
||||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError,
|
// FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError,
|
||||||
0,
|
// 0,
|
||||||
(LPTSTR)&lpMsgBuf, 0, NULL);
|
// (LPTSTR)&lpMsgBuf, 0, NULL);
|
||||||
printf("CreateFile failed with error %d: %s", dwError, (char*)lpMsgBuf);
|
// printf("CreateFile failed with error %d: %s", dwError, (char*)lpMsgBuf);
|
||||||
LocalFree(lpMsgBuf);
|
// LocalFree(lpMsgBuf);
|
||||||
}
|
// }
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,6 +314,6 @@ TEST(osTest, osFilePerformance) {
|
||||||
printf("Test OpenForRead & Close file %d times, cost: %" PRId64 "us\n", TESTTIMES, OpenForReadCloseFileCost);
|
printf("Test OpenForRead & Close file %d times, cost: %" PRId64 "us\n", TESTTIMES, OpenForReadCloseFileCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif OSFILE_PERFORMANCE_TEST
|
#endif // OSFILE_PERFORMANCE_TEST
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
Loading…
Reference in New Issue