(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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user