Age | Commit message (Collapse) | Author |
|
* Removed `ARRAY_SIZE` and use NULL markers for end of array, instead.
The alternative is + size, but for these arrays, NULL markers made
sense, since they are arrays of non-null pointers.
* Made `INDEX_OF_PK` a self-contained macro, not dependent upon the
naming inside its call site. This is a minor change but makes the code
more local and reviews easier.
* No nested structs.
* Use only named function types ending in `_cb` for callbacks.
* Replaced two macros with functions.
* `++i` instead of `i++`.
* struct member names start with lowercase letters.
* It takes a bit of work to support `/**/` comments in preprocessor
macros, so I've decided not to support these. If a macro is complex
enough to need comments inside it, it's too complex. `//` comments are
allowed at the end of macro definitions.
* Callback typedefs must name their parameters.
|
|
* Enums must by typedef'd.
* Comments at end of `#define` must be `//` comments.
* Typedef structs must not be anonymous.
* `;` at the end of a `#define` is invalid.
* Callback typedefs must list their parameter names.
* No nested structs.
* No inline use of function pointer types. Only typedef'd callback types
are allowed.
* Enum types are spelled in Camelsnake_Case.
* The argument to `#error` must be a string literal.
|
|
It turns out, `unix_time` is also monotonic, and is used as such, so I've
renamed the new functions to `mono_time_*`.
2018-07-08:
```
00:01 <@irungentoo> the idea used to be that the unix_time() function
could go backward in time but I think I might have started using it like
if it could not after I changed it so that it would never go back in time
```
|
|
These are not used in a thread-safe way, but it opens the path towards
per-tox-instance time keeping and removal of some unsafe global state.
|
|
|
|
Also:
* compound statements (blocks, e.g. in if/else) must be non-empty.
Comments don't count.
* `=` is not allowed in subexpressions. We treat it as statement-only.
* `++i` is preferred over `i++` in statements.
* `Type_Names` are camelsnake-case.
|
|
Also:
* `#define` must be scoped. If it's used outside a scope, it must be
defined outside that scope (global `#define` does not need a matching
`#undef`).
|
|
|
|
`BS_LIST` would be a constant. `BS_List` is a type name.
|
|
This is now a style rule: you can only use typedef'd function types.
Previous rules now applied in `onion_*.c`:
* `struct`s must have a name (typedef of unnamed struct is not allowed).
* `++i` for increment-stmt, not `i++`, e.g. in loops.
* Only a single declarator per struct member declaration.
* Type_Names vs. variable_names.
|
|
Also:
* No inner structs.
* One declarator per member declaration.
* Function names are snake_case.
* Names ending in `_cb` are function types.
* `++i` is preferred over `i++`.
|
|
We used to pass the actual peer numbers of peers leaving, but we no
longer know these in the PGC world, so we don't pass them anymore.
|
|
Rules:
1. Constants are uppercase names: THE_CONSTANT.
2. SUE[1] types start with an uppercase letter and have at least one
lowercase letter in it: The_Type, THE_Type.
3. Function types end in "_cb": tox_friend_connection_cb.
4. Variable and function names are all lowercase: the_function.
This makes it easier for humans reading the code to determine what an
identifier means. I'm not convinced by the enum type name change, but I
don't know a better rule. Currently, a lot of enum types are spelled like
constants, which is confusing.
[1] struct/union/enum
|
|
Have one script per build. This means more duplication between the
scripts, but it's much easier to understand and to run locally.
|
|
|
|
|
|
* Consistently use `num_packets_array` to get the packet count in the
packet buffer.
* Use `const` in more places.
* Typo fix: begginning.
* Rewrite `length < 1` for unsigned int to `length == 0`.
* Limit scope of some loop variables by using for-init-decl.
* Use early return in error paths to reduce indentation and for clarity.
* Use `net_unpack_*` instead of manual `ntohs`.
* Fix an uninitialised stack variable copy.
* Fix a potential null pointer dereference.
* Consistently use `get_crypto_connection`. It was inlined in some
places. I de-inlined it now.
* Add Loggers to some functions in preparation for adding log statements.
|
|
|
|
Rename args `host:port` from `address:port`.
The *address* is well known as *Tox Address* in this project. Then we
should reserve *addres* to it, and use *host* to express the hostname or
IP address in TCP domain.
|
|
|
|
Fixes #946.
|
|
`clang-format -style='{BasedOnStyle: Google, ColumnLimit: 100}'`
|
|
This one has ASAN enabled, unlike Travis.
|
|
In preparation for adding log statements.
Also, fix an uninitialised variable warning in cppcheck.
|
|
Currently, toxcore does not support UDP over proxies. In the future, we
can relax this by disabling UDP only if the proxy doesn't support it.
|
|
I.e. make tox_new(0, 0) behave the same as tox_new(tox_options_new(0), 0).
Changing defaults in the options does not currently affect NULL options.
|
|
It was a list of #defines, but clearly this is a discrete and limited set
of named values, so an enum is more appropriate.
|
|
|
|
|
|
Fixes #900.
|
|
|
|
|
|
|
|
Fixes #868
Is made by:
1. Fix enumeration mechanism of Crypto_Connection instances in function send_crypto_packets()
(this item solves the main problem);
2. Disruption of correlation between parameters of different dimensions
(the parameters MAX_NUM_SENDPACKET_TRIES and UDP_DIRECT_TIMEOUT have different dimensions).
|
|
The Family stuff in toxcore is a big mess. I'm sure I saw a bunch of bugs
on the way, but I'm not verifying that code now, so the bugs stay.
|
|
|
|
|
|
Windows doesn't report network errors though errno, it has its own facilities.
|
|
|
|
|
|
We control the random functions in crypto_core, so we can make them
deterministic more easily. This will help test reproducibility in the
future.
|
|
|
|
|
|
This is useful for debugging a function that doesn't have a logger
available. It should not be used in production code, since it outputs to
stderr.
|
|
|
|
It's not supported in mingw.
See https://github.com/TokTok/c-toxcore/issues/786.
|
|
|
|
|
|
|
|
By increasing a magic number.. Also, added more verbose logging to the
file transfer test.
|