Skip to content

Commit c9ecc00

Browse files
committed
Fix vexing parse
1 parent 02d2ace commit c9ecc00

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

modules/yup_core/native/yup_Files_linux.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace yup
4242

4343
namespace
4444
{
45-
45+
//==============================================================================
4646
enum
4747
{
4848
U_ISOFS_SUPER_MAGIC = 0x9660, // linux/iso_fs.h
@@ -53,8 +53,7 @@ enum
5353

5454
static String getBlockDeviceName (dev_t dev)
5555
{
56-
// Example sysfs entry:
57-
// /sys/dev/block/8:16 -> ../../block/sdb/sdb1
56+
// Example sysfs entry: /sys/dev/block/8:16 -> ../../block/sdb/sdb1
5857
char sysPath[128] = {};
5958
std::snprintf (sysPath, sizeof (sysPath), "/sys/dev/block/%u:%u", static_cast<unsigned int> (major (dev)), static_cast<unsigned int> (minor (dev)));
6059

@@ -64,16 +63,14 @@ static String getBlockDeviceName (dev_t dev)
6463
return {};
6564

6665
buf[len] = 0;
67-
const String link (CharPointer_UTF8 (buf));
66+
const String link = CharPointer_UTF8 (buf);
6867

69-
// Look for "/block/" component
7068
const int blockIndex = link.indexOf ("/block/");
7169
if (blockIndex < 0)
7270
return {};
7371

7472
String rest = link.substring (blockIndex + 7); // skip "/block/"
7573

76-
// rest is typically "sdb/sdb1" or just "sdb"
7774
const int slash = rest.indexOfChar ('/');
7875
if (slash >= 0)
7976
rest = rest.substring (0, slash);
@@ -82,6 +79,7 @@ static String getBlockDeviceName (dev_t dev)
8279
}
8380
} // namespace
8481

82+
//==============================================================================
8583
bool File::isOnCDRomDrive() const
8684
{
8785
struct statfs buf;

0 commit comments

Comments
 (0)