Commit Graph

536 Commits

Author SHA1 Message Date
Robin Linden
f87a6df938
cleanup: Split msi callback array into 1 member per callback 2022-02-06 15:45:24 +01:00
iphydf
d39f803c7e
docs: Make crypto_core.h appear on doxygen. 2022-02-05 19:34:13 +00:00
iphydf
2ed9b1927f
doc: Add doxygen configuration and netlify publishing. 2022-02-05 15:59:45 +00:00
iphydf
7f0395b746
chore: Make the last few remaining top level comments doxygen style. 2022-02-04 23:25:45 +00:00
iphydf
1859d0f44a
cleanup: Ensure we limit the system headers included in .h files.
Most system headers contain functions (e.g. `memcpy` in `string.h`)
which aren't needed in our own header files. For the most part, our own
headers should only include types needed to declare our own types and
functions. We now enforce this so we think twice about which headers we
really need in the .h files.
2022-02-04 20:54:37 +00:00
jfreegman
da4ef6481e
Add some toxav bounds/sanity checks 2022-01-31 14:46:08 -05:00
jfreegman
791fd01349
Make some non-const pointers const 2022-01-29 11:14:56 -05:00
jfreegman
ade11eb35d
Fix group av memory leak
Introduced in 762a601
2022-01-22 14:52:05 -05:00
jfreegman
762a6017f9
Refactor group audio packet data handling
We now malloc and free the data field separately. This increases
readability of the code and gets rid of static analyzer false
positives.
2022-01-17 19:01:51 -05:00
iphydf
7f94e411a9
chore: Add cpplint to the CI. 2022-01-17 23:42:38 +00:00
iphydf
f7557b4c16
cleanup: Even more pointer-to-const parameters.
I missed these the first time around.
2022-01-16 02:35:08 +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
4a2cb37e4b
fix: Fix some uninitialised memory errors found by valgrind and msan.
Also added a valgrind build to run it on every pull request. I've had to
disable a few tests because valgrind makes those run infinitely slowly,
consistently timing them out.
2022-01-13 20:15:21 +00:00
Maxim Biro
ce4b01df94
Fix the compiled out code too
Has the same double-unlock issue as the previous commit.

It also looks like rtp_free_msg() is gone and free() should be used
instead.
2022-01-12 10:49:33 -05:00
Maxim Biro
dbcfc8265e
Fix a double-unlocking mutex
Fixes #1694

Thanks to @ryancaicse for the pointer!
2022-01-12 10:49:30 -05:00
iphydf
cfb0aa8f25
cleanup: Remove extra parens around function arguments. 2022-01-12 07:02:29 +00:00
iphydf
c1b32bd7a1
chore: Enable compiler layering check.
This ensures that we're explicit about what we depend on and avoids
transitive dependencies.
2022-01-11 15:26:32 +00: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
53bd3c86df
Fix possible unintended negative loop bound 2022-01-01 16:01:29 -05:00
jfreegman
d8397c93c8
Put breaks inside case bracers 2021-12-25 12:30:39 -05:00
iphydf
24f49fc917
chore: Fix up a few source code comment and style issues.
Tokstyle no longer allows:
* Includes inside an `extern "C"`
* Comments on function definition and declaration to be different.
* Doxygen comments commenting on other doxygen comments.
2021-12-21 18:14:53 +00:00
iphydf
4746a8b3af
cleanup: Remove apidsl; remove crypto_memcmp.
* `crypto_memcmp` was replaced by more specific functions. We never want
  to compare arbitrary amounts of data this way. We use these functions
  to compare key material.
* apidsl has been bothering people, so now we un-bother them. You're
  welcome.
* Added the memlock/unlock functions from the New Group Chats branch.
* Remove some system dependencies in crypto_core_mem.c.
* Renamed UPPERCASE_NAMES to Snake_Camel_Case names.
2021-12-19 19:22:38 +00: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
5c53e6a30f
chore: Add autotools build; exempt crypto_pwhash from tokstyle. 2021-12-13 18:47:45 +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
30c939e4ab
cleanup: Fix some clang-tidy warnings and make them errors.
The android warnings are disabled now because they suggest using
linux-only extensions of libc. Useful for android indeed, but we're
targeting non-android and non-linux systems as well.
2021-12-10 15:21:27 +00:00
iphydf
d5fefc927e
cleanup: Require {} around all switch case label statements.
Except for single return-with-value statements.
2021-12-10 14:20:13 +00: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
jfreegman
00f2f41dbb
Use heap memory instead of stack for large variables
The default stack size for musl-libc is 128kb. Therefore we should try to keep stack
allocations well below this limit in order to avoid stack overflows.
2020-11-20 19:15:58 -05: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
iphydf
7b758f66db
Enable cimple tests by default but allow disabling them.
Use `bazel test //c-toxcore/... --build_tag_filters=-haskell` to run all
tests except the ones that depend on Haskell (i.e. cimple tests).
2020-05-03 14:03:54 +01:00
iphydf
2570ddcb17
Fix errors on error paths found by oomer.
* Use-after-free because we free network before dht in one case.
* Various unchecked allocs in tests (not so important).
* We used to not check whether ping arrays were actually allocated in DHT.
* `ping_kill` and `ping_array_kill` used to crash when passing NULL.

Also:
* Added an assert in all public API functions to ensure tox isn't NULL.
  The error message you get from that is a bit nicer than "Segmentation
  fault" when clients (or our tests) do things wrong.
* Decreased the sleep time in iterate_all_wait from 20ms to 5ms.
  Everything seems to still work with 5ms, and this greatly decreases
  the amount of time spent per test run, making oomer run much faster.
2020-05-02 21:47:08 +01:00
iphydf
c08b2fb3e2
Remove tokstyle exemptions from build files.
We put some tokstyle exemptions into the source files themselves,
instead. This way we can check some of the code in those files, and more
in the future when tokstyle supports more constructs (like apidsl).

Also: hacked ping_array.api.h to not emit `_array` as parameter names.
We'll need to fix apidsl to do this better. This works for now.
2020-04-16 11:05:08 +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
zoff99
bcbc374370
Fix 2 memory leaks in ToxAV. 2020-04-05 09:32:23 +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
zugz (tox)
52655b0c1b
clean groups code
* make static functions return bool rather than int to indicate success
* add peer_in_list() to factor out uniformity over peer and frozen lists
* reduce repetition in send_lossy_all_close
* rename 'close' to 'connections'
* use uint32_t for peernumber (in accord with tox.c)
* explain persistence in tox_conference_get_chatlist documentation
* clarify "connectedness" in group API documentation
* clarify that tox_conference_peer_count counts only online peers
* refactor variously
2020-03-15 00:00:27 +00:00