1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 21:36:37 +02:00

Compare commits

...

34 Commits

Author SHA1 Message Date
Ivan Pešić a217e9f72f Update of the Serbian translations (#2329)
* core: update Serbian translations

* doc: update Serbian translations
2026-06-27 08:59:03 +02:00
weechatter 8858d4b6b4 core: update German translations 2026-06-23 13:29:41 +02:00
Sébastien Helleu e9d998a9bf trigger: add unit for timer interval in /help trigger 2026-06-23 12:15:47 +02:00
Sébastien Helleu bfb34faa97 irc: replace "atol" by "atoll" for variables cast to time_t
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.
2026-06-21 08:19:42 +02:00
Sébastien Helleu a4b8d7aedd tcl: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Replace calls to Tcl_GetLongFromObj by Tcl_GetWideIntFromObj.
2026-06-21 08:19:42 +02:00
Sébastien Helleu 75b364cd89 ruby: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Replace calls to NUM2ULONG by NUM2ULL.
2026-06-21 08:19:42 +02:00
Sébastien Helleu 914d3df639 python: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Use "long long" for variables cast to time_t.
2026-06-21 08:19:42 +02:00
Sébastien Helleu a5404172c8 perl: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, the value returned by SvIV can
be 32-bit (its width depends on how Perl was built), whereas time_t is 64-bit.

Read the date with SvNV instead: a double represents all real timestamps
exactly, so the conversion to time_t no longer depends on the size of the Perl
integer type.
2026-06-21 08:19:42 +02:00
Sébastien Helleu 1dd423cb23 lua: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Use "long long" for variables cast to time_t.
2026-06-21 07:43:59 +02:00
Sébastien Helleu 8f33a72c99 guile: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Replace calls to scm_to_long by scm_to_long_long.
2026-06-21 07:42:02 +02:00
Sébastien Helleu f4564a1cb0 core, api: remove unneeded cast to time_t
The field `tv_sec` of struct timeval is already time_t, the cast is not needed.
2026-06-20 21:50:25 +02:00
Sébastien Helleu c4dfb16df0 core: use function util_parse_longlong to parse date in command /print 2026-06-20 17:30:42 +02:00
Sébastien Helleu 6facd390fe core: use function util_parse_longlong to parse time in function hdata_set 2026-06-20 17:30:41 +02:00
Sébastien Helleu 2aada3d0ca xfer: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 791c39cc84 trigger: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu ce6a214ce1 script: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 3c302e078d relay: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 90761d6350 api: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 4eba4f9a47 python: use function util_parse_int in API function hook_signal_send 2026-06-20 17:30:41 +02:00
Sébastien Helleu fcbb508cd7 javascript: use function util_parse_int in API function hook_signal_send 2026-06-20 17:30:41 +02:00
Sébastien Helleu b49eac6f2d irc: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 9b418b4dc2 fset: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 08b173f9b7 exec: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 42b91aa91d buflist: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 4ac2f6c2ad core: use util functions to parse integers in buffer functions 2026-06-20 17:30:41 +02:00
Sébastien Helleu 3d804810a0 core: use util functions to parse integers in window functions 2026-06-20 17:30:41 +02:00
Sébastien Helleu 987b03da39 core: use util functions to parse integers in nicklist functions 2026-06-20 17:30:41 +02:00
Sébastien Helleu a1f1443fd8 core: use util functions to parse integers in function gui_line_hook_update 2026-06-20 17:30:41 +02:00
Sébastien Helleu ca8312a48c core: use function util_parse_int in function gui_key_grab_init 2026-06-20 17:30:41 +02:00
Sébastien Helleu 971f7b1660 core: use function util_parse_int in function gui_hotlist_clear_level_string 2026-06-20 17:30:41 +02:00
Sébastien Helleu 643f2fab5b core: use function util_parse_int in function gui_focus_info_hashtable_gui_focus_info_cb 2026-06-20 17:30:41 +02:00
Sébastien Helleu 5f36c52935 core: use function util_parse_int in color functions 2026-06-20 17:30:41 +02:00
Sébastien Helleu 92219ba132 core: use function util_parse_longlong in function gui_chat_hsignal_quote_line_cb 2026-06-20 17:30:41 +02:00
Matthew Horan 905a68739e doc/api: note that colors param is supported nicks endpoint 2026-06-20 17:18:23 +02:00
72 changed files with 539 additions and 810 deletions
+2
View File
@@ -28,8 +28,10 @@ SPDX-License-Identifier: GPL-3.0-or-later
- api: fix infinite loop in function string_replace when the search string is empty - api: fix infinite loop in function string_replace when the search string is empty
- irc: fix tag in message with list of names when joining a channel - irc: fix tag in message with list of names when joining a channel
- fset: remove error displayed in core buffer when clicking with the mouse below the last option displayed - fset: remove error displayed in core buffer when clicking with the mouse below the last option displayed
- guile, lua, perl, python, ruby, tcl: fix conversion of dates in the API functions
- irc: limit size of data received from the server to prevent memory exhaustion - irc: limit size of data received from the server to prevent memory exhaustion
- irc: fix out-of-bounds read on incoming DCC command with a quoted filename ending the message ([#2322](https://github.com/weechat/weechat/issues/2322)) - irc: fix out-of-bounds read on incoming DCC command with a quoted filename ending the message ([#2322](https://github.com/weechat/weechat/issues/2322))
- irc: fix conversion of dates in received messages
- relay: limit size of decompressed websocket frame with permessage-deflate to prevent memory exhaustion ([GHSA-v2v4-45wm-5cr3](https://github.com/weechat/weechat/security/advisories/GHSA-v2v4-45wm-5cr3), [CVE-2026-53524](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53524)) - relay: limit size of decompressed websocket frame with permessage-deflate to prevent memory exhaustion ([GHSA-v2v4-45wm-5cr3](https://github.com/weechat/weechat/security/advisories/GHSA-v2v4-45wm-5cr3), [CVE-2026-53524](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53524))
- relay: limit size of received websocket frame and HTTP body to prevent memory exhaustion - relay: limit size of received websocket frame and HTTP body to prevent memory exhaustion
- relay: limit size of partial message received while reading an HTTP request to prevent memory exhaustion - relay: limit size of partial message received while reading an HTTP request to prevent memory exhaustion
+7
View File
@@ -1034,6 +1034,13 @@ Path parameters:
confused with the buffer number, which is different) confused with the buffer number, which is different)
* `buffer_name` (string, **required**): buffer name * `buffer_name` (string, **required**): buffer name
Query parameters:
* `colors` (string, optional, default: `ansi`): how to return strings with color codes:
** `ansi`: return ANSI color codes
** `weechat`: return WeeChat internal color codes
** `strip`: strip colors
Request example: get nicks of a buffer: Request example: get nicks of a buffer:
[source,shell] [source,shell]
+8
View File
@@ -1046,6 +1046,14 @@ Paramètres de chemin :
confondre avec le numéro du tampon, qui est différent) confondre avec le numéro du tampon, qui est différent)
* `buffer_name` (chaîne, **obligatoire**) : nom du tampon * `buffer_name` (chaîne, **obligatoire**) : nom du tampon
Paramètres de requête :
* `colors` (chaîne, facultatif, par défaut : `ansi`) : comment les chaînes avec
des couleurs sont retournées :
** `ansi` : retourner les codes couleur ANSI
** `weechat` : retourner les codes couleur internes WeeChat
** `strip` : supprimer les couleurs
Exemple de requête : obtenir les pseudos d'un tampon : Exemple de requête : obtenir les pseudos d'un tampon :
[source,shell] [source,shell]
+10 -5
View File
@@ -1030,12 +1030,19 @@ GET /api/buffers/{id_бафера}/nicks
GET /api/buffers/{име_бафера}/nicks GET /api/buffers/{име_бафера}/nicks
---- ----
Параметри упита: Параметри путање:
* `id_бафера` (цео број, **обавезно**): јединствени идентификатор бафера (не треба * `id_бафера` (цео број, **обавезно**): јединствени идентификатор бафера (не треба
да се помеша са бројем бафера, то је нешто друго) да се помеша са бројем бафера, то је нешто друго)
* `име_бафера` (стринг, **обавезно**): име бафера * `име_бафера` (стринг, **обавезно**): име бафера
Параметри упита:
* `colors` (стринг, није обавезно, подразумевано: `ansi`): како се враћају стрингови са кодовима боје:
** `ansi`: враћају се ANSI кодови боје
** `weechat`: враћају се WeeChat интерни кодови боје
** `strip`: уклањају се боје
Пример захтева: врати надимке бафера: Пример захтева: врати надимке бафера:
[source,shell] [source,shell]
@@ -1181,12 +1188,10 @@ HTTP/1.1 200 OK
] ]
---- ----
// TRANSLATION MISSING
[[resource_scripts]] [[resource_scripts]]
=== Scripts === Скрипте
// TRANSLATION MISSING Враћа учитане скрипте (на свим језицима).
Return loaded scripts (all languages).
Крајња тачка: Крајња тачка:
+4 -2
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-05-30 14:01+0200\n" "PO-Revision-Date: 2026-05-30 14:01+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n" "Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: Czech <weechat-dev@nongnu.org>\n" "Language-Team: Czech <weechat-dev@nongnu.org>\n"
@@ -16690,7 +16690,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+7 -5
View File
@@ -29,8 +29,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-09 10:41+0200\n" "PO-Revision-Date: 2026-06-23 13:29+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German - Germany <weechat-dev@nongnu.org>\n" "Language-Team: German - Germany <weechat-dev@nongnu.org>\n"
"Language: de\n" "Language: de\n"
@@ -18181,10 +18181,12 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "> type `command_run`: Befehl(e) (erforderlich)" msgstr "> type `command_run`: Befehl(e) (erforderlich)"
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
"> type `timer`: Intervall (erforderlich), an Sekunden anpassen, maximale " "> type `timer`: Intervall (erforderlich, in Millisekunden), an Sekunde "
"Anzahl an Aufrufen" "anpassen, maximale Anzahl an Aufrufen"
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
msgstr "> type `config`: Name der Einstellung (erforderlich)" msgstr "> type `config`: Name der Einstellung (erforderlich)"
+4 -2
View File
@@ -24,7 +24,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-05-30 14:01+0200\n" "PO-Revision-Date: 2026-05-30 14:01+0200\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n" "Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: Spanish - Spain <weechat-dev@nongnu.org>\n" "Language-Team: Spanish - Spain <weechat-dev@nongnu.org>\n"
@@ -16980,7 +16980,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+7 -5
View File
@@ -23,8 +23,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-08 23:14+0200\n" "PO-Revision-Date: 2026-06-23 12:14+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: French - France <weechat-dev@nongnu.org>\n" "Language-Team: French - France <weechat-dev@nongnu.org>\n"
"Language: fr\n" "Language: fr\n"
@@ -17837,10 +17837,12 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "> type `command_run` : commande(s) (obligatoire)" msgstr "> type `command_run` : commande(s) (obligatoire)"
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
"> type `timer` : intervalle (obligatoire), alignement sur la seconde, nombre " "> type `timer` : intervalle (obligatoire, en millisecondes), alignement sur "
"max d'appels" "la seconde, nombre max d'appels"
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
msgstr "> type `config` : nom(s) de l'option (obligatoire)" msgstr "> type `config` : nom(s) de l'option (obligatoire)"
+4 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-03-08 08:59+0100\n" "PO-Revision-Date: 2026-03-08 08:59+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: Hungarian <weechat-dev@nongnu.org>\n" "Language-Team: Hungarian <weechat-dev@nongnu.org>\n"
@@ -15910,7 +15910,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+4 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n" "PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: Italian <weechat-dev@nongnu.org>\n" "Language-Team: Italian <weechat-dev@nongnu.org>\n"
@@ -17070,7 +17070,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+4 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n" "PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <weechat-dev@nongnu.org>\n" "Language-Team: Japanese <weechat-dev@nongnu.org>\n"
@@ -17645,7 +17645,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+6 -2
View File
@@ -24,7 +24,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n" "PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n" "Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <weechat-dev@nongnu.org>\n" "Language-Team: Polish <weechat-dev@nongnu.org>\n"
@@ -17388,7 +17388,11 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "> typ `command_run`: komenda(-y) (wymagane)" msgstr "> typ `command_run`: komenda(-y) (wymagane)"
msgid "> type `timer`: interval (required), align on second, max calls" #, fuzzy
#| msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
"> typ `timer`: interwał (wymagany), wyrównane do sekund, maksymalne wywołania" "> typ `timer`: interwał (wymagany), wyrównane do sekund, maksymalne wywołania"
+4 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n" "PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n" "Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese - Portugal <weechat-dev@nongnu.org>\n" "Language-Team: Portuguese - Portugal <weechat-dev@nongnu.org>\n"
@@ -17535,7 +17535,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+4 -2
View File
@@ -46,7 +46,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n" "PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n" "Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: Portuguese - Brazil <weechat-dev@nongnu.org>\n" "Language-Team: Portuguese - Brazil <weechat-dev@nongnu.org>\n"
@@ -16466,7 +16466,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+4 -2
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-03-08 08:59+0100\n" "PO-Revision-Date: 2026-03-08 08:59+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: Russian <weechat-dev@nongnu.org>\n" "Language-Team: Russian <weechat-dev@nongnu.org>\n"
@@ -15962,7 +15962,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+25 -44
View File
@@ -22,8 +22,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n" "PO-Revision-Date: 2026-06-27 09:59+0400\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n" "Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: Serbian <weechat-dev@nongnu.org>\n" "Language-Team: Serbian <weechat-dev@nongnu.org>\n"
"Language: sr\n" "Language: sr\n"
@@ -12664,16 +12664,14 @@ msgstr "%s%s: нисте повезани са сервером"
msgid "%s%s: this buffer is not a channel!" msgid "%s%s: this buffer is not a channel!"
msgstr "%s%s: овај бафер није канал!" msgstr "%s%s: овај бафер није канал!"
#, fuzzy, c-format #, c-format
#| msgid ""
#| "%d channels (total: %d) | Filter: %s | Sort: %s | Key(input): ctrl+j=join "
#| "channel, ($)=refresh, (q)=close buffer"
msgid "" msgid ""
"%d channels (total: %d) | Filter: %s | Sort: %s | Keys: ctrl+j=join channel " "%d channels (total: %d) | Filter: %s | Sort: %s | Keys: ctrl+j=join channel "
"| Input: $=refresh, s:x,y=sort, words=filter, *=reset filter, q=close buffer" "| Input: $=refresh, s:x,y=sort, words=filter, *=reset filter, q=close buffer"
msgstr "" msgstr ""
"%d канала (укупно: %d) | Филтер: %s | Сортирање: %s | Тастер(унос): ctrl+j= " "%d канала (укупно: %d) | Филтер: %s | Сортирање: %s | Тастери: ctrl+j="
"приступ каналу, ($)=освежавање, (q)=затварање бафера" "приступ каналу | Унос: $=освежавање, s:x,y=сортирање, *=ресет филтера, "
"q=затварање бафера"
msgid "Empty list of channels, try \"$\" to refresh list" msgid "Empty list of channels, try \"$\" to refresh list"
msgstr "Празна листа канала, покушајте „$” да освежите листу" msgstr "Празна листа канала, покушајте „$” да освежите листу"
@@ -15679,14 +15677,6 @@ msgstr ""
"relay.network.allow_empty_password) (напомена: садржај се израчунава, " "relay.network.allow_empty_password) (напомена: садржај се израчунава, "
"погледајте /help eval)" "погледајте /help eval)"
#, fuzzy
#| msgid ""
#| "comma separated list of hash algorithms used for password authentication "
#| "in weechat protocol, among these values: \"plain\" (password in plain "
#| "text, not hashed), \"sha256\", \"sha512\", \"pbkdf2+sha256\", "
#| "\"pbkdf2+sha512\"), \"*\" means all algorithms, a name beginning with \"!"
#| "\" is a negative value to prevent an algorithm from being used, wildcard "
#| "\"*\" is allowed in names (examples: \"*\", \"pbkdf2*\", \"*,!plain\")"
msgid "" msgid ""
"comma separated list of hash algorithms used for password authentication in " "comma separated list of hash algorithms used for password authentication in "
"\"api\" and \"weechat\" protocols, among these values: \"plain\" (password " "\"api\" and \"weechat\" protocols, among these values: \"plain\" (password "
@@ -15696,28 +15686,22 @@ msgid ""
"is allowed in names (examples: \"*\", \"pbkdf2*\", \"*,!plain\")" "is allowed in names (examples: \"*\", \"pbkdf2*\", \"*,!plain\")"
msgstr "" msgstr ""
"листа хеш алгоритама раздвојених запетама који се користе за аутентификацију " "листа хеш алгоритама раздвојених запетама који се користе за аутентификацију "
"лозинке у weechat протоколу, могу бити: „plain” (лозинка је чисти текст, не " "лозинке у „api” и „weechat протоколима, који могу бити: „plain” (лозинка је "
"хешира се), „sha256”, „sha512”, „pbkdf2+sha256”, „pbkdf2+sha512”), „*” значи " "чисти текст, не хешира се), „sha256”, „sha512”, „pbkdf2+sha256”, „pbkdf2+"
"сви алгоритми, име које почиње са „!” је негативна вредност којим се " "sha512”), „*” значи сви алгоритми, име које почиње са „!” је негативна "
"спречава употреба тог алгоритма, у именима је дозвољена употреба џокера „*” " "вредност којим се спречава употреба тог алгоритма, у именима је дозвољена "
"(примери: „*”, „pbkdf2*”, „*,!plain”)" "употреба џокера „*” (примери: „*”, „pbkdf2*”, „*,!plain”)"
#, fuzzy
#| msgid ""
#| "number of iterations asked to the client in weechat protocol when a "
#| "hashed password with algorithm PBKDF2 is used for authentication; more "
#| "iterations is better in term of security but is slower to compute; this "
#| "number should not be too high if your CPU is slow"
msgid "" msgid ""
"number of iterations asked to the client in \"api\" and \"weechat\" " "number of iterations asked to the client in \"api\" and \"weechat\" "
"protocols when a hashed password with algorithm PBKDF2 is used for " "protocols when a hashed password with algorithm PBKDF2 is used for "
"authentication; more iterations is better in term of security but is slower " "authentication; more iterations is better in term of security but is slower "
"to compute; this number should not be too high if your CPU is slow" "to compute; this number should not be too high if your CPU is slow"
msgstr "" msgstr ""
"број итерација који се захтева од клијента у weechat протоколу када се за " "број итерација који се захтева од клијента у „api” и „weechat протоколима "
"аутентификацију користи лозинка хеширана PBKDF2 алгоритмом ; више итерација " "када се за аутентификацију користи лозинка хеширана PBKDF2 алгоритмом; више "
"је боље у смислу безбедности, али је спорије за израчунавање; ако је ваш CPU " "итерација је боље у смислу безбедности, али је спорије за израчунавање; ако "
"спор, овај број не би требало да буде сувише велики" "је ваш CPU спор, овај број не би требало да буде сувише велики"
msgid "" msgid ""
"number of seconds to allow before and after the current time for the hash of " "number of seconds to allow before and after the current time for the hash of "
@@ -16303,22 +16287,17 @@ msgstr "(ништа)"
msgid "Alt+key/input: v=back to list d=jump to diff" msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr "Alt+тастер/унос: v=назад на листу d=скок на diff" msgstr "Alt+тастер/унос: v=назад на листу d=скок на diff"
#, fuzzy, c-format #, c-format
#| msgid ""
#| "%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install, "
#| "r=remove, l=load, L=reload, u=unload, A=autoload, h=(un)hold, v=view "
#| "script | Input: q=close, $=refresh, s:x,y=sort, words=filter, *=reset "
#| "filter | Mouse: left=select, right=install/remove"
msgid "" msgid ""
"%d/%d scripts | Filter: %s | Sort: %s | Alt+key/input: i=install, r=remove, " "%d/%d scripts | Filter: %s | Sort: %s | Alt+key/input: i=install, r=remove, "
"l=load, L=reload, u=unload, A=autoload, h=(un)hold, v=view script | Input: " "l=load, L=reload, u=unload, A=autoload, h=(un)hold, v=view script | Input: "
"$=refresh, s:x,y=sort, words=filter, *=reset filter, q=close buffer | Mouse: " "$=refresh, s:x,y=sort, words=filter, *=reset filter, q=close buffer | Mouse: "
"left=select, right=install/remove" "left=select, right=install/remove"
msgstr "" msgstr ""
"%d/%d скрипти илтер: %s) | Сортирање: %s | Alt+тастер/унос: i=инсталација, " "%d/%d скрипти | Филтер: %s | Сортирање: %s | Alt+тастер/унос: i=инсталација, "
"r=уклањање, l=учитавање, L=поновно учитавање, u=уклањање из меморије, " "r=уклањање, l=учитавање, L=поновно учитавање, u=уклањање из меморије, "
"A=аутоучитавање, h=задржавање, v=преглед скрипте | Унос: q=затварање, " "A=аутоучитавање, h=задржавање, v=преглед скрипте | Унос: q=затварање, "
"$=освежавање, s:x,y=сортирање, речи=филтер, *=ресет филтера | Миш: " "$=освежавање, s:x,y=сортирање, words=филтер, *=ресет филтера | Миш: "
"леви=избор, десни=инсталација/уклањање" "леви=избор, десни=инсталација/уклањање"
msgid "Scripts" msgid "Scripts"
@@ -16695,10 +16674,8 @@ msgstr "1 ако је скрипта учитана"
msgid "script name with extension" msgid "script name with extension"
msgstr "име скрипте са екстензијом" msgstr "име скрипте са екстензијом"
#, fuzzy
#| msgid "comma separated list of file name extensions for plugins"
msgid "comma-separated list of plugin:extension with supported languages" msgid "comma-separated list of plugin:extension with supported languages"
msgstr "листа екстензија имена фајлова за додатке раздвојених запетама" msgstr "листа додатак:екстензија са подржаним језицима раздвојених запетама"
msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr "име скрипте са екстензијом (дозвољен је џокер „*”) (није обавезно)" msgstr "име скрипте са екстензијом (дозвољен је џокер „*”) (није обавезно)"
@@ -17333,8 +17310,12 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "> тип `command_run`: команд(а/е) (обавезно)" msgstr "> тип `command_run`: команд(а/е) (обавезно)"
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
msgstr "> тип `timer`: интервал (обавезан), поравнање на секунди, макс позива" "> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
"> тип `timer`: интервал (обавезан, у милисекундама), поравнање на секунди, "
"макс позива"
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
msgstr "> тип `config`: име(на) опције (обавезно)" msgstr "> тип `config`: име(на) опције (обавезно)"
+4 -2
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n" "PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n" "Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: Turkish <weechat-dev@nongnu.org>\n" "Language-Team: Turkish <weechat-dev@nongnu.org>\n"
@@ -17755,7 +17755,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+4 -2
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n" "POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -14579,7 +14579,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)" msgid "> type `command_run`: command(s) (required)"
msgstr "" msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls" msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr "" msgstr ""
msgid "> type `config`: name(s) of option (required)" msgid "> type `config`: name(s) of option (required)"
+3 -3
View File
@@ -5536,7 +5536,7 @@ COMMAND_CALLBACK(print)
struct timeval tv_date; struct timeval tv_date;
char *tags, *pos, *text, *text2, empty_string[1] = { '\0' }; char *tags, *pos, *text, *text2, empty_string[1] = { '\0' };
const char *prefix, *ptr_text; const char *prefix, *ptr_text;
long value; long long value;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -5609,7 +5609,7 @@ COMMAND_CALLBACK(print)
i++; i++;
if ((argv[i][0] == '-') || (argv[i][0] == '+')) if ((argv[i][0] == '-') || (argv[i][0] == '+'))
{ {
if (!util_parse_long (argv[i] + 1, 10, &value)) if (!util_parse_longlong (argv[i] + 1, 10, &value))
COMMAND_ERROR; COMMAND_ERROR;
gettimeofday (&tv_date, NULL); gettimeofday (&tv_date, NULL);
tv_date.tv_sec += (argv[i][0] == '+') ? value : value * -1; tv_date.tv_sec += (argv[i][0] == '+') ? value : value * -1;
@@ -7401,7 +7401,7 @@ command_upgrade_display (struct t_gui_buffer *buffer,
str_first_start[0] = '\0'; str_first_start[0] = '\0';
str_last_start[0] = '\0'; str_last_start[0] = '\0';
weechat_last_start_time = (time_t)weechat_current_start_timeval.tv_sec; weechat_last_start_time = weechat_current_start_timeval.tv_sec;
if (translated_string) if (translated_string)
{ {
+2 -2
View File
@@ -1313,9 +1313,9 @@ hdata_set (struct t_hdata *hdata, void *pointer, const char *name,
} }
break; break;
case WEECHAT_HDATA_TIME: case WEECHAT_HDATA_TIME:
if (util_parse_long (value, 10, &number_long) && (number_long >= 0)) if (util_parse_longlong (value, 10, &number_longlong) && (number_longlong >= 0))
{ {
*((time_t *)(pointer + var->offset)) = (time_t)number_long; *((time_t *)(pointer + var->offset)) = (time_t)number_longlong;
return 1; return 1;
} }
break; break;
+39 -98
View File
@@ -1764,17 +1764,13 @@ void
gui_buffer_set_notify (struct t_gui_buffer *buffer, const char *notify) gui_buffer_set_notify (struct t_gui_buffer *buffer, const char *notify)
{ {
const char *ptr_notify; const char *ptr_notify;
char *error; int mute_old, number;
long number;
int mute_old;
if (!buffer) if (!buffer)
return; return;
ptr_notify = NULL; ptr_notify = NULL;
error = NULL; if (util_parse_int (notify, 10, &number))
number = strtol (notify, &error, 10);
if (error && !error[0])
{ {
if (number < GUI_BUFFER_NUM_NOTIFY) if (number < GUI_BUFFER_NUM_NOTIFY)
{ {
@@ -2232,9 +2228,8 @@ void
gui_buffer_set_hotlist_max_level_nicks (struct t_gui_buffer *buffer, gui_buffer_set_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
const char *new_hotlist_max_level_nicks) const char *new_hotlist_max_level_nicks)
{ {
char **nicks, *pos, *error; char **nicks, *pos;
int nicks_count, value, i; int nicks_count, number, value, i;
long number;
if (!buffer) if (!buffer)
return; return;
@@ -2260,13 +2255,10 @@ gui_buffer_set_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
{ {
pos[0] = '\0'; pos[0] = '\0';
pos++; pos++;
error = NULL; if (util_parse_int (pos, 10, &number))
number = strtol (pos, &error, 10); value = number;
if (error && !error[0])
value = (int)number;
} }
hashtable_set (buffer->hotlist_max_level_nicks, nicks[i], hashtable_set (buffer->hotlist_max_level_nicks, nicks[i], &value);
&value);
} }
string_free_split (nicks); string_free_split (nicks);
} }
@@ -2279,9 +2271,8 @@ void
gui_buffer_add_hotlist_max_level_nicks (struct t_gui_buffer *buffer, gui_buffer_add_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
const char *nicks_to_add) const char *nicks_to_add)
{ {
char **nicks, *pos, *error; char **nicks, *pos;
int nicks_count, value, i; int nicks_count, number, value, i;
long number;
if (!buffer || !nicks_to_add) if (!buffer || !nicks_to_add)
return; return;
@@ -2302,13 +2293,10 @@ gui_buffer_add_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
{ {
pos[0] = '\0'; pos[0] = '\0';
pos++; pos++;
error = NULL; if (util_parse_int (pos, 10, &number))
number = strtol (pos, &error, 10); value = number;
if (error && !error[0])
value = (int)number;
} }
hashtable_set (buffer->hotlist_max_level_nicks, nicks[i], hashtable_set (buffer->hotlist_max_level_nicks, nicks[i], &value);
&value);
} }
string_free_split (nicks); string_free_split (nicks);
} }
@@ -2454,9 +2442,7 @@ void
gui_buffer_set_unread (struct t_gui_buffer *buffer, const char *argument) gui_buffer_set_unread (struct t_gui_buffer *buffer, const char *argument)
{ {
struct t_gui_line *old_last_read_line; struct t_gui_line *old_last_read_line;
int i, old_first_line_not_read; int i, number, old_first_line_not_read;
long number;
char *error;
if (!buffer || (buffer->type != GUI_BUFFER_TYPE_FORMATTED)) if (!buffer || (buffer->type != GUI_BUFFER_TYPE_FORMATTED))
return; return;
@@ -2479,9 +2465,7 @@ gui_buffer_set_unread (struct t_gui_buffer *buffer, const char *argument)
else if (argument[0] == '-') else if (argument[0] == '-')
{ {
/* move the unread marker N lines towards the first line */ /* move the unread marker N lines towards the first line */
error = NULL; if (util_parse_int (argument, 10, &number) && (number < 0))
number = strtol (argument, &error, 10);
if (error && !error[0] && (number < 0))
{ {
for (i = 0; i > number; i--) for (i = 0; i > number; i--)
{ {
@@ -2507,9 +2491,7 @@ gui_buffer_set_unread (struct t_gui_buffer *buffer, const char *argument)
else if (argument[0] == '+') else if (argument[0] == '+')
{ {
/* move the unread marker N lines towards the last line */ /* move the unread marker N lines towards the last line */
error = NULL; if (util_parse_int (argument, 10, &number) && (number > 0))
number = strtol (argument, &error, 10);
if (error && !error[0] && (number > 0))
{ {
for (i = 0; i < number; i++) for (i = 0; i < number; i++)
{ {
@@ -2533,9 +2515,7 @@ gui_buffer_set_unread (struct t_gui_buffer *buffer, const char *argument)
else else
{ {
/* move the unread marker N lines from the end towards the first line */ /* move the unread marker N lines from the end towards the first line */
error = NULL; if (util_parse_int (argument, 10, &number) && (number > 0))
number = strtol (argument, &error, 10);
if (error && !error[0] && (number > 0))
{ {
buffer->lines->last_read_line = buffer->lines->last_line; buffer->lines->last_read_line = buffer->lines->last_line;
buffer->lines->first_line_not_read = 0; buffer->lines->first_line_not_read = 0;
@@ -2569,8 +2549,7 @@ void
gui_buffer_set (struct t_gui_buffer *buffer, const char *property, gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
const char *value) const char *value)
{ {
long number; int number;
char *error;
if (!property || !value) if (!property || !value)
return; return;
@@ -2584,9 +2563,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
gui_add_hotlist = 1; gui_add_hotlist = 1;
else if (buffer) else if (buffer)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
{ {
if (number < 0) if (number < 0)
{ {
@@ -2614,9 +2591,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
/* properties that need a buffer */ /* properties that need a buffer */
if (strcmp (property, "hotlist_conditions") == 0) if (strcmp (property, "hotlist_conditions") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
{ {
if (number < 0) if (number < 0)
{ {
@@ -2650,9 +2625,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
} }
else if (strcmp (property, "hidden") == 0) else if (strcmp (property, "hidden") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
{ {
if (number) if (number)
gui_buffer_hide (buffer); gui_buffer_hide (buffer);
@@ -2662,37 +2635,27 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
} }
else if (strcmp (property, "print_hooks_enabled") == 0) else if (strcmp (property, "print_hooks_enabled") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
buffer->print_hooks_enabled = (number) ? 1 : 0; buffer->print_hooks_enabled = (number) ? 1 : 0;
} }
else if (strcmp (property, "day_change") == 0) else if (strcmp (property, "day_change") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_day_change (buffer, number); gui_buffer_set_day_change (buffer, number);
} }
else if (strcmp (property, "clear") == 0) else if (strcmp (property, "clear") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
buffer->clear = (number) ? 1 : 0; buffer->clear = (number) ? 1 : 0;
} }
else if (strcmp (property, "filter") == 0) else if (strcmp (property, "filter") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_filter (buffer, number); gui_buffer_set_filter (buffer, number);
} }
else if (strcmp (property, "number") == 0) else if (strcmp (property, "number") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number) && (number >= 1))
number = strtol (value, &error, 10);
if (error && !error[0] && (number >= 1))
gui_buffer_move_to_number (buffer, number); gui_buffer_move_to_number (buffer, number);
} }
else if (strcmp (property, "name") == 0) else if (strcmp (property, "name") == 0)
@@ -2724,30 +2687,22 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
} }
else if (strcmp (property, "time_for_each_line") == 0) else if (strcmp (property, "time_for_each_line") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_time_for_each_line (buffer, number); gui_buffer_set_time_for_each_line (buffer, number);
} }
else if (strcmp (property, "nicklist") == 0) else if (strcmp (property, "nicklist") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_nicklist (buffer, number); gui_buffer_set_nicklist (buffer, number);
} }
else if (strcmp (property, "nicklist_case_sensitive") == 0) else if (strcmp (property, "nicklist_case_sensitive") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_nicklist_case_sensitive (buffer, number); gui_buffer_set_nicklist_case_sensitive (buffer, number);
} }
else if (strcmp (property, "nicklist_display_groups") == 0) else if (strcmp (property, "nicklist_display_groups") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_nicklist_display_groups (buffer, number); gui_buffer_set_nicklist_display_groups (buffer, number);
} }
else if (strcmp (property, "highlight_words") == 0) else if (strcmp (property, "highlight_words") == 0)
@@ -2816,37 +2771,27 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
} }
else if (strcmp (property, "input_pos") == 0) else if (strcmp (property, "input_pos") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_input_set_pos (buffer, number); gui_input_set_pos (buffer, number);
} }
else if (strcmp (property, "input_get_any_user_data") == 0) else if (strcmp (property, "input_get_any_user_data") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_input_get_any_user_data (buffer, number); gui_buffer_set_input_get_any_user_data (buffer, number);
} }
else if (strcmp (property, "input_get_unknown_commands") == 0) else if (strcmp (property, "input_get_unknown_commands") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_input_get_unknown_commands (buffer, number); gui_buffer_set_input_get_unknown_commands (buffer, number);
} }
else if (strcmp (property, "input_get_empty") == 0) else if (strcmp (property, "input_get_empty") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_input_get_empty (buffer, number); gui_buffer_set_input_get_empty (buffer, number);
} }
else if (strcmp (property, "input_multiline") == 0) else if (strcmp (property, "input_multiline") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
gui_buffer_set_input_multiline (buffer, number); gui_buffer_set_input_multiline (buffer, number);
} }
else if (strncmp (property, "localvar_set_", 13) == 0) else if (strncmp (property, "localvar_set_", 13) == 0)
@@ -3076,7 +3021,6 @@ gui_buffer_search (const char *plugin, const char *name)
struct t_gui_buffer *ptr_buffer; struct t_gui_buffer *ptr_buffer;
int plugin_match, plugin_case_sensitive, name_case_sensitive; int plugin_match, plugin_case_sensitive, name_case_sensitive;
long long id; long long id;
char *error;
if (!name || !name[0]) if (!name || !name[0])
return gui_current_window->buffer; return gui_current_window->buffer;
@@ -3086,9 +3030,9 @@ gui_buffer_search (const char *plugin, const char *name)
if (plugin && (strcmp (plugin, "==id") == 0)) if (plugin && (strcmp (plugin, "==id") == 0))
{ {
error = NULL; if (util_parse_longlong (name, 10, &id))
id = strtoll (name, &error, 10); return gui_buffer_search_by_id (id);
return (error && !error[0]) ? gui_buffer_search_by_id (id) : NULL; return NULL;
} }
plugin_case_sensitive = 1; plugin_case_sensitive = 1;
@@ -3317,16 +3261,13 @@ gui_buffer_search_by_id_number_name (const char *string)
{ {
struct t_gui_buffer *ptr_buffer; struct t_gui_buffer *ptr_buffer;
long long number; long long number;
char *error;
if (!string) if (!string || !string[0])
return NULL; return NULL;
ptr_buffer = NULL; ptr_buffer = NULL;
error = NULL; if (util_parse_longlong (string, 10, &number))
number = strtoll (string, &error, 10);
if (error && !error[0])
{ {
ptr_buffer = gui_buffer_search_by_id (number); ptr_buffer = gui_buffer_search_by_id (number);
if (!ptr_buffer) if (!ptr_buffer)
+3 -7
View File
@@ -1400,7 +1400,7 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
struct timeval tv; struct timeval tv;
struct t_gui_line *ptr_line; struct t_gui_line *ptr_line;
int is_nick, rc; int is_nick, rc;
char str_time[128], *str, *error; char str_time[128], *str;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -1415,9 +1415,7 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
hashtable_get (hashtable, "_chat_line_date") : NULL; hashtable_get (hashtable, "_chat_line_date") : NULL;
if (ptr_date) if (ptr_date)
{ {
error = NULL; if (util_parse_longlong (ptr_date, 10, &number))
number = strtoll (ptr_date, &error, 10);
if (error && !error[0])
{ {
tv.tv_sec = (time_t)number; tv.tv_sec = (time_t)number;
tv.tv_usec = 0; tv.tv_usec = 0;
@@ -1425,9 +1423,7 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
hashtable_get (hashtable, "_chat_line_date_usec") : NULL; hashtable_get (hashtable, "_chat_line_date_usec") : NULL;
if (ptr_date_usec) if (ptr_date_usec)
{ {
error = NULL; if (util_parse_longlong (ptr_date_usec, 10, &number))
number = strtoll (ptr_date_usec, &error, 10);
if (error && !error[0])
tv.tv_usec = (long)number; tv.tv_usec = (long)number;
} }
util_strftimeval (str_time, sizeof (str_time), util_strftimeval (str_time, sizeof (str_time),
+15 -38
View File
@@ -41,6 +41,7 @@
#include "../core/core-list.h" #include "../core/core-list.h"
#include "../core/core-string.h" #include "../core/core-string.h"
#include "../core/core-utf8.h" #include "../core/core-utf8.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h" #include "../plugins/plugin.h"
#include "gui-color.h" #include "gui-color.h"
#include "gui-chat.h" #include "gui-chat.h"
@@ -254,7 +255,7 @@ gui_color_get_custom (const char *color_name)
static char color[32][96]; static char color[32][96];
static int index_color = 0; static int index_color = 0;
char color_fg[32], color_bg[32]; char color_fg[32], color_bg[32];
char *str_fg, *error, *color_attr; char *str_fg, *color_attr;
const char *ptr_color_name, *pos_delim, *pos_bg; const char *ptr_color_name, *pos_delim, *pos_bg;
/* attribute or other color name (GUI dependent) */ /* attribute or other color name (GUI dependent) */
@@ -438,9 +439,7 @@ gui_color_get_custom (const char *color_name)
fg_term = gui_color_palette_get_alias (str_fg); fg_term = gui_color_palette_get_alias (str_fg);
if (fg_term < 0) if (fg_term < 0)
{ {
error = NULL; if (util_parse_int (str_fg, 10, &term_color))
term_color = (int)strtol (str_fg, &error, 10);
if (error && !error[0])
{ {
fg_term = term_color; fg_term = term_color;
if (fg_term < 0) if (fg_term < 0)
@@ -457,9 +456,7 @@ gui_color_get_custom (const char *color_name)
bg_term = gui_color_palette_get_alias (pos_bg); bg_term = gui_color_palette_get_alias (pos_bg);
if (bg_term < 0) if (bg_term < 0)
{ {
error = NULL; if (util_parse_int (pos_bg, 10, &term_color))
term_color = (int)strtol (pos_bg, &error, 10);
if (error && !error[0])
{ {
bg_term = term_color; bg_term = term_color;
if (bg_term < 0) if (bg_term < 0)
@@ -1286,7 +1283,7 @@ char *
gui_color_encode_ansi (const char *string) gui_color_encode_ansi (const char *string)
{ {
const unsigned char *ptr_string; const unsigned char *ptr_string;
char **out, str_concat[128], str_color[8], *error; char **out, str_concat[128], str_color[8];
int flag, color, length, ansi_color, fg, bg, attrs; int flag, color, length, ansi_color, fg, bg, attrs;
if (!string) if (!string)
@@ -1320,9 +1317,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 5); memcpy (str_color, ptr_string, 5);
str_color[5] = '\0'; str_color[5] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color))
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
{ {
snprintf (str_concat, sizeof (str_concat), snprintf (str_concat, sizeof (str_concat),
"\x1B[38;5;%dm", "\x1B[38;5;%dm",
@@ -1343,9 +1338,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 2); memcpy (str_color, ptr_string, 2);
str_color[2] = '\0'; str_color[2] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color))
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
{ {
ansi_color = gui_color_weechat_to_ansi (color); ansi_color = gui_color_weechat_to_ansi (color);
snprintf (str_concat, sizeof (str_concat), snprintf (str_concat, sizeof (str_concat),
@@ -1370,9 +1363,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 5); memcpy (str_color, ptr_string, 5);
str_color[5] = '\0'; str_color[5] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color))
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
{ {
snprintf (str_concat, sizeof (str_concat), snprintf (str_concat, sizeof (str_concat),
"\x1B[48;5;%dm", "\x1B[48;5;%dm",
@@ -1388,9 +1379,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 2); memcpy (str_color, ptr_string, 2);
str_color[2] = '\0'; str_color[2] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color))
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
{ {
ansi_color = gui_color_weechat_to_ansi (color); ansi_color = gui_color_weechat_to_ansi (color);
snprintf (str_concat, sizeof (str_concat), snprintf (str_concat, sizeof (str_concat),
@@ -1420,9 +1409,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 5); memcpy (str_color, ptr_string, 5);
str_color[5] = '\0'; str_color[5] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color))
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
{ {
snprintf (str_concat, sizeof (str_concat), snprintf (str_concat, sizeof (str_concat),
"\x1B[38;5;%dm", "\x1B[38;5;%dm",
@@ -1443,9 +1430,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 2); memcpy (str_color, ptr_string, 2);
str_color[2] = '\0'; str_color[2] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color))
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
{ {
ansi_color = gui_color_weechat_to_ansi (color); ansi_color = gui_color_weechat_to_ansi (color);
snprintf (str_concat, sizeof (str_concat), snprintf (str_concat, sizeof (str_concat),
@@ -1476,9 +1461,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 5); memcpy (str_color, ptr_string, 5);
str_color[5] = '\0'; str_color[5] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color))
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
{ {
snprintf (str_concat, sizeof (str_concat), snprintf (str_concat, sizeof (str_concat),
"\x1B[48;5;%dm", "\x1B[48;5;%dm",
@@ -1495,9 +1478,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 2); memcpy (str_color, ptr_string, 2);
str_color[2] = '\0'; str_color[2] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color))
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
{ {
ansi_color = gui_color_weechat_to_ansi (color); ansi_color = gui_color_weechat_to_ansi (color);
snprintf (str_concat, sizeof (str_concat), snprintf (str_concat, sizeof (str_concat),
@@ -1521,9 +1502,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 5); memcpy (str_color, ptr_string, 5);
str_color[5] = '\0'; str_color[5] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color))
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
{ {
snprintf (str_concat, sizeof (str_concat), snprintf (str_concat, sizeof (str_concat),
"\x1B[38;5;%dm", "\x1B[38;5;%dm",
@@ -1595,9 +1574,7 @@ gui_color_encode_ansi (const char *string)
{ {
memcpy (str_color, ptr_string, 2); memcpy (str_color, ptr_string, 2);
str_color[2] = '\0'; str_color[2] = '\0';
error = NULL; if (util_parse_int (str_color, 10, &color)
color = (int)strtol (str_color, &error, 10);
if (error && !error[0]
&& (color >= 0) && (color >= 0)
&& (color < GUI_COLOR_NUM_COLORS)) && (color < GUI_COLOR_NUM_COLORS))
{ {
+5 -9
View File
@@ -32,6 +32,7 @@
#include "../core/core-hashtable.h" #include "../core/core-hashtable.h"
#include "../core/core-hook.h" #include "../core/core-hook.h"
#include "../core/core-string.h" #include "../core/core-string.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h" #include "../plugins/plugin.h"
#include "gui-bar.h" #include "gui-bar.h"
#include "gui-bar-window.h" #include "gui-bar-window.h"
@@ -280,11 +281,10 @@ gui_focus_info_hashtable_gui_focus_info_cb (const void *pointer, void *data,
const char *info_name, const char *info_name,
struct t_hashtable *hashtable) struct t_hashtable *hashtable)
{ {
char *error;
const char *ptr_value;
int x, y;
struct t_gui_focus_info *focus_info; struct t_gui_focus_info *focus_info;
struct t_hashtable *focus_hashtable, *ret_hashtable; struct t_hashtable *focus_hashtable, *ret_hashtable;
const char *ptr_value;
int x, y;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -298,17 +298,13 @@ gui_focus_info_hashtable_gui_focus_info_cb (const void *pointer, void *data,
ptr_value = hashtable_get (hashtable, "x"); ptr_value = hashtable_get (hashtable, "x");
if (!ptr_value) if (!ptr_value)
return NULL; return NULL;
error = NULL; if (!util_parse_int (ptr_value, 10, &x))
x = (int)strtol (ptr_value, &error, 10);
if (!error || error[0])
return NULL; return NULL;
ptr_value = hashtable_get (hashtable, "y"); ptr_value = hashtable_get (hashtable, "y");
if (!ptr_value) if (!ptr_value)
return NULL; return NULL;
error = NULL; if (!util_parse_int (ptr_value, 10, &y))
y = (int)strtol (ptr_value, &error, 10);
if (!error || error[0])
return NULL; return NULL;
/* get focus info */ /* get focus info */
+3 -7
View File
@@ -623,10 +623,8 @@ void
gui_hotlist_clear_level_string (struct t_gui_buffer *buffer, gui_hotlist_clear_level_string (struct t_gui_buffer *buffer,
const char *str_level_mask) const char *str_level_mask)
{ {
long level_mask;
char *error;
struct t_gui_hotlist *ptr_hotlist; struct t_gui_hotlist *ptr_hotlist;
int priority; int level_mask, priority;
if (str_level_mask) if (str_level_mask)
{ {
@@ -665,11 +663,9 @@ gui_hotlist_clear_level_string (struct t_gui_buffer *buffer,
else else
{ {
/* clear hotlist using a mask of levels */ /* clear hotlist using a mask of levels */
error = NULL; if (util_parse_int (str_level_mask, 10, &level_mask) && (level_mask > 0))
level_mask = strtol (str_level_mask, &error, 10);
if (error && !error[0] && (level_mask > 0))
{ {
gui_hotlist_clear ((int)level_mask); gui_hotlist_clear (level_mask);
gui_hotlist_initial_buffer = buffer; gui_hotlist_initial_buffer = buffer;
} }
} }
+3 -5
View File
@@ -44,6 +44,7 @@
#include "../core/core-log.h" #include "../core/core-log.h"
#include "../core/core-string.h" #include "../core/core-string.h"
#include "../core/core-utf8.h" #include "../core/core-utf8.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h" #include "../plugins/plugin.h"
#include "gui-key.h" #include "gui-key.h"
#include "gui-bar.h" #include "gui-bar.h"
@@ -193,8 +194,7 @@ gui_key_get_current_context (void)
void void
gui_key_grab_init (int grab_command, const char *delay) gui_key_grab_init (int grab_command, const char *delay)
{ {
long milliseconds; int milliseconds;
char *error;
gui_key_grab = 1; gui_key_grab = 1;
gui_key_grab_count = 0; gui_key_grab_count = 0;
@@ -203,9 +203,7 @@ gui_key_grab_init (int grab_command, const char *delay)
gui_key_grab_delay = CONFIG_INTEGER(config_look_key_grab_delay); gui_key_grab_delay = CONFIG_INTEGER(config_look_key_grab_delay);
if (delay != NULL) if (delay != NULL)
{ {
error = NULL; if (util_parse_int (delay, 10, &milliseconds) && (milliseconds >= 0))
milliseconds = strtol (delay, &error, 10);
if (error && !error[0] && (milliseconds >= 0))
{ {
gui_key_grab_delay = milliseconds; gui_key_grab_delay = milliseconds;
if (gui_key_grab_delay == 0) if (gui_key_grab_delay == 0)
+24 -28
View File
@@ -39,6 +39,7 @@
#include "../core/core-infolist.h" #include "../core/core-infolist.h"
#include "../core/core-log.h" #include "../core/core-log.h"
#include "../core/core-string.h" #include "../core/core-string.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h" #include "../plugins/plugin.h"
#include "gui-line.h" #include "gui-line.h"
#include "gui-buffer.h" #include "gui-buffer.h"
@@ -1674,10 +1675,10 @@ gui_line_hook_update (struct t_gui_line *line,
const char *ptr_value, *ptr_value2; const char *ptr_value, *ptr_value2;
struct t_gui_buffer *ptr_buffer; struct t_gui_buffer *ptr_buffer;
unsigned long value_pointer; unsigned long value_pointer;
long value; long long value_longlong;
char *error, *new_message, *pos_newline; char *new_message, *pos_newline;
int rc, tags_updated, notify_level_updated, highlight_updated; int rc, tags_updated, notify_level_updated, highlight_updated;
int max_notify_level; int max_notify_level, value;
tags_updated = 0; tags_updated = 0;
notify_level_updated = 0; notify_level_updated = 0;
@@ -1730,9 +1731,7 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value = hashtable_get (hashtable2, "y"); ptr_value = hashtable_get (hashtable2, "y");
if (ptr_value) if (ptr_value)
{ {
error = NULL; if (util_parse_int (ptr_value, 10, &value) && (value >= 0))
value = strtol (ptr_value, &error, 10);
if (error && !error[0] && (value >= 0))
line->data->y = value; line->data->y = value;
} }
} }
@@ -1740,9 +1739,8 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "notify_level"); ptr_value2 = hashtable_get (hashtable2, "notify_level");
if (ptr_value2) if (ptr_value2)
{ {
error = NULL; if (util_parse_int (ptr_value2, 10, &value)
value = strtol (ptr_value2, &error, 10); && (value >= -1) && (value <= GUI_HOTLIST_MAX))
if (error && !error[0] && (value >= -1) && (value <= GUI_HOTLIST_MAX))
{ {
notify_level_updated = 1; notify_level_updated = 1;
line->data->notify_level = value; line->data->notify_level = value;
@@ -1752,9 +1750,7 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "highlight"); ptr_value2 = hashtable_get (hashtable2, "highlight");
if (ptr_value2) if (ptr_value2)
{ {
error = NULL; if (util_parse_int (ptr_value2, 10, &value))
value = strtol (ptr_value2, &error, 10);
if (error && !error[0])
{ {
highlight_updated = 1; highlight_updated = 1;
line->data->highlight = (value) ? 1 : 0; line->data->highlight = (value) ? 1 : 0;
@@ -1764,11 +1760,10 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "date"); ptr_value2 = hashtable_get (hashtable2, "date");
if (ptr_value2) if (ptr_value2)
{ {
error = NULL; if (util_parse_longlong (ptr_value2, 10, &value_longlong)
value = strtol (ptr_value2, &error, 10); && (value_longlong >= 0))
if (error && !error[0] && (value >= 0))
{ {
line->data->date = (time_t)value; line->data->date = (time_t)value_longlong;
free (line->data->str_time); free (line->data->str_time);
line->data->str_time = gui_chat_get_time_string ( line->data->str_time = gui_chat_get_time_string (
line->data->date, line->data->date,
@@ -1780,11 +1775,10 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "date_usec"); ptr_value2 = hashtable_get (hashtable2, "date_usec");
if (ptr_value2) if (ptr_value2)
{ {
error = NULL; if (util_parse_int (ptr_value2, 10, &value)
value = strtol (ptr_value2, &error, 10); && (value >= 0) && (value <= 999999))
if (error && !error[0] && (value >= 0) && (value <= 999999))
{ {
line->data->date_usec = (int)value; line->data->date_usec = value;
free (line->data->str_time); free (line->data->str_time);
line->data->str_time = gui_chat_get_time_string ( line->data->str_time = gui_chat_get_time_string (
line->data->date, line->data->date,
@@ -1796,19 +1790,21 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "date_printed"); ptr_value2 = hashtable_get (hashtable2, "date_printed");
if (ptr_value2) if (ptr_value2)
{ {
error = NULL; if (util_parse_longlong (ptr_value2, 10, &value_longlong)
value = strtol (ptr_value2, &error, 10); && (value_longlong >= 0))
if (error && !error[0] && (value >= 0)) {
line->data->date_printed = (time_t)value; line->data->date_printed = (time_t)value_longlong;
}
} }
ptr_value2 = hashtable_get (hashtable2, "date_usec_printed"); ptr_value2 = hashtable_get (hashtable2, "date_usec_printed");
if (ptr_value2) if (ptr_value2)
{ {
error = NULL; if (util_parse_int (ptr_value2, 10, &value)
value = strtol (ptr_value2, &error, 10); && (value >= 0) && (value <= 999999))
if (error && !error[0] && (value >= 0) && (value <= 999999)) {
line->data->date_usec_printed = (int)value; line->data->date_usec_printed = value;
}
} }
ptr_value = hashtable_get (hashtable, "str_time"); ptr_value = hashtable_get (hashtable, "str_time");
+9 -22
View File
@@ -44,6 +44,7 @@
#include "../core/core-log.h" #include "../core/core-log.h"
#include "../core/core-string.h" #include "../core/core-string.h"
#include "../core/core-utf8.h" #include "../core/core-utf8.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h" #include "../plugins/plugin.h"
#include "gui-nicklist.h" #include "gui-nicklist.h"
#include "gui-buffer.h" #include "gui-buffer.h"
@@ -275,7 +276,6 @@ gui_nicklist_search_group (struct t_gui_buffer *buffer,
const char *name) const char *name)
{ {
const char *ptr_name; const char *ptr_name;
char *error;
long long id; long long id;
if ((!buffer && !from_group) if ((!buffer && !from_group)
@@ -287,8 +287,7 @@ gui_nicklist_search_group (struct t_gui_buffer *buffer,
if (strncmp (name, "==id:", 5) == 0) if (strncmp (name, "==id:", 5) == 0)
{ {
id = strtoll (name + 5, &error, 10); if (util_parse_longlong (name + 5, 10, &id))
if (error && !error[0])
return gui_nicklist_search_group_id (buffer, from_group, id); return gui_nicklist_search_group_id (buffer, from_group, id);
} }
@@ -570,7 +569,6 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
const char *name) const char *name)
{ {
long long id; long long id;
char *error;
if ((!buffer && !from_group) if ((!buffer && !from_group)
|| !name || !name
@@ -581,8 +579,7 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
if (strncmp (name, "==id:", 5) == 0) if (strncmp (name, "==id:", 5) == 0)
{ {
id = strtoll (name + 5, &error, 10); if (util_parse_longlong (name + 5, 10, &id))
if (error && !error[0])
return gui_nicklist_search_nick_id (buffer, from_group, id); return gui_nicklist_search_nick_id (buffer, from_group, id);
} }
@@ -1036,9 +1033,7 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
const char *property, const char *value) const char *property, const char *value)
{ {
long long id; long long id;
long number; int group_changed, number;
char *error;
int group_changed;
if (!buffer || !group || !property || !value) if (!buffer || !group || !property || !value)
return; return;
@@ -1047,8 +1042,7 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
if (strcmp (property, "id") == 0) if (strcmp (property, "id") == 0)
{ {
id = strtoll (value, &error, 10); if (util_parse_longlong (value, 10, &id)
if (error && !error[0]
&& (id != group->id) && (id != group->id)
&& !gui_nicklist_search_group_id (buffer, NULL, id)) && !gui_nicklist_search_group_id (buffer, NULL, id))
{ {
@@ -1064,9 +1058,7 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
} }
else if (strcmp (property, "visible") == 0) else if (strcmp (property, "visible") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
group->visible = (number) ? 1 : 0; group->visible = (number) ? 1 : 0;
group_changed = 1; group_changed = 1;
} }
@@ -1158,9 +1150,7 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
const char *property, const char *value) const char *property, const char *value)
{ {
long long id; long long id;
long number; int nick_changed, number;
char *error;
int nick_changed;
if (!buffer || !nick || !property || !value) if (!buffer || !nick || !property || !value)
return; return;
@@ -1169,8 +1159,7 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
if (strcmp (property, "id") == 0) if (strcmp (property, "id") == 0)
{ {
id = strtoll (value, &error, 10); if (util_parse_longlong (value, 10, &id)
if (error && !error[0]
&& (id != nick->id) && (id != nick->id)
&& !gui_nicklist_search_nick_id (buffer, NULL, id)) && !gui_nicklist_search_nick_id (buffer, NULL, id))
{ {
@@ -1198,9 +1187,7 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
} }
else if (strcmp (property, "visible") == 0) else if (strcmp (property, "visible") == 0)
{ {
error = NULL; if (util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (error && !error[0])
nick->visible = (number) ? 1 : 0; nick->visible = (number) ? 1 : 0;
nick_changed = 1; nick_changed = 1;
} }
+6 -10
View File
@@ -43,6 +43,7 @@
#include "../core/core-log.h" #include "../core/core-log.h"
#include "../core/core-string.h" #include "../core/core-string.h"
#include "../core/core-utf8.h" #include "../core/core-utf8.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h" #include "../plugins/plugin.h"
#include "gui-window.h" #include "gui-window.h"
#include "gui-bar.h" #include "gui-bar.h"
@@ -1182,7 +1183,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
int direction, stop, count_msg, scroll_from_end_free_buffer; int direction, stop, count_msg, scroll_from_end_free_buffer;
char time_letter, saved_char; char time_letter, saved_char;
time_t old_date, diff_date; time_t old_date, diff_date;
char *pos, *error; char *pos;
long number; long number;
struct t_gui_line *ptr_line; struct t_gui_line *ptr_line;
struct tm *date_tmp, line_date, old_line_date; struct tm *date_tmp, line_date, old_line_date;
@@ -1231,9 +1232,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
time_letter = pos[0]; time_letter = pos[0];
saved_char = pos[0]; saved_char = pos[0];
pos[0] = '\0'; pos[0] = '\0';
error = NULL; if (!util_parse_long (scroll, 10, &number))
number = strtol (scroll, &error, 10);
if (!error || error[0])
number = 0; number = 0;
pos[0] = saved_char; pos[0] = saved_char;
} }
@@ -1430,9 +1429,8 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
void void
gui_window_scroll_horiz (struct t_gui_window *window, char *scroll) gui_window_scroll_horiz (struct t_gui_window *window, char *scroll)
{ {
int direction, percentage, start_col; int direction, percentage, start_col, number;
char saved_char, *pos, *error; char saved_char, *pos;
long number;
if (!window || !window->buffer->lines->first_line) if (!window || !window->buffer->lines->first_line)
return; return;
@@ -1464,9 +1462,7 @@ gui_window_scroll_horiz (struct t_gui_window *window, char *scroll)
percentage = (pos[0] == '%') ? 1 : 0; percentage = (pos[0] == '%') ? 1 : 0;
saved_char = pos[0]; saved_char = pos[0];
pos[0] = '\0'; pos[0] = '\0';
error = NULL; if (!util_parse_int (scroll, 10, &number))
number = strtol (scroll, &error, 10);
if (!error || error[0])
number = 0; number = 0;
pos[0] = saved_char; pos[0] = saved_char;
} }
+8 -19
View File
@@ -40,9 +40,8 @@ struct t_hashtable *
buflist_focus_cb (const void *pointer, void *data, struct t_hashtable *info) buflist_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
{ {
const char *ptr_bar_item_name, *ptr_bar_item_line, *keys, *ptr_value; const char *ptr_bar_item_name, *ptr_bar_item_line, *keys, *ptr_value;
long item_line; char str_value[128], **list_keys;
char *error, str_value[128], **list_keys; int i, item_index, item_line, num_keys, type;
int i, item_index, num_keys, type;
struct t_gui_buffer *ptr_buffer; struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */ /* make C compiler happy */
@@ -64,15 +63,10 @@ buflist_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
ptr_bar_item_line = weechat_hashtable_get (info, "_bar_item_line"); ptr_bar_item_line = weechat_hashtable_get (info, "_bar_item_line");
if (!ptr_bar_item_line) if (!ptr_bar_item_line)
goto end; goto end;
error = NULL; if (!weechat_util_parse_int (ptr_bar_item_line, 10, &item_line)
item_line = strtol (ptr_bar_item_line, &error, 10); || (item_line < 0)
if (!error || error[0])
goto end;
if ((item_line < 0)
|| (item_line >= weechat_arraylist_size (buflist_list_buffers[item_index]))) || (item_line >= weechat_arraylist_size (buflist_list_buffers[item_index])))
{
goto end; goto end;
}
/* check if buffer pointer is still valid */ /* check if buffer pointer is still valid */
ptr_buffer = weechat_arraylist_get (buflist_list_buffers[item_index], ptr_buffer = weechat_arraylist_get (buflist_list_buffers[item_index],
@@ -333,10 +327,9 @@ buflist_hsignal_cb (const void *pointer, void *data, const char *signal,
const char *ptr_key, *ptr_pointer, *ptr_number, *ptr_number2; const char *ptr_key, *ptr_pointer, *ptr_number, *ptr_number2;
const char *ptr_full_name; const char *ptr_full_name;
struct t_gui_buffer *ptr_buffer; struct t_gui_buffer *ptr_buffer;
char *error, str_command[1024]; char str_command[1024];
long number, number2;
unsigned long value; unsigned long value;
int rc, current_buffer_number; int rc, current_buffer_number, number, number2;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -360,13 +353,9 @@ buflist_hsignal_cb (const void *pointer, void *data, const char *signal,
return WEECHAT_RC_OK; return WEECHAT_RC_OK;
ptr_buffer = (struct t_gui_buffer *)value; ptr_buffer = (struct t_gui_buffer *)value;
error = NULL; if (!weechat_util_parse_int (ptr_number, 10, &number))
number = strtol (ptr_number, &error, 10);
if (!error || error[0])
return WEECHAT_RC_OK; return WEECHAT_RC_OK;
error = NULL; if (!weechat_util_parse_int (ptr_number2, 10, &number2))
number2 = strtol (ptr_number2, &error, 10);
if (!error || error[0])
return WEECHAT_RC_OK; return WEECHAT_RC_OK;
current_buffer_number = weechat_buffer_get_integer ( current_buffer_number = weechat_buffer_get_integer (
+3 -5
View File
@@ -185,8 +185,7 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
int argc, char **argv, int start_arg, int argc, char **argv, int start_arg,
int set_command_index) int set_command_index)
{ {
int i, j, end, length, length_total; int i, j, end, length, length_total, timeout;
char *error;
for (i = start_arg; i < argc; i++) for (i = start_arg; i < argc; i++)
{ {
@@ -318,10 +317,9 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
if (i + 1 >= argc) if (i + 1 >= argc)
return 0; return 0;
i++; i++;
error = NULL; if (!weechat_util_parse_int (argv[i], 10, &timeout))
cmd_options->timeout = strtol (argv[i], &error, 10);
if (!error || error[0])
return 0; return 0;
cmd_options->timeout = timeout;
} }
else if (weechat_strcmp (argv[i], "-name") == 0) else if (weechat_strcmp (argv[i], "-name") == 0)
{ {
+1 -4
View File
@@ -85,15 +85,12 @@ struct t_exec_cmd *
exec_search_by_id (const char *id) exec_search_by_id (const char *id)
{ {
struct t_exec_cmd* ptr_exec_cmd; struct t_exec_cmd* ptr_exec_cmd;
char *error;
long number; long number;
if (!id) if (!id)
return NULL; return NULL;
error = NULL; if (!weechat_util_parse_long (id, 10, &number))
number = strtol (id, &error, 10);
if (!error || error[0])
number = -1; number = -1;
for (ptr_exec_cmd = exec_cmds; ptr_exec_cmd; for (ptr_exec_cmd = exec_cmds; ptr_exec_cmd;
+2 -5
View File
@@ -60,15 +60,12 @@ int
fset_command_get_int_arg (int argc, char **argv, int arg_number, fset_command_get_int_arg (int argc, char **argv, int arg_number,
int default_value) int default_value)
{ {
long value; int value;
char *error;
value = default_value; value = default_value;
if (argc > arg_number) if (argc > arg_number)
{ {
error = NULL; if (!weechat_util_parse_int (argv[arg_number], 10, &value))
value = strtol (argv[arg_number], &error, 10);
if (!error || error[0])
value = default_value; value = default_value;
} }
return (int)value; return (int)value;
+8 -14
View File
@@ -42,11 +42,10 @@ struct t_hashtable *
fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info) fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
{ {
const char *buffer; const char *buffer;
int rc, format_number; int rc, format_number, y, option_index;
unsigned long value; unsigned long value;
struct t_gui_buffer *ptr_buffer; struct t_gui_buffer *ptr_buffer;
long y, option_index; char str_value[128];
char *error, str_value[128];
struct t_fset_option *ptr_fset_option; struct t_fset_option *ptr_fset_option;
/* make C compiler happy */ /* make C compiler happy */
@@ -69,13 +68,11 @@ fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
if (!ptr_buffer || (ptr_buffer != fset_buffer)) if (!ptr_buffer || (ptr_buffer != fset_buffer))
return info; return info;
error = NULL; if (!weechat_util_parse_int (weechat_hashtable_get (info, "_chat_line_y"), 10, &y)
y = strtol (weechat_hashtable_get (info, "_chat_line_y"), &error, 10); || (y < 0))
if (!error || error[0]) {
return info;
if (y < 0)
return info; return info;
}
format_number = weechat_config_integer (fset_config_look_format_number); format_number = weechat_config_integer (fset_config_look_format_number);
option_index = y / fset_config_format_option_num_lines[format_number - 1]; option_index = y / fset_config_format_option_num_lines[format_number - 1];
@@ -87,7 +84,7 @@ fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
snprintf (str_value, sizeof (str_value), snprintf (str_value, sizeof (str_value),
"0x%lx", (unsigned long)ptr_fset_option); "0x%lx", (unsigned long)ptr_fset_option);
weechat_hashtable_set (info, "fset_option", str_value); weechat_hashtable_set (info, "fset_option", str_value);
snprintf (str_value, sizeof (str_value), "%ld", option_index); snprintf (str_value, sizeof (str_value), "%d", option_index);
weechat_hashtable_set (info, "fset_option_index", str_value); weechat_hashtable_set (info, "fset_option_index", str_value);
weechat_hashtable_set (info, "fset_option_name", ptr_fset_option->name); weechat_hashtable_set (info, "fset_option_name", ptr_fset_option->name);
weechat_hashtable_set (info, "fset_option_parent_name", ptr_fset_option->parent_name); weechat_hashtable_set (info, "fset_option_parent_name", ptr_fset_option->parent_name);
@@ -137,15 +134,12 @@ fset_mouse_get_hashtable_int (struct t_hashtable *hashtable,
int default_value) int default_value)
{ {
const char *ptr_value; const char *ptr_value;
char *error;
int value; int value;
ptr_value = weechat_hashtable_get (hashtable, variable); ptr_value = weechat_hashtable_get (hashtable, variable);
if (!ptr_value) if (!ptr_value)
return default_value; return default_value;
error = NULL; if (!weechat_util_parse_int (ptr_value, 10, &value))
value = (int)strtol (ptr_value, &error, 10);
if (!error || error[0])
return default_value; return default_value;
return value; return value;
+5 -5
View File
@@ -2096,7 +2096,7 @@ weechat_guile_api_print_date_tags (SCM buffer, SCM date, SCM tags, SCM message)
plugin_script_api_printf_date_tags (weechat_guile_plugin, plugin_script_api_printf_date_tags (weechat_guile_plugin,
guile_current_script, guile_current_script,
API_STR2PTR(API_SCM_TO_STRING(buffer)), API_STR2PTR(API_SCM_TO_STRING(buffer)),
(time_t)scm_to_long (date), (time_t)scm_to_long_long (date),
API_SCM_TO_STRING(tags), API_SCM_TO_STRING(tags),
"%s", API_SCM_TO_STRING(message)); "%s", API_SCM_TO_STRING(message));
@@ -2117,7 +2117,7 @@ weechat_guile_api_print_datetime_tags (SCM buffer, SCM date, SCM date_usec,
weechat_guile_plugin, weechat_guile_plugin,
guile_current_script, guile_current_script,
API_STR2PTR(API_SCM_TO_STRING(buffer)), API_STR2PTR(API_SCM_TO_STRING(buffer)),
(time_t)scm_to_long (date), (time_t)scm_to_long_long (date),
scm_to_int (date_usec), scm_to_int (date_usec),
API_SCM_TO_STRING(tags), API_SCM_TO_STRING(tags),
"%s", API_SCM_TO_STRING(message)); "%s", API_SCM_TO_STRING(message));
@@ -2156,7 +2156,7 @@ weechat_guile_api_print_y_date_tags (SCM buffer, SCM y, SCM date, SCM tags,
guile_current_script, guile_current_script,
API_STR2PTR(API_SCM_TO_STRING(buffer)), API_STR2PTR(API_SCM_TO_STRING(buffer)),
scm_to_int (y), scm_to_int (y),
(time_t)scm_to_long (date), (time_t)scm_to_long_long (date),
API_SCM_TO_STRING(tags), API_SCM_TO_STRING(tags),
"%s", API_SCM_TO_STRING(message)); "%s", API_SCM_TO_STRING(message));
@@ -2178,7 +2178,7 @@ weechat_guile_api_print_y_datetime_tags (SCM buffer, SCM y, SCM date,
guile_current_script, guile_current_script,
API_STR2PTR(API_SCM_TO_STRING(buffer)), API_STR2PTR(API_SCM_TO_STRING(buffer)),
scm_to_int (y), scm_to_int (y),
(time_t)scm_to_long (date), (time_t)scm_to_long_long (date),
scm_to_int (date_usec), scm_to_int (date_usec),
API_SCM_TO_STRING(tags), API_SCM_TO_STRING(tags),
"%s", API_SCM_TO_STRING(message)); "%s", API_SCM_TO_STRING(message));
@@ -4748,7 +4748,7 @@ weechat_guile_api_infolist_new_var_time (SCM item, SCM name, SCM value)
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(API_SCM_TO_STRING(item)), result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(API_SCM_TO_STRING(item)),
API_SCM_TO_STRING(name), API_SCM_TO_STRING(name),
(time_t)scm_to_long (value))); (time_t)scm_to_long_long (value)));
API_RETURN_STRING(result); API_RETURN_STRING(result);
} }
+15 -28
View File
@@ -96,8 +96,8 @@ char *irc_color_string_decoded[32];
int int
irc_color_convert_rgb2term (long rgb) irc_color_convert_rgb2term (long rgb)
{ {
char str_color[64], *info_color, *error; char str_color[64], *info_color;
long number; int number;
if (rgb < 0) if (rgb < 0)
return -1; return -1;
@@ -111,9 +111,7 @@ irc_color_convert_rgb2term (long rgb)
return -1; return -1;
} }
error = NULL; if (!weechat_util_parse_int (info_color, 10, &number))
number = strtol (info_color, &error, 10);
if (!error || error[0])
{ {
free (info_color); free (info_color);
return -1; return -1;
@@ -121,7 +119,7 @@ irc_color_convert_rgb2term (long rgb)
free (info_color); free (info_color);
return (int)number; return number;
} }
/* /*
@@ -133,8 +131,8 @@ irc_color_convert_rgb2term (long rgb)
int int
irc_color_convert_rgb2irc (long rgb) irc_color_convert_rgb2irc (long rgb)
{ {
char str_color[64], *error, *info_color; char str_color[64], *info_color;
long number; int number;
if (rgb < 0) if (rgb < 0)
return -1; return -1;
@@ -151,9 +149,7 @@ irc_color_convert_rgb2irc (long rgb)
return -1; return -1;
} }
error = NULL; if (!weechat_util_parse_int (info_color, 10, &number)
number = strtol (info_color, &error, 10);
if (!error || error[0]
|| (number < 0) || (number >= IRC_COLOR_TERM2IRC_NUM_COLORS)) || (number < 0) || (number >= IRC_COLOR_TERM2IRC_NUM_COLORS))
{ {
free (info_color); free (info_color);
@@ -174,7 +170,7 @@ irc_color_convert_rgb2irc (long rgb)
int int
irc_color_convert_term2irc (int color) irc_color_convert_term2irc (int color)
{ {
char str_color[64], *error, *info_color; char str_color[64], *info_color;
long number; long number;
snprintf (str_color, sizeof (str_color), "%d", color); snprintf (str_color, sizeof (str_color), "%d", color);
@@ -186,9 +182,8 @@ irc_color_convert_term2irc (int color)
return -1; return -1;
} }
error = NULL; if (!weechat_util_parse_long (info_color, 10, &number)
number = strtol (info_color, &error, 10); || (number < 0) || (number > 0xFFFFFF))
if (!error || error[0] || (number < 0) || (number > 0xFFFFFF))
{ {
free (info_color); free (info_color);
return -1; return -1;
@@ -211,7 +206,7 @@ irc_color_convert_term2irc (int color)
char * char *
irc_color_decode (const char *string, int keep_colors) irc_color_decode (const char *string, int keep_colors)
{ {
char **out, *error; char **out;
char str_fg[16], str_bg[16], str_color[128], str_key[128], str_to_add[128]; char str_fg[16], str_bg[16], str_color[128], str_key[128], str_to_add[128];
const char *remapped_color; const char *remapped_color;
unsigned char *ptr_string; unsigned char *ptr_string;
@@ -337,18 +332,14 @@ irc_color_decode (const char *string, int keep_colors)
bg = -1; bg = -1;
if (str_fg[0]) if (str_fg[0])
{ {
error = NULL; if (weechat_util_parse_int (str_fg, 10, &fg))
fg = (int)strtol (str_fg, &error, 10);
if (error && !error[0])
fg %= IRC_NUM_COLORS; fg %= IRC_NUM_COLORS;
else else
fg = -1; fg = -1;
} }
if (str_bg[0]) if (str_bg[0])
{ {
error = NULL; if (weechat_util_parse_int (str_bg, 10, &bg))
bg = (int)strtol (str_bg, &error, 10);
if (error && !error[0])
bg %= IRC_NUM_COLORS; bg %= IRC_NUM_COLORS;
else else
bg = -1; bg = -1;
@@ -422,16 +413,12 @@ irc_color_decode (const char *string, int keep_colors)
bg_rgb = -1; bg_rgb = -1;
if (str_fg[0]) if (str_fg[0])
{ {
error = NULL; if (!weechat_util_parse_long (str_fg, 16, &fg_rgb))
fg_rgb = strtol (str_fg, &error, 16);
if (!error || error[0])
fg_rgb = -1; fg_rgb = -1;
} }
if (str_bg[0]) if (str_bg[0])
{ {
error = NULL; if (!weechat_util_parse_long (str_bg, 16, &bg_rgb))
bg_rgb = strtol (str_bg, &error, 16);
if (!error || error[0])
bg_rgb = -1; bg_rgb = -1;
} }
str_fg[0] = '\0'; str_fg[0] = '\0';
+13 -29
View File
@@ -232,9 +232,8 @@ irc_command_mode_nicks (struct t_irc_server *server,
char ** char **
irc_command_mode_masks_convert_ranges (char **argv, int arg_start) irc_command_mode_masks_convert_ranges (char **argv, int arg_start)
{ {
char **str_masks, **masks, *error1, *error2, *pos, str_number[32]; char **str_masks, **masks, *pos, str_number[32];
int i, length, added; int i, j, length, added, number1, number2;
long j, number1, number2;
if (!argv || (arg_start < 0)) if (!argv || (arg_start < 0))
return NULL; return NULL;
@@ -255,12 +254,8 @@ irc_command_mode_masks_convert_ranges (char **argv, int arg_start)
&& (argv[i][length - 1] != '-')) && (argv[i][length - 1] != '-'))
{ {
pos[0] = '\0'; pos[0] = '\0';
error1 = NULL; if (weechat_util_parse_int (argv[i], 10, &number1)
number1 = strtol (argv[i], &error1, 10); && weechat_util_parse_int (pos + 1, 10, &number2)
error2 = NULL;
number2 = strtol (pos + 1, &error2, 10);
if (error1 && !error1[0]
&& error2 && !error2[0]
&& (number1 > 0) && (number1 < 128) && (number1 > 0) && (number1 < 128)
&& (number2 > 0) && (number2 < 128) && (number2 > 0) && (number2 < 128)
&& (number1 < number2)) && (number1 < number2))
@@ -269,8 +264,7 @@ irc_command_mode_masks_convert_ranges (char **argv, int arg_start)
{ {
if ((*str_masks)[0]) if ((*str_masks)[0])
weechat_string_dyn_concat (str_masks, " ", -1); weechat_string_dyn_concat (str_masks, " ", -1);
snprintf (str_number, sizeof (str_number), snprintf (str_number, sizeof (str_number), "%d", j);
"%ld", j);
weechat_string_dyn_concat (str_masks, str_number, -1); weechat_string_dyn_concat (str_masks, str_number, -1);
} }
added = 1; added = 1;
@@ -312,14 +306,12 @@ irc_command_mode_masks (struct t_irc_server *server,
const char *set, const char *mode, const char *set, const char *mode,
char **argv, int pos_masks) char **argv, int pos_masks)
{ {
int max_modes, modes_added, msg_priority; int max_modes, modes_added, msg_priority, number;
char **modes, **masks, *mask; char **modes, **masks, *mask;
struct t_irc_channel *ptr_channel; struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick; struct t_irc_nick *ptr_nick;
struct t_irc_modelist *ptr_modelist; struct t_irc_modelist *ptr_modelist;
struct t_irc_modelist_item *ptr_item; struct t_irc_modelist_item *ptr_item;
long number;
char *error;
if (irc_mode_get_chanmode_type (server, mode[0]) != 'A') if (irc_mode_get_chanmode_type (server, mode[0]) != 'A')
{ {
@@ -367,9 +359,7 @@ irc_command_mode_masks (struct t_irc_server *server,
/* use modelist item for number arguments */ /* use modelist item for number arguments */
if (ptr_modelist && (set[0] == '-')) if (ptr_modelist && (set[0] == '-'))
{ {
error = NULL; if (weechat_util_parse_int (argv[pos_masks], 10, &number))
number = strtol (argv[pos_masks], &error, 10);
if (error && !error[0])
{ {
ptr_item = irc_modelist_item_search_number (ptr_modelist, ptr_item = irc_modelist_item_search_number (ptr_modelist,
number - 1); number - 1);
@@ -2622,9 +2612,8 @@ irc_command_ignore_display (struct t_irc_ignore *ignore)
IRC_COMMAND_CALLBACK(ignore) IRC_COMMAND_CALLBACK(ignore)
{ {
struct t_irc_ignore *ptr_ignore; struct t_irc_ignore *ptr_ignore;
char *mask, *regex, *regex2, *ptr_regex, *pos, *server, *channel, *error; char *mask, *regex, *regex2, *ptr_regex, *pos, *server, *channel;
int length, update; int length, number, update;
long number;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -2767,9 +2756,7 @@ IRC_COMMAND_CALLBACK(ignore)
} }
else else
{ {
error = NULL; if (weechat_util_parse_int (argv[2], 10, &number))
number = strtol (argv[2], &error, 10);
if (error && !error[0])
{ {
ptr_ignore = irc_ignore_search_by_number (number); ptr_ignore = irc_ignore_search_by_number (number);
if (ptr_ignore) if (ptr_ignore)
@@ -3430,18 +3417,15 @@ int
irc_command_list_get_int_arg (int argc, char **argv, int arg_number, irc_command_list_get_int_arg (int argc, char **argv, int arg_number,
int default_value) int default_value)
{ {
long value; int value;
char *error;
value = default_value; value = default_value;
if (argc > arg_number) if (argc > arg_number)
{ {
error = NULL; if (!weechat_util_parse_int (argv[arg_number], 10, &value))
value = strtol (argv[arg_number], &error, 10);
if (!error || error[0])
value = default_value; value = default_value;
} }
return (int)value; return value;
} }
/* /*
+2 -6
View File
@@ -1288,10 +1288,8 @@ irc_config_server_check_value_cb (const void *pointer, void *data,
struct t_config_option *option, struct t_config_option *option,
const char *value) const char *value)
{ {
int index_option, proxy_found; int index_option, number, proxy_found;
const char *pos_error, *proxy_name; const char *pos_error, *proxy_name;
char *error;
long number;
struct t_infolist *infolist; struct t_infolist *infolist;
/* make C compiler happy */ /* make C compiler happy */
@@ -1364,9 +1362,7 @@ irc_config_server_check_value_cb (const void *pointer, void *data,
case IRC_SERVER_OPTION_SPLIT_MSG_MAX_LENGTH: case IRC_SERVER_OPTION_SPLIT_MSG_MAX_LENGTH:
if (!value || !value[0]) if (!value || !value[0])
break; break;
error = NULL; if (!weechat_util_parse_int (value, 10, &number))
number = strtol (value, &error, 10);
if (!error || error[0])
{ {
/* /*
* not a valid number, but we return 1 (OK) to let WeeChat * not a valid number, but we return 1 (OK) to let WeeChat
+4 -8
View File
@@ -985,9 +985,8 @@ irc_info_infolist_irc_modelist_item_cb (const void *pointer, void *data,
struct t_irc_channel *ptr_channel; struct t_irc_channel *ptr_channel;
struct t_irc_modelist *ptr_modelist; struct t_irc_modelist *ptr_modelist;
struct t_irc_modelist_item *ptr_item; struct t_irc_modelist_item *ptr_item;
char **argv, *error; char **argv;
int argc; int argc, number;
long number;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -1029,15 +1028,12 @@ irc_info_infolist_irc_modelist_item_cb (const void *pointer, void *data,
} }
if (!obj_pointer && (argc >= 4)) if (!obj_pointer && (argc >= 4))
{ {
error = NULL; if (!weechat_util_parse_int (argv[3], 10, &number) || (number < 0))
number = strtol (argv[3], &error, 10);
if (!error || error[0] || (number < 0))
{ {
weechat_string_free_split (argv); weechat_string_free_split (argv);
return NULL; return NULL;
} }
obj_pointer = irc_modelist_item_search_number (ptr_modelist, obj_pointer = irc_modelist_item_search_number (ptr_modelist, number);
(int)number);
if (!obj_pointer) if (!obj_pointer)
{ {
weechat_string_free_split (argv); weechat_string_free_split (argv);
+13 -18
View File
@@ -234,9 +234,8 @@ int
irc_list_channel_match_filter (struct t_irc_server *server, irc_list_channel_match_filter (struct t_irc_server *server,
struct t_irc_list_channel *channel) struct t_irc_list_channel *channel)
{ {
char *error, *result; char *result;
long number; int match, number;
int match;
/* no filter? then any channel is matching */ /* no filter? then any channel is matching */
if (!server->list->filter) if (!server->list->filter)
@@ -280,25 +279,22 @@ irc_list_channel_match_filter (struct t_irc_server *server,
else if (strncmp (server->list->filter, "u:>", 3) == 0) else if (strncmp (server->list->filter, "u:>", 3) == 0)
{ {
/* filter by users (> N)*/ /* filter by users (> N)*/
error = NULL; if (weechat_util_parse_int (server->list->filter + 3, 10, &number)
number = strtol (server->list->filter + 3, &error, 10); && (channel->users > number))
if (error && !error[0] && channel->users > (int)number)
return 1; return 1;
} }
else if (strncmp (server->list->filter, "u:<", 3) == 0) else if (strncmp (server->list->filter, "u:<", 3) == 0)
{ {
/* filter by users (< N)*/ /* filter by users (< N)*/
error = NULL; if (weechat_util_parse_int (server->list->filter + 3, 10, &number)
number = strtol (server->list->filter + 3, &error, 10); && (channel->users < number))
if (error && !error[0] && channel->users < (int)number)
return 1; return 1;
} }
else if (strncmp (server->list->filter, "u:", 2) == 0) else if (strncmp (server->list->filter, "u:", 2) == 0)
{ {
/* filter by users */ /* filter by users */
error = NULL; if (weechat_util_parse_int (server->list->filter + 2, 10, &number)
number = strtol (server->list->filter + 2, &error, 10); && (channel->users >= number))
if (error && !error[0] && channel->users >= (int)number)
return 1; return 1;
} }
else else
@@ -375,10 +371,9 @@ int
irc_list_parse_messages (struct t_irc_server *server, const char *output) irc_list_parse_messages (struct t_irc_server *server, const char *output)
{ {
struct t_irc_list_channel *channel; struct t_irc_list_channel *channel;
char **irc_msgs, *command, **params, *error; char **irc_msgs, *command, **params;
const char *ptr_name; const char *ptr_name;
int i, count_irc_msgs, num_params, length, keep_colors; int i, count_irc_msgs, num_params, length, keep_colors, number;
long number;
if (server->list->channels) if (server->list->channels)
{ {
@@ -439,9 +434,9 @@ irc_list_parse_messages (struct t_irc_server *server, const char *output)
ptr_name++; ptr_name++;
} }
channel->name2 = strdup (ptr_name); channel->name2 = strdup (ptr_name);
error = NULL; if (!weechat_util_parse_int (params[2], 10, &number))
number = strtol (params[2], &error, 10); number = 0;
channel->users = (error && !error[0]) ? number : 0; channel->users = number;
channel->topic = (num_params > 3) ? channel->topic = (num_params > 3) ?
irc_color_decode (params[3], keep_colors) : NULL; irc_color_decode (params[3], keep_colors) : NULL;
length = weechat_utf8_strlen_screen (channel->name); length = weechat_utf8_strlen_screen (channel->name);
+3 -8
View File
@@ -598,8 +598,7 @@ irc_message_parse_cap_multiline_value (struct t_irc_server *server,
{ {
struct t_hashtable *values; struct t_hashtable *values;
const char *ptr_value; const char *ptr_value;
char *error; int number;
long number;
if (!server) if (!server)
return; return;
@@ -617,18 +616,14 @@ irc_message_parse_cap_multiline_value (struct t_irc_server *server,
ptr_value = (const char *)weechat_hashtable_get (values, "max-bytes"); ptr_value = (const char *)weechat_hashtable_get (values, "max-bytes");
if (ptr_value) if (ptr_value)
{ {
error = NULL; if (weechat_util_parse_int (ptr_value, 10, &number))
number = strtol (ptr_value, &error, 10);
if (error && !error[0])
server->multiline_max_bytes = number; server->multiline_max_bytes = number;
} }
ptr_value = (const char *)weechat_hashtable_get (values, "max-lines"); ptr_value = (const char *)weechat_hashtable_get (values, "max-lines");
if (ptr_value) if (ptr_value)
{ {
error = NULL; if (weechat_util_parse_int (ptr_value, 10, &number))
number = strtol (ptr_value, &error, 10);
if (error && !error[0])
server->multiline_max_lines = number; server->multiline_max_lines = number;
} }
+19 -31
View File
@@ -4061,9 +4061,8 @@ IRC_PROTOCOL_CALLBACK(001)
IRC_PROTOCOL_CALLBACK(005) IRC_PROTOCOL_CALLBACK(005)
{ {
char *str_info, *error, *isupport2; char *str_info, *isupport2;
int i, arg_last, length_isupport, length, casemapping, utf8mapping; int i, arg_last, length_isupport, length, casemapping, utf8mapping, value;
long value;
IRC_PROTOCOL_MIN_PARAMS(2); IRC_PROTOCOL_MIN_PARAMS(2);
@@ -4081,34 +4080,26 @@ IRC_PROTOCOL_CALLBACK(005)
else if (strncmp (ctxt->params[i], "LINELEN=", 8) == 0) else if (strncmp (ctxt->params[i], "LINELEN=", 8) == 0)
{ {
/* save max message length */ /* save max message length */
error = NULL; if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
value = strtol (ctxt->params[i] + 8, &error, 10); ctxt->server->msg_max_length = value;
if (error && !error[0] && (value > 0))
ctxt->server->msg_max_length = (int)value;
} }
else if (strncmp (ctxt->params[i], "NICKLEN=", 8) == 0) else if (strncmp (ctxt->params[i], "NICKLEN=", 8) == 0)
{ {
/* save max nick length */ /* save max nick length */
error = NULL; if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
value = strtol (ctxt->params[i] + 8, &error, 10); ctxt->server->nick_max_length = value;
if (error && !error[0] && (value > 0))
ctxt->server->nick_max_length = (int)value;
} }
else if (strncmp (ctxt->params[i], "USERLEN=", 8) == 0) else if (strncmp (ctxt->params[i], "USERLEN=", 8) == 0)
{ {
/* save max user length */ /* save max user length */
error = NULL; if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
value = strtol (ctxt->params[i] + 8, &error, 10); ctxt->server->user_max_length = value;
if (error && !error[0] && (value > 0))
ctxt->server->user_max_length = (int)value;
} }
else if (strncmp (ctxt->params[i], "HOSTLEN=", 8) == 0) else if (strncmp (ctxt->params[i], "HOSTLEN=", 8) == 0)
{ {
/* save max host length */ /* save max host length */
error = NULL; if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
value = strtol (ctxt->params[i] + 8, &error, 10); ctxt->server->host_max_length = value;
if (error && !error[0] && (value > 0))
ctxt->server->host_max_length = (int)value;
} }
else if (strncmp (ctxt->params[i], "CASEMAPPING=", 12) == 0) else if (strncmp (ctxt->params[i], "CASEMAPPING=", 12) == 0)
{ {
@@ -4144,10 +4135,8 @@ IRC_PROTOCOL_CALLBACK(005)
else if (strncmp (ctxt->params[i], "MONITOR=", 8) == 0) else if (strncmp (ctxt->params[i], "MONITOR=", 8) == 0)
{ {
/* save monitor (limit) */ /* save monitor (limit) */
error = NULL; if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
value = strtol (ctxt->params[i] + 8, &error, 10); ctxt->server->monitor = value;
if (error && !error[0] && (value > 0))
ctxt->server->monitor = (int)value;
} }
else if (strncmp (ctxt->params[i], "CLIENTTAGDENY=", 14) == 0) else if (strncmp (ctxt->params[i], "CLIENTTAGDENY=", 14) == 0)
{ {
@@ -4721,7 +4710,7 @@ IRC_PROTOCOL_CALLBACK(317)
min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60; min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60;
sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60; sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60;
datetime = (time_t)(atol (ctxt->params[3])); datetime = (time_t)(atoll (ctxt->params[3]));
ptr_buffer = irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->params[1], ptr_buffer = irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->params[1],
ctxt->command, "whois", NULL); ctxt->command, "whois", NULL);
@@ -5077,7 +5066,7 @@ IRC_PROTOCOL_CALLBACK(329)
ptr_channel = irc_channel_search (ctxt->server, ctxt->params[1]); ptr_channel = irc_channel_search (ctxt->server, ctxt->params[1]);
datetime = (time_t)(atol (ctxt->params[2])); datetime = (time_t)(atoll (ctxt->params[2]));
if (ptr_channel) if (ptr_channel)
{ {
@@ -5301,8 +5290,7 @@ IRC_PROTOCOL_CALLBACK(333)
ptr_channel = irc_channel_search (ctxt->server, ctxt->params[1]); ptr_channel = irc_channel_search (ctxt->server, ctxt->params[1]);
ptr_nick = (ptr_channel) ? ptr_nick = (ptr_channel) ?
irc_nick_search (ctxt->server, ptr_channel, topic_nick) : NULL; irc_nick_search (ctxt->server, ptr_channel, topic_nick) : NULL;
datetime = (ctxt->num_params > 3) ? datetime = (time_t)(atoll ((ctxt->num_params > 3) ? ctxt->params[3] : ctxt->params[2]));
(time_t)(atol (ctxt->params[3])) : (time_t)(atol (ctxt->params[2]));
if (!topic_nick && (datetime == 0)) if (!topic_nick && (datetime == 0))
return WEECHAT_RC_OK; return WEECHAT_RC_OK;
@@ -5609,7 +5597,7 @@ IRC_PROTOCOL_CALLBACK(346)
irc_message_get_address_from_host (ctxt->params[3])); irc_message_get_address_from_host (ctxt->params[3]));
if (ctxt->num_params >= 5) if (ctxt->num_params >= 5)
{ {
datetime = (time_t)(atol (ctxt->params[4])); datetime = (time_t)(atoll (ctxt->params[4]));
if (ptr_modelist) if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime); irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime);
weechat_printf_datetime_tags ( weechat_printf_datetime_tags (
@@ -5788,7 +5776,7 @@ IRC_PROTOCOL_CALLBACK(348)
irc_message_get_address_from_host (ctxt->params[3])); irc_message_get_address_from_host (ctxt->params[3]));
if (ctxt->num_params >= 5) if (ctxt->num_params >= 5)
{ {
datetime = (time_t)(atol (ctxt->params[4])); datetime = (time_t)(atoll (ctxt->params[4]));
if (ptr_modelist) if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime); irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime);
weechat_printf_datetime_tags ( weechat_printf_datetime_tags (
@@ -6818,7 +6806,7 @@ IRC_PROTOCOL_CALLBACK(367)
irc_message_get_address_from_host (ctxt->params[3])); irc_message_get_address_from_host (ctxt->params[3]));
if (ctxt->num_params >= 5) if (ctxt->num_params >= 5)
{ {
datetime = (time_t)(atol (ctxt->params[4])); datetime = (time_t)(atoll (ctxt->params[4]));
if (ptr_modelist) if (ptr_modelist)
{ {
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3],
@@ -7393,7 +7381,7 @@ IRC_PROTOCOL_CALLBACK(728)
irc_message_get_address_from_host (ctxt->params[4])); irc_message_get_address_from_host (ctxt->params[4]));
if (ctxt->num_params >= 6) if (ctxt->num_params >= 6)
{ {
datetime = (time_t)(atol (ctxt->params[5])); datetime = (time_t)(atoll (ctxt->params[5]));
if (ptr_modelist) if (ptr_modelist)
{ {
irc_modelist_item_new (ptr_modelist, ctxt->params[3], ctxt->params[4], irc_modelist_item_new (ptr_modelist, ctxt->params[3], ctxt->params[4],
+6 -17
View File
@@ -404,9 +404,8 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
const char *cmd_filter) const char *cmd_filter)
{ {
struct t_irc_redirect *new_redirect; struct t_irc_redirect *new_redirect;
char **items[4], *item_upper, *pos, *error; char **items[4], *item_upper, *pos;
int i, j, num_items[4]; int i, j, num_items[4], value;
long value;
struct t_hashtable *hash_cmd[4]; struct t_hashtable *hash_cmd[4];
new_redirect = malloc (sizeof (*new_redirect)); new_redirect = malloc (sizeof (*new_redirect));
@@ -460,9 +459,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
if (pos) if (pos)
{ {
pos[0] = '\0'; pos[0] = '\0';
error = NULL; if (!weechat_util_parse_int (pos + 1, 10, &value))
value = strtol (pos + 1, &error, 10);
if (!error || error[0])
value = -1; value = -1;
} }
item_upper = weechat_string_toupper (items[i][j]); item_upper = weechat_string_toupper (items[i][j]);
@@ -1257,7 +1254,6 @@ irc_redirect_pattern_hsignal_cb (const void *pointer, void *data,
struct t_hashtable *hashtable) struct t_hashtable *hashtable)
{ {
const char *pattern, *str_timeout, *cmd_start, *cmd_stop, *cmd_extra; const char *pattern, *str_timeout, *cmd_start, *cmd_stop, *cmd_extra;
char *error;
int number, timeout; int number, timeout;
/* make C compiler happy */ /* make C compiler happy */
@@ -1295,9 +1291,7 @@ irc_redirect_pattern_hsignal_cb (const void *pointer, void *data,
timeout = 0; timeout = 0;
if (str_timeout && str_timeout[0]) if (str_timeout && str_timeout[0])
{ {
error = NULL; if (weechat_util_parse_int (str_timeout, 10, &number))
number = (int)strtol (str_timeout, &error, 10);
if (error && !error[0])
timeout = number; timeout = number;
} }
@@ -1325,7 +1319,6 @@ irc_redirect_command_hsignal_cb (const void *pointer, void *data,
{ {
const char *server, *pattern, *redirect_signal, *str_count, *string; const char *server, *pattern, *redirect_signal, *str_count, *string;
const char *str_timeout, *cmd_filter; const char *str_timeout, *cmd_filter;
char *error;
struct t_irc_server *ptr_server; struct t_irc_server *ptr_server;
int number, count, timeout; int number, count, timeout;
@@ -1366,18 +1359,14 @@ irc_redirect_command_hsignal_cb (const void *pointer, void *data,
count = 1; count = 1;
if (str_count && str_count[0]) if (str_count && str_count[0])
{ {
error = NULL; if (weechat_util_parse_int (str_count, 10, &number))
number = (int)strtol (str_count, &error, 10);
if (error && !error[0])
count = number; count = number;
} }
timeout = 0; timeout = 0;
if (str_timeout && str_timeout[0]) if (str_timeout && str_timeout[0])
{ {
error = NULL; if (weechat_util_parse_int (str_timeout, 10, &number))
number = (int)strtol (str_timeout, &error, 10);
if (error && !error[0])
timeout = number; timeout = number;
} }
+5 -7
View File
@@ -109,7 +109,7 @@ irc_sasl_mechanism_scram (struct t_irc_server *server,
const char *sasl_password, const char *sasl_password,
char **sasl_error) char **sasl_error)
{ {
char *answer_base64, *string, *username, *username2, *data, **attrs, *error; char *answer_base64, *string, *username, *username2, *data, **attrs;
char nonce_client[18], nonce_client_base64[24 + 1], *nonce_server; char nonce_client[18], nonce_client_base64[24 + 1], *nonce_server;
char *salt_base64, *salt, *verifier_base64, *verifier, *attr_error; char *salt_base64, *salt, *verifier_base64, *verifier, *attr_error;
char *auth_no_proof, *auth_message; char *auth_no_proof, *auth_message;
@@ -117,10 +117,10 @@ irc_sasl_mechanism_scram (struct t_irc_server *server,
char client_signature[512 / 8], client_proof[512 / 8]; char client_signature[512 / 8], client_proof[512 / 8];
char client_proof_base64[((512 / 8) * 4) + 1], server_key[512 / 8]; char client_proof_base64[((512 / 8) * 4) + 1], server_key[512 / 8];
char server_signature[512 / 8]; char server_signature[512 / 8];
int i, rc, length, num_attrs, iterations, salt_size, salted_password_size; int i, rc, length, num_attrs, iterations, number;
int salt_size, salted_password_size;
int client_key_size, stored_key_size, client_signature_size; int client_key_size, stored_key_size, client_signature_size;
int server_key_size, server_signature_size, verifier_size; int server_key_size, server_signature_size, verifier_size;
long number;
if (!server || !hash_algo || !data_base64 || !sasl_username if (!server || !hash_algo || !data_base64 || !sasl_username
|| !sasl_password) || !sasl_password)
@@ -202,10 +202,8 @@ irc_sasl_mechanism_scram (struct t_irc_server *server,
} }
else if (strncmp (attrs[i], "i=", 2) == 0) else if (strncmp (attrs[i], "i=", 2) == 0)
{ {
error = NULL; if (weechat_util_parse_int (attrs[i] + 2, 10, &number))
number = strtol (attrs[i] + 2, &error, 10); iterations = number;
if (error && !error[0])
iterations = (int)number;
} }
else if (strncmp (attrs[i], "v=", 2) == 0) else if (strncmp (attrs[i], "v=", 2) == 0)
{ {
+7 -17
View File
@@ -676,10 +676,9 @@ int
irc_server_set_addresses (struct t_irc_server *server, const char *addresses, irc_server_set_addresses (struct t_irc_server *server, const char *addresses,
int tls) int tls)
{ {
int rc, i, default_port; int rc, i, default_port, number;
char *pos, *error, *addresses_eval; char *pos, *addresses_eval;
const char *ptr_addresses; const char *ptr_addresses;
long number;
if (!server) if (!server)
return 0; return 0;
@@ -753,19 +752,14 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses,
server->addresses_count * sizeof (server->retry_array[0])); server->addresses_count * sizeof (server->retry_array[0]));
for (i = 0; i < server->addresses_count; i++) for (i = 0; i < server->addresses_count; i++)
{ {
server->ports_array[i] = default_port;
pos = strchr (server->addresses_array[i], '/'); pos = strchr (server->addresses_array[i], '/');
if (pos) if (pos)
{ {
pos[0] = 0; pos[0] = 0;
pos++; pos++;
error = NULL; if (weechat_util_parse_int (pos, 10, &number))
number = strtol (pos, &error, 10); server->ports_array[i] = number;
server->ports_array[i] = (error && !error[0]) ?
number : default_port;
}
else
{
server->ports_array[i] = default_port;
} }
server->retry_array[i] = 0; server->retry_array[i] = 0;
} }
@@ -1518,18 +1512,14 @@ int
irc_server_get_max_modes (struct t_irc_server *server) irc_server_get_max_modes (struct t_irc_server *server)
{ {
const char *support_modes; const char *support_modes;
char *error; int max_modes, number;
long number;
int max_modes;
max_modes = 4; max_modes = 4;
support_modes = irc_server_get_isupport_value (server, "MODES"); support_modes = irc_server_get_isupport_value (server, "MODES");
if (support_modes) if (support_modes)
{ {
error = NULL; if (weechat_util_parse_int (support_modes, 10, &number))
number = strtol (support_modes, &error, 10);
if (error && !error[0])
{ {
max_modes = number; max_modes = number;
if (max_modes < 1) if (max_modes < 1)
+13 -24
View File
@@ -356,11 +356,10 @@ irc_upgrade_read_cb (const void *pointer, void *data,
int object_id, int object_id,
struct t_infolist *infolist) struct t_infolist *infolist)
{ {
int flags, sock, size, i, index, nicks_count, num_items, utf8mapping; int flags, sock, size, i, index, nicks_count, num_items, number, utf8mapping;
long number; long long number_longlong;
time_t join_time; time_t join_time;
char *buf, option_name[64], **nicks, *nick_join, *pos, *error; char *buf, option_name[64], **nicks, *nick_join, *pos, **items;
char **items;
const char *buffer_name, *str, *nick; const char *buffer_name, *str, *nick;
struct t_irc_server *ptr_server; struct t_irc_server *ptr_server;
struct t_irc_nick *ptr_nick; struct t_irc_nick *ptr_nick;
@@ -521,10 +520,8 @@ irc_upgrade_read_cb (const void *pointer, void *data,
"LINELEN"); "LINELEN");
if (str) if (str)
{ {
error = NULL; if (weechat_util_parse_int (str, 10, &number))
number = strtol (str, &error, 10); irc_upgrade_current_server->msg_max_length = number;
if (error && !error[0])
irc_upgrade_current_server->msg_max_length = (int)number;
} }
} }
irc_upgrade_current_server->nick_max_length = weechat_infolist_integer (infolist, "nick_max_length"); irc_upgrade_current_server->nick_max_length = weechat_infolist_integer (infolist, "nick_max_length");
@@ -540,10 +537,8 @@ irc_upgrade_read_cb (const void *pointer, void *data,
"USERLEN"); "USERLEN");
if (str) if (str)
{ {
error = NULL; if (weechat_util_parse_int (str, 10, &number))
number = strtol (str, &error, 10); irc_upgrade_current_server->user_max_length = number;
if (error && !error[0])
irc_upgrade_current_server->user_max_length = (int)number;
} }
} }
/* "host_max_length" is new in WeeChat 2.6 */ /* "host_max_length" is new in WeeChat 2.6 */
@@ -558,10 +553,8 @@ irc_upgrade_read_cb (const void *pointer, void *data,
"HOSTLEN"); "HOSTLEN");
if (str) if (str)
{ {
error = NULL; if (weechat_util_parse_int (str, 10, &number))
number = strtol (str, &error, 10); irc_upgrade_current_server->host_max_length = number;
if (error && !error[0])
irc_upgrade_current_server->host_max_length = (int)number;
} }
} }
irc_upgrade_current_server->casemapping = weechat_infolist_integer (infolist, "casemapping"); irc_upgrade_current_server->casemapping = weechat_infolist_integer (infolist, "casemapping");
@@ -621,10 +614,8 @@ irc_upgrade_read_cb (const void *pointer, void *data,
"MONITOR"); "MONITOR");
if (str) if (str)
{ {
error = NULL; if (weechat_util_parse_int (str, 10, &number))
number = strtol (str, &error, 10); irc_upgrade_current_server->monitor = number;
if (error && !error[0])
irc_upgrade_current_server->monitor = (int)number;
} }
} }
/* "clienttagdeny" is new in WeeChat 3.3 */ /* "clienttagdeny" is new in WeeChat 3.3 */
@@ -771,11 +762,9 @@ irc_upgrade_read_cb (const void *pointer, void *data,
pos - nicks[i]); pos - nicks[i]);
if (nick_join) if (nick_join)
{ {
error = NULL; if (weechat_util_parse_longlong (pos + 1, 10, &number_longlong))
number = strtol (pos + 1, &error, 10);
if (error && !error[0])
{ {
join_time = (time_t)number; join_time = (time_t)number_longlong;
irc_channel_join_smart_filtered_add (irc_upgrade_current_channel, irc_channel_join_smart_filtered_add (irc_upgrade_current_channel,
nick_join, nick_join,
join_time); join_time);
+1 -4
View File
@@ -2982,7 +2982,6 @@ API_FUNC(hook_signal)
API_FUNC(hook_signal_send) API_FUNC(hook_signal_send)
{ {
char *error;
int number, rc; int number, rc;
API_INIT_FUNC(1, "hook_signal_send", "sss", API_RETURN_INT(WEECHAT_RC_ERROR)); API_INIT_FUNC(1, "hook_signal_send", "sss", API_RETURN_INT(WEECHAT_RC_ERROR));
@@ -2998,9 +2997,7 @@ API_FUNC(hook_signal_send)
} }
else if (strcmp (*type_data, WEECHAT_HOOK_SIGNAL_INT) == 0) else if (strcmp (*type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{ {
error = NULL; if (weechat_util_parse_int (*signal_data, 10, &number))
number = (int)strtol (*signal_data, &error, 10);
if (error && !error[0])
rc = weechat_hook_signal_send (*signal, *type_data, &number); rc = weechat_hook_signal_send (*signal, *type_data, &number);
else else
rc = WEECHAT_RC_ERROR; rc = WEECHAT_RC_ERROR;
+5 -5
View File
@@ -2173,7 +2173,7 @@ API_FUNC(print)
API_FUNC(print_date_tags) API_FUNC(print_date_tags)
{ {
const char *buffer, *tags, *message; const char *buffer, *tags, *message;
long date; long long date;
API_INIT_FUNC(1, "print_date_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (lua_gettop (L) < 4) if (lua_gettop (L) < 4)
@@ -2197,7 +2197,7 @@ API_FUNC(print_date_tags)
API_FUNC(print_datetime_tags) API_FUNC(print_datetime_tags)
{ {
const char *buffer, *tags, *message; const char *buffer, *tags, *message;
long date; long long date;
int date_usec; int date_usec;
API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR);
@@ -2247,7 +2247,7 @@ API_FUNC(print_y_date_tags)
{ {
const char *buffer, *tags, *message; const char *buffer, *tags, *message;
int y; int y;
long date; long long date;
API_INIT_FUNC(1, "print_y_date_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "print_y_date_tags", API_RETURN_ERROR);
if (lua_gettop (L) < 5) if (lua_gettop (L) < 5)
@@ -2274,7 +2274,7 @@ API_FUNC(print_y_datetime_tags)
{ {
const char *buffer, *tags, *message; const char *buffer, *tags, *message;
int y, date_usec; int y, date_usec;
long date; long long date;
API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR);
if (lua_gettop (L) < 6) if (lua_gettop (L) < 6)
@@ -5008,7 +5008,7 @@ API_FUNC(infolist_new_var_time)
{ {
const char *item, *name; const char *item, *name;
const char *result; const char *result;
long value; long long value;
API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY); API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
if (lua_gettop (L) < 3) if (lua_gettop (L) < 3)
+5 -5
View File
@@ -2106,7 +2106,7 @@ API_FUNC(print_date_tags)
plugin_script_api_printf_date_tags (weechat_perl_plugin, plugin_script_api_printf_date_tags (weechat_perl_plugin,
perl_current_script, perl_current_script,
API_STR2PTR(buffer), API_STR2PTR(buffer),
(time_t)(SvIV (ST (1))), /* date */ (time_t)(SvNV (ST (1))), /* date */
tags, tags,
"%s", message); "%s", message);
@@ -2129,7 +2129,7 @@ API_FUNC(print_datetime_tags)
plugin_script_api_printf_datetime_tags (weechat_perl_plugin, plugin_script_api_printf_datetime_tags (weechat_perl_plugin,
perl_current_script, perl_current_script,
API_STR2PTR(buffer), API_STR2PTR(buffer),
(time_t)(SvIV (ST (1))), /* date */ (time_t)(SvNV (ST (1))), /* date */
SvIV (ST (2)), /* date_usec */ SvIV (ST (2)), /* date_usec */
tags, tags,
"%s", message); "%s", message);
@@ -2175,7 +2175,7 @@ API_FUNC(print_y_date_tags)
perl_current_script, perl_current_script,
API_STR2PTR(buffer), API_STR2PTR(buffer),
SvIV (ST (1)), /* y */ SvIV (ST (1)), /* y */
(time_t)(SvIV (ST (2))), /* date */ (time_t)(SvNV (ST (2))), /* date */
tags, tags,
"%s", message); "%s", message);
@@ -2199,7 +2199,7 @@ API_FUNC(print_y_datetime_tags)
perl_current_script, perl_current_script,
API_STR2PTR(buffer), API_STR2PTR(buffer),
SvIV (ST (1)), /* y */ SvIV (ST (1)), /* y */
(time_t)(SvIV (ST (2))), /* date */ (time_t)(SvNV (ST (2))), /* date */
SvIV (ST (3)), /* date_usec */ SvIV (ST (3)), /* date_usec */
tags, tags,
"%s", message); "%s", message);
@@ -4940,7 +4940,7 @@ API_FUNC(infolist_new_var_time)
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(item), result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(item),
name, name,
(time_t)(SvIV (ST (2))))); /* value */ (time_t)(SvNV (ST (2))))); /* value */
API_RETURN_STRING(result); API_RETURN_STRING(result);
} }
+27 -46
View File
@@ -904,9 +904,8 @@ plugin_api_info_nick_color_ignore_case_cb (const void *pointer, void *data,
const char *info_name, const char *info_name,
const char *arguments) const char *arguments)
{ {
char **items, *result, *error; char **items, *result;
int num_items, case_range; int num_items, case_range, number;
long number;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -918,10 +917,8 @@ plugin_api_info_nick_color_ignore_case_cb (const void *pointer, void *data,
case_range = -1; case_range = -1;
if (num_items >= 2) if (num_items >= 2)
{ {
error = NULL; if (util_parse_int (items[1], 10, &number))
number = strtol (items[1], &error, 10); case_range = number;
if (error && !error[0])
case_range = (int)number;
} }
result = gui_nick_find_color ( result = gui_nick_find_color (
@@ -943,9 +940,8 @@ plugin_api_info_nick_color_name_ignore_case_cb (const void *pointer, void *data,
const char *info_name, const char *info_name,
const char *arguments) const char *arguments)
{ {
char **items, *result, *error; char **items, *result;
int num_items, case_range; int num_items, case_range, number;
long number;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -957,10 +953,8 @@ plugin_api_info_nick_color_name_ignore_case_cb (const void *pointer, void *data,
case_range = -1; case_range = -1;
if (num_items >= 2) if (num_items >= 2)
{ {
error = NULL; if (util_parse_int (items[1], 10, &number))
number = strtol (items[1], &error, 10); case_range = number;
if (error && !error[0])
case_range = (int)number;
} }
result = gui_nick_find_color_name ( result = gui_nick_find_color_name (
@@ -1048,7 +1042,7 @@ plugin_api_info_uptime_current_cb (const void *pointer, void *data,
(void) info_name; (void) info_name;
return plugin_api_info_build_uptime ( return plugin_api_info_build_uptime (
(time_t)weechat_current_start_timeval.tv_sec, weechat_current_start_timeval.tv_sec,
arguments); arguments);
} }
@@ -1064,9 +1058,9 @@ plugin_api_info_totp_generate_cb (const void *pointer, void *data,
const char *info_name, const char *info_name,
const char *arguments) const char *arguments)
{ {
char **argv, *ptr_secret, *error, *totp; char **argv, *ptr_secret, *totp;
int argc, digits; int argc, digits, number_int;
long number; long long number_longlong;
time_t totp_time; time_t totp_time;
/* make C compiler happy */ /* make C compiler happy */
@@ -1094,19 +1088,15 @@ plugin_api_info_totp_generate_cb (const void *pointer, void *data,
if (argc > 1) if (argc > 1)
{ {
error = NULL; if (!util_parse_longlong (argv[1], 10, &number_longlong) || (number_longlong < 0))
number = (int)strtol (argv[1], &error, 10);
if (!error || error[0] || (number < 0))
goto error; goto error;
totp_time = (time_t)number; totp_time = (time_t)number_longlong;
} }
if (argc > 2) if (argc > 2)
{ {
error = NULL; if (!util_parse_int (argv[2], 10, &number_int) || (number_int < 0))
number = (int)strtol (argv[2], &error, 10);
if (!error || error[0] || (number < 0))
goto error; goto error;
digits = number; digits = number_int;
} }
totp = weecrypto_totp_generate (ptr_secret, totp_time, digits); totp = weecrypto_totp_generate (ptr_secret, totp_time, digits);
@@ -1135,9 +1125,9 @@ plugin_api_info_totp_validate_cb (const void *pointer, void *data,
const char *info_name, const char *info_name,
const char *arguments) const char *arguments)
{ {
char value[16], **argv, *ptr_secret, *ptr_otp, *error; char value[16], **argv, *ptr_secret, *ptr_otp;
int argc, window, rc; int argc, window, rc, number_int;
long number; long long number_longlong;
time_t totp_time; time_t totp_time;
/* make C compiler happy */ /* make C compiler happy */
@@ -1165,19 +1155,15 @@ plugin_api_info_totp_validate_cb (const void *pointer, void *data,
if (argc > 2) if (argc > 2)
{ {
error = NULL; if (!util_parse_longlong (argv[2], 10, &number_longlong) || (number_longlong < 0))
number = (int)strtol (argv[2], &error, 10);
if (!error || error[0] || (number < 0))
goto error; goto error;
totp_time = (time_t)number; totp_time = (time_t)number_longlong;
} }
if (argc > 3) if (argc > 3)
{ {
error = NULL; if (!util_parse_int (argv[3], 10, &number_int) || (number_int < 0))
number = (int)strtol (argv[3], &error, 10);
if (!error || error[0] || (number < 0))
goto error; goto error;
window = number; window = number_int;
} }
rc = weecrypto_totp_validate (ptr_secret, totp_time, window, ptr_otp); rc = weecrypto_totp_validate (ptr_secret, totp_time, window, ptr_otp);
@@ -1236,8 +1222,8 @@ plugin_api_info_window_cb (const void *pointer, void *data,
const char *arguments) const char *arguments)
{ {
struct t_gui_window *ptr_window; struct t_gui_window *ptr_window;
long number; int number;
char *error, value[64]; char value[64];
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -1247,9 +1233,7 @@ plugin_api_info_window_cb (const void *pointer, void *data,
if (!arguments || !arguments[0]) if (!arguments || !arguments[0])
return NULL; return NULL;
error = NULL; if (!util_parse_int (arguments, 10, &number))
number = (int)strtol (arguments, &error, 10);
if (!error || error[0])
return NULL; return NULL;
ptr_window = gui_window_search_by_number (number); ptr_window = gui_window_search_by_number (number);
@@ -2041,7 +2025,6 @@ plugin_api_infolist_window_cb (const void *pointer, void *data,
struct t_infolist *ptr_infolist; struct t_infolist *ptr_infolist;
struct t_gui_window *ptr_window; struct t_gui_window *ptr_window;
int number; int number;
char *error;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -2085,9 +2068,7 @@ plugin_api_infolist_window_cb (const void *pointer, void *data,
return NULL; return NULL;
} }
/* check if argument is a window number */ /* check if argument is a window number */
error = NULL; if (util_parse_int (arguments, 10, &number))
number = (int)strtol (arguments, &error, 10);
if (error && !error[0])
{ {
ptr_window = gui_window_search_by_number (number); ptr_window = gui_window_search_by_number (number);
if (ptr_window) if (ptr_window)
+3 -4
View File
@@ -38,6 +38,7 @@
#include "../core/core-input.h" #include "../core/core-input.h"
#include "../core/core-proxy.h" #include "../core/core-proxy.h"
#include "../core/core-string.h" #include "../core/core-string.h"
#include "../core/core-util.h"
#include "../gui/gui-bar.h" #include "../gui/gui-bar.h"
#include "../gui/gui-bar-item.h" #include "../gui/gui-bar-item.h"
#include "../gui/gui-bar-window.h" #include "../gui/gui-bar-window.h"
@@ -394,7 +395,7 @@ plugin_api_command_options (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command, struct t_gui_buffer *buffer, const char *command,
struct t_hashtable *options) struct t_hashtable *options)
{ {
char *command2, *error; char *command2;
const char *ptr_commands_allowed, *ptr_delay, *ptr_split_newline; const char *ptr_commands_allowed, *ptr_delay, *ptr_split_newline;
long delay; long delay;
int rc, split_newline; int rc, split_newline;
@@ -412,9 +413,7 @@ plugin_api_command_options (struct t_weechat_plugin *plugin,
ptr_delay = hashtable_get (options, "delay"); ptr_delay = hashtable_get (options, "delay");
if (ptr_delay) if (ptr_delay)
{ {
error = NULL; if (!util_parse_long (ptr_delay, 10, &delay))
delay = strtol (ptr_delay, &error, 10);
if (!error || error[0])
delay = 0; delay = 0;
} }
ptr_split_newline = hashtable_get (options, "split_newline"); ptr_split_newline = hashtable_get (options, "split_newline");
+12 -14
View File
@@ -2093,14 +2093,14 @@ API_FUNC(prnt)
API_FUNC(prnt_date_tags) API_FUNC(prnt_date_tags)
{ {
char *buffer, *tags, *message; char *buffer, *tags, *message;
long date; long long date;
API_INIT_FUNC(1, "prnt_date_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "prnt_date_tags", API_RETURN_ERROR);
buffer = NULL; buffer = NULL;
date = 0; date = 0;
tags = NULL; tags = NULL;
message = NULL; message = NULL;
if (!PyArg_ParseTuple (args, "slss", &buffer, &date, &tags, &message)) if (!PyArg_ParseTuple (args, "sLss", &buffer, &date, &tags, &message))
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
plugin_script_api_printf_date_tags (weechat_python_plugin, plugin_script_api_printf_date_tags (weechat_python_plugin,
@@ -2116,7 +2116,7 @@ API_FUNC(prnt_date_tags)
API_FUNC(prnt_datetime_tags) API_FUNC(prnt_datetime_tags)
{ {
char *buffer, *tags, *message; char *buffer, *tags, *message;
long date; long long date;
int date_usec; int date_usec;
API_INIT_FUNC(1, "prnt_datetime_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "prnt_datetime_tags", API_RETURN_ERROR);
@@ -2125,7 +2125,7 @@ API_FUNC(prnt_datetime_tags)
date_usec = 0; date_usec = 0;
tags = NULL; tags = NULL;
message = NULL; message = NULL;
if (!PyArg_ParseTuple (args, "sliss", &buffer, &date, &date_usec, &tags, if (!PyArg_ParseTuple (args, "sLiss", &buffer, &date, &date_usec, &tags,
&message)) &message))
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
@@ -2165,7 +2165,7 @@ API_FUNC(prnt_y_date_tags)
{ {
char *buffer, *tags, *message; char *buffer, *tags, *message;
int y; int y;
long date; long long date;
API_INIT_FUNC(1, "prnt_y_date_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "prnt_y_date_tags", API_RETURN_ERROR);
buffer = NULL; buffer = NULL;
@@ -2173,7 +2173,7 @@ API_FUNC(prnt_y_date_tags)
date = 0; date = 0;
tags = NULL; tags = NULL;
message = NULL; message = NULL;
if (!PyArg_ParseTuple (args, "silss", &buffer, &y, &date, &tags, &message)) if (!PyArg_ParseTuple (args, "siLss", &buffer, &y, &date, &tags, &message))
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
plugin_script_api_printf_y_date_tags (weechat_python_plugin, plugin_script_api_printf_y_date_tags (weechat_python_plugin,
@@ -2191,7 +2191,7 @@ API_FUNC(prnt_y_datetime_tags)
{ {
char *buffer, *tags, *message; char *buffer, *tags, *message;
int y; int y;
long date; long long date;
int date_usec; int date_usec;
API_INIT_FUNC(1, "prnt_y_datetime_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "prnt_y_datetime_tags", API_RETURN_ERROR);
@@ -2201,7 +2201,7 @@ API_FUNC(prnt_y_datetime_tags)
date_usec = 0; date_usec = 0;
tags = NULL; tags = NULL;
message = NULL; message = NULL;
if (!PyArg_ParseTuple (args, "siliss", &buffer, &y, &date, &date_usec, if (!PyArg_ParseTuple (args, "siLiss", &buffer, &y, &date, &date_usec,
&tags, &message)) &tags, &message))
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
@@ -3120,7 +3120,7 @@ API_FUNC(hook_signal)
API_FUNC(hook_signal_send) API_FUNC(hook_signal_send)
{ {
char *signal, *type_data, *signal_data, *error; char *signal, *type_data, *signal_data;
int number, rc; int number, rc;
API_INIT_FUNC(1, "hook_signal_send", API_RETURN_INT(WEECHAT_RC_ERROR)); API_INIT_FUNC(1, "hook_signal_send", API_RETURN_INT(WEECHAT_RC_ERROR));
@@ -3137,9 +3137,7 @@ API_FUNC(hook_signal_send)
} }
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0) else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{ {
error = NULL; if (weechat_util_parse_int (signal_data, 10, &number))
number = (int)strtol (signal_data, &error, 10);
if (error && !error[0])
rc = weechat_hook_signal_send (signal, type_data, &number); rc = weechat_hook_signal_send (signal, type_data, &number);
else else
rc = WEECHAT_RC_ERROR; rc = WEECHAT_RC_ERROR;
@@ -4906,13 +4904,13 @@ API_FUNC(infolist_new_var_time)
{ {
char *item, *name; char *item, *name;
const char *result; const char *result;
long value; long long value;
API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY); API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
item = NULL; item = NULL;
name = NULL; name = NULL;
value = 0; value = 0;
if (!PyArg_ParseTuple (args, "ssl", &item, &name, &value)) if (!PyArg_ParseTuple (args, "ssL", &item, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY); API_WRONG_ARGS(API_RETURN_EMPTY);
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(item), result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(item),
+9 -14
View File
@@ -77,7 +77,6 @@ relay_api_protocol_signal_buffer_cb (const void *pointer, void *data,
long long buffer_id; long long buffer_id;
int nicks; int nicks;
const char *ptr_id; const char *ptr_id;
char *error;
/* make C compiler happy */ /* make C compiler happy */
(void) data; (void) data;
@@ -119,9 +118,7 @@ relay_api_protocol_signal_buffer_cb (const void *pointer, void *data,
ptr_buffer); ptr_buffer);
if (ptr_id) if (ptr_id)
{ {
error = NULL; if (!weechat_util_parse_longlong (ptr_id, 10, &buffer_id))
buffer_id = strtoll (ptr_id, &error, 10);
if (!error || error[0])
buffer_id = -1; buffer_id = -1;
weechat_hashtable_remove ( weechat_hashtable_remove (
RELAY_API_DATA(ptr_client, buffers_closing), RELAY_API_DATA(ptr_client, buffers_closing),
@@ -499,7 +496,7 @@ invalid_hash_algo:
RELAY_API_PROTOCOL_CALLBACK(version) RELAY_API_PROTOCOL_CALLBACK(version)
{ {
cJSON *json; cJSON *json;
char *version, *error; char *version;
long number; long number;
json = cJSON_CreateObject (); json = cJSON_CreateObject ();
@@ -517,9 +514,7 @@ RELAY_API_PROTOCOL_CALLBACK(version)
free (version); free (version);
version = weechat_info_get ("version_number", NULL); version = weechat_info_get ("version_number", NULL);
error = NULL; if (weechat_util_parse_long (version, 10, &number))
number = strtol (version, &error, 10);
if (error && !error[0])
{ {
cJSON_AddItemToObject (json, cJSON_AddItemToObject (json,
"weechat_version_number", "weechat_version_number",
@@ -561,10 +556,9 @@ RELAY_API_PROTOCOL_CALLBACK(buffers)
struct t_gui_buffer *ptr_buffer; struct t_gui_buffer *ptr_buffer;
struct t_gui_line *ptr_line; struct t_gui_line *ptr_line;
struct t_gui_line_data *ptr_line_data; struct t_gui_line_data *ptr_line_data;
long lines, lines_free, line_id; long lines, lines_free;
int colors, nicks; int colors, nicks, line_id;
const char *ptr_colors; const char *ptr_colors;
char *error;
json = NULL; json = NULL;
@@ -610,9 +604,10 @@ RELAY_API_PROTOCOL_CALLBACK(buffers)
{ {
if (client->http_req->num_path_items > 4) if (client->http_req->num_path_items > 4)
{ {
line_id = strtol (client->http_req->path_items[4], &error, 10); if (weechat_util_parse_int (client->http_req->path_items[4], 10, &line_id))
ptr_line = (error && !error[0]) ? ptr_line = weechat_line_search_by_id (ptr_buffer, line_id);
weechat_line_search_by_id (ptr_buffer, line_id) : NULL; else
ptr_line = NULL;
ptr_line_data = (ptr_line) ? ptr_line_data = (ptr_line) ?
weechat_hdata_pointer (relay_hdata_line, ptr_line, "data") : NULL; weechat_hdata_pointer (relay_hdata_line, ptr_line, "data") : NULL;
if (!ptr_line_data) if (!ptr_line_data)
+1 -4
View File
@@ -51,7 +51,6 @@ long long
relay_api_get_buffer_id (struct t_gui_buffer *buffer) relay_api_get_buffer_id (struct t_gui_buffer *buffer)
{ {
const char *ptr_id; const char *ptr_id;
char *error;
long long id; long long id;
if (!buffer) if (!buffer)
@@ -61,9 +60,7 @@ relay_api_get_buffer_id (struct t_gui_buffer *buffer)
if (!ptr_id) if (!ptr_id)
return -1; return -1;
error = NULL; if (!weechat_util_parse_longlong (ptr_id, 10, &id))
id = strtoll (ptr_id, &error, 10);
if (!error || error[0])
return -1; return -1;
return id; return id;
@@ -113,7 +113,6 @@ long long
relay_remote_event_get_buffer_id (struct t_gui_buffer *buffer) relay_remote_event_get_buffer_id (struct t_gui_buffer *buffer)
{ {
const char *ptr_id; const char *ptr_id;
char *error;
long long buffer_id; long long buffer_id;
if (!buffer) if (!buffer)
@@ -123,9 +122,7 @@ relay_remote_event_get_buffer_id (struct t_gui_buffer *buffer)
if (!ptr_id) if (!ptr_id)
return -1; return -1;
error = NULL; if (!weechat_util_parse_longlong (ptr_id, 10, &buffer_id))
buffer_id = strtoll (ptr_id, &error, 10);
if (!error || error[0])
return -1; return -1;
return buffer_id; return buffer_id;
+6 -12
View File
@@ -429,9 +429,8 @@ relay_irc_signal_irc_in2_cb (const void *pointer, void *data,
int int
relay_irc_tag_relay_client_id (const char *tags) relay_irc_tag_relay_client_id (const char *tags)
{ {
char **argv, *error; char **argv;
int result, argc, i; int number, result, argc, i;
long number;
result = -1; result = -1;
@@ -449,9 +448,7 @@ relay_irc_tag_relay_client_id (const char *tags)
{ {
if (strncmp (argv[i], "relay_client_", 13) == 0) if (strncmp (argv[i], "relay_client_", 13) == 0)
{ {
error = NULL; if (weechat_util_parse_int (argv[i] + 13, 10, &number))
number = strtol (argv[i] + 13, &error, 10);
if (error && !error[0])
{ {
result = number; result = number;
break; break;
@@ -1606,10 +1603,9 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
const char *ptr_data, *ptr_nick_modes, *pos; const char *ptr_data, *ptr_nick_modes, *pos;
char str_time[128], str_signal[128], str_server_channel[256], *nick; char str_time[128], str_signal[128], str_server_channel[256], *nick;
char str_param[128], *str_args, *version, str_command[128], **params; char str_param[128], *str_args, *version, str_command[128], **params;
char *password, *irc_is_channel, *info, *error, *str_cmd_lower; char *password, *irc_is_channel, *info, *str_cmd_lower;
char modifier_data[128], *new_data, *ctcp_type, *ctcp_params, *nick_modes; char modifier_data[128], *new_data, *ctcp_type, *ctcp_params, *nick_modes;
long num_params; int i, num_params, redirect_msg;
int i, redirect_msg;
new_data = NULL; new_data = NULL;
hash_parsed = NULL; hash_parsed = NULL;
@@ -1650,9 +1646,7 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
goto end; goto end;
irc_command = weechat_hashtable_get (hash_parsed, "command"); irc_command = weechat_hashtable_get (hash_parsed, "command");
str_num_params = weechat_hashtable_get (hash_parsed, "num_params"); str_num_params = weechat_hashtable_get (hash_parsed, "num_params");
error = NULL; if (!weechat_util_parse_int (str_num_params, 10, &num_params))
num_params = strtol (str_num_params, &error, 10);
if (!error || error[0])
num_params = 0; num_params = 0;
if (num_params > 0) if (num_params > 0)
{ {
+5 -11
View File
@@ -283,7 +283,7 @@ relay_auth_parse_pbkdf2 (const char *parameters,
char **salt_hexa, char **salt, int *salt_size, char **salt_hexa, char **salt, int *salt_size,
int *iterations, char **hash) int *iterations, char **hash)
{ {
char **argv, *error; char **argv;
int argc; int argc;
if (salt_hexa) if (salt_hexa)
@@ -329,9 +329,7 @@ relay_auth_parse_pbkdf2 (const char *parameters,
} }
/* parameter 2: iterations */ /* parameter 2: iterations */
error = NULL; if (!weechat_util_parse_int (argv[1], 10, iterations))
*iterations = (int)strtol (argv[1], &error, 10);
if (!error || error[0])
*iterations = 0; *iterations = 0;
/* parameter 3: the PBKDF2 hash */ /* parameter 3: the PBKDF2 hash */
@@ -362,9 +360,7 @@ int
relay_auth_check_salt (struct t_relay_client *client, relay_auth_check_salt (struct t_relay_client *client,
const char *salt_hexa, const char *salt, int salt_size) const char *salt_hexa, const char *salt, int salt_size)
{ {
long number; long long number, time_window;
int time_window;
char *error;
time_t time_now; time_t time_now;
if (!client) if (!client)
@@ -374,12 +370,10 @@ relay_auth_check_salt (struct t_relay_client *client,
{ {
if (!salt || (salt_size < 1)) if (!salt || (salt_size < 1))
return 0; return 0;
error = NULL; if (!weechat_util_parse_longlong (salt, 10, &number))
number = strtol (salt, &error, 10);
if (!error || error[0])
return 0; return 0;
time_now = time (NULL); time_now = time (NULL);
time_window = weechat_config_integer (relay_config_network_time_window); time_window = (long long)weechat_config_integer (relay_config_network_time_window);
return ((number >= time_now - time_window) return ((number >= time_now - time_window)
&& (number <= time_now + time_window)) ? 1 : 0; && (number <= time_now + time_window)) ? 1 : 0;
} }
+36 -13
View File
@@ -652,23 +652,46 @@ relay_config_check_port_cb (const void *pointer, void *data,
struct t_config_option *option, struct t_config_option *option,
const char *value) const char *value)
{ {
char *error;
long port;
struct t_relay_server *ptr_server; struct t_relay_server *ptr_server;
int number, port;
long long new_port;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
(void) data; (void) data;
(void) option;
error = NULL; if (strncmp (value, "++", 2) == 0)
port = strtol (value, &error, 10); {
ptr_server = relay_server_search_port ((int)port); /* relative value: add to the current port */
if (!weechat_util_parse_int (value + 2, 10, &number))
return 1;
new_port = (long long)weechat_config_integer (option) + number;
}
else if (strncmp (value, "--", 2) == 0)
{
/* relative value: subtract from the current port */
if (!weechat_util_parse_int (value + 2, 10, &number))
return 1;
new_port = (long long)weechat_config_integer (option) - number;
}
else
{
/* let WeeChat display the error if value is not a valid integer */
if (!weechat_util_parse_int (value, 10, &port))
return 1;
new_port = port;
}
/* if port is out of range, let WeeChat validate and display the error */
if ((new_port < 0) || (new_port > 65535))
return 1;
ptr_server = relay_server_search_port ((int)new_port);
if (ptr_server) if (ptr_server)
{ {
weechat_printf (NULL, _("%s%s: error: port \"%d\" is already used"), weechat_printf (NULL, _("%s%s: error: port \"%d\" is already used"),
weechat_prefix ("error"), weechat_prefix ("error"),
RELAY_PLUGIN_NAME, (int)port); RELAY_PLUGIN_NAME, (int)new_port);
return 0; return 0;
} }
@@ -866,9 +889,8 @@ relay_config_create_option_port_path (const void *pointer, void *data,
const char *option_name, const char *option_name,
const char *value) const char *value)
{ {
int rc, protocol_number, ipv4, ipv6, tls, unix_socket; int rc, protocol_number, ipv4, ipv6, tls, unix_socket, port;
char *error, *protocol, *protocol_args; char *protocol, *protocol_args;
long port;
struct t_relay_server *ptr_server; struct t_relay_server *ptr_server;
/* make C compiler happy */ /* make C compiler happy */
@@ -925,9 +947,10 @@ relay_config_create_option_port_path (const void *pointer, void *data,
} }
else else
{ {
error = NULL; if (weechat_util_parse_int (value, 10, &port))
port = strtol (value, &error, 10); ptr_server = relay_server_search_port (port);
ptr_server = relay_server_search_port ((int)port); else
ptr_server = NULL;
} }
if (ptr_server) if (ptr_server)
{ {
+16 -25
View File
@@ -212,7 +212,6 @@ relay_http_get_param_long (struct t_relay_http_request *request,
long *value) long *value)
{ {
const char *ptr_value; const char *ptr_value;
char *error;
long number; long number;
if (!value) if (!value)
@@ -223,8 +222,7 @@ relay_http_get_param_long (struct t_relay_http_request *request,
return 0; return 0;
if (ptr_value) if (ptr_value)
{ {
number = strtol (ptr_value, &error, 10); if (!weechat_util_parse_long (ptr_value, 10, &number))
if (!error || error[0])
return 0; return 0;
*value = number; *value = number;
} }
@@ -411,10 +409,9 @@ relay_http_parse_header (struct t_relay_http_request *request,
const char *header, const char *header,
int ws_deflate_allowed) int ws_deflate_allowed)
{ {
char *name, *name_lower, *error, **items; char *name, *name_lower, **items;
const char *pos, *existing_value, *ptr_value; const char *pos, *existing_value, *ptr_value;
int i, num_items; int i, number, num_items;
long number;
weechat_string_dyn_concat (request->raw, header, -1); weechat_string_dyn_concat (request->raw, header, -1);
weechat_string_dyn_concat (request->raw, "\n", -1); weechat_string_dyn_concat (request->raw, "\n", -1);
@@ -475,10 +472,8 @@ relay_http_parse_header (struct t_relay_http_request *request,
/* if header is "Content-Length", save the length */ /* if header is "Content-Length", save the length */
if (strcmp (name_lower, "content-length") == 0) if (strcmp (name_lower, "content-length") == 0)
{ {
error = NULL; if (weechat_util_parse_int (ptr_value, 10, &number))
number = strtol (ptr_value, &error, 10); request->content_length = number;
if (error && !error[0])
request->content_length = (int)number;
} }
/* /*
@@ -606,7 +601,7 @@ relay_http_get_auth_status (struct t_relay_client *client)
{ {
const char *auth, *sec_websocket_protocol, *client_totp, *pos; const char *auth, *sec_websocket_protocol, *client_totp, *pos;
char *relay_password, *totp_secret, *info_totp_args, *info_totp; char *relay_password, *totp_secret, *info_totp_args, *info_totp;
char *user_pass, **protocol_array, *error; char *user_pass, **protocol_array;
int rc, i, length, protocol_count, use_base64url, totp_ok; int rc, i, length, protocol_count, use_base64url, totp_ok;
long number; long number;
@@ -626,8 +621,8 @@ relay_http_get_auth_status (struct t_relay_client *client)
rc = -4; rc = -4;
goto end; goto end;
} }
number = strtol (client_totp, &error, 10); if (!weechat_util_parse_long (client_totp, 10, &number)
if (!error || error[0] || (number < 0) || (number > 999999)) || (number < 0) || (number > 999999))
{ {
rc = -4; rc = -4;
goto end; goto end;
@@ -1496,8 +1491,8 @@ relay_http_parse_response_code (struct t_relay_http_response *response,
const char *response_code) const char *response_code)
{ {
const char *pos, *pos2; const char *pos, *pos2;
char *error, *return_code; char *return_code;
long value; int value;
if (!response) if (!response)
return 0; return 0;
@@ -1528,10 +1523,8 @@ relay_http_parse_response_code (struct t_relay_http_response *response,
if (!return_code) if (!return_code)
goto error; goto error;
error = NULL; if (weechat_util_parse_int (return_code, 10, &value))
value = strtol (return_code, &error, 10); response->return_code = value;
if (error && !error[0])
response->return_code = (int)value;
free (return_code); free (return_code);
@@ -1566,9 +1559,9 @@ int
relay_http_parse_response_header (struct t_relay_http_response *response, relay_http_parse_response_header (struct t_relay_http_response *response,
const char *header) const char *header)
{ {
char *name, *name_lower, *error; char *name, *name_lower;
const char *pos, *ptr_value; const char *pos, *ptr_value;
long number; int number;
/* empty line => end of headers */ /* empty line => end of headers */
if (!header || !header[0]) if (!header || !header[0])
@@ -1608,10 +1601,8 @@ relay_http_parse_response_header (struct t_relay_http_response *response,
/* if header is "Content-Length", save the length */ /* if header is "Content-Length", save the length */
if (strcmp (name_lower, "content-length") == 0) if (strcmp (name_lower, "content-length") == 0)
{ {
error = NULL; if (weechat_util_parse_int (ptr_value, 10, &number))
number = strtol (ptr_value, &error, 10); response->content_length = number;
if (error && !error[0])
response->content_length = (int)number;
} }
free (name); free (name);
+4 -5
View File
@@ -203,7 +203,7 @@ relay_remote_parse_url (const char *url,
int *tls, char **address, int *port) int *tls, char **address, int *port)
{ {
const char *ptr_url, *pos; const char *ptr_url, *pos;
char *str_port, *error; char *str_port;
long number; long number;
if (tls) if (tls)
@@ -270,12 +270,11 @@ relay_remote_parse_url (const char *url,
weechat_strndup (ptr_url, pos - ptr_url) : strdup (ptr_url); weechat_strndup (ptr_url, pos - ptr_url) : strdup (ptr_url);
if (!str_port) if (!str_port)
return 0; return 0;
error = NULL; if (weechat_util_parse_long (str_port, 10, &number)
number = strtol (str_port, &error, 10); && (number >= 0) && (number <= 65535))
if (error && !error[0] && (number >= 0) && (number <= 65535))
{ {
if (port) if (port)
*port = number; *port = (int)number;
free (str_port); free (str_port);
} }
else else
+5 -8
View File
@@ -306,9 +306,8 @@ relay_websocket_parse_extensions (const char *extensions,
struct t_relay_websocket_deflate *ws_deflate, struct t_relay_websocket_deflate *ws_deflate,
int ws_deflate_allowed) int ws_deflate_allowed)
{ {
char **exts, **params, **items, *error; char **exts, **params, **items;
int i, j, num_exts, num_params, num_items; int i, j, number, num_exts, num_params, num_items;
long number;
if (!extensions || !ws_deflate) if (!extensions || !ws_deflate)
return; return;
@@ -351,9 +350,7 @@ relay_websocket_parse_extensions (const char *extensions,
number = 15; number = 15;
if (num_items >= 2) if (num_items >= 2)
{ {
error = NULL; if (weechat_util_parse_int (items[1], 10, &number))
number = strtol (items[1], &error, 10);
if (error && !error[0])
{ {
if (number < 8) if (number < 8)
number = 8; number = 8;
@@ -368,12 +365,12 @@ relay_websocket_parse_extensions (const char *extensions,
if (strcmp (items[0], "server_max_window_bits") == 0) if (strcmp (items[0], "server_max_window_bits") == 0)
{ {
ws_deflate->server_max_window_bits_recv = 1; ws_deflate->server_max_window_bits_recv = 1;
ws_deflate->window_bits_deflate = (int)number; ws_deflate->window_bits_deflate = number;
} }
else else
{ {
ws_deflate->client_max_window_bits_recv = 1; ws_deflate->client_max_window_bits_recv = 1;
ws_deflate->window_bits_inflate = (int)number; ws_deflate->window_bits_inflate = number;
} }
} }
} }
@@ -362,7 +362,7 @@ relay_weechat_msg_add_hdata_path (struct t_relay_weechat_msg *msg,
{ {
int num_added, i, j, count, count_all, var_type, array_size, max_array_size; int num_added, i, j, count, count_all, var_type, array_size, max_array_size;
int length; int length;
char *pos, *pos2, *str_count, *error, *name; char *pos, *pos2, *str_count, *name;
void *sub_pointer; void *sub_pointer;
struct t_hdata *sub_hdata; struct t_hdata *sub_hdata;
const char *sub_hdata_name; const char *sub_hdata_name;
@@ -384,9 +384,7 @@ relay_weechat_msg_add_hdata_path (struct t_relay_weechat_msg *msg,
count_all = 1; count_all = 1;
else else
{ {
error = NULL; if (weechat_util_parse_int (str_count, 10, &count))
count = (int)strtol (str_count, &error, 10);
if (error && !error[0])
{ {
if (count > 0) if (count > 0)
count--; count--;
@@ -684,7 +684,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(completion)
struct t_gui_completion_word *word; struct t_gui_completion_word *word;
struct t_arraylist *ptr_list; struct t_arraylist *ptr_list;
struct t_relay_weechat_msg *msg; struct t_relay_weechat_msg *msg;
char *error, *pos_data; char *pos_data;
int i, position, length_data, context, pos_start, size; int i, position, length_data, context, pos_start, size;
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0); RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
@@ -709,9 +709,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(completion)
goto error; goto error;
} }
error = NULL; if (!weechat_util_parse_int (argv[1], 10, &position))
position = (int)strtol (argv[1], &error, 10);
if (!error || error[0])
goto error; goto error;
pos_data = strchr (argv_eol[1], ' '); pos_data = strchr (argv_eol[1], ' ');
+5 -5
View File
@@ -2604,7 +2604,7 @@ weechat_ruby_api_print_date_tags (VALUE class, VALUE buffer, VALUE date,
Check_Type (message, T_STRING); Check_Type (message, T_STRING);
c_buffer = StringValuePtr (buffer); c_buffer = StringValuePtr (buffer);
c_date = NUM2ULONG (date); c_date = NUM2ULL (date);
c_tags = StringValuePtr (tags); c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message); c_message = StringValuePtr (message);
@@ -2639,7 +2639,7 @@ weechat_ruby_api_print_datetime_tags (VALUE class, VALUE buffer, VALUE date,
Check_Type (message, T_STRING); Check_Type (message, T_STRING);
c_buffer = StringValuePtr (buffer); c_buffer = StringValuePtr (buffer);
c_date = NUM2ULONG (date); c_date = NUM2ULL (date);
c_date_usec = NUM2INT (date_usec); c_date_usec = NUM2INT (date_usec);
c_tags = StringValuePtr (tags); c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message); c_message = StringValuePtr (message);
@@ -2703,7 +2703,7 @@ weechat_ruby_api_print_y_date_tags (VALUE class, VALUE buffer, VALUE y,
c_buffer = StringValuePtr (buffer); c_buffer = StringValuePtr (buffer);
c_y = NUM2INT (y); c_y = NUM2INT (y);
c_date = NUM2ULONG (date); c_date = NUM2ULL (date);
c_tags = StringValuePtr (tags); c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message); c_message = StringValuePtr (message);
@@ -2741,7 +2741,7 @@ weechat_ruby_api_print_y_datetime_tags (VALUE class, VALUE buffer, VALUE y,
c_buffer = StringValuePtr (buffer); c_buffer = StringValuePtr (buffer);
c_y = NUM2INT (y); c_y = NUM2INT (y);
c_date = NUM2ULONG (date); c_date = NUM2ULL (date);
c_date_usec = NUM2INT (date_usec); c_date_usec = NUM2INT (date_usec);
c_tags = StringValuePtr (tags); c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message); c_message = StringValuePtr (message);
@@ -6040,7 +6040,7 @@ weechat_ruby_api_infolist_new_var_time (VALUE class, VALUE item,
c_item = StringValuePtr (item); c_item = StringValuePtr (item);
c_name = StringValuePtr (name); c_name = StringValuePtr (name);
c_value = NUM2ULONG (value); c_value = NUM2ULL (value);
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(c_item), result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(c_item),
c_name, c_name,
+7 -18
View File
@@ -45,9 +45,7 @@ script_command_action (struct t_gui_buffer *buffer,
{ {
struct t_script_repo *ptr_script; struct t_script_repo *ptr_script;
char str_action[4096]; char str_action[4096];
long value; int quiet, value;
char *error;
int quiet;
if (arguments) if (arguments)
{ {
@@ -62,9 +60,7 @@ script_command_action (struct t_gui_buffer *buffer,
arguments++; arguments++;
} }
} }
error = NULL; if (weechat_util_parse_int (arguments, 10, &value))
value = strtol (arguments, &error, 10);
if (error && !error[0])
{ {
ptr_script = script_repo_search_displayed_by_number (value); ptr_script = script_repo_search_displayed_by_number (value);
if (ptr_script) if (ptr_script)
@@ -132,9 +128,8 @@ script_command_script (const void *pointer, void *data,
struct t_gui_buffer *buffer, int argc, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol) char **argv, char **argv_eol)
{ {
char *error, command[128]; char command[128];
long value; int line, value;
int line;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -227,9 +222,7 @@ script_command_script (const void *pointer, void *data,
} }
else else
{ {
error = NULL; if (weechat_util_parse_int (argv[2], 10, &value))
value = strtol (argv[2], &error, 10);
if (error && !error[0])
line = value; line = value;
} }
if (line >= 0) if (line >= 0)
@@ -248,9 +241,7 @@ script_command_script (const void *pointer, void *data,
value = 1; value = 1;
if (argc > 2) if (argc > 2)
{ {
error = NULL; if (!weechat_util_parse_int (argv[2], 10, &value))
value = strtol (argv[2], &error, 10);
if (!error || error[0])
value = 1; value = 1;
} }
if (script_buffer_detail_script) if (script_buffer_detail_script)
@@ -282,9 +273,7 @@ script_command_script (const void *pointer, void *data,
value = 1; value = 1;
if (argc > 2) if (argc > 2)
{ {
error = NULL; if (!weechat_util_parse_int (argv[2], 10, &value))
value = strtol (argv[2], &error, 10);
if (!error || error[0])
value = 1; value = 1;
} }
if (script_buffer_detail_script) if (script_buffer_detail_script)
+7 -10
View File
@@ -40,11 +40,10 @@ script_mouse_focus_chat_cb (const void *pointer, void *data,
struct t_hashtable *info) struct t_hashtable *info)
{ {
const char *buffer; const char *buffer;
int rc; int rc, y;
unsigned long value; unsigned long value;
struct t_gui_buffer *ptr_buffer; struct t_gui_buffer *ptr_buffer;
long x; char str_date[64];
char *error, str_date[64];
struct t_script_repo *ptr_script; struct t_script_repo *ptr_script;
struct tm *tm; struct tm *tm;
@@ -72,15 +71,13 @@ script_mouse_focus_chat_cb (const void *pointer, void *data,
ptr_script = script_buffer_detail_script; ptr_script = script_buffer_detail_script;
else else
{ {
error = NULL; if (!weechat_util_parse_int (weechat_hashtable_get (info, "_chat_line_y"), 10, &y)
x = strtol (weechat_hashtable_get (info, "_chat_line_y"), &error, 10); || (y < 0))
if (!error || error[0]) {
return info; return info;
}
if (x < 0) ptr_script = script_repo_search_displayed_by_number (y);
return info;
ptr_script = script_repo_search_displayed_by_number (x);
if (!ptr_script) if (!ptr_script)
return info; return info;
} }
+1 -5
View File
@@ -1312,11 +1312,7 @@ script_repo_file_read (int quiet)
script->url = strdup (value); script->url = strdup (value);
else if (strcmp (name, "popularity") == 0) else if (strcmp (name, "popularity") == 0)
{ {
error = NULL; if (!weechat_util_parse_int (value, 10, &(script->popularity)))
script->popularity = (int)strtol (value,
&error,
10);
if (!error || error[0])
script->popularity = 0; script->popularity = 0;
} }
else if (strcmp (name, "added") == 0) else if (strcmp (name, "added") == 0)
+10 -10
View File
@@ -2123,13 +2123,13 @@ API_FUNC(print)
API_FUNC(print_date_tags) API_FUNC(print_date_tags)
{ {
char *buffer, *tags, *message; char *buffer, *tags, *message;
long date; Tcl_WideInt date;
API_INIT_FUNC(1, "print_date_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (objc < 5) if (objc < 5)
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetLongFromObj (interp, objv[2], &date) != TCL_OK) if (Tcl_GetWideIntFromObj (interp, objv[2], &date) != TCL_OK)
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetString (objv[1]); buffer = Tcl_GetString (objv[1]);
@@ -2150,13 +2150,13 @@ API_FUNC(print_datetime_tags)
{ {
char *buffer, *tags, *message; char *buffer, *tags, *message;
int date_usec; int date_usec;
long date; Tcl_WideInt date;
API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR);
if (objc < 6) if (objc < 6)
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetLongFromObj (interp, objv[2], &date) != TCL_OK) if (Tcl_GetWideIntFromObj (interp, objv[2], &date) != TCL_OK)
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetIntFromObj (interp, objv[3], &date_usec) != TCL_OK) if (Tcl_GetIntFromObj (interp, objv[3], &date_usec) != TCL_OK)
@@ -2205,7 +2205,7 @@ API_FUNC(print_y_date_tags)
{ {
char *buffer, *tags, *message; char *buffer, *tags, *message;
int y; int y;
long date; Tcl_WideInt date;
API_INIT_FUNC(1, "print_y_date_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "print_y_date_tags", API_RETURN_ERROR);
if (objc < 6) if (objc < 6)
@@ -2214,7 +2214,7 @@ API_FUNC(print_y_date_tags)
if (Tcl_GetIntFromObj (interp, objv[2], &y) != TCL_OK) if (Tcl_GetIntFromObj (interp, objv[2], &y) != TCL_OK)
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetLongFromObj (interp, objv[3], &date) != TCL_OK) if (Tcl_GetWideIntFromObj (interp, objv[3], &date) != TCL_OK)
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
buffer = Tcl_GetString (objv[1]); buffer = Tcl_GetString (objv[1]);
@@ -2236,7 +2236,7 @@ API_FUNC(print_y_datetime_tags)
{ {
char *buffer, *tags, *message; char *buffer, *tags, *message;
int y, date_usec; int y, date_usec;
long date; Tcl_WideInt date;
API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR); API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR);
if (objc < 7) if (objc < 7)
@@ -2245,7 +2245,7 @@ API_FUNC(print_y_datetime_tags)
if (Tcl_GetIntFromObj (interp, objv[2], &y) != TCL_OK) if (Tcl_GetIntFromObj (interp, objv[2], &y) != TCL_OK)
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetLongFromObj (interp, objv[3], &date) != TCL_OK) if (Tcl_GetWideIntFromObj (interp, objv[3], &date) != TCL_OK)
API_WRONG_ARGS(API_RETURN_ERROR); API_WRONG_ARGS(API_RETURN_ERROR);
if (Tcl_GetIntFromObj (interp, objv[4], &date_usec) != TCL_OK) if (Tcl_GetIntFromObj (interp, objv[4], &date_usec) != TCL_OK)
@@ -4942,13 +4942,13 @@ API_FUNC(infolist_new_var_pointer)
API_FUNC(infolist_new_var_time) API_FUNC(infolist_new_var_time)
{ {
const char *result; const char *result;
long value; Tcl_WideInt value;
API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY); API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
if (objc < 4) if (objc < 4)
API_WRONG_ARGS(API_RETURN_EMPTY); API_WRONG_ARGS(API_RETURN_EMPTY);
if (Tcl_GetLongFromObj (interp, objv[3], &value) != TCL_OK) if (Tcl_GetWideIntFromObj (interp, objv[3], &value) != TCL_OK)
API_WRONG_ARGS(API_RETURN_EMPTY); API_WRONG_ARGS(API_RETURN_EMPTY);
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(Tcl_GetString (objv[1])), /* item */ result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(Tcl_GetString (objv[1])), /* item */
+2 -1
View File
@@ -1305,7 +1305,8 @@ trigger_command_init (void)
"are evaluated, \"${tg_trigger_name}\" is replaced by the trigger " "are evaluated, \"${tg_trigger_name}\" is replaced by the trigger "
"name, see /help eval)"), "name, see /help eval)"),
N_("> type `command_run`: command(s) (required)"), N_("> type `command_run`: command(s) (required)"),
N_("> type `timer`: interval (required), align on second, max calls"), N_("> type `timer`: interval (required, in milliseconds), "
"align on second, max calls"),
N_("> type `config`: name(s) of option (required)"), N_("> type `config`: name(s) of option (required)"),
N_("> type `focus`: name(s) of area (required)"), N_("> type `focus`: name(s) of area (required)"),
N_("> type `info`: name(s) of info (required)"), N_("> type `info`: name(s) of info (required)"),
+7 -14
View File
@@ -303,10 +303,9 @@ void
trigger_hook (struct t_trigger *trigger) trigger_hook (struct t_trigger *trigger)
{ {
char **argv, **argv_eol, *buffer_type, *buffer_name, *tags, *message; char **argv, **argv_eol, *buffer_type, *buffer_name, *tags, *message;
char *error1, *error2, *error3;
char *eval_desc, *eval_args, *eval_desc_args, *eval_completion; char *eval_desc, *eval_args, *eval_desc_args, *eval_completion;
int i, argc, strip_colors; int i, argc, align_second, max_calls, strip_colors;
long interval, align_second, max_calls; long interval;
struct t_hashtable *extra_vars; struct t_hashtable *extra_vars;
if (!weechat_config_boolean (trigger->options[TRIGGER_OPTION_ENABLED])) if (!weechat_config_boolean (trigger->options[TRIGGER_OPTION_ENABLED]))
@@ -488,17 +487,11 @@ trigger_hook (struct t_trigger *trigger)
case TRIGGER_HOOK_TIMER: case TRIGGER_HOOK_TIMER:
if (argv && (argc >= 1)) if (argv && (argc >= 1))
{ {
error1 = NULL; if (weechat_util_parse_long (argv[0], 10, &interval)
error2 = NULL;
error3 = NULL;
interval = strtol (argv[0], &error1, 10);
align_second = strtol ((argc >= 2) ? argv[1] : "0", &error2, 10);
max_calls = strtol ((argc >= 3) ? argv[2] : "0", &error3, 10);
if (error1 && !error1[0]
&& error2 && !error2[0]
&& error3 && !error3[0]
&& (interval > 0) && (interval > 0)
&& weechat_util_parse_int ((argc >= 2) ? argv[1] : "0", 10, &align_second)
&& (align_second >= 0) && (align_second >= 0)
&& weechat_util_parse_int ((argc >= 3) ? argv[2] : "0", 10, &max_calls)
&& (max_calls >= 0)) && (max_calls >= 0))
{ {
trigger->hooks = malloc (sizeof (trigger->hooks[0])); trigger->hooks = malloc (sizeof (trigger->hooks[0]));
@@ -507,8 +500,8 @@ trigger_hook (struct t_trigger *trigger)
trigger->hooks_count = 1; trigger->hooks_count = 1;
trigger->hooks[0] = weechat_hook_timer ( trigger->hooks[0] = weechat_hook_timer (
interval, interval,
(int)align_second, align_second,
(int)max_calls, max_calls,
&trigger_callback_timer_cb, &trigger_callback_timer_cb,
trigger, NULL); trigger, NULL);
} }
+3 -4
View File
@@ -59,15 +59,14 @@
char * char *
xfer_network_convert_integer_to_ipv4 (const char *str_address) xfer_network_convert_integer_to_ipv4 (const char *str_address)
{ {
char *error, result[128]; char result[128];
long long number; long long number;
if (!str_address || !str_address[0]) if (!str_address || !str_address[0])
return NULL; return NULL;
error = NULL; if (!weechat_util_parse_longlong (str_address, 10, &number)
number = strtoll (str_address, &error, 10); || (number <= 0) || (number > UINT32_MAX))
if (!error || error[0] || (number <= 0) || (number > UINT32_MAX))
return NULL; return NULL;
snprintf (result, sizeof (result), snprintf (result, sizeof (result),
+6 -6
View File
@@ -1008,7 +1008,7 @@ TEST(GuiBuffer, Set)
LONGS_EQUAL(0, buffer->hidden); LONGS_EQUAL(0, buffer->hidden);
gui_buffer_set (buffer, "hidden", "2"); gui_buffer_set (buffer, "hidden", "2");
LONGS_EQUAL(1, buffer->hidden); LONGS_EQUAL(1, buffer->hidden);
gui_buffer_set (buffer, "hidden", ""); gui_buffer_set (buffer, "hidden", "0");
LONGS_EQUAL(0, buffer->hidden); LONGS_EQUAL(0, buffer->hidden);
/* print_hooks_enabled */ /* print_hooks_enabled */
@@ -1017,7 +1017,7 @@ TEST(GuiBuffer, Set)
LONGS_EQUAL(0, buffer->print_hooks_enabled); LONGS_EQUAL(0, buffer->print_hooks_enabled);
gui_buffer_set (buffer, "print_hooks_enabled", "1"); gui_buffer_set (buffer, "print_hooks_enabled", "1");
LONGS_EQUAL(1, buffer->print_hooks_enabled); LONGS_EQUAL(1, buffer->print_hooks_enabled);
gui_buffer_set (buffer, "print_hooks_enabled", ""); gui_buffer_set (buffer, "print_hooks_enabled", "0");
LONGS_EQUAL(0, buffer->print_hooks_enabled); LONGS_EQUAL(0, buffer->print_hooks_enabled);
gui_buffer_set (buffer, "print_hooks_enabled", "2"); gui_buffer_set (buffer, "print_hooks_enabled", "2");
LONGS_EQUAL(1, buffer->print_hooks_enabled); LONGS_EQUAL(1, buffer->print_hooks_enabled);
@@ -1028,7 +1028,7 @@ TEST(GuiBuffer, Set)
LONGS_EQUAL(0, buffer->day_change); LONGS_EQUAL(0, buffer->day_change);
gui_buffer_set (buffer, "day_change", "1"); gui_buffer_set (buffer, "day_change", "1");
LONGS_EQUAL(1, buffer->day_change); LONGS_EQUAL(1, buffer->day_change);
gui_buffer_set (buffer, "day_change", ""); gui_buffer_set (buffer, "day_change", "0");
LONGS_EQUAL(0, buffer->day_change); LONGS_EQUAL(0, buffer->day_change);
gui_buffer_set (buffer, "day_change", "2"); gui_buffer_set (buffer, "day_change", "2");
LONGS_EQUAL(1, buffer->day_change); LONGS_EQUAL(1, buffer->day_change);
@@ -1039,14 +1039,14 @@ TEST(GuiBuffer, Set)
LONGS_EQUAL(0, buffer->clear); LONGS_EQUAL(0, buffer->clear);
gui_buffer_set (buffer, "clear", "1"); gui_buffer_set (buffer, "clear", "1");
LONGS_EQUAL(1, buffer->clear); LONGS_EQUAL(1, buffer->clear);
gui_buffer_set (buffer, "clear", ""); gui_buffer_set (buffer, "clear", "0");
LONGS_EQUAL(0, buffer->clear); LONGS_EQUAL(0, buffer->clear);
gui_buffer_set (buffer, "clear", "2"); gui_buffer_set (buffer, "clear", "2");
LONGS_EQUAL(1, buffer->clear); LONGS_EQUAL(1, buffer->clear);
/* filter */ /* filter */
LONGS_EQUAL(1, buffer->filter); LONGS_EQUAL(1, buffer->filter);
gui_buffer_set (buffer, "filter", ""); gui_buffer_set (buffer, "filter", "0");
LONGS_EQUAL(0, buffer->filter); LONGS_EQUAL(0, buffer->filter);
gui_buffer_set (buffer, "filter", "1"); gui_buffer_set (buffer, "filter", "1");
LONGS_EQUAL(1, buffer->filter); LONGS_EQUAL(1, buffer->filter);
@@ -1292,7 +1292,7 @@ TEST(GuiBuffer, Set)
LONGS_EQUAL(0, buffer->input_buffer_pos); LONGS_EQUAL(0, buffer->input_buffer_pos);
gui_buffer_set (buffer, "input_pos", "2"); gui_buffer_set (buffer, "input_pos", "2");
LONGS_EQUAL(2, buffer->input_buffer_pos); LONGS_EQUAL(2, buffer->input_buffer_pos);
gui_buffer_set (buffer, "input_pos", ""); gui_buffer_set (buffer, "input_pos", "0");
LONGS_EQUAL(0, buffer->input_buffer_pos); LONGS_EQUAL(0, buffer->input_buffer_pos);
gui_buffer_set (buffer, "input", ""); gui_buffer_set (buffer, "input", "");
STRCMP_EQUAL("", buffer->input_buffer); STRCMP_EQUAL("", buffer->input_buffer);