Commit Graph

486 Commits

Author SHA1 Message Date
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
cb22b3df5f
Fix up comments a bit to start being more uniform.
Tokstyle (check-cimple) will start enforcing comment formats at some
point. It will not support arbitrary stuff in comments, and will parse
them. The result can then be semantically analysed.
2020-03-14 13:28:42 +00:00
iphydf
11ad5471b9
Use spdx license identifier instead of GPL blurb. 2020-03-14 13:06:19 +00:00
iphydf
e671490989
Use rules_cc instead of native cc_library rules. 2020-03-12 12:20:54 +00:00
iphydf
7b3d2eda3f
Use net_pack instead of casting bytes to ints.
The current code violates the C standard and causes crashes on strict
alignment architectures.
2020-03-06 11:05:52 +00:00
iphydf
e618829112
Add "cimple_test" to the bazel build. 2020-03-02 15:20:34 +00:00
iphydf
0f7138c010
Upgrade bazel to 2.1.1.
Removed av_test, because it depends on an ancient opencv that starts to
really not exist on modern systems anymore.
2020-03-02 14:23:44 +00:00
sudden6
683bc802e2
fix ToxAV threading documentation
ToxAV is not thread-safe at the moment, remove that claim from the
header file.
2020-01-02 11:58:52 +01:00
sudden6
abfd90d25b
fix log message creating data race 2019-11-21 23:47:03 +01: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
zugz (tox)
d14989f6df
put toxav.h stuff in toxav.api.h 2019-02-10 18:17:59 +01:00
zugz (tox)
695fa4373a
explain enabling in API comment 2019-02-10 00:00:00 +00:00
zugz (tox)
959f468eac
add API function to test whether av is enabled 2019-02-10 00:00:00 +00:00
zugz (tox)
49e2406ffa
Expose api functions for enabling and disabling AV in AV groups
A group loaded from a savefile starts with AV disabled.
2019-02-10 00:00:00 +00:00
zugz (tox)
a122ee9e01
Expose offline conference peers in API 2019-01-05 15:01:29 +00:00
iphydf
3e58f3cd4d
Improve Windows compatibility of toxav code.
- unistd.h doesn't exist on MSVC.
- `vpx_codec_iface_t` is already `const`, so adding `const` qualifiers is
  redundant and causes warnings on MSVC.
2018-10-08 22:22:58 +00:00
iphydf
bfd288c196
Revert "Improve cmake build for MSVC."
This reverts commit f87f8719d0.
2018-09-24 22:25:49 +00:00
iphydf
b694dbc223
Add Cirrus CI configuration.
This CI can run Bazel tests, because it supports IPv6. This is nice,
because now we can run IPv6 tests on every PR.
2018-09-24 22:00:17 +00:00
Mick Sayson
f87f8719d0
Improve cmake build for MSVC. 2018-09-22 11:14:45 +00: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
49bb43f662
Standardise header guards.
Using the full path including the repo name.
2018-09-14 19:09:10 +00:00
iphydf
7821cd8412
Use C++ style casts in C++ code. 2018-09-14 14:08:27 +00:00
iphydf
33c2f5138f
Always use the passed logger (from Messenger) in msi_kill. 2018-09-08 22:47:32 +00:00
iphydf
6872c14e1a
Avoid use of global mutable state in mono_time on win32.
This uses a trick to get read-write access to `this` from a `const`
member function, similar to C++ `mutable`, but uglier.
2018-09-03 20:03:47 +00:00
iphydf
473cde24d8
Update copyright to 2018. 2018-08-26 18:57:29 +00:00
iphydf
e99c13120f
Change while-loop to for-loop to express for-each-frame.
* Assignments can't be used as expressions, therefore `while` loops
  should not be used as a `for-each` construct. Use `for`, instead.
2018-08-25 20:39:24 +00:00
iphydf
7aa57afeba
Avoid redefining macros from different files. 2018-08-19 23:15:01 +00:00
zugz (tox)
14484c6879
make Mono_Time an argument to current_time_monotonic 2018-08-19 23:41:43 +02:00
iphydf
d6d305feeb
Use per-instance Mono_Time for Messenger and onion. 2018-08-16 21:01:43 +00:00
iphydf
c0db255425
Limit the size of a save file in file_saving_test.
Limited to 4GiB. That ought to be enough for any save file.
2018-08-16 10:15:01 +00:00
iphydf
475f01bc1a
Fix style in toxav.c.
* Use Camel_Snake_Case for type names.
* Use at least 4 characters for constant names. I.e. `END` is a type
  name, but `RETURN` is a constant name. This is because `DHT` is a type
  name (yay consistency).
