mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
utils: fix compilation warnings
This commit is contained in:
parent
93adc8587d
commit
21940c922d
@ -48,22 +48,28 @@ obs_bounds_type getBoundsTypeFromName(QString name) {
|
|||||||
return boundTypeNames.key(name);
|
return boundTypeNames.key(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
obs_data_array_t* Utils::StringListToArray(char** strings, char* key) {
|
obs_data_array_t* Utils::StringListToArray(char** strings, const char* key) {
|
||||||
if (!strings)
|
|
||||||
return obs_data_array_create();
|
|
||||||
|
|
||||||
obs_data_array_t* list = obs_data_array_create();
|
obs_data_array_t* list = obs_data_array_create();
|
||||||
|
|
||||||
char* value = "";
|
if (!strings || !key) {
|
||||||
for (int i = 0; value != nullptr; i++) {
|
return list; // empty list
|
||||||
value = strings[i];
|
}
|
||||||
|
|
||||||
|
size_t index = 0;
|
||||||
|
char* value = nullptr;
|
||||||
|
|
||||||
|
do {
|
||||||
|
value = strings[index];
|
||||||
|
|
||||||
OBSDataAutoRelease item = obs_data_create();
|
OBSDataAutoRelease item = obs_data_create();
|
||||||
obs_data_set_string(item, key, value);
|
obs_data_set_string(item, key, value);
|
||||||
|
|
||||||
if (value)
|
if (value) {
|
||||||
obs_data_array_push_back(list, item);
|
obs_data_array_push_back(list, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
} while (value != nullptr);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@ -72,8 +78,9 @@ obs_data_array_t* Utils::GetSceneItems(obs_source_t* source) {
|
|||||||
obs_data_array_t* items = obs_data_array_create();
|
obs_data_array_t* items = obs_data_array_create();
|
||||||
OBSScene scene = obs_scene_from_source(source);
|
OBSScene scene = obs_scene_from_source(source);
|
||||||
|
|
||||||
if (!scene)
|
if (!scene) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
obs_scene_enum_items(scene, [](
|
obs_scene_enum_items(scene, [](
|
||||||
obs_scene_t* scene,
|
obs_scene_t* scene,
|
||||||
@ -91,8 +98,9 @@ obs_data_array_t* Utils::GetSceneItems(obs_source_t* source) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
obs_data_t* Utils::GetSceneItemData(obs_sceneitem_t* item) {
|
obs_data_t* Utils::GetSceneItemData(obs_sceneitem_t* item) {
|
||||||
if (!item)
|
if (!item) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
vec2 pos;
|
vec2 pos;
|
||||||
obs_sceneitem_get_pos(item, &pos);
|
obs_sceneitem_get_pos(item, &pos);
|
||||||
|
@ -33,7 +33,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
|
|
||||||
class Utils {
|
class Utils {
|
||||||
public:
|
public:
|
||||||
static obs_data_array_t* StringListToArray(char** strings, char* key);
|
static obs_data_array_t* StringListToArray(char** strings, const char* key);
|
||||||
static obs_data_array_t* GetSceneItems(obs_source_t* source);
|
static obs_data_array_t* GetSceneItems(obs_source_t* source);
|
||||||
static obs_data_t* GetSceneItemData(obs_sceneitem_t* item);
|
static obs_data_t* GetSceneItemData(obs_sceneitem_t* item);
|
||||||
static obs_sceneitem_t* GetSceneItemFromName(
|
static obs_sceneitem_t* GetSceneItemFromName(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user