mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
cleanup: Remove extra parens around function arguments.
This commit is contained in:
parent
c1b32bd7a1
commit
cfb0aa8f25
|
@ -29,22 +29,22 @@ put() {
|
|||
}
|
||||
|
||||
putmain() {
|
||||
echo "namespace ${1//[^a-zA-Z0-9_]/_} {" >>amalgamation.cc
|
||||
NS=$(echo "${1//[^a-zA-Z0-9_]/_}" | sed -e 's/^__*//')
|
||||
echo "namespace $NS {" >>amalgamation.cc
|
||||
if [ "$SKIP_LINES" = "" ]; then
|
||||
echo "#line 1 \"$1\"" >>amalgamation.cc
|
||||
fi
|
||||
sed -e 's/^int main(/static &/' "$1" >>amalgamation.cc
|
||||
echo "} // namespace ${1//[^a-zA-Z0-9_]/_}" >>amalgamation.cc
|
||||
echo "} // namespace $NS" >>amalgamation.cc
|
||||
}
|
||||
|
||||
callmain() {
|
||||
echo " call(${1//[^a-zA-Z0-9_]/_}::main, argc, argv);" >>amalgamation.cc
|
||||
NS=$(echo "${1//[^a-zA-Z0-9_]/_}" | sed -e 's/^__*//')
|
||||
echo " call($NS::main, argc, argv);" >>amalgamation.cc
|
||||
}
|
||||
|
||||
: >amalgamation.cc
|
||||
|
||||
put auto_tests/check_compat.h
|
||||
|
||||
# Include all C and C++ code
|
||||
FIND_QUERY="find . '-(' -name '*.c' -or -name '*.cc' '-)'"
|
||||
# Excludes
|
||||
|
@ -52,6 +52,7 @@ FIND_QUERY="$FIND_QUERY -and -not -wholename './_build/*'"
|
|||
FIND_QUERY="$FIND_QUERY -and -not -wholename './super_donators/*'"
|
||||
FIND_QUERY="$FIND_QUERY -and -not -name amalgamation.cc"
|
||||
FIND_QUERY="$FIND_QUERY -and -not -name av_test.c"
|
||||
FIND_QUERY="$FIND_QUERY -and -not -name cracker.c"
|
||||
FIND_QUERY="$FIND_QUERY -and -not -name dht_test.c"
|
||||
FIND_QUERY="$FIND_QUERY -and -not -name trace.cc"
|
||||
FIND_QUERY="$FIND_QUERY -and -not -name version_test.c"
|
||||
|
@ -64,6 +65,8 @@ readarray -t FILES <<<"$(eval "$FIND_QUERY")"
|
|||
grep -E -v '<win|<ws|<iphlp|<libc|<mach/|<crypto_|<randombytes|<u.h>|<sys/filio|<stropts.h>|<linux'
|
||||
done) | sort -u >>amalgamation.cc
|
||||
|
||||
put auto_tests/check_compat.h
|
||||
|
||||
echo 'namespace {' >>amalgamation.cc
|
||||
for i in "${FILES[@]}"; do
|
||||
if ! grep -q '^int main(' "$i"; then
|
||||
|
|
|
@ -136,7 +136,7 @@ static void send_update(BWController *bwc)
|
|||
if (bwc->cycle.lost) {
|
||||
LOGGER_DEBUG(bwc->m->log, "%p Sent update rcv: %u lost: %u percent: %f %%",
|
||||
(void *)bwc, bwc->cycle.recv, bwc->cycle.lost,
|
||||
(((double) bwc->cycle.lost / (bwc->cycle.recv + bwc->cycle.lost)) * 100.0));
|
||||
((double)bwc->cycle.lost / (bwc->cycle.recv + bwc->cycle.lost)) * 100.0);
|
||||
uint8_t bwc_packet[sizeof(struct BWCMessage) + 1];
|
||||
size_t offset = 0;
|
||||
|
||||
|
@ -178,9 +178,9 @@ static int on_update(BWController *bwc, const struct BWCMessage *msg)
|
|||
|
||||
if (lost && bwc->mcb) {
|
||||
LOGGER_DEBUG(bwc->m->log, "recved: %u lost: %u percentage: %f %%", recv, lost,
|
||||
(((double) lost / (recv + lost)) * 100.0));
|
||||
((double)lost / (recv + lost)) * 100.0);
|
||||
bwc->mcb(bwc, bwc->friend_number,
|
||||
((float) lost / (recv + lost)),
|
||||
(float)lost / (recv + lost),
|
||||
bwc->mcb_user_data);
|
||||
}
|
||||
|
||||
|
|
|
@ -320,7 +320,7 @@ static void update_bwc_values(const Logger *log, RTPSession *session, const stru
|
|||
|
||||
if (received_length_full < data_length_full) {
|
||||
LOGGER_DEBUG(log, "BWC: full length=%u received length=%d", data_length_full, received_length_full);
|
||||
bwc_add_lost(session->bwc, (data_length_full - received_length_full));
|
||||
bwc_add_lost(session->bwc, data_length_full - received_length_full);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ static int handle_rtp_packet(Messenger *m, uint32_t friendnumber, const uint8_t
|
|||
return -1;
|
||||
}
|
||||
|
||||
LOGGER_DEBUG(m->log, "header.pt %d, video %d", (uint8_t)header.pt, (RTP_TYPE_VIDEO % 128));
|
||||
LOGGER_DEBUG(m->log, "header.pt %d, video %d", (uint8_t)header.pt, RTP_TYPE_VIDEO % 128);
|
||||
|
||||
// The sender uses the new large-frame capable protocol and is sending a
|
||||
// video packet.
|
||||
|
|
|
@ -932,7 +932,7 @@ void do_friend_connections(Friend_Connections *fr_c, void *userdata)
|
|||
if (friend_con->dht_lock) {
|
||||
if (friend_new_connection(fr_c, i) == 0) {
|
||||
set_direct_ip_port(fr_c->net_crypto, friend_con->crypt_connection_id, friend_con->dht_ip_port, 0);
|
||||
connect_to_saved_tcp_relays(fr_c, i, (MAX_FRIEND_TCP_CONNECTIONS / 2)); /* Only fill it half up. */
|
||||
connect_to_saved_tcp_relays(fr_c, i, MAX_FRIEND_TCP_CONNECTIONS / 2); /* Only fill it half up. */
|
||||
}
|
||||
}
|
||||
} else if (friend_con->status == FRIENDCONN_STATUS_CONNECTED) {
|
||||
|
|
|
@ -2202,7 +2202,7 @@ static unsigned int send_peers(Group_Chats *g_c, const Group_c *g, int friendcon
|
|||
|| (p - response_packet) + sizeof(uint16_t) + CRYPTO_PUBLIC_KEY_SIZE * 2 + 1 + g->group[i].nick_len >
|
||||
sizeof(response_packet)) {
|
||||
if (send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_CONFERENCE, group_num, response_packet,
|
||||
(p - response_packet))) {
|
||||
p - response_packet)) {
|
||||
sent = i;
|
||||
} else {
|
||||
return sent;
|
||||
|
|
|
@ -499,12 +499,12 @@ static void loglogdata(const Logger *log, const char *message, const uint8_t *bu
|
|||
net_kill_strerror(strerror);
|
||||
} else if ((res > 0) && ((size_t)res <= buflen)) {
|
||||
LOGGER_TRACE(log, "[%2u] %s %3u%c %s:%u (%u: %s) | %04x%04x",
|
||||
buffer[0], message, min_u16(res, 999), ((size_t)res < buflen ? '<' : '='),
|
||||
buffer[0], message, min_u16(res, 999), (size_t)res < buflen ? '<' : '=',
|
||||
ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK",
|
||||
data_0(buflen, buffer), data_1(buflen, buffer));
|
||||
} else { /* empty or overwrite */
|
||||
LOGGER_TRACE(log, "[%2u] %s %u%c%u %s:%u (%u: %s) | %04x%04x",
|
||||
buffer[0], message, res, (!res ? '!' : '>'), buflen,
|
||||
buffer[0], message, res, !res ? '!' : '>', buflen,
|
||||
ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK",
|
||||
data_0(buflen, buffer), data_1(buflen, buffer));
|
||||
}
|
||||
|
|
|
@ -1182,7 +1182,7 @@ static int send_dhtpk_announce(Onion_Client *onion_c, uint16_t friend_num, uint8
|
|||
net_pack_u64(data + 1, no_replay);
|
||||
memcpy(data + 1 + sizeof(uint64_t), dht_get_self_public_key(onion_c->dht), CRYPTO_PUBLIC_KEY_SIZE);
|
||||
Node_format nodes[MAX_SENT_NODES];
|
||||
uint16_t num_relays = copy_connected_tcp_relays(onion_c->c, nodes, (MAX_SENT_NODES / 2));
|
||||
uint16_t num_relays = copy_connected_tcp_relays(onion_c->c, nodes, MAX_SENT_NODES / 2);
|
||||
uint16_t num_nodes = closelist_nodes(onion_c->dht, &nodes[num_relays], MAX_SENT_NODES - num_relays);
|
||||
num_nodes += num_relays;
|
||||
int nodes_len = 0;
|
||||
|
|
|
@ -34,7 +34,7 @@ int state_load(const Logger *log, state_load_cb *state_load_callback, void *oute
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (lendian_to_host16((cookie_type >> 16)) != cookie_inner) {
|
||||
if (lendian_to_host16(cookie_type >> 16) != cookie_inner) {
|
||||
/* something is not matching up in a bad way, give up */
|
||||
LOGGER_ERROR(log, "state file garbled: %04x != %04x", cookie_type >> 16, cookie_inner);
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user