From 6e21d1d21a38a01eedf5f91b90d44709099e8a90 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 13 Oct 2023 09:50:36 -0700 Subject: [PATCH] QStorageInfo: change private blockSize member to int It's what the public API returns. There's little reason to use ulong, despite that being the type that struct statvfs uses (on Windows, that was 32-bit anyway). Saves 8 bytes on the size of the QStorageInfoPrivate class. Change-Id: I8f3ce163ccc5408cac39fffd178db8cfb9e5e4f6 Reviewed-by: Ahmad Samir Reviewed-by: Edward Welbourne --- src/corelib/io/qstorageinfo_linux.cpp | 2 +- src/corelib/io/qstorageinfo_p.h | 2 +- src/corelib/io/qstorageinfo_unix.cpp | 2 +- src/corelib/io/qstorageinfo_win.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qstorageinfo_linux.cpp b/src/corelib/io/qstorageinfo_linux.cpp index 40e3cafd5a6..7475f3d4166 100644 --- a/src/corelib/io/qstorageinfo_linux.cpp +++ b/src/corelib/io/qstorageinfo_linux.cpp @@ -170,7 +170,7 @@ void QStorageInfoPrivate::retrieveVolumeInfo() bytesTotal = statfs_buf.f_blocks * statfs_buf.f_frsize; bytesFree = statfs_buf.f_bfree * statfs_buf.f_frsize; bytesAvailable = statfs_buf.f_bavail * statfs_buf.f_frsize; - blockSize = statfs_buf.f_bsize; + blockSize = int(statfs_buf.f_bsize); #if defined(Q_OS_ANDROID) #if defined(_STATFS_F_FLAGS) diff --git a/src/corelib/io/qstorageinfo_p.h b/src/corelib/io/qstorageinfo_p.h index e133c20cb49..25106dacfbb 100644 --- a/src/corelib/io/qstorageinfo_p.h +++ b/src/corelib/io/qstorageinfo_p.h @@ -96,7 +96,7 @@ public: qint64 bytesTotal = -1; qint64 bytesFree = -1; qint64 bytesAvailable = -1; - ulong blockSize = ulong(-1); + int blockSize = -1; bool readOnly = false; bool ready = false; diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 75d83a58d65..3c458ad30b9 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -417,7 +417,7 @@ void QStorageInfoPrivate::retrieveVolumeInfo() bytesFree = statfs_buf.f_bfree * statfs_buf.f_frsize; bytesAvailable = statfs_buf.f_bavail * statfs_buf.f_frsize; #endif - blockSize = statfs_buf.f_bsize; + blockSize = int(statfs_buf.f_bsize); #if defined(Q_OS_ANDROID) || defined(Q_OS_BSD4) || defined(Q_OS_INTEGRITY) || defined(Q_OS_RTEMS) #if defined(_STATFS_F_FLAGS) readOnly = (statfs_buf.f_flags & ST_RDONLY) != 0; diff --git a/src/corelib/io/qstorageinfo_win.cpp b/src/corelib/io/qstorageinfo_win.cpp index 0d2d34898cf..3ee1df9f3c8 100644 --- a/src/corelib/io/qstorageinfo_win.cpp +++ b/src/corelib/io/qstorageinfo_win.cpp @@ -203,7 +203,7 @@ bool QStorageInfoPrivate::queryStorageProperty() nullptr); CloseHandle(handle); if (result) - blockSize = saad.BytesPerPhysicalSector; + blockSize = int(saad.BytesPerPhysicalSector); return result; }