This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch try_fix_python
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/try_fix_python by this push:
new 658ea9de try linux
658ea9de is described below
commit 658ea9dee58f1dd6831ca97befc4d7c4e572dd47
Author: HTHou <[email protected]>
AuthorDate: Mon Aug 12 09:24:25 2024 +0800
try linux
---
.github/workflows/unit-test.yml | 2 +-
cpp/src/file/read_file.cc | 14 ++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
index c5668d83..384e9ec0 100644
--- a/.github/workflows/unit-test.yml
+++ b/.github/workflows/unit-test.yml
@@ -40,7 +40,7 @@ jobs:
max-parallel: 20
matrix:
java: [ 21 ]
- os: [ windows-latest ]
+ os: [ windows-latest,ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
diff --git a/cpp/src/file/read_file.cc b/cpp/src/file/read_file.cc
index 40309dde..97385835 100644
--- a/cpp/src/file/read_file.cc
+++ b/cpp/src/file/read_file.cc
@@ -135,23 +135,25 @@ int ReadFile::read(int32_t offset, char *buf, int32_t
buf_size,
#ifdef _WIN32
ssize_t pread(int fd, void *buf, size_t count, uint64_t offset)
{
- DWORD read_bytes = 0;
+ long unsigned int read_bytes = 0;
+
OVERLAPPED overlapped;
memset(&overlapped, 0, sizeof(OVERLAPPED));
- overlapped.OffsetHigh = (DWORD)((offset & 0xFFFFFFFF00000000LL) >> 32);
- overlapped.Offset = (DWORD)(offset & 0xFFFFFFFFLL);
+ overlapped.OffsetHigh = (uint32_t)((offset & 0xFFFFFFFF00000000LL) >> 32);
+ overlapped.Offset = (uint32_t)(offset & 0xFFFFFFFFLL);
HANDLE file = (HANDLE)_get_osfhandle(fd);
SetLastError(0);
- BOOL RF = ReadFile(file, buf, count, &read_bytes, &overlapped);
+ bool RF = ReadFile(file, buf, count, &read_bytes, &overlapped);
// For some reason it errors when it hits end of file so we don't want to
check that
if ((RF == 0) && GetLastError() != ERROR_HANDLE_EOF) {
- _set_errno(GetLastError()); // Use _set_errno to set the POSIX errno
+ errno = GetLastError();
+ // printf ("Error reading file : %d\n", GetLastError());
return -1;
}
- return (ssize_t)read_bytes;
+ return read_bytes;
}
#endif