Skip to content

Commit 4ae039f

Browse files
committed
On Windows, return number of valid (full-sized) pages rather than rounded up number. This is how it works on Linux since v3. And this fixes validation of database file < one full page in size.
1 parent 9048844 commit 4ae039f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/jrd/os/posix/unix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ ULONG PIO_get_number_of_pages(const jrd_file* file, const USHORT pagesize)
470470
**************************************
471471
*
472472
* Functional description
473-
* Compute number of pages in file, based only on file size.
473+
* Compute number of full-size pages in file, based only on file size.
474474
*
475475
**************************************/
476476

src/jrd/os/win32/winnt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ ULONG PIO_get_number_of_pages(const jrd_file* file, const USHORT pagesize)
740740
**************************************
741741
*
742742
* Functional description
743-
* Compute number of pages in file, based only on file size.
743+
* Compute number of full-size pages in file, based only on file size.
744744
*
745745
**************************************/
746746
HANDLE hFile = file->fil_desc;
@@ -752,7 +752,7 @@ ULONG PIO_get_number_of_pages(const jrd_file* file, const USHORT pagesize)
752752
nt_error("GetFileSize", file, isc_io_access_err, 0);
753753

754754
const ULONGLONG ullFileSize = (((ULONGLONG) dwFileSizeHigh) << 32) + dwFileSizeLow;
755-
return (ULONG) ((ullFileSize + pagesize - 1) / pagesize);
755+
return ullFileSize / pagesize;
756756
}
757757

758758

0 commit comments

Comments
 (0)