(API Change) Remove pointers from all typedefs

Typedef pointers are unsafe.  If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data.  I admit this was a fundamental mistake that must
be corrected.

All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.

This does not break ABI though, which is pretty nice.
This commit is contained in:
jp9000 2014-09-25 17:44:05 -07:00
commit c9df41c1e2
146 changed files with 3105 additions and 3079 deletions

View file

@ -1,8 +1,8 @@
#include <obs-module.h>
struct test_filter {
obs_source_t source;
gs_effect_t whatever;
obs_source_t *source;
gs_effect_t *whatever;
};
static const char *filter_getname(void)
@ -24,7 +24,7 @@ static void filter_destroy(void *data)
}
}
static void *filter_create(obs_data_t settings, obs_source_t source)
static void *filter_create(obs_data_t *settings, obs_source_t *source)
{
struct test_filter *tf = bzalloc(sizeof(struct test_filter));
char *effect_file;
@ -47,7 +47,7 @@ static void *filter_create(obs_data_t settings, obs_source_t source)
return tf;
}
static void filter_render(void *data, gs_effect_t effect)
static void filter_render(void *data, gs_effect_t *effect)
{
struct test_filter *tf = data;
obs_source_process_filter(tf->source, tf->whatever, 0, 0, GS_RGBA,

View file

@ -4,8 +4,8 @@
#include <obs.h>
struct random_tex {
obs_source_t source;
os_event_t stop_signal;
obs_source_t *source;
os_event_t *stop_signal;
pthread_t thread;
bool initialized;
};
@ -74,7 +74,7 @@ static void *video_thread(void *data)
return NULL;
}
static void *random_create(obs_data_t settings, obs_source_t source)
static void *random_create(obs_data_t *settings, obs_source_t *source)
{
struct random_tex *rt = bzalloc(sizeof(struct random_tex));
rt->source = source;

View file

@ -7,8 +7,8 @@
struct sinewave_data {
bool initialized_thread;
pthread_t thread;
os_event_t event;
obs_source_t source;
os_event_t *event;
obs_source_t *source;
};
/* middle C */
@ -79,8 +79,8 @@ static void sinewave_destroy(void *data)
}
}
static void *sinewave_create(obs_data_t settings,
obs_source_t source)
static void *sinewave_create(obs_data_t *settings,
obs_source_t *source)
{
struct sinewave_data *swd = bzalloc(sizeof(struct sinewave_data));
swd->source = source;

View file

@ -15,23 +15,23 @@ static const int cy = 600;
/* --------------------------------------------------- */
class SourceContext {
obs_source_t source;
obs_source_t *source;
public:
inline SourceContext(obs_source_t source) : source(source) {}
inline SourceContext(obs_source_t *source) : source(source) {}
inline ~SourceContext() {obs_source_release(source);}
inline operator obs_source_t() {return source;}
inline operator obs_source_t*() {return source;}
};
/* --------------------------------------------------- */
class SceneContext {
obs_scene_t scene;
obs_scene_t *scene;
public:
inline SceneContext(obs_scene_t scene) : scene(scene) {}
inline SceneContext(obs_scene_t *scene) : scene(scene) {}
inline ~SceneContext() {obs_scene_release(scene);}
inline operator obs_scene_t() {return scene;}
inline operator obs_scene_t*() {return scene;}
};
/* --------------------------------------------------- */
@ -92,9 +92,9 @@ static void CreateOBS(HWND hwnd)
throw "Couldn't initialize video";
}
static void AddTestItems(obs_scene_t scene, obs_source_t source)
static void AddTestItems(obs_scene_t *scene, obs_source_t *source)
{
obs_sceneitem_t item = NULL;
obs_sceneitem_t *item = NULL;
struct vec2 scale;
vec2_set(&scale, 20.0f, 20.0f);