New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make events const and remove unused argument. #7
Make events const and remove unused argument. #7
Conversation
@iphydf review this PR, please. |
Run |
@iphydf ,
|
Ok, only toxcore/tox.h needs to be updated there. |
Take a look at 4fbd899. astyle change is veeery suspicious. |
Ah yes, makes sense. TokTok#1173 would need to be fixed first. In the meantime, just change the callbacks to not take a user_data. |
E.g. https://github.com/iphydf/c-toxcore/blob/ngc-rebased-master/toxcore/tox.h#L3796 has user_data, but https://github.com/iphydf/c-toxcore/blob/ngc-rebased-master/toxcore/tox.h#L2509 does not. None of the callbacks registration functions should get a user_data parameter. The user_data should come from tox_iterate only. |
4fbd899
to
98a3579
Compare
Yes, I've removed user_data in the first commit. Together with assertions. Take a look :) |
Ok, thanks. Can you update the tests so they compile with this change? |
Also take a look at line 751. There are a bunch of callback registration calls there which cause user data to be "tox". Those need to also not get any user data, because the user data should come from tox_iterate. |
Also, update auto_tests/group_message_test.c line 30 to print |
@iphydf how to run tests?
|
@crypto-universe You need to set the |
c-toxcore/auto_tests/group_announce_test.c:74:5: error: too many arguments to function ‘tox_callback_group_invite’
tox_callback_group_invite(toxes[1], group_invite_handler, nullptr); These are some errors that need to be fixed. I realised that the issue specification was not very precise, so I'm going to accept this solution to it, even though the real solution is a lot more work. I'll file a separate issue for the remainder of the work. |
Wait a second, in a few minutes there will be a working (at least compiling) solution. |
98a3579
to
f24269e
Compare
auto_tests/group_message_test.c
Outdated
@@ -27,7 +27,7 @@ static void group_invite_handler(Tox *tox, uint32_t friend_number, const uint8_t | |||
self_info.nick_length = 4; | |||
self_info.user_status = TOX_USER_STATUS_NONE; | |||
|
|||
printf("invite arrived; accepting\n"); | |||
printf("invite arrived; accepting; tox0_index=%u, tox1_index=%u\n", global_state_tox0->index, global_state_tox1->index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error: ‘global_state_tox0’ undeclared (first use in this function)
It'll need to move up. But also, let's not do this in this PR, because what we actually want is no use of global state in this test. If you do that, you'll notice it's quite a bit of work.
3b838af
to
f24269e
Compare
My fault. Trivial change, so I didn't check if it compiles. |
Reference issue TokTok#1185