mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-15 12:22:47 +00:00
spa: libcamera: get rid of an unnecessary snprintf()
call
Simply use the returned string for populating the spa_dict instead of doing a copy into a fixed size buffer on the stack.
This commit is contained in:
parent
5b128cdbe9
commit
08002f0497
|
@ -106,7 +106,7 @@ static int emit_info(struct impl *impl, bool full)
|
|||
uint32_t n_items = 0;
|
||||
struct spa_device_info info;
|
||||
struct spa_param_info params[2];
|
||||
char path[256], model[256], name[256], devices_str[128];
|
||||
char path[256], name[256], devices_str[128];
|
||||
struct spa_strbuf buf;
|
||||
|
||||
info = SPA_DEVICE_INFO_INIT();
|
||||
|
@ -123,9 +123,10 @@ static int emit_info(struct impl *impl, bool full)
|
|||
if (auto location = cameraLoc(impl->camera.get()))
|
||||
ADD_ITEM(SPA_KEY_API_LIBCAMERA_LOCATION, location);
|
||||
|
||||
snprintf(model, sizeof(model), "%s", cameraModel(impl->camera.get()).c_str());
|
||||
ADD_ITEM(SPA_KEY_DEVICE_PRODUCT_NAME, model);
|
||||
ADD_ITEM(SPA_KEY_DEVICE_DESCRIPTION, model);
|
||||
const auto model = cameraModel(impl->camera.get());
|
||||
ADD_ITEM(SPA_KEY_DEVICE_PRODUCT_NAME, model.c_str());
|
||||
ADD_ITEM(SPA_KEY_DEVICE_DESCRIPTION, model.c_str());
|
||||
|
||||
snprintf(name, sizeof(name), "libcamera_device.%s", impl->device_id.c_str());
|
||||
ADD_ITEM(SPA_KEY_DEVICE_NAME, name);
|
||||
|
||||
|
|
Loading…
Reference in a new issue