Commit Graph

259 Commits

Author SHA1 Message Date
iphydf
89957be230
cleanup: Ensure handler params are named after callback params. 2024-01-18 10:55:31 +00:00
iphydf
0426624dcb
refactor: Assign malloc return to a local variable first. 2024-01-10 11:46:41 +00:00
iphydf
a549807df7
refactor: Add mem module to allow tests to override allocators.
This will allow us to do more interesting things with memory allocation
within toxcore, and allow fuzzers to explore various allocation failure
paths.
2023-08-30 22:55:05 +00:00
iphydf
941026266e
refactor: Allow overriding mono_time in tox_new.
This makes it so if mono_time is overridden, no monotonic time-related
system call is invoked in tox_new.
2022-04-03 22:48:16 +00:00
iphydf
cc31ff07fa
feat: Add support for custom random number generator.
This can be used by fuzzers to make RNG-driven code deterministic (i.e.
based on the fuzzer input).
2022-04-01 14:06:05 +00:00
iphydf
6749974470
cleanup: Expose struct Tox to internal code.
To avoid unsafe casts that tokstyle doesn't allow and that can cause
random breakages.
2022-03-26 21:15:31 +00:00
iphydf
3275bb8fea
cleanup: Add explicit callback setters for MSI callbacks.
Instead of a callback ID and a `switch`.
2022-03-04 10:33:23 +00:00
iphydf
cff9a18e39
cleanup: Split util.c out of the network library.
Also, don't include ccompat.h in header files. Instead, explicitly
include it in .c files.
2022-03-04 10:33:11 +00:00
iphydf
163e9c3b03
cleanup: Remove more boolean conversions (and a bugfix).
These were found by the new stronger type check in cimple. The one
bugfix is in `crypto_sha512_cmp`, which used to think `crypto_verify_32`
returns bool while actually it's -1/0/1.
2022-02-26 00:03:56 +00:00
iphydf
2ce6f5b169
fix: Report failure to DHT bootstrap back to the client.
Also reduce log verbosity a bit.
2022-02-24 11:37:47 +00:00
Robin Linden
0ac930e1f6
cleanup: Clean up comparing bools with ints 2022-02-23 22:50:12 +00:00
Robin Linden
0ca2882b92
cleanup: Remove yet more implicit bool conversions 2022-02-23 22:00:46 +00:00
iphydf
b13590a86d
cleanup: Mark all local non-pointers as const where possible. 2022-02-23 19:30:01 +00:00
iphydf
70d75ae9a3
cleanup: Remove implicit conversions from uint32_t to bool. 2022-02-22 23:25:23 +00:00
iphydf
e7bc611dac
cleanup: Enable most cppcheck warnings as errors.
Cleaned up some of the warnings it gives. Disabled the ones that are
less useful for us at this time.
2022-02-21 17:17:36 +00:00
iphydf
a9ccf1be26
cleanup: Remove all implicit bool conversions in if-conditions.
Note to reviewer: please review carefully. This was done manually.
2022-02-21 15:10:22 +00:00
iphydf
87c38ece30
cleanup: Avoid implicit bool conversions in logical operators. 2022-02-18 10:24:31 +00:00
iphydf
7b2f6c34c6
cleanup: Apply stronger type checks and fix errors.
Found a bug, too: file recv and chunk events were intermittently
converting to `uint32_t`, losing precision.
2022-02-17 22:34:56 +00:00
iphydf
5e724d8909
cleanup: Avoid implicit pointer-to-bool conversion in if in toxav. 2022-02-17 20:33:24 +00:00
iphydf
7f94e411a9
chore: Add cpplint to the CI. 2022-01-17 23:42:38 +00:00
iphydf
6823fcbae1
cleanup: Stop using strerror directly.
We have a more portable wrapper that is now also thread-safe. Also
stopped using sprintf in the one place we used it. This doesn't really
help much, but it allows us to forbid sprintf globally.
2022-01-15 01:25:56 +00:00
jfreegman
dfa7a0183f
Refactor toxav_call_control
Control logic is now placed in control-specific helper functions
instead of having one giant confusing function that does everything
2022-01-13 17:50:39 -05:00
iphydf
9ab77e015d
cleanup: Fix calloc argument order.
See https://github.com/TokTok/hs-tokstyle/pull/102
2022-01-09 18:42:20 +00:00
jfreegman
0385315200
Make struct typedefs have the same name as their struct 2022-01-04 11:36:28 -05:00
jfreegman
d8397c93c8
Put breaks inside case bracers 2021-12-25 12:30:39 -05:00
iphydf
27f7c8beaa
chore: Tie down the use of doxygen comments.
These should only be used before a toplevel thing that can be commented on.
2021-12-15 18:35:48 +00:00
iphydf
fd32c87707
cleanup: Don't include "config.h" unless needed.
Currently only `crypto_core_mem.c` needs this. We should try not to
depend on configure'd values. Also note: config.h is only created and
used in the autotools build. In CMake, we pass `-D` flags directly.
2021-12-12 22:18:38 +00:00
sudden6
891fe60ea2
extend ToxAV API to support different threads for audio and video
This allows for prioritizing audio over video transcoding and improves
performance when multiple CPU cores are available.
2021-12-11 10:43:47 +01:00
sudden6
a80a29163c
clarify purpose of variable 2021-12-10 23:10:21 +01:00
iphydf
e4ad0c833c
cleanup: Enforce for loop consistency.
All for-loops must have an init-decl, a condition, and an increment
statement. Any loop that doesn't have one of these should be a while
loop (only 2 of these exist in toxav, none in toxcore).
2021-12-09 14:53:00 +00:00
jfreegman
ce268c2f82
Add some missing null checks 2021-12-06 16:57:07 -05:00
iphydf
af1848ed13
chore: Use toktok-stack docker image with built third_party.
This should cut down the build time a bit by downloading the binaries
built for `//third_party/...`.
2021-12-05 19:21:57 +00:00
iphydf
03a511482f
Format comments according to tokstyle's requirements. 2020-05-17 18:16:42 +01:00
iphydf
88b90c8225
Fix a bug in savedata loading when malloc fails.
Also added a bunch of asserts to tests where they don't check allocs.
2020-05-03 14:13:48 +00:00
zoff99
af6e27bbf1
Use public API for sending in RTP. 2020-04-09 11:51:34 +00:00
zoff99
da2c4191b4
Use public API for sending in BWC. 2020-04-08 13:41:58 +00:00
iphydf
8ddc2df662
Remove newlines from the end of LOGGER format strings.
See https://github.com/TokTok/hs-tokstyle/pull/49 for the corresponding
tokstyle analysis.
2020-04-07 19:17:58 +00:00
zoff99
dfe19e04d3
Change ToxAVCall struct mutex to a more distinct name. 2020-04-07 17:56:01 +00:00
zoff99
97fc2f4c0b
Create own instance of MonoTime for ToxAV. 2020-04-07 17:16:17 +00:00
zoff99
27f24e61b2
Stop using Messenger's mono_time in bandwidth controller.
We're actually still using it, but we got a private pointer now,
preparing us for having a private mono_time in toxav.
2020-04-05 11:56:52 +00:00
iphydf
84e6a8d057
Make function defns match their decls regarding storage class.
We want functions declared as `static` to also be defined as `static`.
2020-03-18 15:14:31 +00:00
iphydf
1b7bf5b182
Mark file-local function definitions as static.
https://github.com/TokTok/hs-tokstyle/pull/43 implements a validation for
this. We should avoid locally declaring functions from another
translation unit, and instead use header files to export/import them.
2020-03-18 00:53:02 +00:00
iphydf
8795c5f987
Avoid casting back and forth between void-ptr.
In windows network code, we implement inet_pton and inet_ntop, which take
void pointers. We can do slightly better because we already know the type
when we call these functions, so we can avoid casting between void
pointer and the addr struct types.
2020-03-14 13:48:56 +00:00
iphydf
94d98ddd86
Standardise on having a comma at the end of enums.
Most of our enums already have one. Some didn't. Tokstyle is going to
require commas at the end of enumerator lists in enum definitions.
2020-03-14 13:40:36 +00:00
iphydf
11ad5471b9
Use spdx license identifier instead of GPL blurb. 2020-03-14 13:06:19 +00:00
sudden6
a29d5805a6
fix missing mutex 2019-11-21 23:47:02 +01:00
sudden6
81728addb2
fix ToxAV mutex released to early 2019-11-21 23:46:59 +01:00
Mick Sayson
dc0b2e7919
Fix using uninitialized mutex on call end. 2018-09-21 20:44:24 +00:00
yangfl
d3d5b701cb
Fix typos 2018-09-19 18:16:13 +00:00
iphydf
473cde24d8
Update copyright to 2018. 2018-08-26 18:57:29 +00:00