Skip to content

Commit 27605d7

Browse files
committed
Replace superfluous boolean operation
1 parent 24ae4fa commit 27605d7

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/InternalStorage.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bool InternalStorage::begin(){
3232
this -> userDataFileSystem = new LittleFileSystem(this->partitionName);
3333
}
3434
int err = this -> userDataFileSystem -> mount(userData);
35-
return err == 0 ? true : false;
35+
return err == 0;
3636
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
3737
this -> blockDevice = QSPIFBlockDevice::get_default_instance();
3838
this -> userData = new mbed::MBRBlockDevice(this->blockDevice, this->partitionNumber);
@@ -51,15 +51,15 @@ bool InternalStorage::begin(){
5151
this -> userDataFileSystem = new mbed::LittleFileSystem(this->partitionName);
5252
}
5353
int err = this -> userDataFileSystem -> mount(this -> userData);
54-
return err == 0 ? true : false;
54+
return err == 0;
5555
#else
5656
return false; // Unsupported board
5757
#endif
5858
}
5959

6060
bool InternalStorage::unmount(){
6161
int err = this -> userDataFileSystem -> unmount();
62-
return err == 0 ? true : false;
62+
return err == 0;
6363
}
6464

6565
Folder InternalStorage::getRootFolder(){
@@ -83,18 +83,18 @@ bool InternalStorage::format(FileSystems fs){
8383
if(fs == FS_FAT){
8484
#if defined(ARDUINO_PORTENTA_C33)
8585
this -> userDataFileSystem = new FATFileSystem(this->partitionName);
86-
return this -> userDataFileSystem -> reformat(this-> userData) == 0 ? true : false;
86+
return this -> userDataFileSystem -> reformat(this-> userData) == 0;
8787
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
8888
this -> userDataFileSystem = new mbed::FATFileSystem(this->partitionName);
89-
return this -> userDataFileSystem -> reformat(this-> userData) == 0 ? true : false;
89+
return this -> userDataFileSystem -> reformat(this-> userData) == 0;
9090
#endif
9191
} if (fs == FS_LITTLEFS) {
9292
#if defined(ARDUINO_PORTENTA_C33)
9393
this -> userDataFileSystem = new LittleFileSystem(this->partitionName);
94-
return this -> userDataFileSystem -> reformat(this-> userData) == 0 ? true : false;
94+
return this -> userDataFileSystem -> reformat(this-> userData) == 0;
9595
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
9696
this -> userDataFileSystem = new mbed::LittleFileSystem(this->partitionName);
97-
return this -> userDataFileSystem -> reformat(this-> userData) == 0 ? true : false;
97+
return this -> userDataFileSystem -> reformat(this-> userData) == 0;
9898
#endif
9999
}
100100

src/SDStorage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SDStorage::SDStorage(){
99
}
1010

1111
bool SDStorage::begin(){
12-
return mount(DEV_SDCARD, this->fileSystem, MNT_DEFAULT) == 0 ? true : false;
12+
return mount(DEV_SDCARD, this->fileSystem, MNT_DEFAULT) == 0;
1313
}
1414

1515
bool SDStorage::begin(FileSystems fs){
@@ -18,7 +18,7 @@ bool SDStorage::begin(FileSystems fs){
1818
}
1919

2020
bool SDStorage::unmount(){
21-
return umount(DEV_SDCARD) == 0 ? true : false;
21+
return umount(DEV_SDCARD) == 0;
2222
}
2323

2424
Folder SDStorage::getRootFolder(){
@@ -39,7 +39,7 @@ bool SDStorage::format(FileSystems fs){
3939
err = mkfs(DEV_SDCARD, FS_LITTLEFS);
4040
}
4141

42-
return err == 0 ? true : false;
42+
return err == 0;
4343
}
4444

4545

src/USBStorage.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bool USBStorage::begin(){
3838
this -> connected = false;
3939
}
4040

41-
return err == 0 ? true : false;
41+
return err == 0;
4242
}
4343

4444
bool USBStorage::unmount(){
@@ -49,7 +49,7 @@ bool USBStorage::unmount(){
4949
this -> connected = false;
5050
}
5151

52-
return unmountResult == 0 ? true : false;
52+
return unmountResult == 0;
5353
}
5454

5555
Folder USBStorage::getRootFolder(){
@@ -90,12 +90,12 @@ bool USBStorage::format(FileSystems fs){
9090
this -> begin();
9191
this -> unmount();
9292
this -> fileSystem = FS_FAT;
93-
return mkfs(DEV_USB, FS_FAT) == 0 ? true : false;
93+
return mkfs(DEV_USB, FS_FAT) == 0;
9494
} else if(FS_LITTLEFS) {
9595
this -> begin();
9696
this -> unmount();
9797
this -> fileSystem = FS_LITTLEFS;
98-
return mkfs(DEV_USB, FS_LITTLEFS) == 0 ? true : false;
98+
return mkfs(DEV_USB, FS_LITTLEFS) == 0;
9999
}
100100

101101
}

0 commit comments

Comments
 (0)