mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Windows: use ffStrbufInitWS
This commit is contained in:
@@ -117,8 +117,7 @@ const char* ffDetectGamepad(FF_MAYBE_UNUSED const FFinstance* instance, FFlist*
|
||||
continue;
|
||||
|
||||
FFGamepadDevice* device = (FFGamepadDevice*) ffListAdd(devices);
|
||||
ffStrbufInit(&device->identifier);
|
||||
ffStrbufSetWS(&device->identifier, devName);
|
||||
ffStrbufInitWS(&device->identifier, devName);
|
||||
ffStrbufInit(&device->name);
|
||||
|
||||
const char* knownGamepad = detectKnownGamepad(rdi.hid.dwVendorId, rdi.hid.dwProductId);
|
||||
|
||||
@@ -20,15 +20,13 @@ const char* ffDetectGPUImpl(FFlist* gpus, FF_MAYBE_UNUSED const FFinstance* inst
|
||||
|
||||
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
|
||||
ffStrbufInit(&gpu->vendor);
|
||||
ffStrbufInit(&gpu->name);
|
||||
ffStrbufInitWS(&gpu->name, displayDevice.DeviceString);
|
||||
ffStrbufInit(&gpu->driver);
|
||||
gpu->temperature = FF_GPU_TEMP_UNSET;
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
gpu->type = FF_GPU_TYPE_UNKNOWN;
|
||||
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
|
||||
|
||||
ffStrbufSetWS(&gpu->name, displayDevice.DeviceString);
|
||||
|
||||
if (deviceKeyLength == 100 && displayDevice.DeviceKey[deviceKeyPrefixLength - 1] == '{')
|
||||
{
|
||||
wmemcpy(regKey + regKeyPrefixLength, displayDevice.DeviceKey + deviceKeyPrefixLength, 100 - regKeyPrefixLength + 1);
|
||||
|
||||
@@ -63,11 +63,9 @@ const char* ffDetectSound(FF_MAYBE_UNUSED const FFinstance* instance, FF_MAYBE_U
|
||||
device->main = wcscmp(mainDeviceId, immDeviceId) == 0;
|
||||
device->active = !!(immState & DEVICE_STATE_ACTIVE);
|
||||
device->volume = FF_SOUND_VOLUME_UNKNOWN;
|
||||
ffStrbufInit(&device->identifier);
|
||||
ffStrbufInitWS(&device->identifier, immDeviceId);
|
||||
ffStrbufInit(&device->name);
|
||||
|
||||
ffStrbufSetWS(&device->identifier, immDeviceId);
|
||||
|
||||
{
|
||||
PROPVARIANT __attribute__((__cleanup__(PropVariantClear))) friendlyName;
|
||||
PropVariantInit(&friendlyName);
|
||||
|
||||
@@ -72,7 +72,7 @@ const char* ffDetectWifi(FF_MAYBE_UNUSED const FFinstance* instance, FFlist* res
|
||||
WLAN_INTERFACE_INFO* ifInfo = (WLAN_INTERFACE_INFO*)&ifList->InterfaceInfo[index];
|
||||
|
||||
FFWifiResult* item = (FFWifiResult*)ffListAdd(result);
|
||||
ffStrbufInit(&item->inf.description);
|
||||
ffStrbufInitWS(&item->inf.description, ifInfo->strInterfaceDescription);
|
||||
ffStrbufInit(&item->inf.status);
|
||||
ffStrbufInit(&item->conn.status);
|
||||
ffStrbufInit(&item->conn.ssid);
|
||||
@@ -83,7 +83,6 @@ const char* ffDetectWifi(FF_MAYBE_UNUSED const FFinstance* instance, FFlist* res
|
||||
item->conn.rxRate = 0.0/0.0;
|
||||
item->conn.txRate = 0.0/0.0;
|
||||
|
||||
ffStrbufSetWS(&item->inf.description, ifInfo->strInterfaceDescription);
|
||||
convertIfStateToString(ifInfo->isState, &item->inf.status);
|
||||
|
||||
if(ifInfo->isState != wlan_interface_state_connected)
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#include "FFPlatform_private.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/windows/unicode.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
#include "util/windows/unicode.h"
|
||||
|
||||
static void getHomeDir(FFPlatform* platform)
|
||||
{
|
||||
PWSTR pPath;
|
||||
@@ -41,8 +39,7 @@ static void platformPathAddKnownFolder(FFlist* dirs, REFKNOWNFOLDERID folderId)
|
||||
if(SUCCEEDED(SHGetKnownFolderPath(folderId, 0, NULL, &pPath)))
|
||||
{
|
||||
FFstrbuf* buffer = (FFstrbuf*) ffListAdd(dirs);
|
||||
ffStrbufInit(buffer);
|
||||
ffStrbufSetWS(buffer, pPath);
|
||||
ffStrbufInitWS(buffer, pPath);
|
||||
ffStrbufReplaceAllC(buffer, '\\', '/');
|
||||
ffStrbufEnsureEndsWithC(buffer, '/');
|
||||
FF_PLATFORM_PATH_UNIQUE(dirs, buffer);
|
||||
@@ -159,7 +156,7 @@ static void getSystemReleaseAndVersion(FFPlatform* platform)
|
||||
|
||||
DWORD ubr;
|
||||
bufSize = sizeof(ubr);
|
||||
if(RegGetValueA(hKey, NULL, "UBR", RRF_RT_REG_DWORD, NULL, &ubr, &bufSize) != ERROR_SUCCESS || bufSize != sizeof(ubr))
|
||||
if(RegGetValueW(hKey, NULL, L"UBR", RRF_RT_REG_DWORD, NULL, &ubr, &bufSize) != ERROR_SUCCESS || bufSize != sizeof(ubr))
|
||||
ubr = 0;
|
||||
|
||||
ffStrbufAppendF(&platform->systemRelease, "%s.%s.%u", currentVersion, currentBuildNumber, (unsigned)ubr);
|
||||
|
||||
Reference in New Issue
Block a user