summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-26 09:08:13 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-26 09:08:13 -0500
commitcac8dcdd2baad264974aa158283458569c832060 (patch)
tree7b6173a97719b2d3c4f00d53f214a4fd25a535f5
parentea0df494854f5c73bc8c9ee3fc22211f2221ba08 (diff)
downloadtdelibs-cac8dcdd2baad264974aa158283458569c832060.tar.gz
tdelibs-cac8dcdd2baad264974aa158283458569c832060.zip
Fix incorrect block device size reporting on 32 bit systems
-rw-r--r--tdecore/tdehardwaredevices.cpp6
-rw-r--r--tdecore/tdehardwaredevices.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp
index cce10f21a..8cf86d721 100644
--- a/tdecore/tdehardwaredevices.cpp
+++ b/tdecore/tdehardwaredevices.cpp
@@ -859,7 +859,7 @@ TQPixmap TDEStorageDevice::icon(TDEIcon::StdSizes size) {
return ret;
}
-unsigned long TDEStorageDevice::deviceSize() {
+unsigned long long TDEStorageDevice::deviceSize() {
TQString bsnodename = systemPath();
bsnodename.append("/queue/physical_block_size");
TQFile bsfile( bsnodename );
@@ -870,7 +870,7 @@ unsigned long TDEStorageDevice::deviceSize() {
bsfile.close();
}
else {
- // Drat, I can't get a gauranteed block size. Assume a block size of 512, as everything I have read indicates that /sys/block/<dev>/size is given in terms of a 512 byte block...
+ // Drat, I can't get a guaranteed block size. Assume a block size of 512, as everything I have read indicates that /sys/block/<dev>/size is given in terms of a 512 byte block...
blocksize = "512";
}
@@ -884,7 +884,7 @@ unsigned long TDEStorageDevice::deviceSize() {
dsfile.close();
}
- return (blocksize.toULong()*devicesize.toULong());
+ return ((unsigned long long)blocksize.toULong()*(unsigned long long)devicesize.toULong());
}
TQString TDEStorageDevice::deviceFriendlySize() {
diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h
index 1fe962207..54cba4c29 100644
--- a/tdecore/tdehardwaredevices.h
+++ b/tdecore/tdehardwaredevices.h
@@ -613,7 +613,7 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
/**
* @return an unsigned long with the device size in bytes
*/
- unsigned long deviceSize();
+ unsigned long long deviceSize();
/**
* @return a TQString with the device size in human readable form