mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-07-27 23:56:12 -04:00
libobs: Change return type for getting filter index
This changes the return type for getting the filter index from a size_t to an int. This makes it easier for developers to use, as an invalid index just returns a -1.
This commit is contained in:
@@ -1281,7 +1281,7 @@ void OBSBasicFilters::FiltersMoved(const QModelIndex &, int srcIdxStart, int,
|
||||
neighborIdx = 0;
|
||||
|
||||
OBSSource neighbor = GetFilter(neighborIdx, isAsync);
|
||||
size_t idx = obs_source_filter_get_index(source, neighbor);
|
||||
int idx = obs_source_filter_get_index(source, neighbor);
|
||||
|
||||
OBSSource filter = GetFilter(list->currentRow(), isAsync);
|
||||
obs_source_filter_set_index(source, filter, idx);
|
||||
|
||||
@@ -3294,12 +3294,12 @@ void obs_source_filter_set_order(obs_source_t *source, obs_source_t *filter,
|
||||
obs_source_dosignal(source, NULL, "reorder_filters");
|
||||
}
|
||||
|
||||
size_t obs_source_filter_get_index(obs_source_t *source, obs_source_t *filter)
|
||||
int obs_source_filter_get_index(obs_source_t *source, obs_source_t *filter)
|
||||
{
|
||||
if (!obs_source_valid(source, "obs_source_filter_get_index"))
|
||||
return DARRAY_INVALID;
|
||||
return -1;
|
||||
if (!obs_ptr_valid(filter, "obs_source_filter_get_index"))
|
||||
return DARRAY_INVALID;
|
||||
return -1;
|
||||
|
||||
size_t idx;
|
||||
|
||||
@@ -3307,7 +3307,7 @@ size_t obs_source_filter_get_index(obs_source_t *source, obs_source_t *filter)
|
||||
idx = da_find(source->filters, &filter, 0);
|
||||
pthread_mutex_unlock(&source->filter_mutex);
|
||||
|
||||
return idx;
|
||||
return idx != DARRAY_INVALID ? (int)idx : -1;
|
||||
}
|
||||
|
||||
static bool set_filter_index(obs_source_t *source, obs_source_t *filter,
|
||||
|
||||
@@ -1134,8 +1134,8 @@ EXPORT void obs_source_filter_set_order(obs_source_t *source,
|
||||
enum obs_order_movement movement);
|
||||
|
||||
/** Gets filter index */
|
||||
EXPORT size_t obs_source_filter_get_index(obs_source_t *source,
|
||||
obs_source_t *filter);
|
||||
EXPORT int obs_source_filter_get_index(obs_source_t *source,
|
||||
obs_source_t *filter);
|
||||
|
||||
/** Sets filter index */
|
||||
EXPORT void obs_source_filter_set_index(obs_source_t *source,
|
||||
|
||||
Reference in New Issue
Block a user