summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-09-06Improve static and const correctness.iphydf
- Any non-externally-visible declarations should be `static`. - Casting away the `const` qualifier from pointers-to-const is dangerous. All but one instance of this are now correct. The one instance where we can't keep `const` is one where toxav code actually writes to a chunk of memory marked as `const`. This code also assumes 4 byte alignment of data packets. I don't know whether that is a valid assumption, but it's likely unportable, and *not* obviously correct. - Replaced empty parameter lists with `(void)` to avoid passing parameters to it. Empty parameter lists are old style declarations for unknown number and type of arguments. - Commented out (as `#if DHT_HARDENING` block) the hardening code that was never executed. - Minor style fix: don't use `default` in enum-switches unless the number of enumerators in the default case is very large. In this case, it was 2, so we want to list them both explicitly to be warned about missing one if we add one in the future. - Removed the only two function declarations from nTox.h and put them into nTox.c. They are not used outside and nTox is not a library.
2016-09-06Merge remote-tracking branch 'irungentoo/master' into merge-iruiphydf
2016-09-06Improve C standard compliance.iphydf
- Don't cast between object and function pointers. - Use standard compliant `__VA_ARGS__` in macros. - Add explicit `__extension__` on unnamed union in struct (it's a GNU extension). - Remove ; after function definitions. - Replace `const T foo = 3;` for integral types `T` with `enum { foo = 3 };`. Folding integral constants like that as compile time constants is a GNU extension. Arrays allocated with `foo` as dimension are VLAs on strictly compliant C99 compilers. - Replace empty initialiser list `{}` with zero-initialiser-list `{0}`. The former is a GNU extension meaning the latter. - Cast `T*` (where `T != void`) to `void *` in format arguments. While any object pointer can be implicitly converted to and from `void *`, this conversion does not happen in variadic function calls. - Replace arithmetic on `void *` with arithmetic on `char *`. The former is non-compliant. - Replace non-`int`-derived types (like `uint16_t`, which is `short`-derived) in bit fields with `int`-derived types. Using any type other than `int` or `unsigned int` (or any of their aliases) in bit fields is a GNU extension.
2016-09-06Make friend requests statelessGregory Mullen (grayhatter)
Messenger is slightly twisty when it comes to sending connection status callbacks It will very likely need at the very least a partial refactor to clean it up a bit. Toxcore shouldn't need void *userdata as deep as is currently does. (amend 1) Because of the nature of toxcore connection callbacks, I decided to change this commit from statelessness for connections changes to statelessness for friend requests. It's simpler this was and doesn't include doing anything foolish in the time between commits. group fixup because grayhatter doesn't want to do it "arguably correct" is not how you write security sensitive code Clear a compiler warning about types within a function.
2016-09-05Fixed bug.irungentoo
2016-09-06Allocate sizeof(IP_ADAPTER_INFO) bytes instead of sizeof(T*).iphydf
https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365917(v=vs.85).aspx shows an example use of GetAdaptersInfo that does it this way.
2016-09-05Make packet data a ptr-to-const.iphydf
Ensure that nobody inadvertly modifies the temporary packet data buffer.
2016-09-05Add TODO for @mannol.iphydf
2016-09-03Rearrange fields to decrease size of structureisotoxin
2016-09-02Add a short sleep before each tox_iterate in av test.iphydf
A race condition that happens on machines with heavily used network interfaces causes tests to fail. Packets sent don't arrive on time. This sleep gives it 100 extra milliseconds. The real fix would be to wait for the event to occur and then continue, but with a "once-loop" that is tox_iterate, it's not feasible at this time.
2016-09-02Re-enable group chat tests.iphydf
They don't seem to be a lot less stable than the rest. Either way we regularly need to restart builds to make timeouts go away.
2016-09-02Do not use `else` after `return`.iphydf
http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
2016-09-02Replace pthread_yield with sched_yield.iphydf
The former is a non-standard glibc extension. On linux, it is implemented as a call to sched_yield, so this change does nothing there. On OSX, pthread_yield doesn't exist, and we already use sched_yield.
2016-09-01Remove useless casts.iphydf
These casts are either completely useless (casting T to T) or implicit (x = y).
2016-09-01Sort #includes in all source files.iphydf
2016-09-01Add missing #include <pthread.h> to av_test.c.iphydf
It was an undefined function before.
2016-09-01Match parameter names in declarations with their definitions.iphydf
The parameter names were taken from function definitions to update the names in function declarations (prototypes).
2016-08-31Remove redundant `return` statements.iphydf
2016-08-31Add newlines because astyle wants them.iphydf
We'll revert this once we move to clang-format.
2016-08-31Add braces to all if statements.iphydf
2016-08-31Enable build of av_test.iphydf
It has not been built in a while. We do want to keep this one working (or at least compiling).
2016-08-31Remove unused and bit-rotten friends_test.iphydf
2016-08-30Add missing #includes to headers and rename tox_old to tox_group.iphydf
Also, no longer #include the group code into tox.c. Instead, compile it separately in tox_group.c. This is a bit less surprising to someone looking around the code. Having some implementations in a .h file is certainly a bit surprising to a disciplined C programmer, especially when there is no technical reason to do it.
2016-08-29Add getters/setters for options.iphydf
2016-08-29Update tox.h with constant functions.iphydf
These are now generated by apidsl.
2016-08-28Expose constants as functions.iphydf
These functions simply return the constants. They are a stable ABI, so that if constants change, the ABI of these functions won't. Code solely relying on these functions will remain compatible with future values of those constants. The functions are currently not exposed in tox.h, because this is pending a change in apidsl to generate accessors for "const" values.
2016-08-27Move logging to a callback.iphydf
This removes the global logger (which by the way was deleted when the first tox was killed, so other toxes would then stop logging). Various bits of the code now carry a logger or pass it around. It's a bit less transparent now, but now there is no need to have a global logger, and clients can decide what to log and where.
2016-08-26Fix plane size calculation in testmannol
2016-08-26Avoid large stack allocations on thread stacks.iphydf
OS X and Windows have small thread stacks by default. Allocating audio and video frames (about 962KB total) on the stack overflows it.
2016-08-26Comment out useless TODO'd if block.iphydf
The condition is a potential use after free, because `connection_kill` before it will delete the `conn` that is dereferenced.
2016-08-26Initialise the id in assoc_test.iphydf
Once every new moon, the assoc_test would fail because the key is 0. It can be anything but 0 to succeed, so I made it 1.
2016-08-25Reduce the timeout on travis to something much more reasonableGregory Mullen (grayhatter)
10x timeouts forces travis to kill our build without offering anything helpful
2016-08-24Add cmake test for apidsl.iphydf
2016-08-22Replace uint with unsigned int in assoc.c.iphydf
uint is not a valid type on Windows. It's also not a valid type in C, but Linux and OSX define it somewhere. We can't rely on its existence.
2016-08-22Make Message received receipts statelessGregory Mullen (grayhatter)
2016-08-22Make Friend User Status statelessGregory Mullen (grayhatter)
2016-08-21Fix windows build.iphydf
The threading networking functions (on windows: winsock and friends) need to be linked into the toxnetwork library, not the toxcore library, anymore. On Linux and OSX, there is no winsock. On OSX, there is no need to link against threading libraries, and on Linux, toxnetwork can have unresolved symbols when linking, so this failure wasn't caught before. Tested by building on the iphydf/windows-x86-qt5 docker image.
2016-08-20docs(INSTALL.md): update instructions for GentooZetok Zalbavar
2016-08-20Make the friend message callback statelessGregory Mullen (grayhatter)
2016-08-20Build assoc DHT code on travis.iphydf
2016-08-20Add format-source script.iphydf
This is easier to use from a precommit hook, so it can be used to ensure that all formatting is correct before committing code.
2016-08-19Make Typing change callback statelessGregory Mullen (grayhatter)
Moved a few #defines to the top of the header for better readability
2016-08-19Fix operation sequencing in TCP_test.iphydf
The expression was fun(foo = bar, foo). The evaluation order is unspecified, and often this will do the wrong thing. We should forbid side effects in argument lists and conditionals.
2016-08-18Make friend_status_message callback stateless.iphydf
See #40 for details.
2016-08-18Fix some compiler warnings.iphydf
2016-08-18Allow NULL as argument to tox_kill.iphydf
This behaviour is consistent with free() and operator delete.
2016-08-18Make tox_callback_friend_name stateless.iphydf
See #27 and #40 for details.
2016-08-17Add missing DHT_bootstrap to CMakeLists.txt.iphydf
- This PR also adds a DEBUG cmake option that enables -DTOX_DEBUG. - We also remove `-Wall`, because there are too many warnings, and nobody really looks at them at the moment. We'll see about fixing them soon. We'll also want to enable `-Werror` at some point. - Finally, this PR enables `-O3` to make sure toxcore still works correctly under heavy compiler optimisations.
2016-08-17Try searching for libsodium with pkg-config in ./configure.iphydf
If libsodium can't be found with PKG_CHECK_MODULES, try AC_CHECK_LIB. If that also fails, abort configure. If a user passes --with-libsodium-libs explicitly, that overrides the pkg-config found location.
2016-08-17Merge remote-tracking branch 'irungentoo/master'iphydf