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);
|
||||
}
|
||||
|
||||
obs_data_array_t* Utils::StringListToArray(char** strings, char* key) {
|
||||
if (!strings)
|
||||
return obs_data_array_create();
|
||||
|
||||
obs_data_array_t* Utils::StringListToArray(char** strings, const char* key) {
|
||||
obs_data_array_t* list = obs_data_array_create();
|
||||
|
||||
char* value = "";
|
||||
for (int i = 0; value != nullptr; i++) {
|
||||
value = strings[i];
|
||||
if (!strings || !key) {
|
||||
return list; // empty list
|
||||
}
|
||||
|
||||
size_t index = 0;
|
||||
char* value = nullptr;
|
||||
|
||||
do {
|
||||
value = strings[index];
|
||||
|
||||
OBSDataAutoRelease item = obs_data_create();
|
||||
obs_data_set_string(item, key, value);
|
||||
|
||||
if (value)
|
||||
if (value) {
|
||||
obs_data_array_push_back(list, item);
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
} while (value != nullptr);
|
||||
|
||||
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();
|
||||
OBSScene scene = obs_scene_from_source(source);
|
||||
|
||||
if (!scene)
|
||||
if (!scene) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
obs_scene_enum_items(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) {
|
||||
if (!item)
|
||||
if (!item) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vec2 pos;
|
||||
obs_sceneitem_get_pos(item, &pos);
|
||||
|
@ -33,7 +33,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
|
||||
class Utils {
|
||||
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_t* GetSceneItemData(obs_sceneitem_t* item);
|
||||
static obs_sceneitem_t* GetSceneItemFromName(
|
||||
|
Loading…
x
Reference in New Issue
Block a user