diff --git a/other/analysis/gen-file.sh b/other/analysis/gen-file.sh index 019bd8f9..ad8df3b8 100644 --- a/other/analysis/gen-file.sh +++ b/other/analysis/gen-file.sh @@ -17,20 +17,20 @@ put() { if [ "$SKIP_LINES" = "" ]; then echo "#line 1 \"$1\"" >> amalgamation.cc fi - cat $1 >> amalgamation.cc + cat "$1" >> amalgamation.cc } putmain() { - echo "namespace $(echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g') {" >> amalgamation.cc + echo "namespace $(echo "$1" | sed -e 's/[^a-zA-Z0-9_]/_/g') {" >> amalgamation.cc if [ "$SKIP_LINES" = "" ]; then echo "#line 1 \"$1\"" >> amalgamation.cc fi - sed -e 's/^int main(/static &/' $1 >> amalgamation.cc - echo "} // namespace $(echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g')" >> amalgamation.cc + sed -e 's/^int main(/static &/' "$1" >> amalgamation.cc + echo "} // namespace $(echo "$1" | sed -e 's/[^a-zA-Z0-9_]/_/g')" >> amalgamation.cc } callmain() { - echo " call($(echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g')::main, argc, argv);" >> amalgamation.cc + echo " call($(echo "$1" | sed -e 's/[^a-zA-Z0-9_]/_/g')::main, argc, argv);" >> amalgamation.cc } :> amalgamation.cc @@ -53,25 +53,32 @@ FIND_QUERY="$FIND_QUERY -and -not -name av_test.c" FIND_QUERY="$FIND_QUERY -and -not -name dht_test.c" FIND_QUERY="$FIND_QUERY -and -not -name version_test.c" -for i in $(eval $FIND_QUERY); do - if ! grep -q '^int main(' $i; then - put $i +(for i in $(eval "$FIND_QUERY"); do + grep -o '#include <[^>]*>' "$i" \ + | grep -E -v '|> amalgamation.cc + +echo 'namespace {' >> amalgamation.cc +for i in $(eval "$FIND_QUERY"); do + if ! grep -q '^int main(' "$i"; then + put "$i" fi done -for i in $(eval $FIND_QUERY); do - if grep -q '^int main(' $i; then - putmain $i +for i in $(eval "$FIND_QUERY"); do + if grep -q '^int main(' "$i"; then + putmain "$i" fi done echo "static void call(int m(), int argc, char **argv) { m(); }" >> amalgamation.cc echo "static void call(int m(int, char **), int argc, char **argv) { m(argc, argv); }" >> amalgamation.cc +echo '} // namespace' >> amalgamation.cc echo "int main(int argc, char **argv) {" >> amalgamation.cc -for i in $(eval $FIND_QUERY); do - if grep -q '^int main(' $i; then - callmain $i +for i in $(eval "$FIND_QUERY"); do + if grep -q '^int main(' "$i"; then + callmain "$i" fi done echo " return 0;" >> amalgamation.cc diff --git a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 index 5287541b..4d02d38f 100644 --- a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 +++ b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 @@ -1 +1 @@ -e7b6d31485b5e1561659be08f3e3ef003cef186042d7e0fe2ef48cf341932b5a /usr/local/bin/tox-bootstrapd +89df21d6a19a1b6652db5b7e6e9f65ad5f8be8abdca9f58645548b9e0c9383e3 /usr/local/bin/tox-bootstrapd diff --git a/other/cpufeatures.c b/other/cpufeatures.c index 3da06e58..38c97059 100644 --- a/other/cpufeatures.c +++ b/other/cpufeatures.c @@ -3,4 +3,4 @@ #include ANDROID_CPU_FEATURES #endif -extern int unused_declaration; +typedef int unused_declaration; diff --git a/testing/DHT_test.c b/testing/DHT_test.c index 8ba61ec2..5f28eb99 100644 --- a/testing/DHT_test.c +++ b/testing/DHT_test.c @@ -17,6 +17,7 @@ #define _XOPEN_SOURCE 600 #endif +#include #include #include #include diff --git a/toxcore/LAN_discovery.api.h b/toxcore/LAN_discovery.api.h index 5c25b67b..ad3d60ed 100644 --- a/toxcore/LAN_discovery.api.h +++ b/toxcore/LAN_discovery.api.h @@ -21,7 +21,7 @@ namespace lan_discovery { /** * Interval in seconds between LAN discovery packet sending. */ -const INTERVAL = 10; +#define LAN_DISCOVERY_INTERVAL 10 /** * Send a LAN discovery pcaket to the broadcast address with port port. diff --git a/toxcore/LAN_discovery.h b/toxcore/LAN_discovery.h index 7e049b99..6b55e319 100644 --- a/toxcore/LAN_discovery.h +++ b/toxcore/LAN_discovery.h @@ -26,8 +26,6 @@ typedef struct IP IP; */ #define LAN_DISCOVERY_INTERVAL 10 -uint32_t lan_discovery_interval(void); - /** * Send a LAN discovery pcaket to the broadcast address with port port. */ diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 82c31147..556acc27 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -1450,38 +1450,6 @@ int file_data(const Messenger *m, int32_t friendnumber, uint32_t filenumber, uin return -6; } -/* Give the number of bytes left to be sent/received. - * - * send_receive is 0 if we want the sending files, 1 if we want the receiving. - * - * return number of bytes remaining to be sent/received on success - * return 0 on failure - */ -uint64_t file_dataremaining(const Messenger *m, int32_t friendnumber, uint8_t filenumber, uint8_t send_receive) -{ - if (!friend_is_valid(m, friendnumber)) { - return 0; - } - - const struct File_Transfers *const sending = &m->friendlist[friendnumber].file_sending[filenumber]; - - if (send_receive == 0) { - if (sending->status == FILESTATUS_NONE) { - return 0; - } - - return sending->size - sending->transferred; - } - - const struct File_Transfers *const receiving = &m->friendlist[friendnumber].file_receiving[filenumber]; - - if (receiving->status == FILESTATUS_NONE) { - return 0; - } - - return receiving->size - receiving->transferred; -} - /** * Iterate over all file transfers and request chunks (from the client) for each * of them. diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 74c19e09..31526b63 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h @@ -651,15 +651,6 @@ int file_seek(const Messenger *m, int32_t friendnumber, uint32_t filenumber, uin int file_data(const Messenger *m, int32_t friendnumber, uint32_t filenumber, uint64_t position, const uint8_t *data, uint16_t length); -/* Give the number of bytes left to be sent/received. - * - * send_receive is 0 if we want the sending files, 1 if we want the receiving. - * - * return number of bytes remaining to be sent/received on success - * return 0 on failure - */ -uint64_t file_dataremaining(const Messenger *m, int32_t friendnumber, uint8_t filenumber, uint8_t send_receive); - /** A/V related */ /* Set the callback for msi packets. diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c index 403e0872..2fa4750f 100644 --- a/toxcore/crypto_core.c +++ b/toxcore/crypto_core.c @@ -12,11 +12,12 @@ #include "config.h" #endif +#include "crypto_core.h" + #include #include #include "ccompat.h" -#include "crypto_core.h" #ifndef VANILLA_NACL /* We use libsodium by default. */ diff --git a/toxcore/group.c b/toxcore/group.c index 3e04f181..a946e7b8 100644 --- a/toxcore/group.c +++ b/toxcore/group.c @@ -1301,36 +1301,6 @@ int group_set_max_frozen(const Group_Chats *g_c, uint32_t groupnumber, uint32_t return 0; } -/* List all the (frozen, if frozen is true) peers in the group chat. - * - * Copies the names of the peers to the `name[length][MAX_NAME_LENGTH]` array. - * - * Copies the lengths of the names to `lengths[length]` - * - * returns the number of peers on success. - * - * return -1 on failure. - */ -int group_names(const Group_Chats *g_c, uint32_t groupnumber, uint8_t names[][MAX_NAME_LENGTH], uint16_t lengths[], - uint16_t length, bool frozen) -{ - const Group_c *g = get_group_c(g_c, groupnumber); - - if (!g) { - return -1; - } - - const uint32_t num = frozen ? g->numfrozen : g->numpeers; - - unsigned int i; - - for (i = 0; i < num && i < length; ++i) { - lengths[i] = group_peername(g_c, groupnumber, i, names[i], frozen); - } - - return i; -} - /* Return the number of (frozen, if frozen is true) peers in the group chat on * success. * return -1 if groupnumber is invalid. diff --git a/toxcore/group.h b/toxcore/group.h index 1e054de3..eb8db55f 100644 --- a/toxcore/group.h +++ b/toxcore/group.h @@ -355,19 +355,6 @@ int group_number_peers(const Group_Chats *g_c, uint32_t groupnumber, bool frozen */ int group_peernumber_is_ours(const Group_Chats *g_c, uint32_t groupnumber, uint32_t peernumber); -/* List all the (frozen, if frozen is true) peers in the group chat. - * - * Copies the names of the peers to the `name[length][MAX_NAME_LENGTH]` array. - * - * Copies the lengths of the names to `lengths[length]` - * - * returns the number of peers on success. - * - * return -1 on failure. - */ -int group_names(const Group_Chats *g_c, uint32_t groupnumber, uint8_t names[][MAX_NAME_LENGTH], uint16_t lengths[], - uint16_t length, bool frozen); - /* Set handlers for custom lossy packets. */ void group_lossy_packet_registerhandler(Group_Chats *g_c, uint8_t byte, lossy_packet_cb *function); diff --git a/toxcore/list.c b/toxcore/list.c index cb3c71cc..fca8cea8 100644 --- a/toxcore/list.c +++ b/toxcore/list.c @@ -248,13 +248,3 @@ int bs_list_remove(BS_List *list, const uint8_t *data, int id) return 1; } - -int bs_list_trim(BS_List *list) -{ - if (!resize(list, list->n)) { - return 0; - } - - list->capacity = list->n; - return 1; -} diff --git a/toxcore/list.h b/toxcore/list.h index 9d65b53f..afe4240b 100644 --- a/toxcore/list.h +++ b/toxcore/list.h @@ -57,12 +57,4 @@ int bs_list_add(BS_List *list, const uint8_t *data, int id); */ int bs_list_remove(BS_List *list, const uint8_t *data, int id); -/* Removes the memory overhead - * - * return value: - * 1 : success - * 0 : failure - */ -int bs_list_trim(BS_List *list); - #endif diff --git a/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c b/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c index 7f015238..38a536a6 100644 --- a/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +++ b/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c @@ -398,4 +398,4 @@ escrypt_kdf_sse(escrypt_local_t * local, #endif /* ISO C requires a translation unit to contain at least one declaration */ -extern int non_empty_tu_decl; +typedef int non_empty_tu_decl;