summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-08-16Limit the size of a save file in file_saving_test.iphydf
Limited to 4GiB. That ought to be enough for any save file.
2018-08-16Prune long long warnings.Leonid Bobrov
2018-08-15Fix possible resource leaks in testcrypto-universe
2018-08-14Fix style in toxav.c.iphydf
* 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-14Use `--config` to tell bazel about the environment.iphydf
Instead of importing a well-known file. This gives toktok-stack more freedom in where and how it wants to define its interface, as long as it provides the configurations requested ("linux" and "clang").
2018-08-13Avoid implicit conversion of negative value to uint32_t.iphydf
2018-08-13Fix ToxAv's use of `struct Tox`.iphydf
* 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-13Avoid passing -1 as friend connection to new groups.iphydf
Somehow it still works because the lower levels can deal with inconsistent/broken state, but this lets us avoid that broken state in the first place. If a friend connection doesn't exist, we don't add it to our group.
2018-08-13Fix style in video.c.iphydf
* 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-13Use tokstyle in the cmake travis build.iphydf
This checks that (some of) the code follows some simplicity and naming guidelines set by the tool.
2018-08-13Fix some printf format specifiers.iphydf
2018-08-13Fix memory leak in error path in group A/V.iphydf
This probably doesn't happen, but it can in theory, so we avoid it.
2018-08-13Fix groupav.c style and avoid casts in toxav_old.c.iphydf
* 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-12Fix coding style in rtp module.iphydf
* 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-12Temporarily disable FreeBSD build, since it times out.iphydf
2018-08-12Fix style in msi.c.iphydf
* 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-12Make `conferences_object` properly typed.iphydf
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-12add callback for successful connection to a conferencezugz (tox)
2018-08-12Fix enumerator names to comply with toxcore naming standards.iphydf
2018-08-12Avoid forward declaration of rtp structs.iphydf
Forward declarations are problematic, as they easily allow introducing cyclic dependencies.
2018-08-12Fix style in bwcontroller module.iphydf
* Comments in macros must be `//` style. * No inner structs. * Named callback types. * `++i` instead of `i++`. * No assignments as expressions.
2018-08-12Stop running tests in the bazel build.iphydf
These always fail at present. We'll need to look into making them not always fail so we can enable them and get some useful signal from them.
2018-08-12Move OSX to stage 1 of Travis.iphydf
This avoids its dependency on FreeBSD.
2018-08-12Add simple deterministic random number generator for testszugz (tox)
2018-08-12Assert that we don't divide by 0 in random_testing.cc.iphydf
This is always true due to the condition function, but if we introduce a bug that makes the condition not be applied, this causes undefined behaviour.
2018-08-12Fix a few warnings from clang.iphydf
Also remove the use of a VLA in a context where there can be unbounded memory allocations.
2018-08-12Check that the save file size isn't larger than our address space.iphydf
2018-08-12Remove all uses of the PAIR macro in toxav.iphydf
2018-08-12Remove last use of the `MIN` macro.iphydf
We use functions for this instead.
2018-08-11Add deprecation notice to some UPPER_CASE enums.iphydf
The enumerators won't change, but the type name will change in 0.3.0. Reasoning: - Type names in toxcore start with an uppercase letter and either have at least one lowercase letter in them, or are less than 4 characters long. - Constants consist of 4 or more uppercase letters or underscores. By these rules, "DHT" is a type name, but "TOX_USER_STATUS" is a constant. We provide Tox_User_Status as an alternative for now, and will switch to that in 0.3.0, removing the UPPER_CASE versions.
2018-08-11Split out conference type (text/av) from identifier.iphydf
2018-08-10Use the crypto random functions instead of `rand()`.iphydf
Presumably the uses of `rand()` were fine because they were not used in security-sensitive places, but having to think about whether a crappy RNG is acceptable in each situation requires effort that could better be spent elsewhere. Also, this means that once we have a custom deterministic RNG for testing, that RNG is used everywhere, so all the code is deterministic. It also allowed us to delete a system-specific function that wasn't used anywhere except in a call to `srand()`.
2018-08-09Fix typo in loop over assocs.zugz (tox)
2018-08-08Release 0.2.5Robin Lindén
2018-08-04Fix error message in m_send_generic_messageendoffile78
2018-08-04Remove unused `m_callback_log` function.iphydf
The logger callback can only be set once at the beginning, because it requires user data coming from `Tox_Options`.
2018-08-04Make a separate `struct Tox` containing the Messenger.iphydf
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-04Avoid multiple for-next expressions.iphydf
All for-loops in toxcore are of the form for (<for-init>; <for-cond>; <for-next>) { <body> } `for-init` can be a variable declaration (like `int i = 0`), an assignment (like `i = 0`), or empty. `for-cond` can be any expression. `for-next` can be an assignment or a single increment/decrement expression (like `++i` or `--i`). No other forms are allowed, so e.g. comma expressions in any of these are not allowed (so no `for (i = 0, j = n; ...; ++i, --j)`).
2018-08-02Fix problems with initial connections and name-setting in conferenceszugz
* test names in conference_test * raise error on attempt to invite friend to group before we are connected * revise handling of temporary invited connections We are now careful not to prematurely delete a connection to a peer established during the invitation process; namely, before we have sufficient other connections and have confirmed that we have an alternative route to the peer. * process out-of-order messages from a peer * don't reset names when handling a Peer Response
2018-07-30Fix autotools buildhugbubby
Mosts of the tests in auto_tests weren't running when the project was built using autotools. This fixes that.
2018-07-28Add `by_id` and `get_id` functions, renaming from `*_uid`.iphydf
`UID` sounds like `User ID`. While it is a Unique ID, the property of an "identifier" is generally that it identifies a unique thing, so the 'U' is redundant, and `GUID` as a globally unique id (which is likely also true for these IDs) has a specific meaning and syntax, so we're not using that. So, we just say conference `id`.
2018-07-28auto_test fixture and filenameshugbubby
Renamed a poorly named test, fixed up a few printf statements, substituted some unsigned integers with fixed size counterparts, and implemmented the auto_run_test.h fixture for the lossy and lossless packet tests.
2018-07-23More fixed_width ints and incorporating file_saving_test.chugbubby
The file_saving_test.c was not included in the cmake list and thus was ignored by travis and "make check". I found this out while introducing ck_assert_msg into the integration test. Furthermore, removed some variable width integers from encryptsave_test.c, and the SRunner utilization. Implemmented ck_assert_msg, reorganized some loops, and removed some longs in file_transfer_test.c.
2018-07-22Run Clang global static analysis on Travis.iphydf
This uses a single .cc file containing almost all the code in the repository to perform whole program analysis.
2018-07-21Avoid implementations in .h files or #including .c files.iphydf
Also, avoid the need for putting `_XOPEN_SOURCE` in every test file.
2018-07-21Remove redundant casts to the same type.iphydf
Also removed an unused identifier in messenger_test.c.
2018-07-21Add github usernames to TODOs.iphydf
2018-07-21Synchronise parameter names in headers with those in the implementation.iphydf
2018-07-21Reduce nesting by doing more early returns on error.iphydf
This almost entirely avoids any else-after-return in toxcore. One case is left, and that one is more readable this way. Why no else after return: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return Why exemptions exist: https://blog.mozilla.org/nnethercote/2009/08/31/no-else-after-return-considered-harmful/
2018-07-21Make `resize` in `list.c` return bool instead of 0/1.iphydf