From 6295adad6db050d42d608236fb2ba2e0f455c6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 2 Aug 2014 16:17:30 +0200 Subject: [PATCH] relay: fix number of bytes sent/received on 32-bit systems --- ChangeLog.asciidoc | 1 + po/cs.po | 4 ++-- po/de.po | 6 +++--- po/es.po | 6 +++--- po/fr.po | 6 +++--- po/hu.po | 4 ++-- po/it.po | 6 +++--- po/ja.po | 4 ++-- po/pl.po | 6 +++--- po/pt_BR.po | 4 ++-- po/ru.po | 4 ++-- po/tr.po | 4 ++-- po/weechat.pot | 4 ++-- src/plugins/relay/relay-client.c | 12 ++++++------ src/plugins/relay/relay-client.h | 4 ++-- src/plugins/relay/relay-command.c | 2 +- 16 files changed, 39 insertions(+), 38 deletions(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index f89f70fe2..bcec1549b 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -169,6 +169,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * python: fix read of return value for callbacks returning an integer in Python 2.x (closes #125) * python: fix interpreter used after unload of a script +* relay: fix number of bytes sent/received on 32-bit systems * relay: fix crash when closing relay buffers (closes #57, closes #78) * relay: check pointers received in hdata command to prevent crashes with bad pointers (WeeChat protocol) diff --git a/po/cs.po b/po/cs.po index a4503ce86..1f81cd20a 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-25 20:37+0200\n" +"POT-Creation-Date: 2014-08-02 16:12+0200\n" "PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -9058,7 +9058,7 @@ msgstr "Klienti pro přenos:" #, fuzzy, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" " id: %d, %s%s%s (%s%s%s), spuštěn v: %s, poslední aktivita: %s, bytů: %lu " diff --git a/po/de.po b/po/de.po index 5c51e1a54..659fdec88 100644 --- a/po/de.po +++ b/po/de.po @@ -10140,11 +10140,11 @@ msgstr "Verbindungen zu Clients für Relay:" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" -" %s%s%s (%s%s%s), gestartet am: %s, letzte Aktivität: %s, Bytes: %lu " -"empfangen, %lu gesendet" +" %s%s%s (%s%s%s), gestartet am: %s, letzte Aktivität: %s, Bytes: %llu " +"empfangen, %llu gesendet" #, c-format msgid " %s%s%s (%s%s%s), started on: %s" diff --git a/po/es.po b/po/es.po index d84294f07..8ae5581ed 100644 --- a/po/es.po +++ b/po/es.po @@ -9337,11 +9337,11 @@ msgstr "Clientes conectados para retransmitir:" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" -" %s%s%s (%s%s%s), iniciado en: %s, última actividad: %s, bytes: %lu " -"recibidos, %lu enviados" +" %s%s%s (%s%s%s), iniciado en: %s, última actividad: %s, bytes: %llu " +"recibidos, %llu enviados" #, c-format msgid " %s%s%s (%s%s%s), started on: %s" diff --git a/po/fr.po b/po/fr.po index 926d4c55a..92af4cdd3 100644 --- a/po/fr.po +++ b/po/fr.po @@ -9914,11 +9914,11 @@ msgstr "Clients connectés pour le relai :" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" -" %s%s%s (%s%s%s), démarré le : %s, dernière activité : %s, octets : %lu " -"reçus, %lu envoyés" +" %s%s%s (%s%s%s), démarré le : %s, dernière activité : %s, octets : %llu " +"reçus, %llu envoyés" #, c-format msgid " %s%s%s (%s%s%s), started on: %s" diff --git a/po/hu.po b/po/hu.po index 58f053c01..efc0517d0 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-02 11:25+0200\n" +"POT-Creation-Date: 2014-08-02 16:12+0200\n" "PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -8453,7 +8453,7 @@ msgstr "" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" diff --git a/po/it.po b/po/it.po index fc1824da8..652eae4ab 100644 --- a/po/it.po +++ b/po/it.po @@ -9494,11 +9494,11 @@ msgstr "Client connessi per il relay:" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" -" %s%s%s (%s%s%s), avviato il %s, attività recente: %s byte: %lu ricevuti, " -"%lu inviati" +" %s%s%s (%s%s%s), avviato il %s, attività recente: %s byte: %llu ricevuti, " +"%llu inviati" #, c-format msgid " %s%s%s (%s%s%s), started on: %s" diff --git a/po/ja.po b/po/ja.po index 5cbda99d8..b53008918 100644 --- a/po/ja.po +++ b/po/ja.po @@ -9541,10 +9541,10 @@ msgstr "リレーする接続済みクライアント:" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" -" %s%s%s (%s%s%s)、開始日時: %s、最新の活動: %s、バイト数: %lu 受信、%lu 送信" +" %s%s%s (%s%s%s)、開始日時: %s、最新の活動: %s、バイト数: %llu 受信、%llu 送信" #, c-format msgid " %s%s%s (%s%s%s), started on: %s" diff --git a/po/pl.po b/po/pl.po index c899fa55a..d006032bf 100644 --- a/po/pl.po +++ b/po/pl.po @@ -9660,11 +9660,11 @@ msgstr "Klienci do przekazywania:" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" -" %s%s%s (%s%s%s), rozpoczęto: %s, ostatnia aktywność: %s, bajtów: %lu " -"odebrano, %lu wysłano" +" %s%s%s (%s%s%s), rozpoczęto: %s, ostatnia aktywność: %s, bajtów: %llu " +"odebrano, %llu wysłano" #, c-format msgid " %s%s%s (%s%s%s), started on: %s" diff --git a/po/pt_BR.po b/po/pt_BR.po index feacb5cf9..a00a8170d 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-02 11:25+0200\n" +"POT-Creation-Date: 2014-08-02 16:12+0200\n" "PO-Revision-Date: 2014-07-14 18:44+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -8716,7 +8716,7 @@ msgstr "Clientes para relay:" #, fuzzy, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" " id: %d, %s%s%s (%s%s%s), iniciado em: %s, última atividade: %s, %lu bytes " diff --git a/po/ru.po b/po/ru.po index 2dd3090e7..c48d664b9 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-02 11:25+0200\n" +"POT-Creation-Date: 2014-08-02 16:12+0200\n" "PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -8481,7 +8481,7 @@ msgstr "" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" diff --git a/po/tr.po b/po/tr.po index 3a8e6042f..7bd7c1367 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-02 11:25+0200\n" +"POT-Creation-Date: 2014-08-02 16:12+0200\n" "PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -7600,7 +7600,7 @@ msgstr "" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 6a0ecb4c2..bffa06420 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-02 11:25+0200\n" +"POT-Creation-Date: 2014-08-02 16:12+0200\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: weechat-dev \n" @@ -7543,7 +7543,7 @@ msgstr "" #, c-format msgid "" -" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %lu recv, %lu " +" %s%s%s (%s%s%s), started on: %s, last activity: %s, bytes: %llu recv, %llu " "sent" msgstr "" diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c index 51df04ec2..690afc7f2 100644 --- a/src/plugins/relay/relay-client.c +++ b/src/plugins/relay/relay-client.c @@ -1253,9 +1253,9 @@ relay_client_new_with_infolist (struct t_infolist *infolist) new_client->hook_fd = NULL; new_client->last_activity = weechat_infolist_time (infolist, "last_activity"); sscanf (weechat_infolist_string (infolist, "bytes_recv"), - "%lu", &(new_client->bytes_recv)); + "%llu", &(new_client->bytes_recv)); sscanf (weechat_infolist_string (infolist, "bytes_sent"), - "%lu", &(new_client->bytes_sent)); + "%llu", &(new_client->bytes_sent)); new_client->recv_data_type = weechat_infolist_integer (infolist, "recv_data_type"); new_client->send_data_type = weechat_infolist_integer (infolist, "send_data_type"); str = weechat_infolist_string (infolist, "partial_message"); @@ -1554,10 +1554,10 @@ relay_client_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_time (ptr_item, "last_activity", client->last_activity)) return 0; - snprintf (value, sizeof (value), "%lu", client->bytes_recv); + snprintf (value, sizeof (value), "%llu", client->bytes_recv); if (!weechat_infolist_new_var_string (ptr_item, "bytes_recv", value)) return 0; - snprintf (value, sizeof (value), "%lu", client->bytes_sent); + snprintf (value, sizeof (value), "%llu", client->bytes_sent); if (!weechat_infolist_new_var_string (ptr_item, "bytes_sent", value)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, "recv_data_type", client->recv_data_type)) @@ -1622,8 +1622,8 @@ relay_client_print_log () weechat_log_printf (" end_time. . . . . . . : %ld", ptr_client->end_time); weechat_log_printf (" hook_fd . . . . . . . : 0x%lx", ptr_client->hook_fd); weechat_log_printf (" last_activity . . . . : %ld", ptr_client->last_activity); - weechat_log_printf (" bytes_recv. . . . . . : %lu", ptr_client->bytes_recv); - weechat_log_printf (" bytes_sent. . . . . . : %lu", ptr_client->bytes_sent); + weechat_log_printf (" bytes_recv. . . . . . : %llu", ptr_client->bytes_recv); + weechat_log_printf (" bytes_sent. . . . . . : %llu", ptr_client->bytes_sent); weechat_log_printf (" recv_data_type. . . . : %d (%s)", ptr_client->recv_data_type, relay_client_data_type_string[ptr_client->recv_data_type]); diff --git a/src/plugins/relay/relay-client.h b/src/plugins/relay/relay-client.h index 017c712ea..8ca05ceb4 100644 --- a/src/plugins/relay/relay-client.h +++ b/src/plugins/relay/relay-client.h @@ -93,8 +93,8 @@ struct t_relay_client time_t end_time; /* time of client disconnection */ struct t_hook *hook_fd; /* hook for socket or child pipe */ time_t last_activity; /* time of last byte received/sent */ - unsigned long bytes_recv; /* bytes received from client */ - unsigned long bytes_sent; /* bytes sent to client */ + unsigned long long bytes_recv; /* bytes received from client */ + unsigned long long bytes_sent; /* bytes sent to client */ enum t_relay_client_data_type recv_data_type; /* type recv from client */ enum t_relay_client_data_type send_data_type; /* type sent to client */ char *partial_message; /* partial text message received */ diff --git a/src/plugins/relay/relay-command.c b/src/plugins/relay/relay-command.c index f5b29777c..664c65748 100644 --- a/src/plugins/relay/relay-command.c +++ b/src/plugins/relay/relay-command.c @@ -82,7 +82,7 @@ relay_command_client_list (int full) { weechat_printf (NULL, _(" %s%s%s (%s%s%s), started on: %s, last activity: %s, " - "bytes: %lu recv, %lu sent"), + "bytes: %llu recv, %llu sent"), RELAY_COLOR_CHAT_CLIENT, ptr_client->desc, RELAY_COLOR_CHAT,