forked from Green-Sky/tomato
Squashed 'external/toxcore/c-toxcore/' changes from 3e05824b80..da438763d5
da438763d5 chore: Release 0.2.19 f90417987c chore: Add cmake flag to disable unit tests. 7df3f99417 docs: Document that group topic lock is default on. 9e9ed77390 docs: Add missing param docs for callbacks. 0ec4978de5 refactor: Don't expose Tox_System in the public API a3d1b8595c docs: Public headers, Core/toxcore -> Tox/the Tox library f78d0f3f39 docs: Public headers, events_alloc -> internal 817518949e docs: Public headers, NULL-terminated -> NUL-terminated be085db191 docs: Public headers, spellcheck 4c902955f3 docs: Public headers, 80 column width comments be8a82a818 docs: Public headers, null -> NULL 419d783d95 docs: Public headers, tox -> Tox 5c8aa65e41 docs: Update user data API explanation ad4921dbaa cleanup: A more descriptive error for group invite accept function git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: da438763d5b8e071de6e061a1dcaddd2177dff7d
This commit is contained in:
@ -712,7 +712,8 @@ static int tox_load(Tox *tox, const uint8_t *data, uint32_t length)
|
||||
length - cookie_len, STATE_COOKIE_TYPE);
|
||||
}
|
||||
|
||||
Tox *tox_new(const struct Tox_Options *options, Tox_Err_New *error)
|
||||
nullable(1, 2, 3)
|
||||
static Tox *tox_new_system(const struct Tox_Options *options, Tox_Err_New *error, const Tox_System *sys)
|
||||
{
|
||||
struct Tox_Options *default_options = nullptr;
|
||||
|
||||
@ -736,7 +737,6 @@ Tox *tox_new(const struct Tox_Options *options, Tox_Err_New *error)
|
||||
const struct Tox_Options *const opts = options != nullptr ? options : default_options;
|
||||
assert(opts != nullptr);
|
||||
|
||||
const Tox_System *sys = tox_options_get_operating_system(opts);
|
||||
const Tox_System default_system = tox_default_system();
|
||||
|
||||
if (sys == nullptr) {
|
||||
@ -1020,6 +1020,37 @@ Tox *tox_new(const struct Tox_Options *options, Tox_Err_New *error)
|
||||
return tox;
|
||||
}
|
||||
|
||||
Tox *tox_new(const struct Tox_Options *options, Tox_Err_New *error)
|
||||
{
|
||||
return tox_new_system(options, error, nullptr);
|
||||
}
|
||||
|
||||
Tox *tox_new_testing(const Tox_Options *options, Tox_Err_New *error, const Tox_Options_Testing *testing, Tox_Err_New_Testing *testing_error)
|
||||
{
|
||||
if (testing == nullptr) {
|
||||
SET_ERROR_PARAMETER(error, TOX_ERR_NEW_NULL);
|
||||
SET_ERROR_PARAMETER(testing_error, TOX_ERR_NEW_TESTING_NULL);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (testing->operating_system == nullptr) {
|
||||
SET_ERROR_PARAMETER(error, TOX_ERR_NEW_NULL);
|
||||
SET_ERROR_PARAMETER(testing_error, TOX_ERR_NEW_TESTING_NULL);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Tox_System *sys = testing->operating_system;
|
||||
|
||||
if (sys->rng == nullptr || sys->ns == nullptr || sys->mem == nullptr) {
|
||||
SET_ERROR_PARAMETER(error, TOX_ERR_NEW_NULL);
|
||||
SET_ERROR_PARAMETER(testing_error, TOX_ERR_NEW_TESTING_NULL);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SET_ERROR_PARAMETER(testing_error, TOX_ERR_NEW_TESTING_OK);
|
||||
return tox_new_system(options, error, sys);
|
||||
}
|
||||
|
||||
void tox_kill(Tox *tox)
|
||||
{
|
||||
if (tox == nullptr) {
|
||||
@ -4269,7 +4300,7 @@ uint32_t tox_group_invite_accept(Tox *tox, uint32_t friend_number, const uint8_t
|
||||
}
|
||||
|
||||
case -6: {
|
||||
SET_ERROR_PARAMETER(error, TOX_ERR_GROUP_INVITE_ACCEPT_CORE);
|
||||
SET_ERROR_PARAMETER(error, TOX_ERR_GROUP_INVITE_ACCEPT_FRIEND_NOT_FOUND);
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user