Skip to content

Commit e24e3b6

Browse files
committed
Global: returns false when an error is printed
1 parent 135547f commit e24e3b6

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

src/modules/bluetooth/bluetooth.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ bool ffPrintBluetooth(FFBluetoothOptions* options) {
6666

6767
if (devices.length == 0) {
6868
ffPrintError(FF_BLUETOOTH_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No bluetooth devices found");
69+
return false;
6970
}
7071

7172
uint8_t i = 1;

src/modules/bluetoothradio/bluetoothradio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ bool ffPrintBluetoothRadio(FFBluetoothRadioOptions* options) {
113113
} else {
114114
ffPrintError(FF_BLUETOOTHRADIO_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No devices detected");
115115
}
116+
return false;
116117
}
117118

118119
FF_LIST_FOR_EACH (FFBluetoothRadioResult, radio, radios) {

src/modules/gpu/gpu.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,6 @@ bool ffPrintGPU(FFGPUOptions* options) {
196196
++i;
197197
}
198198

199-
if (selectedGPUs.length == 0) {
200-
ffPrintError(FF_GPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No GPUs found");
201-
}
202-
203199
FF_LIST_FOR_EACH (FFGPUResult, gpu, gpus) {
204200
ffStrbufDestroy(&gpu->vendor);
205201
ffStrbufDestroy(&gpu->name);
@@ -208,6 +204,11 @@ bool ffPrintGPU(FFGPUOptions* options) {
208204
ffStrbufDestroy(&gpu->memoryType);
209205
}
210206

207+
if (selectedGPUs.length == 0) {
208+
ffPrintError(FF_GPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, (gpus.length > 0 ? "GPUs found but all hidden by hideType option" : "No GPUs detected"));
209+
return false;
210+
}
211+
211212
return true;
212213
}
213214

@@ -230,7 +231,7 @@ void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module) {
230231

231232
if (unsafe_yyjson_equals_str(key, "detectionMethod")) {
232233
int value;
233-
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
234+
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]){
234235
{ "auto", FF_GPU_DETECTION_METHOD_AUTO },
235236
{ "pci", FF_GPU_DETECTION_METHOD_PCI },
236237
{ "vulkan", FF_GPU_DETECTION_METHOD_VULKAN },
@@ -251,7 +252,7 @@ void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module) {
251252
options->hideType = FF_GPU_TYPE_NONE;
252253
} else {
253254
int value;
254-
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
255+
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]){
255256
{ "none", FF_GPU_TYPE_NONE },
256257
{ "unknown", FF_GPU_TYPE_UNKNOWN },
257258
{ "integrated", FF_GPU_TYPE_INTEGRATED },
@@ -445,8 +446,8 @@ void ffInitGPUOptions(FFGPUOptions* options) {
445446
;
446447
options->temp = false;
447448
options->hideType = FF_GPU_TYPE_NONE;
448-
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
449-
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
449+
options->tempConfig = (FFColorRangeConfig){ 60, 80 };
450+
options->percent = (FFPercentageModuleConfig){ 50, 80, 0 };
450451
}
451452

452453
void ffDestroyGPUOptions(FFGPUOptions* options) {
@@ -462,7 +463,7 @@ FFModuleBaseInfo ffGPUModuleInfo = {
462463
.printModule = (void*) ffPrintGPU,
463464
.generateJsonResult = (void*) ffGenerateGPUJsonResult,
464465
.generateJsonConfig = (void*) ffGenerateGPUJsonConfig,
465-
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
466+
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]){
466467
{ "GPU vendor", "vendor" },
467468
{ "GPU name", "name" },
468469
{ "GPU driver", "driver" },

0 commit comments

Comments
 (0)