tests/manual,auto/qstorageinfo: Use function pointer in print helper

Fix warning about unused variable printer in auto-test and redirects
output to qInfo() as intended.
Amends change a26435d65ceac5d714d5cc7d5af2326e162d7a41.

Change-Id: Ia72a93267a54b9c4f9ef37fa058b95ef586ecc75
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Friedemann Kleint 2016-11-25 12:56:07 +01:00
parent 5cd4001bf2
commit 032971af2f

View File

@ -42,17 +42,17 @@ void printVolumes(const QList<QStorageInfo> &volumes, int (*printer)(const char
// 214958080 39088272 4096 /
// /dev/disk1s2 (hfs) RW 488050672 419909696 4096 Macintosh HD2 /Volumes/Macintosh HD2
printf("Filesystem (Type) Size Available BSize Label Mounted on\n");
printer("Filesystem (Type) Size Available BSize Label Mounted on\n");
foreach (const QStorageInfo &info, volumes) {
QByteArray fsAndType = info.device();
if (info.fileSystemType() != fsAndType)
fsAndType += " (" + info.fileSystemType() + ')';
printf("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W');
printer("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W');
if (fsAndType.size() > 19)
printf("\n%23s", "");
printer("\n%23s", "");
printf("%10llu %10llu %5u ", info.bytesTotal() / 1024, info.bytesFree() / 1024, info.blockSize());
printf("%-16s %s\n", qPrintable(info.name()), qPrintable(info.rootPath()));
printer("%10llu %10llu %5u ", info.bytesTotal() / 1024, info.bytesFree() / 1024, info.blockSize());
printer("%-16s %s\n", qPrintable(info.name()), qPrintable(info.rootPath()));
}
}