mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 06:00:08 +01:00
Global: replaces __attribute__ to C23 [[attribute]]
This commit is contained in:
@@ -21,7 +21,7 @@ static const char* parseTermuxApi(FFBatteryOptions* options, FFlist* results) {
|
||||
return "Starting `" FF_TERMUX_API_PATH " " FF_TERMUX_API_PARAM "` failed";
|
||||
}
|
||||
|
||||
yyjson_doc* FF_A_CLEANUP(wrapYyjsonFree) doc = yyjson_read_opts(buffer.chars, buffer.length, 0, nullptr, nullptr);
|
||||
[[gnu::cleanup(wrapYyjsonFree)]] yyjson_doc* doc = yyjson_read_opts(buffer.chars, buffer.length, 0, nullptr, nullptr);
|
||||
if (!doc) {
|
||||
return "Failed to parse battery info";
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <sys/fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const char* ffDetectBattery(FF_A_UNUSED FFBatteryOptions* options, FFlist* results) {
|
||||
const char* ffDetectBattery([[maybe_unused]] FFBatteryOptions* options, FFlist* results) {
|
||||
// https://www.freebsd.org/cgi/man.cgi?acpi_battery(4)
|
||||
// https://gitlab.xfce.org/panel-plugins/xfce4-battery-plugin/-/blob/master/panel-plugin/libacpi.c
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ const char* parseBattery(int dfd, const char* battId, FFlist* results) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* ffDetectBattery(FF_A_UNUSED FFBatteryOptions* options, FFlist* results) {
|
||||
const char* ffDetectBattery([[maybe_unused]] FFBatteryOptions* options, FFlist* results) {
|
||||
FF_AUTO_CLOSE_DIR DIR* dir = opendir("/dev/power/acpi_battery/");
|
||||
if (!dir) {
|
||||
return "opendir(/dev/power/acpi_battery) failed";
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
const char* ffDetectBattery(FF_A_UNUSED FFBatteryOptions* options, FFlist* results) {
|
||||
const char* ffDetectBattery([[maybe_unused]] FFBatteryOptions* options, FFlist* results) {
|
||||
FF_AUTO_CLOSE_FD int fd = open(_PATH_SYSMON, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
return "open(_PATH_SYSMON, O_RDONLY | O_CLOEXEC) failed";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
const char* ffDetectBattery(FF_A_UNUSED FFBatteryOptions* options, FFlist* result) {
|
||||
const char* ffDetectBattery([[maybe_unused]] FFBatteryOptions* options, FFlist* result) {
|
||||
FF_AUTO_CLOSE_FD int devfd = open("/dev/apm", O_RDONLY | O_CLOEXEC);
|
||||
|
||||
if (devfd < 0) {
|
||||
|
||||
@@ -51,7 +51,7 @@ static FFBatteryWmiEntry* getBatteryEntry(FFlist* entries, FFlist* results, ULON
|
||||
}
|
||||
|
||||
static const char* queryWmiAllData(const GUID* guid, const char* guidStr, PWNODE_ALL_DATA* pAllData, ULONG* pBufferSize) {
|
||||
FF_AUTO_CLOSE_WMI_BLOCK HANDLE hBlock = nullptr;
|
||||
[[gnu::cleanup(ffCloseWmiBlock)]] HANDLE hBlock = nullptr;
|
||||
ULONG status = WmiOpenBlock(guid, WMIGUID_QUERY, &hBlock);
|
||||
if (status != ERROR_SUCCESS) {
|
||||
FF_DEBUG("WMI: WmiOpenBlock() failed for %s: %s", guidStr, ffDebugWin32Error(status));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "bios.h"
|
||||
|
||||
const char* ffDetectBios(FF_A_UNUSED FFBiosResult* bios) {
|
||||
const char* ffDetectBios([[maybe_unused]] FFBiosResult* bios) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#endif
|
||||
|
||||
typedef struct FFSmbiosBios {
|
||||
typedef struct [[gnu::packed]] FFSmbiosBios {
|
||||
FFSmbiosHeader Header;
|
||||
|
||||
uint8_t Vendor; // string
|
||||
@@ -38,7 +38,7 @@ typedef struct FFSmbiosBios {
|
||||
|
||||
// 3.1+
|
||||
uint16_t ExtendedBiosRomSize; // bit field
|
||||
} FF_A_PACKED FFSmbiosBios;
|
||||
} FFSmbiosBios;
|
||||
|
||||
static_assert(offsetof(FFSmbiosBios, ExtendedBiosRomSize) == 0x18,
|
||||
"FFSmbiosBios: Wrong struct alignment");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#define L2CAP_SOCKET_CHECKED
|
||||
#include <bluetooth.h>
|
||||
|
||||
static int enumDev(FF_A_UNUSED int sockfd, struct bt_devinfo const* dev, FFlist* devices) {
|
||||
static int enumDev([[maybe_unused]] int sockfd, struct bt_devinfo const* dev, FFlist* devices) {
|
||||
FFBluetoothResult* device = FF_LIST_ADD(FFBluetoothResult, *devices);
|
||||
ffStrbufInitS(&device->name,
|
||||
#if __FreeBSD__
|
||||
@@ -20,7 +20,7 @@ static int enumDev(FF_A_UNUSED int sockfd, struct bt_devinfo const* dev, FFlist*
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* ffDetectBluetooth(FF_A_UNUSED FFBluetoothOptions* options, FF_A_UNUSED FFlist* devices /* FFBluetoothResult */) {
|
||||
const char* ffDetectBluetooth([[maybe_unused]] FFBluetoothOptions* options, [[maybe_unused]] FFlist* devices /* FFBluetoothResult */) {
|
||||
// struct hostent* ent = bt_gethostent();
|
||||
if (bt_devenum((void*) enumDev, devices) < 0) {
|
||||
return "bt_devenum() failed";
|
||||
|
||||
@@ -5,7 +5,7 @@ extern "C" {
|
||||
|
||||
#include <bluetooth/LocalDevice.h>
|
||||
|
||||
const char* ffDetectBluetooth(FF_A_UNUSED FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */) {
|
||||
const char* ffDetectBluetooth([[maybe_unused]] FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */) {
|
||||
using namespace Bluetooth;
|
||||
FF_SUPPRESS_IO();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "bluetooth.h"
|
||||
|
||||
const char* ffDetectBluetooth(FF_A_UNUSED FFBluetoothOptions* options, FF_A_UNUSED FFlist* devices /* FFBluetoothResult */) {
|
||||
const char* ffDetectBluetooth([[maybe_unused]] FFBluetoothOptions* options, [[maybe_unused]] FFlist* devices /* FFBluetoothResult */) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ static const char* ffBluetoothDetectBattery(FFlist* devices) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
wchar_t* FF_AUTO_FREE idList = (wchar_t*) malloc((size_t) idListLength * sizeof(wchar_t));
|
||||
FF_AUTO_FREE wchar_t* idList = (wchar_t*) malloc((size_t) idListLength * sizeof(wchar_t));
|
||||
if (!idList) {
|
||||
return "malloc() failed";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "bluetoothradio.h"
|
||||
|
||||
const char* ffDetectBluetoothRadio(FF_A_UNUSED FFlist* devices /* FFBluetoothRadioResult */) {
|
||||
const char* ffDetectBluetoothRadio([[maybe_unused]] FFlist* devices /* FFBluetoothRadioResult */) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#define IOCTL_BTH_GET_LOCAL_INFO BTH_CTL(BTH_IOCTL_BASE + 0x00)
|
||||
#define LMP_LE_SUPPORTED(x) ((x >> 38) & 1)
|
||||
|
||||
typedef struct _BTH_RADIO_INFO {
|
||||
typedef struct [[gnu::packed]] _BTH_RADIO_INFO {
|
||||
// Supported LMP features of the radio. Use LMP_XXX() to extract
|
||||
// the desired bits.
|
||||
ULONGLONG lmpSupportedFeatures;
|
||||
@@ -27,9 +27,9 @@ typedef struct _BTH_RADIO_INFO {
|
||||
|
||||
// LMP version
|
||||
UCHAR lmpVersion;
|
||||
} FF_A_PACKED BTH_RADIO_INFO;
|
||||
} BTH_RADIO_INFO;
|
||||
|
||||
typedef struct _BTH_LOCAL_RADIO_INFO {
|
||||
typedef struct [[gnu::packed]] _BTH_LOCAL_RADIO_INFO {
|
||||
// Local BTH_ADDR, class of device, and radio name
|
||||
BTH_DEVICE_INFO localInfo;
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef struct _BTH_LOCAL_RADIO_INFO {
|
||||
|
||||
// More information about the local radio (LMP, MFG)
|
||||
BTH_RADIO_INFO radioInfo;
|
||||
} FF_A_PACKED BTH_LOCAL_RADIO_INFO;
|
||||
} BTH_LOCAL_RADIO_INFO;
|
||||
static_assert(sizeof(BTH_LOCAL_RADIO_INFO) == 292, "BTH_LOCAL_RADIO_INFO should be 292 bytes");
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wpointer-sign"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "board.h"
|
||||
|
||||
const char* ffDetectBoard(FF_A_UNUSED FFBoardResult* board) {
|
||||
const char* ffDetectBoard([[maybe_unused]] FFBoardResult* board) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "board.h"
|
||||
#include "common/smbios.h"
|
||||
|
||||
typedef struct FFSmbiosBaseboard {
|
||||
typedef struct [[gnu::packed]] FFSmbiosBaseboard {
|
||||
FFSmbiosHeader Header;
|
||||
|
||||
uint8_t Manufacturer; // string
|
||||
@@ -15,7 +15,7 @@ typedef struct FFSmbiosBaseboard {
|
||||
uint8_t BoardType; // enum
|
||||
uint8_t NumberOfContainedObjectHandles; // varies
|
||||
uint16_t ContainedObjectHandles[]; // varies
|
||||
} FF_A_PACKED FFSmbiosBaseboard;
|
||||
} FFSmbiosBaseboard;
|
||||
|
||||
static_assert(offsetof(FFSmbiosBaseboard, ContainedObjectHandles) == 0x0F,
|
||||
"FFSmbiosBaseboard: Wrong struct alignment");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "bootmgr.h"
|
||||
|
||||
const char* ffDetectBootmgr(FF_A_UNUSED FFBootmgrResult* result) {
|
||||
const char* ffDetectBootmgr([[maybe_unused]] FFBootmgrResult* result) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -9,21 +9,21 @@
|
||||
// DDC/CI
|
||||
#ifdef __aarch64__
|
||||
typedef CFTypeRef IOAVServiceRef;
|
||||
extern IOAVServiceRef IOAVServiceCreate(CFAllocatorRef allocator) FF_A_WEAK_IMPORT;
|
||||
extern IOAVServiceRef IOAVServiceCreateWithService(CFAllocatorRef allocator, io_service_t service) FF_A_WEAK_IMPORT;
|
||||
extern IOReturn IOAVServiceCopyEDID(IOAVServiceRef service, CFDataRef* x2) FF_A_WEAK_IMPORT;
|
||||
extern IOReturn IOAVServiceReadI2C(IOAVServiceRef service, uint32_t chipAddress, uint32_t offset, void* outputBuffer, uint32_t outputBufferSize) FF_A_WEAK_IMPORT;
|
||||
extern IOReturn IOAVServiceWriteI2C(IOAVServiceRef service, uint32_t chipAddress, uint32_t dataAddress, void* inputBuffer, uint32_t inputBufferSize) FF_A_WEAK_IMPORT;
|
||||
[[clang::weak_import]] extern IOAVServiceRef IOAVServiceCreate(CFAllocatorRef allocator);
|
||||
[[clang::weak_import]] extern IOAVServiceRef IOAVServiceCreateWithService(CFAllocatorRef allocator, io_service_t service);
|
||||
[[clang::weak_import]] extern IOReturn IOAVServiceCopyEDID(IOAVServiceRef service, CFDataRef* x2);
|
||||
[[clang::weak_import]] extern IOReturn IOAVServiceReadI2C(IOAVServiceRef service, uint32_t chipAddress, uint32_t offset, void* outputBuffer, uint32_t outputBufferSize);
|
||||
[[clang::weak_import]] extern IOReturn IOAVServiceWriteI2C(IOAVServiceRef service, uint32_t chipAddress, uint32_t dataAddress, void* inputBuffer, uint32_t inputBufferSize);
|
||||
#else
|
||||
// DDC/CI (Intel)
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||
#include <IOKit/i2c/IOI2CInterface.h>
|
||||
extern void CGSServiceForDisplayNumber(CGDirectDisplayID display, io_service_t* service) FF_A_WEAK_IMPORT;
|
||||
[[clang::weak_import]] extern void CGSServiceForDisplayNumber(CGDirectDisplayID display, io_service_t* service);
|
||||
#endif
|
||||
|
||||
// ACPI
|
||||
extern int DisplayServicesGetBrightness(CGDirectDisplayID display, float* brightness) FF_A_WEAK_IMPORT;
|
||||
[[clang::weak_import]] extern int DisplayServicesGetBrightness(CGDirectDisplayID display, float* brightness);
|
||||
|
||||
// Works for internal display
|
||||
static const char* detectWithDisplayServices(const FFDisplayServerResult* displayServer, FFlist* result) {
|
||||
@@ -51,7 +51,7 @@ static const char* detectWithDisplayServices(const FFDisplayServerResult* displa
|
||||
#ifdef __aarch64__
|
||||
// https://github.com/waydabber/m1ddc
|
||||
// Works for Apple Silicon and USB-C adapter connection ( but not HTMI )
|
||||
static const char* detectWithDdcci(FF_A_UNUSED const FFDisplayServerResult* displayServer, FFBrightnessOptions* options, FFlist* result) {
|
||||
static const char* detectWithDdcci([[maybe_unused]] const FFDisplayServerResult* displayServer, FFBrightnessOptions* options, FFlist* result) {
|
||||
if (!IOAVServiceCreate || !IOAVServiceReadI2C || !IOAVServiceWriteI2C) {
|
||||
return "IOAVService is not available";
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#if __has_include(<dev/iicbus/iic.h>)
|
||||
#include <dev/iicbus/iic.h>
|
||||
|
||||
const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) {
|
||||
const char* detectWithDdcci([[maybe_unused]] FFBrightnessOptions* options, FFlist* result) {
|
||||
// FIXME: doesn't work for me
|
||||
for (char i = '0'; i <= '9'; ++i) {
|
||||
char path[] = "/dev/iic0";
|
||||
@@ -74,7 +74,7 @@ const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFlist* re
|
||||
|
||||
#else
|
||||
|
||||
const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FF_A_UNUSED FFlist* result) {
|
||||
const char* detectWithDdcci([[maybe_unused]] FFBrightnessOptions* options, [[maybe_unused]] FFlist* result) {
|
||||
FF_DEBUG("DDC/CI support is not available on this system");
|
||||
return "DDC/CI is supported only on FreeBSD";
|
||||
}
|
||||
@@ -84,7 +84,7 @@ const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FF_A_UNUSE
|
||||
#if __has_include(<sys/backlight.h>)
|
||||
#include <sys/backlight.h>
|
||||
|
||||
const char* detectWithBacklight(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) {
|
||||
const char* detectWithBacklight([[maybe_unused]] FFBrightnessOptions* options, FFlist* result) {
|
||||
// https://man.freebsd.org/cgi/man.cgi?query=backlight&sektion=9
|
||||
char path[] = "/dev/backlight/backlight0";
|
||||
|
||||
@@ -130,14 +130,14 @@ const char* detectWithBacklight(FF_A_UNUSED FFBrightnessOptions* options, FFlist
|
||||
|
||||
#else
|
||||
|
||||
const char* detectWithBacklight(FF_A_UNUSED FFBrightnessOptions* options, FF_A_UNUSED FFlist* result) {
|
||||
const char* detectWithBacklight([[maybe_unused]] FFBrightnessOptions* options, [[maybe_unused]] FFlist* result) {
|
||||
FF_DEBUG("Backlight support is not available on this system");
|
||||
return "Backlight is supported only on FreeBSD 13 and newer";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) {
|
||||
const char* ffDetectBrightness([[maybe_unused]] FFBrightnessOptions* options, FFlist* result) {
|
||||
detectWithBacklight(options, result);
|
||||
|
||||
if (options->ddcciSleep != FF_BRIGHTNESS_DDCCI_SLEEP_SKIP && result->length == 0) {
|
||||
|
||||
@@ -6,7 +6,7 @@ extern "C" {
|
||||
#include <Application.h>
|
||||
#include <Screen.h>
|
||||
|
||||
const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) {
|
||||
const char* ffDetectBrightness([[maybe_unused]] FFBrightnessOptions* options, FFlist* result) {
|
||||
// We need a valid be_app to query the app_server here.
|
||||
BApplication app("application/x-vnd.fastfetch-cli-fastfetch");
|
||||
BScreen screen{}; // default screen is the main one
|
||||
|
||||
@@ -90,7 +90,7 @@ double ddca_set_default_sleep_multiplier(double multiplier); // ddcutil 1.4
|
||||
DDCA_Status ddca_init(const char* libopts, int syslog_level, int opts);
|
||||
#endif
|
||||
|
||||
static const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) {
|
||||
static const char* detectWithDdcci([[maybe_unused]] FFBrightnessOptions* options, FFlist* result) {
|
||||
FF_LIBRARY_LOAD_MESSAGE(libddcutil, "libddcutil" FF_LIBRARY_EXTENSION, 5);
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_get_display_info_list2)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libddcutil, ddca_open_display2)
|
||||
@@ -158,7 +158,7 @@ static const char* detectWithDdcci(FF_A_UNUSED FFBrightnessOptions* options, FFl
|
||||
}
|
||||
#endif
|
||||
|
||||
const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) {
|
||||
const char* ffDetectBrightness([[maybe_unused]] FFBrightnessOptions* options, FFlist* result) {
|
||||
detectWithBacklight(result);
|
||||
|
||||
#ifdef FF_HAVE_DDCUTIL
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "common/sysctl.h"
|
||||
|
||||
const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) {
|
||||
const char* ffDetectBrightness([[maybe_unused]] FFBrightnessOptions* options, FFlist* result) {
|
||||
// https://man.netbsd.org/NetBSD-10.1/acpiout.4#DESCRIPTION
|
||||
char key[] = "hw.acpi.acpiout0.brightness";
|
||||
char* pn = key + strlen("hw.acpi.acpiout");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "brightness.h"
|
||||
|
||||
const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FF_A_UNUSED FFlist* result) {
|
||||
const char* ffDetectBrightness([[maybe_unused]] FFBrightnessOptions* options, [[maybe_unused]] FFlist* result) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) {
|
||||
const char* ffDetectBrightness([[maybe_unused]] FFBrightnessOptions* options, FFlist* result) {
|
||||
char path[] = "/dev/ttyCX";
|
||||
for (char i = '0'; i <= '9'; ++i) {
|
||||
path[strlen("/dev/ttyC")] = i;
|
||||
|
||||
@@ -45,7 +45,7 @@ static const char* detectWithWmi(FFlist* result) {
|
||||
0xd43412ac, 0x67f9, 0x4fbb, { 0xa0, 0x81, 0x17, 0x52, 0xa2, 0xc3, 0x3e, 0x84 }
|
||||
};
|
||||
|
||||
FF_AUTO_CLOSE_WMI_BLOCK HANDLE hBlock = nullptr;
|
||||
[[gnu::cleanup(ffCloseWmiBlock)]] HANDLE hBlock = nullptr;
|
||||
|
||||
ULONG status = WmiOpenBlock(&WmiMonitorBrightnessGuid, WMIGUID_QUERY, &hBlock);
|
||||
if (status != 0) {
|
||||
@@ -204,7 +204,7 @@ static bool hasBuiltinDisplay(const FFDisplayServerResult* displayServer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) {
|
||||
const char* ffDetectBrightness([[maybe_unused]] FFBrightnessOptions* options, FFlist* result) {
|
||||
const FFDisplayServerResult* displayServer = ffConnectDisplayServer();
|
||||
FF_DEBUG("start, displayCount=%u", displayServer->displays.length);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "btrfs.h"
|
||||
|
||||
const char* ffDetectBtrfs(FF_A_UNUSED FFlist* result) {
|
||||
const char* ffDetectBtrfs([[maybe_unused]] FFlist* result) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@ static inline void wrapYyjsonFree(yyjson_doc** doc) {
|
||||
}
|
||||
}
|
||||
|
||||
const char* ffDetectCamera(FF_A_UNUSED FFlist* result) {
|
||||
const char* ffDetectCamera([[maybe_unused]] FFlist* result) {
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
|
||||
if (ffProcessAppendStdOut(&buffer, (char* const[]) { FF_TERMUX_API_PATH, FF_TERMUX_API_PARAM, nullptr })) {
|
||||
return "Starting `" FF_TERMUX_API_PATH " " FF_TERMUX_API_PARAM "` failed";
|
||||
}
|
||||
|
||||
yyjson_doc* FF_A_CLEANUP(wrapYyjsonFree) doc = yyjson_read_opts(buffer.chars, buffer.length, 0, nullptr, nullptr);
|
||||
[[gnu::cleanup(wrapYyjsonFree)]] yyjson_doc* doc = yyjson_read_opts(buffer.chars, buffer.length, 0, nullptr, nullptr);
|
||||
if (!doc) {
|
||||
return "Failed to parse camera info";
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#ifdef MAC_OS_VERSION_14_0
|
||||
// To make fastfetch compiled on newer macOS versions runs on older ones
|
||||
AVF_EXPORT FF_A_WEAK_IMPORT AVCaptureDeviceType const AVCaptureDeviceTypeExternal;
|
||||
[[clang::weak_import]] AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeExternal;
|
||||
#endif
|
||||
|
||||
const char* ffDetectCamera(FFlist* result)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "camera.h"
|
||||
|
||||
const char* ffDetectCamera(FF_A_UNUSED FFlist* result) {
|
||||
const char* ffDetectCamera([[maybe_unused]] FFlist* result) {
|
||||
return "Not support on this platform";
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
#include <mfapi.h>
|
||||
#include <mfidl.h>
|
||||
|
||||
extern "C" const char* ffDetectCamera(FF_A_UNUSED FFlist* result) {
|
||||
extern "C" const char* ffDetectCamera([[maybe_unused]] FFlist* result) {
|
||||
FF_LIBRARY_LOAD_MESSAGE(mfplat, "mfplat" FF_LIBRARY_EXTENSION, 1)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(mfplat, MFCreateAttributes)
|
||||
FF_LIBRARY_LOAD_MESSAGE(mf, "mf" FF_LIBRARY_EXTENSION, 1)
|
||||
@@ -21,7 +21,7 @@ extern "C" const char* ffDetectCamera(FF_A_UNUSED FFlist* result) {
|
||||
return error;
|
||||
}
|
||||
|
||||
IMFAttributes* FF_AUTO_RELEASE_COM_OBJECT attrs = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT IMFAttributes* attrs = nullptr;
|
||||
if (FAILED(ffMFCreateAttributes(&attrs, 1))) {
|
||||
return "MFCreateAttributes() failed";
|
||||
}
|
||||
@@ -40,7 +40,7 @@ extern "C" const char* ffDetectCamera(FF_A_UNUSED FFlist* result) {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
IMFActivate* FF_AUTO_RELEASE_COM_OBJECT device = devices[i];
|
||||
FF_AUTO_RELEASE_COM_OBJECT IMFActivate* device = devices[i];
|
||||
|
||||
wchar_t buffer[256];
|
||||
uint32_t length = 0;
|
||||
@@ -60,25 +60,25 @@ extern "C" const char* ffDetectCamera(FF_A_UNUSED FFlist* result) {
|
||||
ffStrbufSetNWS(&camera->id, length, buffer);
|
||||
}
|
||||
|
||||
IMFMediaSource* FF_AUTO_RELEASE_COM_OBJECT source = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT IMFMediaSource* source = nullptr;
|
||||
if (FAILED(device->ActivateObject(IID_PPV_ARGS(&source)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
on_scope_exit destroySource([&] { source->Shutdown(); });
|
||||
|
||||
IMFPresentationDescriptor* FF_AUTO_RELEASE_COM_OBJECT pd = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT IMFPresentationDescriptor* pd = nullptr;
|
||||
if (FAILED(source->CreatePresentationDescriptor(&pd))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IMFStreamDescriptor* FF_AUTO_RELEASE_COM_OBJECT sd = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT IMFStreamDescriptor* sd = nullptr;
|
||||
BOOL selected;
|
||||
if (FAILED(pd->GetStreamDescriptorByIndex(0, &selected, &sd))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IMFMediaTypeHandler* FF_AUTO_RELEASE_COM_OBJECT handler = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT IMFMediaTypeHandler* handler = nullptr;
|
||||
if (FAILED(sd->GetMediaTypeHandler(&handler))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "chassis.h"
|
||||
|
||||
const char* ffDetectChassis(FF_A_UNUSED FFChassisResult* result) {
|
||||
const char* ffDetectChassis([[maybe_unused]] FFChassisResult* result) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "common/smbios.h"
|
||||
|
||||
// 7.4
|
||||
typedef struct FFSmbiosSystemEnclosure {
|
||||
typedef struct [[gnu::packed]] FFSmbiosSystemEnclosure {
|
||||
FFSmbiosHeader Header;
|
||||
|
||||
uint8_t Manufacturer; // string
|
||||
@@ -24,7 +24,7 @@ typedef struct FFSmbiosSystemEnclosure {
|
||||
uint8_t ContainedElementCount; // varies
|
||||
uint8_t ContainedRecordLength; // varies
|
||||
uint8_t ContainedElements[]; // varies
|
||||
} FF_A_PACKED FFSmbiosSystemEnclosure;
|
||||
} FFSmbiosSystemEnclosure;
|
||||
|
||||
static_assert(offsetof(FFSmbiosSystemEnclosure, ContainedElements) == 0x15,
|
||||
"FFSmbiosSystemEnclosure: Wrong struct alignment");
|
||||
|
||||
@@ -278,7 +278,7 @@ static const FFCodecMftEncoderSubtype FF_D3D11VA_MFT_ENCODER_SUBTYPES[] = {
|
||||
};
|
||||
|
||||
static FFCodecType ffDetectD3d11vaDecoders(IDXGIAdapter1* adapter, __typeof__(&D3D11CreateDevice) ffD3D11CreateDevice) {
|
||||
ID3D11Device* FF_AUTO_RELEASE_COM_OBJECT d3dDevice = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT ID3D11Device* d3dDevice = nullptr;
|
||||
D3D_FEATURE_LEVEL featureLevel;
|
||||
if (FAILED(ffD3D11CreateDevice(
|
||||
adapter,
|
||||
@@ -295,7 +295,7 @@ static FFCodecType ffDetectD3d11vaDecoders(IDXGIAdapter1* adapter, __typeof__(&D
|
||||
return FF_CODEC_TYPE_NONE;
|
||||
}
|
||||
|
||||
ID3D11VideoDevice* FF_AUTO_RELEASE_COM_OBJECT videoDevice = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT ID3D11VideoDevice* videoDevice = nullptr;
|
||||
if (FAILED(d3dDevice->QueryInterface(__uuidof(ID3D11VideoDevice), (void**) &videoDevice)) || !videoDevice) {
|
||||
return FF_CODEC_TYPE_NONE;
|
||||
}
|
||||
@@ -320,7 +320,7 @@ static FFCodecType ffDetectD3d11vaDecoders(IDXGIAdapter1* adapter, __typeof__(&D
|
||||
}
|
||||
|
||||
static FFCodecType ffDetectD3d11MftEncoders(const LUID& adapterLuid, __typeof__(&MFCreateAttributes) ffMFCreateAttributes, __typeof__(&MFTEnum2) ffMFTEnum2) {
|
||||
IMFAttributes* FF_AUTO_RELEASE_COM_OBJECT attributes = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT IMFAttributes* attributes = nullptr;
|
||||
if (FAILED(ffMFCreateAttributes(&attributes, 1)) || !attributes) {
|
||||
return FF_CODEC_TYPE_NONE;
|
||||
}
|
||||
@@ -382,7 +382,7 @@ static FFCodecType ffCodecEncoderToType(D3D12_VIDEO_ENCODER_CODEC codec) {
|
||||
template <typename Func>
|
||||
static void ffEnumHardwareAdapters(IDXGIFactory1* factory, Func&& onAdapter) {
|
||||
for (UINT adapterIndex = 0;; ++adapterIndex) {
|
||||
IDXGIAdapter1* FF_AUTO_RELEASE_COM_OBJECT adapter = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT IDXGIAdapter1* adapter = nullptr;
|
||||
HRESULT adapterStatus = factory->EnumAdapters1(adapterIndex, &adapter);
|
||||
if (adapterStatus == DXGI_ERROR_NOT_FOUND) {
|
||||
break;
|
||||
@@ -468,7 +468,7 @@ const char* detectD3d12va(FFCodecOptions* options, FFlist* result /*list of FFCo
|
||||
const uint32_t resultLengthBefore = result->length;
|
||||
|
||||
ffEnumHardwareAdapters(factory, [&](IDXGIAdapter1* adapter, const DXGI_ADAPTER_DESC1& desc) {
|
||||
ID3D12Device* FF_AUTO_RELEASE_COM_OBJECT d3dDevice = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT ID3D12Device* d3dDevice = nullptr;
|
||||
if (FAILED(ffD3D12CreateDevice(
|
||||
adapter,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
@@ -478,7 +478,7 @@ const char* detectD3d12va(FFCodecOptions* options, FFlist* result /*list of FFCo
|
||||
return;
|
||||
}
|
||||
|
||||
ID3D12VideoDevice* FF_AUTO_RELEASE_COM_OBJECT videoDevice = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT ID3D12VideoDevice* videoDevice = nullptr;
|
||||
if (FAILED(d3dDevice->QueryInterface(__uuidof(ID3D12VideoDevice), (void**) &videoDevice)) || !videoDevice) {
|
||||
return;
|
||||
}
|
||||
@@ -538,7 +538,7 @@ const char* ffDetectCodecNative(FFCodecOptions* options, FFlist* result /*list o
|
||||
return error;
|
||||
}
|
||||
|
||||
IDXGIFactory1* FF_AUTO_RELEASE_COM_OBJECT factory = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT IDXGIFactory1* factory = nullptr;
|
||||
if (FAILED(ffCreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**) &factory)) || !factory) {
|
||||
return "CreateDXGIFactory1() failed";
|
||||
}
|
||||
|
||||
@@ -510,14 +510,14 @@ void ffCPUDetectByCpuid(FFCPUResult* cpu) {
|
||||
}
|
||||
}
|
||||
#else
|
||||
void ffCPUDetectByCpuid(FF_A_UNUSED FFCPUResult* cpu) {
|
||||
void ffCPUDetectByCpuid([[maybe_unused]] FFCPUResult* cpu) {
|
||||
// Unsupported system
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
void ffCPUDetectByCpuid(FF_A_UNUSED FFCPUResult* cpu) {
|
||||
void ffCPUDetectByCpuid([[maybe_unused]] FFCPUResult* cpu) {
|
||||
// Unsupported architecture
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <OS.h>
|
||||
#include <private/shared/cpu_type.h>
|
||||
|
||||
const char* ffDetectCPUImpl(FF_A_UNUSED const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
const char* ffDetectCPUImpl([[maybe_unused]] const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
system_info sysInfo;
|
||||
if (get_system_info(&sysInfo) != B_OK) {
|
||||
return "get_system_info() failed";
|
||||
|
||||
@@ -546,11 +546,11 @@ static void detectArmName(FFstrbuf* cpuinfo, FFCPUResult* cpu, uint32_t implId)
|
||||
static const char* parseCpuInfo(
|
||||
FFstrbuf* cpuinfo,
|
||||
FFCPUResult* cpu,
|
||||
FF_A_UNUSED FFstrbuf* physicalCoresBuffer,
|
||||
FF_A_UNUSED FFstrbuf* cpuMHz,
|
||||
FF_A_UNUSED FFstrbuf* cpuIsa,
|
||||
FF_A_UNUSED FFstrbuf* cpuUarch,
|
||||
FF_A_UNUSED FFstrbuf* cpuImplementer) {
|
||||
[[maybe_unused]] FFstrbuf* physicalCoresBuffer,
|
||||
[[maybe_unused]] FFstrbuf* cpuMHz,
|
||||
[[maybe_unused]] FFstrbuf* cpuIsa,
|
||||
[[maybe_unused]] FFstrbuf* cpuUarch,
|
||||
[[maybe_unused]] FFstrbuf* cpuImplementer) {
|
||||
char* line = nullptr;
|
||||
size_t len = 0;
|
||||
|
||||
@@ -681,7 +681,7 @@ static bool detectFrequency(FFCPUResult* cpu, const FFCPUOptions* options) {
|
||||
|
||||
#if __i386__ || __x86_64__
|
||||
|
||||
FF_A_UNUSED static uint16_t getPackageCount(FFstrbuf* cpuinfo) {
|
||||
[[maybe_unused]] static uint16_t getPackageCount(FFstrbuf* cpuinfo) {
|
||||
const char* p = cpuinfo->chars;
|
||||
uint64_t low = 0, high = 0;
|
||||
|
||||
@@ -700,7 +700,7 @@ FF_A_UNUSED static uint16_t getPackageCount(FFstrbuf* cpuinfo) {
|
||||
return (uint16_t) (__builtin_popcountll(low) + __builtin_popcountll(high));
|
||||
}
|
||||
|
||||
FF_A_UNUSED static const char* detectCPUX86(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
[[maybe_unused]] static const char* detectCPUX86(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
FF_STRBUF_AUTO_DESTROY cpuinfo = ffStrbufCreateA(PROC_FILE_BUFFSIZ);
|
||||
if (!ffReadFileBuffer(FF_CPUINFO_PATH, &cpuinfo) || cpuinfo.length == 0) {
|
||||
return "ffReadFileBuffer(\"" FF_CPUINFO_PATH "\") failed";
|
||||
@@ -813,7 +813,7 @@ static const char* detectPhysicalCores(FFCPUResult* cpu) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FF_A_UNUSED static void parseIsa(FFstrbuf* cpuIsa) {
|
||||
[[maybe_unused]] static void parseIsa(FFstrbuf* cpuIsa) {
|
||||
// Always use the last part of the ISA string. Ref: #590 #1204
|
||||
ffStrbufSubstrAfterLastC(cpuIsa, ' ');
|
||||
|
||||
@@ -833,7 +833,7 @@ FF_A_UNUSED static void parseIsa(FFstrbuf* cpuIsa) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_UNUSED static void detectSocName(FFCPUResult* cpu) {
|
||||
[[maybe_unused]] static void detectSocName(FFCPUResult* cpu) {
|
||||
if (cpu->name.length > 0) {
|
||||
return;
|
||||
}
|
||||
@@ -953,7 +953,7 @@ FF_A_UNUSED static void detectSocName(FFCPUResult* cpu) {
|
||||
}
|
||||
|
||||
#ifdef __loongarch__
|
||||
FF_A_UNUSED static uint16_t getLoongarchPropCount(FFstrbuf* cpuinfo, const char* key) {
|
||||
[[maybe_unused]] static uint16_t getLoongarchPropCount(FFstrbuf* cpuinfo, const char* key) {
|
||||
const char* p = cpuinfo->chars;
|
||||
uint64_t low = 0, high = 0;
|
||||
uint32_t keylen = (uint32_t) strlen(key);
|
||||
@@ -974,7 +974,7 @@ FF_A_UNUSED static uint16_t getLoongarchPropCount(FFstrbuf* cpuinfo, const char*
|
||||
}
|
||||
#endif
|
||||
|
||||
FF_A_UNUSED static const char* detectCPUOthers(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
[[maybe_unused]] static const char* detectCPUOthers(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
cpu->coresLogical = (uint16_t) get_nprocs_conf();
|
||||
cpu->coresOnline = (uint16_t) get_nprocs();
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ static const char* detectCpuTemp(const FFCPUOptions* options, double* current) {
|
||||
return "open(_PATH_SYSMON, O_RDONLY | O_CLOEXEC) failed";
|
||||
}
|
||||
|
||||
FF_A_CLEANUP(freePropDict) prop_dictionary_t root = nullptr;
|
||||
[[gnu::cleanup(freePropDict)]] prop_dictionary_t root = nullptr;
|
||||
if (prop_dictionary_recv_ioctl(fd, ENVSYS_GETDICTIONARY, &root) < 0) {
|
||||
return "prop_dictionary_recv_ioctl(ENVSYS_GETDICTIONARY) failed";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "cpu.h"
|
||||
|
||||
const char* ffDetectCPUImpl(FF_A_UNUSED const FFCPUOptions* options, FF_A_UNUSED FFCPUResult* cpu) {
|
||||
const char* ffDetectCPUImpl([[maybe_unused]] const FFCPUOptions* options, [[maybe_unused]] FFCPUResult* cpu) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ static inline uint16_t countTypeId(kstat_ctl_t* kc, const char* type) {
|
||||
}
|
||||
|
||||
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
FF_A_CLEANUP(kstatFreeWrap) kstat_ctl_t* kc = kstat_open();
|
||||
[[gnu::cleanup(kstatFreeWrap)]] kstat_ctl_t* kc = kstat_open();
|
||||
if (!kc) {
|
||||
return "kstat_open() failed";
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ const char* detectThermalTemp(const FFCPUOptions* options, double* result) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_CLEANUP(ffPerfCloseQueryHandle)
|
||||
[[gnu::cleanup(ffPerfCloseQueryHandle)]]
|
||||
HANDLE hQuery = nullptr;
|
||||
|
||||
if (PerfOpenQueryHandle(nullptr, &hQuery) != ERROR_SUCCESS) {
|
||||
@@ -139,7 +139,7 @@ const char* detectThermalTemp(const FFCPUOptions* options, double* result) {
|
||||
}
|
||||
|
||||
// 7.5
|
||||
typedef struct FFSmbiosProcessorInfo {
|
||||
typedef struct [[gnu::packed]] FFSmbiosProcessorInfo {
|
||||
FFSmbiosHeader Header;
|
||||
|
||||
uint8_t SocketDesignation; // string
|
||||
@@ -181,7 +181,7 @@ typedef struct FFSmbiosProcessorInfo {
|
||||
|
||||
// 3.6+
|
||||
uint16_t ThreadEnabled; // varies
|
||||
} FF_A_PACKED FFSmbiosProcessorInfo;
|
||||
} FFSmbiosProcessorInfo;
|
||||
|
||||
static_assert(offsetof(FFSmbiosProcessorInfo, ThreadEnabled) == 0x30,
|
||||
"FFSmbiosProcessorInfo: Wrong struct alignment");
|
||||
@@ -238,7 +238,7 @@ static const char* detectNCores(const FFCPUOptions* options, FFCPUResult* cpu) {
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, nullptr, &length) failed";
|
||||
}
|
||||
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* FF_AUTO_FREE
|
||||
FF_AUTO_FREE SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*
|
||||
pProcessorInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*) malloc(length);
|
||||
|
||||
if (!NT_SUCCESS(NtQuerySystemInformationEx(SystemLogicalProcessorAndGroupInformation, &lpr, sizeof(lpr), pProcessorInfo, length, &length))) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "cpucache.h"
|
||||
|
||||
const char* ffDetectCPUCache(FF_A_UNUSED FFCPUCacheResult* result) {
|
||||
const char* ffDetectCPUCache([[maybe_unused]] FFCPUCacheResult* result) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "common/smbios.h"
|
||||
#include "common/strutil.h"
|
||||
|
||||
typedef struct FFSmbiosCacheInfo {
|
||||
typedef struct [[gnu::packed]] FFSmbiosCacheInfo {
|
||||
FFSmbiosHeader Header;
|
||||
|
||||
uint8_t SocketDesignation; // string
|
||||
@@ -21,7 +21,7 @@ typedef struct FFSmbiosCacheInfo {
|
||||
// 3.1+
|
||||
uint32_t MaximumCacheSize2; // bit field
|
||||
uint32_t InstalledCacheSize2; // bit field
|
||||
} FF_A_PACKED FFSmbiosCacheInfo;
|
||||
} FFSmbiosCacheInfo;
|
||||
|
||||
static_assert(offsetof(FFSmbiosCacheInfo, InstalledCacheSize2) == 0x17,
|
||||
"FFSmbiosCacheInfo: Wrong struct alignment");
|
||||
|
||||
@@ -10,7 +10,7 @@ const char* ffDetectCPUCache(FFCPUCacheResult* result) {
|
||||
return "GetLogicalProcessorInformationEx(RelationCache, nullptr, &length) failed";
|
||||
}
|
||||
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* FF_AUTO_FREE
|
||||
FF_AUTO_FREE SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*
|
||||
pProcessorInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*) malloc(length);
|
||||
|
||||
if (!NT_SUCCESS(NtQuerySystemInformationEx(SystemLogicalProcessorAndGroupInformation, &lpr, sizeof(lpr), pProcessorInfo, length, &length))) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "fastfetch.h"
|
||||
#include "detection/cpuusage/cpuusage.h"
|
||||
|
||||
const char* ffGetCpuUsageInfo(FF_A_UNUSED FFlist* cpuTimes) {
|
||||
const char* ffGetCpuUsageInfo([[maybe_unused]] FFlist* cpuTimes) {
|
||||
return "Not support on this platform";
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ static inline void kstatFreeWrap(kstat_ctl_t** pkc) {
|
||||
}
|
||||
|
||||
const char* ffGetCpuUsageInfo(FFlist* cpuTimes) {
|
||||
FF_A_CLEANUP(kstatFreeWrap) kstat_ctl_t* kc = kstat_open();
|
||||
[[gnu::cleanup(kstatFreeWrap)]] kstat_ctl_t* kc = kstat_open();
|
||||
if (!kc) {
|
||||
return "kstat_open() failed";
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ static const char* getInfoByNqsi(FFlist* cpuTimes) {
|
||||
return "NtQuerySystemInformation(SystemProcessorPerformanceInformation, nullptr) failed";
|
||||
}
|
||||
|
||||
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* FF_AUTO_FREE pinfo = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*) malloc(size);
|
||||
FF_AUTO_FREE SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* pinfo = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*) malloc(size);
|
||||
if (!NT_SUCCESS(NtQuerySystemInformation(SystemProcessorPerformanceInformation, pinfo, size, &size))) {
|
||||
return "NtQuerySystemInformation(SystemProcessorPerformanceInformation, size) failed";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "cursor.h"
|
||||
|
||||
void ffDetectCursor(FF_A_UNUSED FFCursorResult* result) {
|
||||
void ffDetectCursor([[maybe_unused]] FFCursorResult* result) {
|
||||
ffStrbufInitS(&result->error, "Not supported on this platform");
|
||||
}
|
||||
|
||||
+13
-13
@@ -22,7 +22,7 @@
|
||||
#define _PATH_LOCALBASE "/usr/pkg"
|
||||
#endif
|
||||
|
||||
static void getKDE(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static void getKDE(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
#ifdef _PATH_LOCALBASE
|
||||
ffParsePropFile(_PATH_LOCALBASE "/share/wayland-sessions/plasma.desktop", "X-KDE-PluginInfo-Version =", result);
|
||||
if (result->length == 0) {
|
||||
@@ -56,7 +56,7 @@ static void getKDE(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
}
|
||||
}
|
||||
|
||||
static const char* getGnomeByDbus(FF_A_UNUSED FFstrbuf* result) {
|
||||
static const char* getGnomeByDbus([[maybe_unused]] FFstrbuf* result) {
|
||||
#ifdef FF_HAVE_DBUS
|
||||
FF_DBUS_AUTO_DESTROY_DATA FFDBusData dbus = {};
|
||||
if (ffDBusLoadData(DBUS_BUS_SESSION, &dbus) != nullptr) {
|
||||
@@ -70,7 +70,7 @@ static const char* getGnomeByDbus(FF_A_UNUSED FFstrbuf* result) {
|
||||
#endif // FF_HAVE_DBUS
|
||||
}
|
||||
|
||||
static void getGnome(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static void getGnome(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
getGnomeByDbus(result);
|
||||
|
||||
if (result->length == 0) {
|
||||
@@ -80,7 +80,7 @@ static void getGnome(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
}
|
||||
}
|
||||
|
||||
static void getCinnamon(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static void getCinnamon(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
ffStrbufSetS(result, getenv("CINNAMON_VERSION"));
|
||||
|
||||
if (result->length == 0) {
|
||||
@@ -94,7 +94,7 @@ static void getCinnamon(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
}
|
||||
}
|
||||
|
||||
static void getMate(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static void getMate(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
FF_STRBUF_AUTO_DESTROY major = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY minor = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY micro = ffStrbufCreate();
|
||||
@@ -124,7 +124,7 @@ static const char* getXfce4ByLib(FFstrbuf* result) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static void getXFCE4(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static void getXFCE4(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
getXfce4ByLib(result);
|
||||
|
||||
if (result->length == 0) {
|
||||
@@ -137,7 +137,7 @@ static void getXFCE4(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
}
|
||||
}
|
||||
|
||||
static void getLXQt(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static void getLXQt(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
ffParsePropFileData("gconfig/lxqt.pc", "Version:", result);
|
||||
|
||||
if (result->length == 0) {
|
||||
@@ -156,11 +156,11 @@ static void getLXQt(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
}
|
||||
}
|
||||
|
||||
static void getBudgie(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static void getBudgie(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
ffParsePropFileData("budgie/budgie-version.xml", "<str>", result);
|
||||
}
|
||||
|
||||
static void getUnity(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static void getUnity(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
if (ffParsePropFile("/usr/bin/unity", "parser = OptionParser(version= \"%prog ", result)) {
|
||||
ffStrbufSubstrBeforeFirstC(result, '"');
|
||||
}
|
||||
@@ -177,7 +177,7 @@ static bool extractTdeVersion(const char* line, uint32_t len, void* userdata) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char* getTrinity(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static const char* getTrinity(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
|
||||
const char* error = ffFindExecutableInPath("tde-config", &path);
|
||||
if (error) {
|
||||
@@ -200,7 +200,7 @@ static const char* getTrinity(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options
|
||||
return "All methods failed";
|
||||
}
|
||||
|
||||
static const char* getCosmic(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static const char* getCosmic(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
if (ffProcessAppendStdOut(result, (char* const[]) { "cosmic-comp", "--version", nullptr }) == nullptr) {
|
||||
// cosmic-comp 0.1.0 (git commit fa88002ba41d2edec25dd7ffdee9719fbb928fc0)
|
||||
ffStrbufSubstrAfterFirstC(result, ' ');
|
||||
@@ -211,7 +211,7 @@ static const char* getCosmic(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options)
|
||||
return "All methods failed";
|
||||
}
|
||||
|
||||
static const char* getEnlightenmentByDbus(FF_A_UNUSED FFstrbuf* result) {
|
||||
static const char* getEnlightenmentByDbus([[maybe_unused]] FFstrbuf* result) {
|
||||
#ifdef FF_HAVE_DBUS
|
||||
FF_DBUS_AUTO_DESTROY_DATA FFDBusData dbus = {};
|
||||
if (ffDBusLoadData(DBUS_BUS_SESSION, &dbus) != nullptr) {
|
||||
@@ -240,7 +240,7 @@ static const char* getEnlightenmentByDbus(FF_A_UNUSED FFstrbuf* result) {
|
||||
#endif // FF_HAVE_DBUS
|
||||
}
|
||||
|
||||
static void getEnlightenment(FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
static void getEnlightenment(FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
getEnlightenmentByDbus(result);
|
||||
|
||||
if (result->length == 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "de.h"
|
||||
|
||||
const char* ffDetectDEVersion(FF_A_UNUSED const FFstrbuf* deName, FF_A_UNUSED FFstrbuf* result, FF_A_UNUSED FFDEOptions* options) {
|
||||
const char* ffDetectDEVersion([[maybe_unused]] const FFstrbuf* deName, [[maybe_unused]] FFstrbuf* result, [[maybe_unused]] FFDEOptions* options) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ static const char* detectFsLabel(struct statfs* fs, FFDisk* disk) {
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
static const char* detectFsLabel(FF_A_UNUSED struct statfs* fs, FF_A_UNUSED FFDisk* disk) {
|
||||
static const char* detectFsLabel([[maybe_unused]] struct statfs* fs, [[maybe_unused]] FFDisk* disk) {
|
||||
return "Fastfetch was compiled without libgeom support";
|
||||
}
|
||||
#endif
|
||||
@@ -84,11 +84,11 @@ static void detectFsInfo(struct statfs* fs, FFDisk* disk) {
|
||||
#define MNT_REMOVABLE 0x00000200
|
||||
#endif
|
||||
|
||||
struct CmnAttrBuf {
|
||||
struct [[gnu::packed]] CmnAttrBuf {
|
||||
uint32_t length;
|
||||
attrreference_t nameRef;
|
||||
char nameSpace[NAME_MAX * 3 + 1];
|
||||
} FF_A_PACKED;
|
||||
};
|
||||
|
||||
void detectFsInfo(struct statfs* fs, FFDisk* disk) {
|
||||
if (fs->f_flags & MNT_DONTBROWSE) {
|
||||
|
||||
@@ -162,7 +162,7 @@ static void detectName(FFDisk* disk) {
|
||||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
static void detectType(FF_A_UNUSED const FFlist* disks, FFDisk* currentDisk, FF_A_UNUSED struct mntent* device) {
|
||||
static void detectType([[maybe_unused]] const FFlist* disks, FFDisk* currentDisk, [[maybe_unused]] struct mntent* device) {
|
||||
if (ffStrbufEqualS(¤tDisk->mountpoint, "/") || ffStrbufEqualS(¤tDisk->mountpoint, "/storage/emulated")) {
|
||||
currentDisk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
|
||||
} else if (ffStrbufStartsWithS(¤tDisk->mountpoint, "/mnt/media_rw/")) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "disk.h"
|
||||
|
||||
const char* ffDetectDisksImpl(FF_A_UNUSED FFDiskOptions* options, FF_A_UNUSED FFlist* disks) {
|
||||
const char* ffDetectDisksImpl([[maybe_unused]] FFDiskOptions* options, [[maybe_unused]] FFlist* disks) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <libgeom.h>
|
||||
|
||||
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
|
||||
FF_A_CLEANUP(geom_deletetree) struct gmesh geomTree = {};
|
||||
[[gnu::cleanup(geom_deletetree)]] struct gmesh geomTree = {};
|
||||
if (geom_gettree(&geomTree) < 0) {
|
||||
return "geom_gettree() failed";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "diskio.h"
|
||||
|
||||
const char* ffDiskIOGetIoCounters(FF_A_UNUSED FFlist* result, FF_A_UNUSED FFDiskIOOptions* options) {
|
||||
const char* ffDiskIOGetIoCounters([[maybe_unused]] FFlist* result, [[maybe_unused]] FFDiskIOOptions* options) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ static inline void kstatFreeWrap(kstat_ctl_t** pkc) {
|
||||
}
|
||||
|
||||
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options) {
|
||||
FF_A_CLEANUP(kstatFreeWrap) kstat_ctl_t* kc = kstat_open();
|
||||
[[gnu::cleanup(kstatFreeWrap)]] kstat_ctl_t* kc = kstat_open();
|
||||
if (!kc) {
|
||||
return "kstat_open() failed";
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include <IOKit/IOKitLib.h>
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
extern Boolean CoreDisplay_Display_SupportsHDRMode(CGDirectDisplayID display) FF_A_WEAK_IMPORT;
|
||||
extern Boolean CoreDisplay_Display_IsHDRModeEnabled(CGDirectDisplayID display) FF_A_WEAK_IMPORT;
|
||||
extern CFDictionaryRef CoreDisplay_DisplayCreateInfoDictionary(CGDirectDisplayID display) FF_A_WEAK_IMPORT;
|
||||
[[clang::weak_import]] extern Boolean CoreDisplay_Display_SupportsHDRMode(CGDirectDisplayID display);
|
||||
[[clang::weak_import]] extern Boolean CoreDisplay_Display_IsHDRModeEnabled(CGDirectDisplayID display);
|
||||
[[clang::weak_import]] extern CFDictionaryRef CoreDisplay_DisplayCreateInfoDictionary(CGDirectDisplayID display);
|
||||
#else
|
||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||
#endif
|
||||
@@ -50,7 +50,7 @@ static void detectDisplays(FFDisplayServerResult* ds) {
|
||||
}
|
||||
|
||||
ffStrbufClear(&buffer);
|
||||
CFDictionaryRef FF_CFTYPE_AUTO_RELEASE displayInfo = nullptr;
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef displayInfo = nullptr;
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
if (CoreDisplay_DisplayCreateInfoDictionary) {
|
||||
displayInfo = CoreDisplay_DisplayCreateInfoDictionary(screen);
|
||||
|
||||
@@ -12,8 +12,7 @@ static inline void freeArgBuffer(FFArgBuffer* buffer) {
|
||||
}
|
||||
buffer->data = nullptr;
|
||||
buffer->length = 0;
|
||||
}
|
||||
#define FF_AUTO_FREE_ARG_BUFFER FF_A_CLEANUP(freeArgBuffer)
|
||||
}\
|
||||
|
||||
// http://undoc.airesoft.co.uk/user32.dll/IsThreadDesktopComposited.php
|
||||
BOOL WINAPI IsThreadDesktopComposited();
|
||||
@@ -47,7 +46,7 @@ static void detectDisplays(FFDisplayServerResult* ds) {
|
||||
.id = path->targetInfo.id,
|
||||
},
|
||||
};
|
||||
FF_AUTO_FREE_ARG_BUFFER FFArgBuffer edid = {};
|
||||
[[gnu::cleanup(freeArgBuffer)]] FFArgBuffer edid = {};
|
||||
if (DisplayConfigGetDeviceInfo(&targetName.header) == ERROR_SUCCESS) {
|
||||
wchar_t regPath[256] = L"SYSTEM\\CurrentControlSet\\Enum";
|
||||
wchar_t* pRegPath = regPath + strlen("SYSTEM\\CurrentControlSet\\Enum");
|
||||
|
||||
@@ -175,7 +175,7 @@ static inline const char* drmType2Name(uint32_t connector_type) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_UNUSED static const char* drmGetEdidByConnId(uint32_t connId, uint8_t* edidData, ssize_t* edidLength) {
|
||||
[[maybe_unused]] static const char* drmGetEdidByConnId(uint32_t connId, uint8_t* edidData, ssize_t* edidLength) {
|
||||
const char* drmDirPath = "/sys/class/drm/";
|
||||
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(drmDirPath);
|
||||
@@ -434,7 +434,7 @@ static const char* drmConnectLibdrm(FFDisplayServerResult* result) {
|
||||
|
||||
#endif
|
||||
|
||||
const char* ffdsConnectDrm(FF_A_UNUSED FFDisplayServerResult* result) {
|
||||
const char* ffdsConnectDrm([[maybe_unused]] FFDisplayServerResult* result) {
|
||||
#if FF_HAVE_DRM
|
||||
if (instance.config.general.dsForceDrm != FF_DS_FORCE_DRM_TYPE_SYSFS_ONLY) {
|
||||
if (drmConnectLibdrm(result) == nullptr) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "xdg-output-unstable-v1-client-protocol.h"
|
||||
#include "wp-color-management-v1-client-protocol.h"
|
||||
|
||||
static void waylandOutputModeListener(void* data, FF_A_UNUSED struct wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refreshRate) {
|
||||
static void waylandOutputModeListener(void* data, [[maybe_unused]] struct wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refreshRate) {
|
||||
WaylandDisplay* display = data;
|
||||
|
||||
if (flags & WL_OUTPUT_MODE_CURRENT) {
|
||||
@@ -20,20 +20,20 @@ static void waylandOutputModeListener(void* data, FF_A_UNUSED struct wl_output*
|
||||
}
|
||||
}
|
||||
|
||||
static void waylandOutputScaleListener(void* data, FF_A_UNUSED struct wl_output* output, int32_t scale) {
|
||||
static void waylandOutputScaleListener(void* data, [[maybe_unused]] struct wl_output* output, int32_t scale) {
|
||||
WaylandDisplay* display = data;
|
||||
display->dpi = 96 * (uint32_t) scale;
|
||||
}
|
||||
|
||||
static void waylandOutputGeometryListener(void* data,
|
||||
FF_A_UNUSED struct wl_output* output,
|
||||
FF_A_UNUSED int32_t x,
|
||||
FF_A_UNUSED int32_t y,
|
||||
[[maybe_unused]] struct wl_output* output,
|
||||
[[maybe_unused]] int32_t x,
|
||||
[[maybe_unused]] int32_t y,
|
||||
int32_t physical_width,
|
||||
int32_t physical_height,
|
||||
FF_A_UNUSED int32_t subpixel,
|
||||
FF_A_UNUSED const char* make,
|
||||
FF_A_UNUSED const char* model,
|
||||
[[maybe_unused]] int32_t subpixel,
|
||||
[[maybe_unused]] const char* make,
|
||||
[[maybe_unused]] const char* model,
|
||||
int32_t transform) {
|
||||
WaylandDisplay* display = data;
|
||||
display->physicalWidth = physical_width;
|
||||
@@ -41,7 +41,7 @@ static void waylandOutputGeometryListener(void* data,
|
||||
display->transform = (enum wl_output_transform) transform;
|
||||
}
|
||||
|
||||
static void handleXdgLogicalSize(void* data, FF_A_UNUSED struct zxdg_output_v1* _, int32_t width, FF_A_UNUSED int32_t height) {
|
||||
static void handleXdgLogicalSize(void* data, [[maybe_unused]] struct zxdg_output_v1* _, int32_t width, [[maybe_unused]] int32_t height) {
|
||||
WaylandDisplay* display = data;
|
||||
// Seems the values are only useful when ractional scale is enabled
|
||||
if (width < display->width) {
|
||||
@@ -71,7 +71,7 @@ static struct zxdg_output_v1_listener zxdgOutputListener = {
|
||||
.description = (void*) ffWaylandOutputDescriptionListener,
|
||||
};
|
||||
|
||||
static void handleWpTfNamed(void *data, FF_A_UNUSED struct wp_image_description_info_v1* wp_image_description_info_v1, uint32_t tf) {
|
||||
static void handleWpTfNamed(void *data, [[maybe_unused]] struct wp_image_description_info_v1* wp_image_description_info_v1, uint32_t tf) {
|
||||
// KDE reports `gamma 2.2` even in HDR mode, but it should be handled in KDE specific path
|
||||
WaylandDisplay* display = data;
|
||||
switch (tf) {
|
||||
|
||||
@@ -13,18 +13,18 @@ typedef struct WaylandKdeMode {
|
||||
struct kde_output_device_mode_v2* pMode;
|
||||
} WaylandKdeMode;
|
||||
|
||||
static void waylandKdeModeSizeListener(void* data, FF_A_UNUSED struct kde_output_device_mode_v2* _, int32_t width, int32_t height) {
|
||||
static void waylandKdeModeSizeListener(void* data, [[maybe_unused]] struct kde_output_device_mode_v2* _, int32_t width, int32_t height) {
|
||||
WaylandKdeMode* mode = (WaylandKdeMode*) data;
|
||||
mode->width = width;
|
||||
mode->height = height;
|
||||
}
|
||||
|
||||
static void waylandKdeModeRefreshListener(void* data, FF_A_UNUSED struct kde_output_device_mode_v2* _, int32_t rate) {
|
||||
static void waylandKdeModeRefreshListener(void* data, [[maybe_unused]] struct kde_output_device_mode_v2* _, int32_t rate) {
|
||||
WaylandKdeMode* mode = (WaylandKdeMode*) data;
|
||||
mode->refreshRate = rate;
|
||||
}
|
||||
|
||||
static void waylandKdeModePreferredListener(void* data, FF_A_UNUSED struct kde_output_device_mode_v2* _) {
|
||||
static void waylandKdeModePreferredListener(void* data, [[maybe_unused]] struct kde_output_device_mode_v2* _) {
|
||||
WaylandKdeMode* mode = (WaylandKdeMode*) data;
|
||||
mode->preferred = true;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ static const struct kde_output_device_mode_v2_listener modeListener = {
|
||||
.flags = (void*) stubListener,
|
||||
};
|
||||
|
||||
static void waylandKdeModeListener(void* data, FF_A_UNUSED struct kde_output_device_v2* _, struct kde_output_device_mode_v2* mode) {
|
||||
static void waylandKdeModeListener(void* data, [[maybe_unused]] struct kde_output_device_v2* _, struct kde_output_device_mode_v2* mode) {
|
||||
WaylandDisplay* wldata = (WaylandDisplay*) data;
|
||||
if (!wldata->internal) {
|
||||
return;
|
||||
@@ -50,7 +50,7 @@ static void waylandKdeModeListener(void* data, FF_A_UNUSED struct kde_output_dev
|
||||
wldata->parent->ffwl_proxy_add_listener((struct wl_proxy*) mode, (void (**)(void)) &modeListener, newMode);
|
||||
}
|
||||
|
||||
static void waylandKdeCurrentModeListener(void* data, FF_A_UNUSED struct kde_output_device_v2* _, struct kde_output_device_mode_v2* mode) {
|
||||
static void waylandKdeCurrentModeListener(void* data, [[maybe_unused]] struct kde_output_device_v2* _, struct kde_output_device_mode_v2* mode) {
|
||||
// waylandKdeModeListener is always run before this
|
||||
WaylandDisplay* wldata = (WaylandDisplay*) data;
|
||||
if (!wldata->internal) {
|
||||
@@ -78,12 +78,12 @@ static void waylandKdeCurrentModeListener(void* data, FF_A_UNUSED struct kde_out
|
||||
}
|
||||
}
|
||||
|
||||
static void waylandKdeScaleListener(void* data, FF_A_UNUSED struct kde_output_device_v2* _, wl_fixed_t scale) {
|
||||
static void waylandKdeScaleListener(void* data, [[maybe_unused]] struct kde_output_device_v2* _, wl_fixed_t scale) {
|
||||
WaylandDisplay* wldata = (WaylandDisplay*) data;
|
||||
wldata->dpi = (uint32_t) scale * 3 / 8; // wl_fixed_to_double(scale) * 96;
|
||||
}
|
||||
|
||||
static void waylandKdeEdidListener(void* data, FF_A_UNUSED struct kde_output_device_v2* _, const char* raw) {
|
||||
static void waylandKdeEdidListener(void* data, [[maybe_unused]] struct kde_output_device_v2* _, const char* raw) {
|
||||
if (!*raw) {
|
||||
return;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ static void waylandKdeEdidListener(void* data, FF_A_UNUSED struct kde_output_dev
|
||||
wldata->hdrInfoAvailable = true;
|
||||
}
|
||||
|
||||
static void waylandKdeEnabledListener(void* data, FF_A_UNUSED struct kde_output_device_v2* _, int32_t enabled) {
|
||||
static void waylandKdeEnabledListener(void* data, [[maybe_unused]] struct kde_output_device_v2* _, int32_t enabled) {
|
||||
WaylandDisplay* wldata = (WaylandDisplay*) data;
|
||||
if (!enabled) {
|
||||
wldata->internal = nullptr;
|
||||
@@ -108,14 +108,14 @@ static void waylandKdeEnabledListener(void* data, FF_A_UNUSED struct kde_output_
|
||||
}
|
||||
|
||||
static void waylandKdeGeometryListener(void* data,
|
||||
FF_A_UNUSED struct kde_output_device_v2* kde_output_device_v2,
|
||||
FF_A_UNUSED int32_t x,
|
||||
FF_A_UNUSED int32_t y,
|
||||
[[maybe_unused]] struct kde_output_device_v2* kde_output_device_v2,
|
||||
[[maybe_unused]] int32_t x,
|
||||
[[maybe_unused]] int32_t y,
|
||||
int32_t physical_width,
|
||||
int32_t physical_height,
|
||||
FF_A_UNUSED int32_t subpixel,
|
||||
FF_A_UNUSED const char* make,
|
||||
FF_A_UNUSED const char* model,
|
||||
[[maybe_unused]] int32_t subpixel,
|
||||
[[maybe_unused]] const char* make,
|
||||
[[maybe_unused]] const char* model,
|
||||
int32_t transform) {
|
||||
WaylandDisplay* display = data;
|
||||
display->physicalWidth = physical_width;
|
||||
@@ -123,7 +123,7 @@ static void waylandKdeGeometryListener(void* data,
|
||||
display->transform = (enum wl_output_transform) transform;
|
||||
}
|
||||
|
||||
static void waylandKdeNameListener(void* data, FF_A_UNUSED struct kde_output_device_v2* kde_output_device_v2, const char* name) {
|
||||
static void waylandKdeNameListener(void* data, [[maybe_unused]] struct kde_output_device_v2* kde_output_device_v2, const char* name) {
|
||||
WaylandDisplay* display = data;
|
||||
display->type = ffdsGetDisplayType(name);
|
||||
// As display->id is used as an internal identifier, we don't need it to be NUL terminated
|
||||
@@ -132,17 +132,17 @@ static void waylandKdeNameListener(void* data, FF_A_UNUSED struct kde_output_dev
|
||||
ffStrbufAppendS(&display->name, name);
|
||||
}
|
||||
|
||||
static void waylandKdeHdrListener(void* data, FF_A_UNUSED struct kde_output_device_v2* kde_output_device_v2, uint32_t hdr_enabled) {
|
||||
static void waylandKdeHdrListener(void* data, [[maybe_unused]] struct kde_output_device_v2* kde_output_device_v2, uint32_t hdr_enabled) {
|
||||
WaylandDisplay* display = data;
|
||||
display->hdrEnabled = !!hdr_enabled;
|
||||
}
|
||||
|
||||
static void waylandKdeMaxBitsPerColorListener(void* data, FF_A_UNUSED struct kde_output_device_v2* kde_output_device_v2, uint32_t max_bpc) {
|
||||
static void waylandKdeMaxBitsPerColorListener(void* data, [[maybe_unused]] struct kde_output_device_v2* kde_output_device_v2, uint32_t max_bpc) {
|
||||
WaylandDisplay* display = data;
|
||||
display->bitDepth = (uint8_t) max_bpc;
|
||||
}
|
||||
|
||||
static void waylandKdePriorityListener(void* data, FF_A_UNUSED struct kde_output_device_v2* kde_output_device_v2, uint32_t priority) {
|
||||
static void waylandKdePriorityListener(void* data, [[maybe_unused]] struct kde_output_device_v2* kde_output_device_v2, uint32_t priority) {
|
||||
WaylandDisplay* display = data;
|
||||
display->primary = priority == 1;
|
||||
}
|
||||
@@ -282,7 +282,7 @@ const char* ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* re
|
||||
return waylandKdeHandleOutput(wldata, output);
|
||||
}
|
||||
|
||||
static void waylandKdeOutputListener(void* data, FF_A_UNUSED struct kde_output_device_registry_v2* kde_output_device_registry_v2, struct kde_output_device_v2* output) {
|
||||
static void waylandKdeOutputListener(void* data, [[maybe_unused]] struct kde_output_device_registry_v2* kde_output_device_registry_v2, struct kde_output_device_v2* output) {
|
||||
waylandKdeHandleOutput((WaylandData*) data, (struct wl_proxy*) output);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ static void waylandGlobalAddListener(void* data, struct wl_registry* registry, u
|
||||
}
|
||||
}
|
||||
|
||||
static FF_A_UNUSED bool matchDrmConnector(const char* connName, WaylandDisplay* wldata) {
|
||||
[[maybe_unused]] static bool matchDrmConnector(const char* connName, WaylandDisplay* wldata) {
|
||||
// https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-event-name
|
||||
// The doc says that "do not assume that the name is a reflection of an underlying DRM connector, X11 connection, etc."
|
||||
// However I can't find a better method to get the edid data
|
||||
@@ -149,7 +149,7 @@ static FF_A_UNUSED bool matchDrmConnector(const char* connName, WaylandDisplay*
|
||||
return false;
|
||||
}
|
||||
|
||||
void ffWaylandOutputNameListener(void* data, FF_A_UNUSED void* output, const char* name) {
|
||||
void ffWaylandOutputNameListener(void* data, [[maybe_unused]] void* output, const char* name) {
|
||||
WaylandDisplay* display = data;
|
||||
if (display->id) {
|
||||
return;
|
||||
@@ -165,7 +165,7 @@ void ffWaylandOutputNameListener(void* data, FF_A_UNUSED void* output, const cha
|
||||
ffStrbufAppendS(&display->name, name);
|
||||
}
|
||||
|
||||
void ffWaylandOutputDescriptionListener(void* data, FF_A_UNUSED void* output, const char* description) {
|
||||
void ffWaylandOutputDescriptionListener(void* data, [[maybe_unused]] void* output, const char* description) {
|
||||
WaylandDisplay* display = data;
|
||||
if (display->description.length) {
|
||||
return;
|
||||
@@ -341,7 +341,7 @@ const char* ffdsConnectWayland(FFDisplayServerResult* result) {
|
||||
|
||||
#else
|
||||
|
||||
const char* ffdsConnectWayland(FF_A_UNUSED FFDisplayServerResult* result) {
|
||||
const char* ffdsConnectWayland([[maybe_unused]] FFDisplayServerResult* result) {
|
||||
return "Fastfetch was compiled without Wayland support";
|
||||
}
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ inline static uint64_t ffWaylandGenerateIdFromName(const char* name) {
|
||||
return id;
|
||||
}
|
||||
|
||||
void ffWaylandOutputNameListener(void* data, FF_A_UNUSED void* output, const char* name);
|
||||
void ffWaylandOutputDescriptionListener(void* data, FF_A_UNUSED void* output, const char* description);
|
||||
void ffWaylandOutputNameListener(void* data, [[maybe_unused]] void* output, const char* name);
|
||||
void ffWaylandOutputDescriptionListener(void* data, [[maybe_unused]] void* output, const char* description);
|
||||
// Modifies content of display. Don't call this function when calling ffdsAppendDisplay
|
||||
uint32_t ffWaylandHandleRotation(WaylandDisplay* display);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <iphlpapi.h>
|
||||
|
||||
const char* ffDetectDNS(FFDNSOptions* options, FFlist* results) {
|
||||
IP_ADAPTER_ADDRESSES* FF_AUTO_FREE adapter_addresses = nullptr;
|
||||
FF_AUTO_FREE IP_ADAPTER_ADDRESSES* adapter_addresses = nullptr;
|
||||
|
||||
// Multiple attempts in case interfaces change while
|
||||
// we are in the middle of querying them.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static bool extractNvimVersionFromBinary(const char* str, FF_A_UNUSED uint32_t len, void* userdata) {
|
||||
static bool extractNvimVersionFromBinary(const char* str, [[maybe_unused]] uint32_t len, void* userdata) {
|
||||
if (!ffStrStartsWith(str, "NVIM v")) {
|
||||
return true;
|
||||
}
|
||||
@@ -15,7 +15,7 @@ static bool extractNvimVersionFromBinary(const char* str, FF_A_UNUSED uint32_t l
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool extractVimVersionFromBinary(const char* str, FF_A_UNUSED uint32_t len, void* userdata) {
|
||||
static bool extractVimVersionFromBinary(const char* str, [[maybe_unused]] uint32_t len, void* userdata) {
|
||||
if (!ffStrStartsWith(str, "VIM - Vi IMproved ")) {
|
||||
return true;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ static bool extractVimVersionFromBinary(const char* str, FF_A_UNUSED uint32_t le
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool extractNanoVersionFromBinary(const char* str, FF_A_UNUSED uint32_t len, void* userdata) {
|
||||
static bool extractNanoVersionFromBinary(const char* str, [[maybe_unused]] uint32_t len, void* userdata) {
|
||||
if (!ffStrStartsWith(str, "GNU nano ")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "fastfetch.h"
|
||||
#include "font.h"
|
||||
|
||||
const char* ffDetectFontImpl(FF_A_UNUSED FFFontResult* result) {
|
||||
const char* ffDetectFontImpl([[maybe_unused]] FFFontResult* result) {
|
||||
FF_UNUSED(result);
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -28,17 +28,17 @@ static void enumSet(IOHIDDeviceRef value, FFlist* results) {
|
||||
}
|
||||
|
||||
const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
IOHIDManagerRef FF_CFTYPE_AUTO_RELEASE manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
FF_CFTYPE_AUTO_RELEASE IOHIDManagerRef manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
if (IOHIDManagerOpen(manager, kIOHIDOptionsTypeNone) != kIOReturnSuccess) {
|
||||
return "IOHIDManagerOpen() failed";
|
||||
}
|
||||
|
||||
CFDictionaryRef FF_CFTYPE_AUTO_RELEASE matching1 = CFDictionaryCreate(kCFAllocatorDefault, (const void**) (CFStringRef[]) { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) }, (const void**) (CFNumberRef[]) { ffCfCreateInt(kHIDPage_GenericDesktop), ffCfCreateInt(kHIDUsage_GD_Joystick) }, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
CFDictionaryRef FF_CFTYPE_AUTO_RELEASE matching2 = CFDictionaryCreate(kCFAllocatorDefault, (const void**) (CFStringRef[]) { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) }, (const void**) (CFNumberRef[]) { ffCfCreateInt(kHIDPage_GenericDesktop), ffCfCreateInt(kHIDUsage_GD_GamePad) }, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
CFArrayRef FF_CFTYPE_AUTO_RELEASE matchings = CFArrayCreate(kCFAllocatorDefault, (const void**) (CFTypeRef[]) { matching1, matching2 }, 2, &kCFTypeArrayCallBacks);
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef matching1 = CFDictionaryCreate(kCFAllocatorDefault, (const void**) (CFStringRef[]) { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) }, (const void**) (CFNumberRef[]) { ffCfCreateInt(kHIDPage_GenericDesktop), ffCfCreateInt(kHIDUsage_GD_Joystick) }, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef matching2 = CFDictionaryCreate(kCFAllocatorDefault, (const void**) (CFStringRef[]) { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) }, (const void**) (CFNumberRef[]) { ffCfCreateInt(kHIDPage_GenericDesktop), ffCfCreateInt(kHIDUsage_GD_GamePad) }, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
FF_CFTYPE_AUTO_RELEASE CFArrayRef matchings = CFArrayCreate(kCFAllocatorDefault, (const void**) (CFTypeRef[]) { matching1, matching2 }, 2, &kCFTypeArrayCallBacks);
|
||||
IOHIDManagerSetDeviceMatchingMultiple(manager, matchings);
|
||||
|
||||
CFSetRef FF_CFTYPE_AUTO_RELEASE set = IOHIDManagerCopyDevices(manager);
|
||||
FF_CFTYPE_AUTO_RELEASE CFSetRef set = IOHIDManagerCopyDevices(manager);
|
||||
if (set) {
|
||||
CFSetApplyFunction(set, (CFSetApplierFunction) &enumSet, devices);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "gamepad.h"
|
||||
|
||||
const char* ffDetectGamepad(FF_A_UNUSED FFlist* devices /* List of FFGamepadDevice */) {
|
||||
const char* ffDetectGamepad([[maybe_unused]] FFlist* devices /* List of FFGamepadDevice */) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
if (nDevices == 0) {
|
||||
return "No HID devices found";
|
||||
}
|
||||
RAWINPUTDEVICELIST* FF_AUTO_FREE pRawInputDeviceList = (RAWINPUTDEVICELIST*) malloc(sizeof(RAWINPUTDEVICELIST) * nDevices);
|
||||
FF_AUTO_FREE RAWINPUTDEVICELIST* pRawInputDeviceList = (RAWINPUTDEVICELIST*) malloc(sizeof(RAWINPUTDEVICELIST) * nDevices);
|
||||
if ((nDevices = GetRawInputDeviceList(pRawInputDeviceList, &nDevices, sizeof(RAWINPUTDEVICELIST))) == (UINT) -1) {
|
||||
return "GetRawInputDeviceList(pRawInputDeviceList) failed";
|
||||
}
|
||||
@@ -122,7 +122,7 @@ const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
|
||||
if (knownGamepad) {
|
||||
ffStrbufSetS(&device->name, knownGamepad);
|
||||
}
|
||||
HANDLE FF_AUTO_CLOSE_FD hHidFile = CreateFileW(devName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr);
|
||||
FF_AUTO_CLOSE_FD HANDLE hHidFile = CreateFileW(devName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr);
|
||||
if (hHidFile == INVALID_HANDLE_VALUE) {
|
||||
if (!knownGamepad) {
|
||||
ffStrbufSetF(&device->name, "Unknown gamepad %04X-%04X", (unsigned) rdi.hid.dwVendorId, (unsigned) rdi.hid.dwProductId);
|
||||
|
||||
@@ -316,18 +316,18 @@ typedef struct _DXGK_NODEMETADATA_FLAGS {
|
||||
};
|
||||
} DXGK_NODEMETADATA_FLAGS;
|
||||
|
||||
typedef struct _DXGK_NODEMETADATA {
|
||||
typedef struct [[gnu::packed]] _DXGK_NODEMETADATA {
|
||||
DXGK_ENGINE_TYPE EngineType;
|
||||
WCHAR FriendlyName[DXGK_MAX_METADATA_NAME_LENGTH];
|
||||
DXGK_NODEMETADATA_FLAGS Flags; // WDDM 2.2
|
||||
BOOLEAN GpuMmuSupported; // WDDM 2.0 ???
|
||||
BOOLEAN IoMmuSupported;
|
||||
} FF_A_PACKED DXGK_NODEMETADATA;
|
||||
} DXGK_NODEMETADATA;
|
||||
|
||||
typedef struct _D3DKMT_NODEMETADATA {
|
||||
typedef struct [[gnu::packed]] _D3DKMT_NODEMETADATA {
|
||||
UINT NodeOrdinalAndAdapterIndex; // WDDMv2: High word is physical adapter index, low word is node ordinal
|
||||
DXGK_NODEMETADATA NodeData;
|
||||
} FF_A_PACKED D3DKMT_NODEMETADATA;
|
||||
} D3DKMT_NODEMETADATA;
|
||||
static_assert(sizeof(D3DKMT_NODEMETADATA) == 0x4E, "D3DKMT_NODEMETADATA structure size mismatch");
|
||||
|
||||
// Functions
|
||||
|
||||
@@ -106,7 +106,7 @@ const char* detectByOpenGL(FFlist* gpus) {
|
||||
ffStrbufInit(&result.slv);
|
||||
ffStrbufInit(&result.library);
|
||||
|
||||
FF_A_CLEANUP(ffDestroyOpenGLOptions) FFOpenGLOptions options;
|
||||
[[gnu::cleanup(ffDestroyOpenGLOptions)]] FFOpenGLOptions options;
|
||||
ffInitOpenGLOptions(&options);
|
||||
const char* error = ffDetectOpenGL(&options, &result);
|
||||
FF_DEBUG("OpenGL detection returns: %s", error ?: "success");
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "common/debug.h"
|
||||
|
||||
// Helper function to convert ADL status code to string
|
||||
FF_A_UNUSED static const char* ffAdlStatusToString(int status) {
|
||||
[[maybe_unused]] static const char* ffAdlStatusToString(int status) {
|
||||
switch (status) {
|
||||
#define FF_ADL_STATUS_CASE(name) \
|
||||
case name: \
|
||||
|
||||
@@ -48,7 +48,7 @@ const char* ffDetectMthreadsGpuInfo(const FFGpuDriverCondition* cond, FFGpuDrive
|
||||
#define FF_GPU_DRIVER_DLLNAME_PATH_PREFIX
|
||||
#endif
|
||||
|
||||
FF_A_UNUSED static inline bool getDriverSpecificDetectionFn(const char* vendor, __typeof__(&ffDetectNvidiaGpuInfo)* pDetectFn, const char** pDllName) {
|
||||
[[maybe_unused]] static inline bool getDriverSpecificDetectionFn(const char* vendor, __typeof__(&ffDetectNvidiaGpuInfo)* pDetectFn, const char** pDllName) {
|
||||
if (vendor == FF_GPU_VENDOR_NAME_NVIDIA) {
|
||||
*pDetectFn = ffDetectNvidiaGpuInfo;
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -15,7 +15,7 @@ enum {
|
||||
PCI_CONF_SIZE = 0x40,
|
||||
};
|
||||
|
||||
const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* ffDetectGPUImpl([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
int dDomainFd = open(_SERVERS_BUS "/pci/0000", O_RDONLY | O_CLOEXEC);
|
||||
if (dDomainFd < 0) {
|
||||
return "open(_SERVERS_BUS \"/pci/0000\") failed";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <private/drivers/poke.h>
|
||||
|
||||
const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* ffDetectGPUImpl([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
FF_AUTO_CLOSE_FD int pokefd = open(POKE_DEVICE_FULLNAME, O_RDWR | O_CLOEXEC);
|
||||
if (pokefd < 0) {
|
||||
return "open(POKE_DEVICE_FULLNAME) failed";
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static bool detectDriverFromSysfs(FFstrbuf* result, FFstrbuf* pciDir, FFstrbuf* buffer, FF_A_UNUSED const char* drmKey) {
|
||||
static bool detectDriverFromSysfs(FFstrbuf* result, FFstrbuf* pciDir, FFstrbuf* buffer, [[maybe_unused]] const char* drmKey) {
|
||||
uint32_t pciDirLength = pciDir->length;
|
||||
ffStrbufAppendS(pciDir, "/driver");
|
||||
char pathBuf[PATH_MAX];
|
||||
@@ -52,7 +52,7 @@ static bool detectDriverFromSysfs(FFstrbuf* result, FFstrbuf* pciDir, FFstrbuf*
|
||||
return true;
|
||||
}
|
||||
|
||||
FF_A_UNUSED static const char* drmFindRenderFromCard(const char* drmCardKey, FFstrbuf* result) {
|
||||
[[maybe_unused]] static const char* drmFindRenderFromCard(const char* drmCardKey, FFstrbuf* result) {
|
||||
char path[PATH_MAX];
|
||||
sprintf(path, "/sys/class/drm/%s/device/drm", drmCardKey);
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(path);
|
||||
@@ -497,7 +497,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
|
||||
#if __aarch64__
|
||||
#include "detection/cpu/cpu.h"
|
||||
|
||||
FF_A_UNUSED static const char* drmDetectAsahiSpecific(FFGPUResult* gpu, const char* name, FF_A_UNUSED FFstrbuf* buffer, FF_A_UNUSED const char* drmKey) {
|
||||
[[maybe_unused]] static const char* drmDetectAsahiSpecific(FFGPUResult* gpu, const char* name, [[maybe_unused]] FFstrbuf* buffer, [[maybe_unused]] const char* drmKey) {
|
||||
if (sscanf(name, "agx-t%lu", &gpu->deviceId) == 1) {
|
||||
ffStrbufSetStatic(&gpu->name, ffCPUAppleCodeToName((uint32_t) gpu->deviceId));
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ struct FFMtmlData {
|
||||
MtmlSystem* sys;
|
||||
} mtmlData;
|
||||
|
||||
FF_A_UNUSED static void shutdownMtml(void) {
|
||||
[[maybe_unused]] static void shutdownMtml(void) {
|
||||
mtmlData.ffmtmlLibraryShutDown(mtmlData.lib);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ static inline int pciReadConf(int fd, uint32_t bus, uint32_t device, uint32_t fu
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* ffDetectGPUImpl([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
char pciDevPath[] = "/dev/pciXXX";
|
||||
|
||||
for (uint32_t idev = 0; idev <= 255; idev++) {
|
||||
|
||||
@@ -27,7 +27,7 @@ static inline int pciReadConf(int fd, uint8_t bus, uint8_t device, uint8_t func,
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* detectByPci(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* detectByPci([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
char pciDevPath[] = "/dev/pci0";
|
||||
FF_AUTO_CLOSE_FD int pcifd = open(pciDevPath, O_RDONLY | O_CLOEXEC);
|
||||
if (pcifd < 0) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <libdevinfo.h>
|
||||
|
||||
static int walkDevTree(di_node_t node, FF_A_UNUSED di_minor_t minor, FFlist* gpus) {
|
||||
static int walkDevTree(di_node_t node, [[maybe_unused]] di_minor_t minor, FFlist* gpus) {
|
||||
int* vendorId;
|
||||
int* deviceId;
|
||||
if (di_prop_lookup_ints(DDI_DEV_T_ANY, node, "vendor-id", &vendorId) > 0 && di_prop_lookup_ints(DDI_DEV_T_ANY, node, "device-id", &deviceId) > 0) {
|
||||
@@ -43,7 +43,7 @@ static int walkDevTree(di_node_t node, FF_A_UNUSED di_minor_t minor, FFlist* gpu
|
||||
return DI_WALK_CONTINUE;
|
||||
}
|
||||
|
||||
const char* ffDetectGPUImpl(FF_A_UNUSED const FFGPUOptions* options, FFlist* gpus) {
|
||||
const char* ffDetectGPUImpl([[maybe_unused]] const FFGPUOptions* options, FFlist* gpus) {
|
||||
di_node_t rootNode = di_init("/", DINFOCPYALL);
|
||||
if (rootNode == DI_NODE_NIL) {
|
||||
return "di_init() failed";
|
||||
|
||||
@@ -230,7 +230,7 @@ static void closeDxgfd(void) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_UNUSED static inline const char* ffDebugNtStatus(NTSTATUS status) {
|
||||
[[maybe_unused]] static inline const char* ffDebugNtStatus(NTSTATUS status) {
|
||||
return status < 0 ? strerror(-status) : "Success";
|
||||
}
|
||||
#endif
|
||||
@@ -407,7 +407,7 @@ ffGPUDetectWsl2
|
||||
const char* dllName;
|
||||
if (options->driverSpecific && getDriverSpecificDetectionFn(gpu->vendor.chars, &detectFn, &dllName)) {
|
||||
FF_DEBUG("Calling driver-specific detection function for vendor: %s, DLL: %s", gpu->vendor.chars, dllName);
|
||||
FF_A_UNUSED const char* error = detectFn(
|
||||
[[maybe_unused]] const char* error = detectFn(
|
||||
&(FFGpuDriverCondition) {
|
||||
.type = FF_GPU_DRIVER_CONDITION_TYPE_LUID |
|
||||
(deviceIds.DeviceIds.VendorID != -1u ? FF_GPU_DRIVER_CONDITION_TYPE_DEVICE_ID : 0) |
|
||||
@@ -613,7 +613,7 @@ ffGPUDetectWsl2
|
||||
#if _WIN32
|
||||
else if (ffIsWindows10OrGreater()) {
|
||||
const char* ffGPUDetectTypeWithDXCore(LUID adapterLuid, FFGPUResult * gpu);
|
||||
FF_A_UNUSED const char* error = ffGPUDetectTypeWithDXCore(adapter->AdapterLuid, gpu);
|
||||
[[maybe_unused]] const char* error = ffGPUDetectTypeWithDXCore(adapter->AdapterLuid, gpu);
|
||||
FF_DEBUG("DXCore GPU type detection result: %s", error ?: "Success");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ static inline void applyGTKSettings(FFGTKResult* result, const char* themeName,
|
||||
}
|
||||
}
|
||||
|
||||
static bool testXfconfWallpaperPropKey(FF_A_UNUSED void* data, const char* key) {
|
||||
static bool testXfconfWallpaperPropKey([[maybe_unused]] void* data, const char* key) {
|
||||
int count = 0;
|
||||
sscanf(key, "/backdrop/screen0/monitor%*[^/]/workspace0/last-image%n", &count);
|
||||
return count == 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "host.h"
|
||||
|
||||
const char* ffDetectHost(FF_A_UNUSED FFHostResult* host) {
|
||||
const char* ffDetectHost([[maybe_unused]] FFHostResult* host) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "host.h"
|
||||
#include "common/smbios.h"
|
||||
|
||||
typedef struct FFSmbiosSystemInfo {
|
||||
typedef struct [[gnu::packed]] FFSmbiosSystemInfo {
|
||||
FFSmbiosHeader Header;
|
||||
|
||||
uint8_t Manufacturer; // string
|
||||
@@ -10,20 +10,20 @@ typedef struct FFSmbiosSystemInfo {
|
||||
uint8_t SerialNumber; // string
|
||||
|
||||
// 2.1+
|
||||
struct {
|
||||
struct [[gnu::packed]] {
|
||||
uint32_t TimeLow;
|
||||
uint16_t TimeMid;
|
||||
uint16_t TimeHighAndVersion;
|
||||
uint8_t ClockSeqHiAndReserved;
|
||||
uint8_t ClockSeqLow;
|
||||
uint8_t Node[6];
|
||||
} FF_A_PACKED UUID; // varies
|
||||
} UUID; // varies
|
||||
uint8_t WakeUpType; // enum
|
||||
|
||||
// 2.4+
|
||||
uint8_t SKUNumber; // string
|
||||
uint8_t Family; // string
|
||||
} FF_A_PACKED FFSmbiosSystemInfo;
|
||||
} FFSmbiosSystemInfo;
|
||||
|
||||
static_assert(offsetof(FFSmbiosSystemInfo, Family) == 0x1A,
|
||||
"FFSmbiosSystemInfo: Wrong struct alignment");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "icons.h"
|
||||
|
||||
const char* ffDetectIcons(FF_A_UNUSED FFIconsResult* result) {
|
||||
const char* ffDetectIcons([[maybe_unused]] FFIconsResult* result) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
|
||||
FF_A_UNUSED static bool extractSystemdVersion(const char* str, uint32_t len, void* userdata) {
|
||||
[[maybe_unused]] static bool extractSystemdVersion(const char* str, uint32_t len, void* userdata) {
|
||||
if (!ffStrStartsWith(str, "systemd ")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "initsystem.h"
|
||||
|
||||
const char* ffDetectInitSystem(FF_A_UNUSED FFInitSystemResult* result) {
|
||||
const char* ffDetectInitSystem([[maybe_unused]] FFInitSystemResult* result) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -18,15 +18,15 @@ static void enumSet(IOHIDDeviceRef value, FFlist* results) {
|
||||
}
|
||||
|
||||
const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
IOHIDManagerRef FF_CFTYPE_AUTO_RELEASE manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
FF_CFTYPE_AUTO_RELEASE IOHIDManagerRef manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
if (IOHIDManagerOpen(manager, kIOHIDOptionsTypeNone) != kIOReturnSuccess) {
|
||||
return "IOHIDManagerOpen() failed";
|
||||
}
|
||||
|
||||
CFDictionaryRef FF_CFTYPE_AUTO_RELEASE matching1 = CFDictionaryCreate(kCFAllocatorDefault, (const void**) (CFStringRef[]) { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) }, (const void**) (CFNumberRef[]) { ffCfCreateInt(kHIDPage_GenericDesktop), ffCfCreateInt(kHIDUsage_GD_Keyboard) }, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef matching1 = CFDictionaryCreate(kCFAllocatorDefault, (const void**) (CFStringRef[]) { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) }, (const void**) (CFNumberRef[]) { ffCfCreateInt(kHIDPage_GenericDesktop), ffCfCreateInt(kHIDUsage_GD_Keyboard) }, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
IOHIDManagerSetDeviceMatching(manager, matching1);
|
||||
|
||||
CFSetRef FF_CFTYPE_AUTO_RELEASE set = IOHIDManagerCopyDevices(manager);
|
||||
FF_CFTYPE_AUTO_RELEASE CFSetRef set = IOHIDManagerCopyDevices(manager);
|
||||
if (set) {
|
||||
CFSetApplyFunction(set, (CFSetApplierFunction) &enumSet, devices);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "keyboard.h"
|
||||
|
||||
const char* ffDetectKeyboard(FF_A_UNUSED FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
const char* ffDetectKeyboard([[maybe_unused]] FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
return "No mouse support on this platform";
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
return "No HID devices found";
|
||||
}
|
||||
|
||||
RAWINPUTDEVICELIST* FF_AUTO_FREE pRawInputDeviceList = (RAWINPUTDEVICELIST*) malloc(sizeof(RAWINPUTDEVICELIST) * nDevices);
|
||||
FF_AUTO_FREE RAWINPUTDEVICELIST* pRawInputDeviceList = (RAWINPUTDEVICELIST*) malloc(sizeof(RAWINPUTDEVICELIST) * nDevices);
|
||||
if ((nDevices = GetRawInputDeviceList(pRawInputDeviceList, &nDevices, sizeof(RAWINPUTDEVICELIST))) == (UINT) -1) {
|
||||
return "GetRawInputDeviceList(pRawInputDeviceList) failed";
|
||||
}
|
||||
@@ -49,7 +49,7 @@ const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */) {
|
||||
|
||||
wchar_t buffer[MAX_PATH];
|
||||
|
||||
HANDLE FF_AUTO_CLOSE_FD hHidFile = CreateFileW(devName, 0 /* must be 0 instead of GENERIC_READ */, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||
FF_AUTO_CLOSE_FD HANDLE hHidFile = CreateFileW(devName, 0 /* must be 0 instead of GENERIC_READ */, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||
if (hHidFile != INVALID_HANDLE_VALUE) {
|
||||
if (HidD_GetProductString(hHidFile, buffer, (ULONG) sizeof(buffer))) {
|
||||
ffStrbufSetWS(&device->name, buffer);
|
||||
|
||||
@@ -81,7 +81,7 @@ static const char* getSddmVersion(FFstrbuf* version) {
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
static const char* getSddmVersion(FF_A_UNUSED FFstrbuf* version) {
|
||||
static const char* getSddmVersion([[maybe_unused]] FFstrbuf* version) {
|
||||
return "Fastfetch is built without libz support";
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "lm.h"
|
||||
|
||||
const char* ffDetectLM(FF_A_UNUSED FFLMResult* result) {
|
||||
const char* ffDetectLM([[maybe_unused]] FFLMResult* result) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "detection/loadavg/loadavg.h"
|
||||
|
||||
const char* ffDetectLoadavg(FF_A_UNUSED double result[3]) {
|
||||
const char* ffDetectLoadavg([[maybe_unused]] double result[3]) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -982,7 +982,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
#endif
|
||||
#if __sun
|
||||
if (options->showType & FF_LOCALIP_TYPE_SPEED_BIT) {
|
||||
FF_A_CLEANUP(kstatFreeWrap) kstat_ctl_t* kc = kstat_open();
|
||||
[[gnu::cleanup(kstatFreeWrap)]] kstat_ctl_t* kc = kstat_open();
|
||||
for (kstat_t* ks = kc->kc_chain; ks; ks = ks->ks_next) {
|
||||
if (!ffStrEquals(ks->ks_class, "net") || !ffStrEquals(ks->ks_module, "link")) {
|
||||
continue;
|
||||
|
||||
@@ -30,7 +30,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
(int) options->namePrefix.length,
|
||||
options->namePrefix.chars);
|
||||
|
||||
IP_ADAPTER_ADDRESSES* FF_AUTO_FREE adapter_addresses = nullptr;
|
||||
FF_AUTO_FREE IP_ADAPTER_ADDRESSES* adapter_addresses = nullptr;
|
||||
|
||||
// Multiple attempts in case interfaces change while
|
||||
// we are in the middle of querying them.
|
||||
@@ -67,7 +67,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_UNUSED int adapterCount = 0, processedCount = 0;
|
||||
[[maybe_unused]] int adapterCount = 0, processedCount = 0;
|
||||
|
||||
// Iterate through all of the adapters
|
||||
for (IP_ADAPTER_ADDRESSES* adapter = adapter_addresses; adapter; adapter = adapter->Next) {
|
||||
@@ -127,7 +127,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) {
|
||||
uint32_t typesToAdd = options->showType & (FF_LOCALIP_TYPE_IPV4_BIT | FF_LOCALIP_TYPE_IPV6_BIT | FF_LOCALIP_TYPE_ALL_IPS_BIT);
|
||||
FF_DEBUG("Types to add for adapter %u: 0x%X", (unsigned) adapter->IfIndex, typesToAdd);
|
||||
|
||||
FF_A_UNUSED int ipv4Count = 0, ipv6Count = 0;
|
||||
[[maybe_unused]] int ipv4Count = 0, ipv6Count = 0;
|
||||
|
||||
for (IP_ADAPTER_UNICAST_ADDRESS* ifa = adapter->FirstUnicastAddress; ifa; ifa = ifa->Next) {
|
||||
FF_DEBUG("Processing unicast address: prefix origin=%d, suffix origin=%d, family=%d, DadState=%d",
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#import <CoreServices/CoreServices.h>
|
||||
|
||||
// https://github.com/andrewwiik/iOS-Blocks/blob/master/Widgets/Music/MediaRemote.h
|
||||
extern void MRMediaRemoteGetNowPlayingInfo(dispatch_queue_t dispatcher, void (^callback)(_Nullable CFDictionaryRef info)) FF_A_WEAK_IMPORT;
|
||||
extern void MRMediaRemoteGetNowPlayingApplicationIsPlaying(dispatch_queue_t queue, void (^callback)(BOOL playing)) FF_A_WEAK_IMPORT;
|
||||
extern void MRMediaRemoteGetNowPlayingApplicationDisplayID(dispatch_queue_t queue, void (^callback)(_Nullable CFStringRef displayID)) FF_A_WEAK_IMPORT;
|
||||
extern void MRMediaRemoteGetNowPlayingApplicationDisplayName(int unknown, dispatch_queue_t queue, void (^callback)(_Nullable CFStringRef name)) FF_A_WEAK_IMPORT;
|
||||
[[clang::weak_import]] extern void MRMediaRemoteGetNowPlayingInfo(dispatch_queue_t dispatcher, void (^callback)(_Nullable CFDictionaryRef info));
|
||||
[[clang::weak_import]] extern void MRMediaRemoteGetNowPlayingApplicationIsPlaying(dispatch_queue_t queue, void (^callback)(BOOL playing));
|
||||
[[clang::weak_import]] extern void MRMediaRemoteGetNowPlayingApplicationDisplayID(dispatch_queue_t queue, void (^callback)(_Nullable CFStringRef displayID));
|
||||
[[clang::weak_import]] extern void MRMediaRemoteGetNowPlayingApplicationDisplayName(int unknown, dispatch_queue_t queue, void (^callback)(_Nullable CFStringRef name));
|
||||
|
||||
static uint32_t getTrueElapsedTime(CFDictionaryRef info) {
|
||||
double elapsedTime;
|
||||
@@ -111,7 +111,7 @@ static const char* getMediaByMediaRemote(FFMediaResult* result, bool saveCover)
|
||||
}
|
||||
|
||||
#if !FF_MODULE_DISABLE_MEDIA
|
||||
__attribute__((visibility("default"), used)) int ffPrintMediaByMediaRemote(int saveCover) {
|
||||
[[gnu::visibility("default"), gnu::used]] int ffPrintMediaByMediaRemote(int saveCover) {
|
||||
FFMediaResult media = {
|
||||
.status = ffStrbufCreate(),
|
||||
.song = ffStrbufCreate(),
|
||||
|
||||
@@ -51,7 +51,7 @@ static inline HRESULT ffQueryInterface(SourceAbi* source, abi_t<TargetProjection
|
||||
|
||||
template <typename TOperationAbi, typename TResultAbi>
|
||||
static HRESULT ffWaitForAsyncOperation(TOperationAbi* operation, TResultAbi** result) {
|
||||
IAsyncInfo* FF_AUTO_RELEASE_COM_OBJECT asyncInfo = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT IAsyncInfo* asyncInfo = nullptr;
|
||||
HRESULT hr = ffQueryInterface<IAsyncInfo>(operation, &asyncInfo);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
@@ -82,7 +82,7 @@ static HRESULT ffWaitForAsyncOperation(TOperationAbi* operation, TResultAbi** re
|
||||
|
||||
template <typename TResultProjection, typename TOperation>
|
||||
static HRESULT ffRunAndWait(TOperation&& operation, abi_t<TResultProjection>** result) {
|
||||
abi_t<IAsyncOperation<TResultProjection>>* FF_AUTO_RELEASE_COM_OBJECT opResult = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<IAsyncOperation<TResultProjection>>* opResult = nullptr;
|
||||
HRESULT hr = operation(reinterpret_cast<void**>(&opResult));
|
||||
if (FAILED(hr) || !opResult) {
|
||||
return hr;
|
||||
@@ -95,7 +95,7 @@ template <typename TResultProjection, typename TOperation>
|
||||
static HRESULT ffRunAndWait2(TOperation&& operation, abi_t<TResultProjection>** result) {
|
||||
*result = nullptr;
|
||||
|
||||
abi_t<IAsyncOperationWithProgress<TResultProjection, int32_t>>* FF_AUTO_RELEASE_COM_OBJECT opResult = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<IAsyncOperationWithProgress<TResultProjection, int32_t>>* opResult = nullptr;
|
||||
HRESULT hr = operation(reinterpret_cast<void**>(&opResult));
|
||||
if (FAILED(hr) || !opResult) {
|
||||
return hr;
|
||||
@@ -107,7 +107,7 @@ static HRESULT ffRunAndWait2(TOperation&& operation, abi_t<TResultProjection>**
|
||||
static HRESULT ffSaveThumbnailToTempPath(
|
||||
abi_t<winrt::Windows::Storage::Streams::IRandomAccessStreamReference>* thumbnail,
|
||||
FFstrbuf* destination) {
|
||||
abi_t<winrt::Windows::Storage::Streams::IRandomAccessStreamWithContentType>* FF_AUTO_RELEASE_COM_OBJECT contentStream = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Storage::Streams::IRandomAccessStreamWithContentType>* contentStream = nullptr;
|
||||
HRESULT hr = ffRunAndWait<winrt::Windows::Storage::Streams::IRandomAccessStreamWithContentType>([=](void** result) {
|
||||
return thumbnail->OpenReadAsync(result);
|
||||
},
|
||||
@@ -116,7 +116,7 @@ static HRESULT ffSaveThumbnailToTempPath(
|
||||
return FAILED(hr) ? hr : E_FAIL;
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Storage::Streams::IRandomAccessStream>* FF_AUTO_RELEASE_COM_OBJECT randomAccessStream = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Storage::Streams::IRandomAccessStream>* randomAccessStream = nullptr;
|
||||
hr = ffQueryInterface<winrt::Windows::Storage::Streams::IRandomAccessStream>(contentStream, &randomAccessStream);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
@@ -132,25 +132,25 @@ static HRESULT ffSaveThumbnailToTempPath(
|
||||
return HRESULT_FROM_WIN32(ERROR_FILE_TOO_LARGE);
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Storage::Streams::IBufferFactory>* FF_AUTO_RELEASE_COM_OBJECT bufferFactory = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Storage::Streams::IBufferFactory>* bufferFactory = nullptr;
|
||||
hr = ffGetActivationFactory(L"Windows.Storage.Streams.Buffer", winrt::guid_of<winrt::Windows::Storage::Streams::IBufferFactory>(), &bufferFactory);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Storage::Streams::IBuffer>* FF_AUTO_RELEASE_COM_OBJECT buffer = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Storage::Streams::IBuffer>* buffer = nullptr;
|
||||
hr = bufferFactory->Create((UINT32) size, reinterpret_cast<void**>(&buffer));
|
||||
if (FAILED(hr) || !buffer) {
|
||||
return FAILED(hr) ? hr : E_FAIL;
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Storage::Streams::IInputStream>* FF_AUTO_RELEASE_COM_OBJECT inputStream = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Storage::Streams::IInputStream>* inputStream = nullptr;
|
||||
hr = ffQueryInterface<winrt::Windows::Storage::Streams::IInputStream>(contentStream, &inputStream);
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Storage::Streams::IBuffer>* FF_AUTO_RELEASE_COM_OBJECT readBuffer = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Storage::Streams::IBuffer>* readBuffer = nullptr;
|
||||
hr = ffRunAndWait2<winrt::Windows::Storage::Streams::IBuffer>([=](void** result) {
|
||||
return inputStream->ReadAsync(buffer, (uint32_t) size, (uint32_t) winrt::Windows::Storage::Streams::InputStreamOptions::None, result);
|
||||
},
|
||||
@@ -165,7 +165,7 @@ static HRESULT ffSaveThumbnailToTempPath(
|
||||
return FAILED(hr) ? hr : S_FALSE;
|
||||
}
|
||||
|
||||
Windows::Storage::Streams::IBufferByteAccess* FF_AUTO_RELEASE_COM_OBJECT byteAccess = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT Windows::Storage::Streams::IBufferByteAccess* byteAccess = nullptr;
|
||||
hr = readBuffer->QueryInterface(IID_PPV_ARGS(&byteAccess));
|
||||
if (FAILED(hr)) {
|
||||
return hr;
|
||||
@@ -217,14 +217,14 @@ static const char* getMedia(FFMediaResult* result, bool saveCover) {
|
||||
}
|
||||
|
||||
do {
|
||||
abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionManagerStatics>* FF_AUTO_RELEASE_COM_OBJECT managerStatics = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionManagerStatics>* managerStatics = nullptr;
|
||||
HRESULT hr = ffGetActivationFactory(L"Windows.Media.Control.GlobalSystemMediaTransportControlsSessionManager", winrt::guid_of<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionManagerStatics>(), &managerStatics);
|
||||
if (FAILED(hr) || !managerStatics) {
|
||||
error = "winrt: RoGetActivationFactory(GlobalSystemMediaTransportControlsSessionManager) failed";
|
||||
break;
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionManager>* FF_AUTO_RELEASE_COM_OBJECT manager = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionManager>* manager = nullptr;
|
||||
hr = ffRunAndWait<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionManager>([=](void** result) {
|
||||
return managerStatics->RequestAsync(result);
|
||||
},
|
||||
@@ -234,11 +234,11 @@ static const char* getMedia(FFMediaResult* result, bool saveCover) {
|
||||
break;
|
||||
}
|
||||
|
||||
FF_A_CLEANUP(deleteHstring) HSTRING playerId = nullptr;
|
||||
[[gnu::cleanup(deleteHstring)]] HSTRING playerId = nullptr;
|
||||
|
||||
abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSession>* FF_AUTO_RELEASE_COM_OBJECT session = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSession>* session = nullptr;
|
||||
if (instance.config.general.playerName.length) {
|
||||
abi_t<winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::Media::Control::GlobalSystemMediaTransportControlsSession>>* FF_AUTO_RELEASE_COM_OBJECT sessions = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::Media::Control::GlobalSystemMediaTransportControlsSession>>* sessions = nullptr;
|
||||
hr = manager->GetSessions(reinterpret_cast<void**>(&sessions));
|
||||
if (FAILED(hr) || !sessions) {
|
||||
error = "winrt: GetSessions() failed";
|
||||
@@ -251,7 +251,7 @@ static const char* getMedia(FFMediaResult* result, bool saveCover) {
|
||||
break;
|
||||
}
|
||||
for (uint32_t i = 0; i < sessionCount; i++) {
|
||||
abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSession>* FF_AUTO_RELEASE_COM_OBJECT currentSession = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSession>* currentSession = nullptr;
|
||||
hr = sessions->GetAt(i, reinterpret_cast<void**>(¤tSession));
|
||||
if (FAILED(hr) || !currentSession) {
|
||||
continue;
|
||||
@@ -294,7 +294,7 @@ static const char* getMedia(FFMediaResult* result, bool saveCover) {
|
||||
ffStrbufSetHstring(&result->playerId, playerId);
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionMediaProperties>* FF_AUTO_RELEASE_COM_OBJECT mediaProps = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionMediaProperties>* mediaProps = nullptr;
|
||||
hr = ffRunAndWait<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionMediaProperties>([=](void** result) {
|
||||
return session->TryGetMediaPropertiesAsync(result);
|
||||
},
|
||||
@@ -304,7 +304,7 @@ static const char* getMedia(FFMediaResult* result, bool saveCover) {
|
||||
break;
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionPlaybackInfo>* FF_AUTO_RELEASE_COM_OBJECT playbackInfo = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionPlaybackInfo>* playbackInfo = nullptr;
|
||||
hr = session->GetPlaybackInfo(reinterpret_cast<void**>(&playbackInfo));
|
||||
bool isPlaying = false;
|
||||
double playbackRate = 1.0;
|
||||
@@ -327,7 +327,7 @@ static const char* getMedia(FFMediaResult* result, bool saveCover) {
|
||||
}
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Foundation::IReference<double>>* FF_AUTO_RELEASE_COM_OBJECT playbackRateRef = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Foundation::IReference<double>>* playbackRateRef = nullptr;
|
||||
if (SUCCEEDED(playbackInfo->get_PlaybackRate(reinterpret_cast<void**>(&playbackRateRef))) && playbackRateRef) {
|
||||
if (SUCCEEDED(playbackRateRef->get_Value(&playbackRate)) && playbackRate < 0.0) {
|
||||
playbackRate = 0.0;
|
||||
@@ -335,22 +335,22 @@ static const char* getMedia(FFMediaResult* result, bool saveCover) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_CLEANUP(deleteHstring) HSTRING title = nullptr;
|
||||
[[gnu::cleanup(deleteHstring)]] HSTRING title = nullptr;
|
||||
if (SUCCEEDED(mediaProps->get_Title(reinterpret_cast<void**>(&title)))) {
|
||||
ffStrbufSetHstring(&result->song, title);
|
||||
}
|
||||
|
||||
FF_A_CLEANUP(deleteHstring) HSTRING artist = nullptr;
|
||||
[[gnu::cleanup(deleteHstring)]] HSTRING artist = nullptr;
|
||||
if (SUCCEEDED(mediaProps->get_Artist(reinterpret_cast<void**>(&artist)))) {
|
||||
ffStrbufSetHstring(&result->artist, artist);
|
||||
}
|
||||
|
||||
FF_A_CLEANUP(deleteHstring) HSTRING album = nullptr;
|
||||
[[gnu::cleanup(deleteHstring)]] HSTRING album = nullptr;
|
||||
if (SUCCEEDED(mediaProps->get_AlbumTitle(reinterpret_cast<void**>(&album)))) {
|
||||
ffStrbufSetHstring(&result->album, album);
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionTimelineProperties>* FF_AUTO_RELEASE_COM_OBJECT timelineProps = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Media::Control::IGlobalSystemMediaTransportControlsSessionTimelineProperties>* timelineProps = nullptr;
|
||||
hr = session->GetTimelineProperties(reinterpret_cast<void**>(&timelineProps));
|
||||
if (SUCCEEDED(hr) && timelineProps) {
|
||||
int64_t duration = 0;
|
||||
@@ -373,14 +373,14 @@ static const char* getMedia(FFMediaResult* result, bool saveCover) {
|
||||
}
|
||||
}
|
||||
|
||||
abi_t<winrt::Windows::ApplicationModel::IAppInfoStatics>* FF_AUTO_RELEASE_COM_OBJECT appInfoStatics = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::ApplicationModel::IAppInfoStatics>* appInfoStatics = nullptr;
|
||||
hr = ffGetActivationFactory(L"Windows.ApplicationModel.AppInfo", winrt::guid_of<winrt::Windows::ApplicationModel::IAppInfoStatics>(), &appInfoStatics);
|
||||
if (SUCCEEDED(hr) && appInfoStatics) {
|
||||
abi_t<winrt::Windows::ApplicationModel::IAppInfo>* FF_AUTO_RELEASE_COM_OBJECT appInfo = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::ApplicationModel::IAppInfo>* appInfo = nullptr;
|
||||
if (SUCCEEDED(appInfoStatics->GetFromAppUserModelId(reinterpret_cast<void*>(playerId), reinterpret_cast<void**>(&appInfo))) && appInfo) {
|
||||
abi_t<winrt::Windows::ApplicationModel::IAppDisplayInfo>* FF_AUTO_RELEASE_COM_OBJECT displayInfo = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::ApplicationModel::IAppDisplayInfo>* displayInfo = nullptr;
|
||||
if (SUCCEEDED(appInfo->get_DisplayInfo(reinterpret_cast<void**>(&displayInfo))) && displayInfo) {
|
||||
FF_A_CLEANUP(deleteHstring) HSTRING displayName = nullptr;
|
||||
[[gnu::cleanup(deleteHstring)]] HSTRING displayName = nullptr;
|
||||
if (SUCCEEDED(displayInfo->get_DisplayName(reinterpret_cast<void**>(&displayName)))) {
|
||||
ffStrbufSetHstring(&result->player, displayName);
|
||||
}
|
||||
@@ -396,7 +396,7 @@ static const char* getMedia(FFMediaResult* result, bool saveCover) {
|
||||
}
|
||||
|
||||
if (saveCover) {
|
||||
abi_t<winrt::Windows::Storage::Streams::IRandomAccessStreamReference>* FF_AUTO_RELEASE_COM_OBJECT thumbnail = nullptr;
|
||||
FF_AUTO_RELEASE_COM_OBJECT abi_t<winrt::Windows::Storage::Streams::IRandomAccessStreamReference>* thumbnail = nullptr;
|
||||
hr = mediaProps->get_Thumbnail(reinterpret_cast<void**>(&thumbnail));
|
||||
if (SUCCEEDED(hr) && thumbnail) {
|
||||
if (SUCCEEDED(ffSaveThumbnailToTempPath(thumbnail, &result->cover)) && result->cover.length > 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "memory.h"
|
||||
|
||||
const char* ffDetectMemory(FF_A_UNUSED FFMemoryResult* ram) {
|
||||
const char* ffDetectMemory([[maybe_unused]] FFMemoryResult* ram) {
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* ffDetectMemory(FFMemoryResult* ram) {
|
||||
ram->bytesTotal = (uint64_t) sysconf(_SC_PHYS_PAGES) * pageSize;
|
||||
ram->bytesUsed = ram->bytesTotal - (uint64_t) sysconf(_SC_AVPHYS_PAGES) * pageSize;
|
||||
|
||||
FF_A_CLEANUP(kstatFreeWrap) kstat_ctl_t* kc = kstat_open();
|
||||
[[gnu::cleanup(kstatFreeWrap)]] kstat_ctl_t* kc = kstat_open();
|
||||
if (kc != nullptr) {
|
||||
kstat_t* ksp = kstat_lookup(kc, "zfs", -1, "arcstats");
|
||||
if (ksp != nullptr && kstat_read(kc, ksp, nullptr) != -1) {
|
||||
|
||||
@@ -18,15 +18,15 @@ static void enumSet(IOHIDDeviceRef value, FFlist* results) {
|
||||
}
|
||||
|
||||
const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */) {
|
||||
IOHIDManagerRef FF_CFTYPE_AUTO_RELEASE manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
FF_CFTYPE_AUTO_RELEASE IOHIDManagerRef manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
if (IOHIDManagerOpen(manager, kIOHIDOptionsTypeNone) != kIOReturnSuccess) {
|
||||
return "IOHIDManagerOpen() failed";
|
||||
}
|
||||
|
||||
CFDictionaryRef FF_CFTYPE_AUTO_RELEASE matching1 = CFDictionaryCreate(kCFAllocatorDefault, (const void**) (CFStringRef[]) { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) }, (const void**) (CFNumberRef[]) { ffCfCreateInt(kHIDPage_GenericDesktop), ffCfCreateInt(kHIDUsage_GD_Mouse) }, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
FF_CFTYPE_AUTO_RELEASE CFDictionaryRef matching1 = CFDictionaryCreate(kCFAllocatorDefault, (const void**) (CFStringRef[]) { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) }, (const void**) (CFNumberRef[]) { ffCfCreateInt(kHIDPage_GenericDesktop), ffCfCreateInt(kHIDUsage_GD_Mouse) }, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
IOHIDManagerSetDeviceMatching(manager, matching1);
|
||||
|
||||
CFSetRef FF_CFTYPE_AUTO_RELEASE set = IOHIDManagerCopyDevices(manager);
|
||||
FF_CFTYPE_AUTO_RELEASE CFSetRef set = IOHIDManagerCopyDevices(manager);
|
||||
if (set) {
|
||||
CFSetApplyFunction(set, (CFSetApplierFunction) &enumSet, devices);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "mouse.h"
|
||||
|
||||
const char* ffDetectMouse(FF_A_UNUSED FFlist* devices /* List of FFMouseDevice */) {
|
||||
const char* ffDetectMouse([[maybe_unused]] FFlist* devices /* List of FFMouseDevice */) {
|
||||
return "No mouse support on this platform";
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user