Skip to content

Commit d54bb4f

Browse files
committed
Windows: use ffStrbufInitWS
1 parent 0a946e3 commit d54bb4f

File tree

5 files changed

+7
-16
lines changed

5 files changed

+7
-16
lines changed

src/detection/gamepad/gamepad_windows.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ const char* ffDetectGamepad(FF_MAYBE_UNUSED const FFinstance* instance, FFlist*
117117
continue;
118118

119119
FFGamepadDevice* device = (FFGamepadDevice*) ffListAdd(devices);
120-
ffStrbufInit(&device->identifier);
121-
ffStrbufSetWS(&device->identifier, devName);
120+
ffStrbufInitWS(&device->identifier, devName);
122121
ffStrbufInit(&device->name);
123122

124123
const char* knownGamepad = detectKnownGamepad(rdi.hid.dwVendorId, rdi.hid.dwProductId);

src/detection/gpu/gpu_windows.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ const char* ffDetectGPUImpl(FFlist* gpus, FF_MAYBE_UNUSED const FFinstance* inst
2020

2121
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
2222
ffStrbufInit(&gpu->vendor);
23-
ffStrbufInit(&gpu->name);
23+
ffStrbufInitWS(&gpu->name, displayDevice.DeviceString);
2424
ffStrbufInit(&gpu->driver);
2525
gpu->temperature = FF_GPU_TEMP_UNSET;
2626
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
2727
gpu->type = FF_GPU_TYPE_UNKNOWN;
2828
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
2929

30-
ffStrbufSetWS(&gpu->name, displayDevice.DeviceString);
31-
3230
if (deviceKeyLength == 100 && displayDevice.DeviceKey[deviceKeyPrefixLength - 1] == '{')
3331
{
3432
wmemcpy(regKey + regKeyPrefixLength, displayDevice.DeviceKey + deviceKeyPrefixLength, 100 - regKeyPrefixLength + 1);

src/detection/sound/sound_windows.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ const char* ffDetectSound(FF_MAYBE_UNUSED const FFinstance* instance, FF_MAYBE_U
6363
device->main = wcscmp(mainDeviceId, immDeviceId) == 0;
6464
device->active = !!(immState & DEVICE_STATE_ACTIVE);
6565
device->volume = FF_SOUND_VOLUME_UNKNOWN;
66-
ffStrbufInit(&device->identifier);
66+
ffStrbufInitWS(&device->identifier, immDeviceId);
6767
ffStrbufInit(&device->name);
6868

69-
ffStrbufSetWS(&device->identifier, immDeviceId);
70-
7169
{
7270
PROPVARIANT __attribute__((__cleanup__(PropVariantClear))) friendlyName;
7371
PropVariantInit(&friendlyName);

src/detection/wifi/wifi_windows.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const char* ffDetectWifi(FF_MAYBE_UNUSED const FFinstance* instance, FFlist* res
7272
WLAN_INTERFACE_INFO* ifInfo = (WLAN_INTERFACE_INFO*)&ifList->InterfaceInfo[index];
7373

7474
FFWifiResult* item = (FFWifiResult*)ffListAdd(result);
75-
ffStrbufInit(&item->inf.description);
75+
ffStrbufInitWS(&item->inf.description, ifInfo->strInterfaceDescription);
7676
ffStrbufInit(&item->inf.status);
7777
ffStrbufInit(&item->conn.status);
7878
ffStrbufInit(&item->conn.ssid);
@@ -83,7 +83,6 @@ const char* ffDetectWifi(FF_MAYBE_UNUSED const FFinstance* instance, FFlist* res
8383
item->conn.rxRate = 0.0/0.0;
8484
item->conn.txRate = 0.0/0.0;
8585

86-
ffStrbufSetWS(&item->inf.description, ifInfo->strInterfaceDescription);
8786
convertIfStateToString(ifInfo->isState, &item->inf.status);
8887

8988
if(ifInfo->isState != wlan_interface_state_connected)

src/util/platform/FFPlatform_windows.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#include "FFPlatform_private.h"
22
#include "util/stringUtils.h"
3+
#include "util/windows/unicode.h"
34

45
#include <Windows.h>
56
#include <shlobj.h>
6-
7-
#include "util/windows/unicode.h"
8-
97
static void getHomeDir(FFPlatform* platform)
108
{
119
PWSTR pPath;
@@ -41,8 +39,7 @@ static void platformPathAddKnownFolder(FFlist* dirs, REFKNOWNFOLDERID folderId)
4139
if(SUCCEEDED(SHGetKnownFolderPath(folderId, 0, NULL, &pPath)))
4240
{
4341
FFstrbuf* buffer = (FFstrbuf*) ffListAdd(dirs);
44-
ffStrbufInit(buffer);
45-
ffStrbufSetWS(buffer, pPath);
42+
ffStrbufInitWS(buffer, pPath);
4643
ffStrbufReplaceAllC(buffer, '\\', '/');
4744
ffStrbufEnsureEndsWithC(buffer, '/');
4845
FF_PLATFORM_PATH_UNIQUE(dirs, buffer);
@@ -159,7 +156,7 @@ static void getSystemReleaseAndVersion(FFPlatform* platform)
159156

160157
DWORD ubr;
161158
bufSize = sizeof(ubr);
162-
if(RegGetValueA(hKey, NULL, "UBR", RRF_RT_REG_DWORD, NULL, &ubr, &bufSize) != ERROR_SUCCESS || bufSize != sizeof(ubr))
159+
if(RegGetValueW(hKey, NULL, L"UBR", RRF_RT_REG_DWORD, NULL, &ubr, &bufSize) != ERROR_SUCCESS || bufSize != sizeof(ubr))
163160
ubr = 0;
164161

165162
ffStrbufAppendF(&platform->systemRelease, "%s.%s.%u", currentVersion, currentBuildNumber, (unsigned)ubr);

0 commit comments

Comments
 (0)