summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--other/apidsl/README.md50
-rw-r--r--other/apidsl/tox.in.h8
-rw-r--r--other/astyle/README11
-rw-r--r--other/astyle/README.md32
-rw-r--r--toxcore/onion_client.c2
-rw-r--r--toxcore/tox.h11
7 files changed, 97 insertions, 23 deletions
diff --git a/README.md b/README.md
index 67a877c1..1844fbd5 100644
--- a/README.md
+++ b/README.md
@@ -3,8 +3,8 @@
3 3
4With the rise of governmental monitoring programs, Tox, a FOSS initiative, aims to be an easy to use, all-in-one communication platform that ensures their users full privacy and secure message delivery.<br /> <br /> 4With the rise of governmental monitoring programs, Tox, a FOSS initiative, aims to be an easy to use, all-in-one communication platform that ensures their users full privacy and secure message delivery.<br /> <br />
5 5
6[**Website**](https://tox.im) **|** [**Wiki**](https://wiki.tox.im/) **|** [**Blog**](https://blog.tox.im/) **|** [**FAQ**](https://wiki.tox.im/FAQ) **|** [**Binaries/Downloads**](https://wiki.tox.im/Binaries) **|** [**Clients**](https://wiki.tox.im/Client) **|** [**Compiling**](/INSTALL.md) **|** 6[**Website**](http://utox.org) **|** [**Wiki**](https://wiki.tox.im/) **|** [**Blog**](https://blog.tox.im/) **|** [**FAQ**](https://wiki.tox.im/FAQ) **|** [**Binaries/Downloads**](https://wiki.tox.im/Binaries) **|** [**Clients**](https://wiki.tox.im/Client) **|** [**Compiling**](/INSTALL.md) **|**
7[**API**](https://libtoxcore.so/) **|** [**Bugs**](http://tox.lighthouseapp.com/) **|** [**Help and Suggestions**](http://support.libtoxcore.so) **|** **IRC Channel:** [#tox@freenode](https://webchat.freenode.net/?channels=tox) 7[**API**](https://libtoxcore.so/) **|** **IRC Channel:** [#tox@freenode](https://webchat.freenode.net/?channels=tox)
8 8
9 9
10## The Complex Stuff: 10## The Complex Stuff:
@@ -39,5 +39,3 @@ The goal of this project is to create a configuration-free P2P Skype replacement
39- [Crypto](/docs/updates/Crypto.md)<br /> 39- [Crypto](/docs/updates/Crypto.md)<br />
40 40
41Additional developer documentation can be found at [Libtoxcore.so](https://libtoxcore.so/) 41Additional developer documentation can be found at [Libtoxcore.so](https://libtoxcore.so/)
42
43[String]: https://en.wikipedia.org/wiki/String_(computer_science)
diff --git a/other/apidsl/README.md b/other/apidsl/README.md
index 0b3e776d..c0f29ea4 100644
--- a/other/apidsl/README.md
+++ b/other/apidsl/README.md
@@ -1,11 +1,49 @@
1This folder contains the input file that can be used to generate the tox.h api 1This folder contains the input file (``tox.in.h``) that has to be used to generate the ``tox.h`` api with: https://github.com/iphydf/apidsl
2with: https://github.com/iphydf/apidsl
3 2
4You can also use the following command if you can't install it: 3# Minimal requirements
5 4
5There are some minimal requirements to contribute to ``tox.h``:
6* unix enrironment
7* ``astyle`` ``>=2.03``
8* [``apidsl``](https://github.com/iphydf/apidsl) (you can use provided service with curl instead)
9
10## Quick way
11
12If you want to do it quickly and you don't have time for anything other than copypasting commands, you should have ``curl`` installed.
13
14
151. Make sure that you have ``curl`` and ``>=astyle-2.03`` installed
162. Modify [``tox.in.h``](/other/apidsl/tox.in.h)
173. Run command below ↓
18
19Command to run from ``toxcore`` directory (quick way, involves using curl):
20```bash
21rm toxcore/tox.h && \
22( curl -X POST --data-binary @- https://criticism.herokuapp.com/apidsl < ./other/apidsl/tox.in.h > ./toxcore/tox.h ) && \
23astyle --options=./other/astyle/astylerc ./toxcore/tox.h
24```
25
26When formatting will be complete, you should see output like:
6``` 27```
7curl -X POST --data-binary @- https://criticism.herokuapp.com/apidsl < tox.in.h > tox.h 28Formatted ./toxcore/tox.h
29```
30
31You may want to make sure with ``git diff`` that changes made in ``tox.h`` reflect changes in ``tox.in.h``.
32
33And you're done.
34
35
36## Manually
37
38If you prefer to have more control over what is happening, there are steps below:
39
401. Install [``apidsl``](https://github.com/iphydf/apidsl)
412. Install ``astyle``, version 2.03 or later.
423. Modify [``tox.in.h``](/other/apidsl/tox.in.h)
434. Use ``apidsl`` ``??``
445. Parse generated ``tox.h`` with astyle, minimal command for it would be:
45```bash
46astyle --options=./other/astyle/astylerc ./toxcore/tox.h
8``` 47```
9 48
10Note that the output must be passed through astyle with the config in 49**Always pass output from ``apidsl`` through astyle.** \ No newline at end of file
11other/astyle/astylerc to generate the exact same file.
diff --git a/other/apidsl/tox.in.h b/other/apidsl/tox.in.h
index 493dd18e..4a0ab950 100644
--- a/other/apidsl/tox.in.h
+++ b/other/apidsl/tox.in.h
@@ -34,6 +34,14 @@ extern "C" {
34#endif 34#endif
35%} 35%}
36 36
37
38/*****************************************************************************
39 * `tox.h` SHOULD *NOT* BE EDITED MANUALLY – any changes should be made to *
40 * `tox.in.h`, located in `other/apidsl/`. For instructions on how to *
41 * generate `tox.h` from `tox.in.h` please refer to `other/apidsl/README.md` *
42 *****************************************************************************/
43
44
37/** \page core Public core API for Tox clients. 45/** \page core Public core API for Tox clients.
38 * 46 *
39 * Every function that can fail takes a function-specific error code pointer 47 * Every function that can fail takes a function-specific error code pointer
diff --git a/other/astyle/README b/other/astyle/README
deleted file mode 100644
index 26802ec7..00000000
--- a/other/astyle/README
+++ /dev/null
@@ -1,11 +0,0 @@
1This directory can house various tools and utilities.
2
3astylerc
4 - This file can be used in the precommit hook to try its best
5 at making the code conform to the coding style document.
6
7pre-commit (*NIX only at the moment)
8 - Lints your file in adherence to the coding style doucment as
9 best as possible in terms of spacing, indenting, etc.
10 - Requires you to have astyle installed.
11 - To use, copy this file to ProjectTox-Core/.git/hooks
diff --git a/other/astyle/README.md b/other/astyle/README.md
new file mode 100644
index 00000000..f68edf68
--- /dev/null
+++ b/other/astyle/README.md
@@ -0,0 +1,32 @@
1This directory can house various tools and utilities.
2
3# How to use astyle
4
5## Manually
6
7### For all files
8
9Run from ``toxcore`` directory:
10```bash
11astyle --options=./other/astyle/astylerc ./toxcore/*.c ./toxcore/*.h ./toxdns/*.c ./toxdns/*.h ./testing/*.c ./toxav/*.c ./toxav/*.h ./other/*.c ./other/bootstrap_daemon/*.c ./toxencryptsave/*.c ./toxencryptsave/*.h ./auto_tests/*.c
12```
13
14### For selected file
15
16Run from ``toxcore`` directory, e.g. for [``tox.h``](/toxcore/tox.h) file:
17```bash
18astyle --options=./other/astyle/astylerc ./toxcore/tox.h
19```
20
21
22## Automatically, as pre-commit hook (*NIX only)
23
24Copy [``astylerc``](/other/astyle/astylerc) to ``toxcore/.git/hooks``
25
26
27
28# Why
29
30``astylerc`` - this file can be used in the pre-commit hook to try its best at making the code conform to the coding style of toxcore.
31
32Furthermore, it is being used to format ``tox.h`` after using [``apidsl``](/other/apidsl) to generate it. \ No newline at end of file
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index 90eea451..4f049fbc 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -219,7 +219,7 @@ static _Bool path_timed_out(Onion_Client_Paths *onion_paths, uint32_t pathnum)
219 */ 219 */
220static int random_path(const Onion_Client *onion_c, Onion_Client_Paths *onion_paths, uint32_t pathnum, Onion_Path *path) 220static int random_path(const Onion_Client *onion_c, Onion_Client_Paths *onion_paths, uint32_t pathnum, Onion_Path *path)
221{ 221{
222 if (pathnum == ~0) { 222 if (pathnum == UINT32_MAX) {
223 pathnum = rand() % NUMBER_ONION_PATHS; 223 pathnum = rand() % NUMBER_ONION_PATHS;
224 } else { 224 } else {
225 pathnum = pathnum % NUMBER_ONION_PATHS; 225 pathnum = pathnum % NUMBER_ONION_PATHS;
diff --git a/toxcore/tox.h b/toxcore/tox.h
index 5af92c72..3b2da2f7 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -32,6 +32,15 @@
32extern "C" { 32extern "C" {
33#endif 33#endif
34 34
35
36/*******************************************************************************
37 * `tox.h` SHOULD *NOT* BE EDITED MANUALLY – any changes should be made to *
38 * `tox.in.h`, located in `other/apidsl/`. For instructions on how to *
39 * generate `tox.h` from `tox.in.h` please refer to `other/apidsl/README.md` *
40 ******************************************************************************/
41
42
43
35/** \page core Public core API for Tox clients. 44/** \page core Public core API for Tox clients.
36 * 45 *
37 * Every function that can fail takes a function-specific error code pointer 46 * Every function that can fail takes a function-specific error code pointer
@@ -454,7 +463,7 @@ struct Tox_Options {
454 * The port to use for the TCP server (relay). If 0, the TCP server is 463 * The port to use for the TCP server (relay). If 0, the TCP server is
455 * disabled. 464 * disabled.
456 * 465 *
457 * Enabling it is not required for Tox to function normally. 466 * Enabling it is not required for Tox to function properly.
458 * 467 *
459 * When enabled, your Tox instance can act as a TCP relay for other Tox 468 * When enabled, your Tox instance can act as a TCP relay for other Tox
460 * instance. This leads to increased traffic, thus when writing a client 469 * instance. This leads to increased traffic, thus when writing a client