* Using `min_*` functions instead of MIN, we can avoid a cast.
* Use `for`-loops for for-each-frame semantics instead of `while`.
* Don't use assignments as expressions.
* `++i` instead of `i++`.
* Function pointers are dereferenced automatically, so no need to
  manually do so.
* Avoid void pointers that lie about not being spaghetti code. Toxcore
  and toxav are both spaghetti and shouldn't pretend anything else.
* Don't use empty statements (e.g. no `;;` anywhere in the code).
2018-08-14 21:59:27 +00:00
iphydf
2d84681529
Fix ToxAv's use of struct Tox.
* Fix `toxav_get_tox` to return tox, not messenger.
* Fix the casts from Tox* to Messenger* in toxav_old.c.
* Pass Tox instead of Messenger to public group AV callbacks.
2018-08-13 22:11:48 +00:00
iphydf
c10d5ceeee
Fix style in video.c.
* Constant-style macros can't be function call expressions. These must be
  function calls themselves.
* Assignments can't be used as expressions.
  * Therefore: `while` loops should not be used as a `for-each`
    construct. Use `for`, instead.
2018-08-13 21:40:05 +00:00
iphydf
97a4b8e6a7
Fix memory leak in error path in group A/V.
This probably doesn't happen, but it can in theory, so we avoid it.
2018-08-13 10:45:21 +00:00
iphydf
d518374819
Fix groupav.c style and avoid casts in toxav_old.c.
* No anonymous structs.
* No assignment expressions.
* Only one declarator per struct member declaration.
* Named callback types only, no inline types.
* No `;` empty statements.
* `++i` instead of `i++`.

Avoiding a cast in toxav_old.c avoids some potential (and real) bugs.
2018-08-13 10:37:09 +00:00
iphydf
df9033dcb9
Fix coding style in rtp module.
* Named callback types only.
* No anonymous enums or structs.
* `++i` instead of `i++`.
* Don't use enums to specify integer constants. Enums should be
  enumerations. All values of an enum type should be listed[1].

[1] I don't know what to do about bit masks yet, but given that enums by
C standard can only go up to 32767 portably and 2^31 in reality, they are
probably not useful for 64 bit bit masks.
2018-08-12 23:32:59 +00:00
iphydf
04d894e7cc
Fix style in msi.c.
* Don't use anonymous enums (`typedef enum { ... } Name;`).
* Don't use macros to generate structs (too magical, hard to grep).
* Assign output parameter once, and don't access it a lot in the
  function body.
* Don't pass type names as parameters to macros (this is C, we don't have
  templates, sorry).
* All function-like macros must be do-while(0).
* `++i` instead of `i++`.
* No assignment-expressions.
* No void-casts.
2018-08-12 21:27:53 +00:00
iphydf
6d8d80b387
Make conferences_object properly typed.
The void pointer here only adds opportunity to introduce bugs and doesn't
actually make things more layered. It's just the code lying about being
layered while it's actually spaghetti.
2018-08-12 21:10:27 +00:00
iphydf
4ed6e59992
Fix enumerator names to comply with toxcore naming standards. 2018-08-12 20:07:18 +00:00
iphydf
767ccbb387
Avoid forward declaration of rtp structs.
Forward declarations are problematic, as they easily allow introducing
cyclic dependencies.
2018-08-12 19:54:27 +00:00
iphydf
b2590e2f44
Fix style in bwcontroller module.
* Comments in macros must be `//` style.
* No inner structs.
* Named callback types.
* `++i` instead of `i++`.
* No assignments as expressions.
2018-08-12 18:26:31 +00:00
iphydf
1de8b020cb
Remove all uses of the PAIR macro in toxav. 2018-08-12 11:38:23 +00:00
iphydf
5d15b5930d
Remove last use of the MIN macro.
We use functions for this instead.
2018-08-12 11:38:23 +00:00
iphydf
064ffe5875
Make a separate struct Tox containing the Messenger.
This allows Tox to contain additional data on top of Messenger, making
Messenger not necessarily the most top-level object. E.g. groups are
built on Messenger and currently awkwardly void-pointered into it to
pretend there is no cyclic dependency.
2018-08-04 09:29:15 +00:00
iphydf
f627a26a7b
Run Clang global static analysis on Travis.
This uses a single .cc file containing almost all the code in the
repository to perform whole program analysis.
2018-07-22 02:34:30 +00:00
iphydf
7c2b95ef5e
Remove redundant casts to the same type.
Also removed an unused identifier in messenger_test.c.
2018-07-21 15:09:39 +00:00
iphydf
adb12d5340
Add github usernames to TODOs. 2018-07-21 14:56:21 +00:00