Commit Graph

1442 Commits (master)

Author SHA1 Message Date
Sébastien Helleu 007fd03bc8 tests: add tests on calc functions
Functions tested:

- calc_operator_precedence
- calc_pop_value
- calc_list_free_cb
- calc_operation
- calc_operation_stacks
2020-04-08 21:38:51 +02:00
Sébastien Helleu d78ac827e9 core: fix memory leak in calculation of expression on FreeBSD (closes #1469)
The memory leak was caused by a bug in function setlocale on FreeBSD:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243195

The fix is the following:

* Remove the calls to setlocale when formatting the result.
* The function snprintf is still called, and then is now locale dependent,
  for example in French the decimal separator is a comma instead of a dot.
* A new function calc_sanitize_decimal_number is introduced to "sanitize" a
  decimal number: keep only the decimal separator (replace it by a dot) and
  remove any other separator found.

Unit tests are added on these functions:

* calc_sanitize_decimal_number
* calc_format_result
2020-04-07 21:37:48 +02:00
Sébastien Helleu fa931b46eb core: fix compiler warnings on Cygwin 2020-03-23 07:23:08 +01:00
Sébastien Helleu c29b45a0f2 api: add info "auto_connect" (closes #1453) 2020-03-20 20:42:05 +01:00
Sébastien Helleu 7af8e6c652 core: add minimum libgcypt version 1.7.0 for SHA3 algorithms in comment of function weecrypto_hash 2020-03-02 22:57:44 +01:00
Sébastien Helleu 3604abba7d core: fix copyright date in wee-crypto sources 2020-03-02 22:57:39 +01:00
Sébastien Helleu 2d7829b2d5 core: require libgcrypt >= 1.7.0 for SHA3 algorithms 2020-03-02 21:49:30 +01:00
Sébastien Helleu 3157d1f06e api: add function crypto_hash_pbkdf2 2020-03-01 23:14:55 +01:00
Sébastien Helleu 9a6a27ef58 core: move crypto functions to wee-crypto.c, rename API function string_hash to crypto_hash 2020-03-01 21:24:27 +01:00
Sébastien Helleu c4ef3d6c2e core: merge functions string_hash_binary and string_hash into a single function string_hash 2020-03-01 16:41:28 +01:00
Sébastien Helleu 1ae2591458 core: add function secure_hash_pbkdf2 2020-03-01 14:26:24 +01:00
Sébastien Helleu 7449bc8827 core: add support of CRC32 algorithm in hash functions 2020-02-29 21:12:13 +01:00
Sébastien Helleu 410a5b341f api: add functions string_hash_binary and string_hash 2020-02-29 21:02:42 +01:00
Sébastien Helleu 7e808e2ef7 core: call function secure_hash_binary in secure_derive_key to compute SHA512 hash 2020-02-29 15:46:25 +01:00
Sébastien Helleu 45fd04ee72 core: return 0 in case of invalid parameters received in function secure_derive_key 2020-02-29 15:46:25 +01:00
Sébastien Helleu e2135fc3eb core: add functions to compute binary/hex hash of data 2020-02-29 15:46:25 +01:00
Sébastien Helleu 27266ccd02 core: rename function util_get_uptime to util_get_time_diff
The two times must be sent as parameters, which makes the function not specific
to uptime. It is now easier to test the function in unit tests.
2020-02-02 13:57:39 +01:00
Sébastien Helleu 4d67af399d core: flush stdout/stderr before forking in hook_process function (closes #1441) 2020-01-20 21:15:15 +01:00
Sébastien Helleu 1fac6fd404 core: add variable "old_full_name" in buffer, set before the buffer is renamed (issue #1428) 2020-01-12 16:57:08 +01:00
Sébastien Helleu feb6258910 core: update copyright dates 2020-01-04 10:41:26 +01:00
Sébastien Helleu e612e63140 core: fix evaluation of condition with nested "if" (closes #1434) 2019-12-18 21:22:36 +01:00
Sébastien Helleu a13099aa63 core: add debug option "-d" in command /eval (issue #1434) 2019-12-18 21:18:59 +01:00
Sébastien Helleu 7e833ee60b core: add missing variable "proxy" in function hook_connect_print_log 2019-12-18 07:55:39 +01:00
Sébastien Helleu b43ab911fd core: add more info in /help weechat.look.nick_color_hash_salt (issue #635) 2019-11-25 21:38:58 +01:00
Simmo Saan 1a00368888 core: add option weechat.look.nick_color_hash_salt to allow for reshuffling of colors (issue #635) 2019-11-25 21:38:20 +01:00
Sébastien Helleu ecc7edda9e core: optimize search of options in configuration sections
Since options are sorted in sections, it is faster to search from the last
option to the first one.

For configuration files with many options in a single section (like
plugins.conf), the load of configuration file is about 2 to 3x faster.
2019-10-23 19:45:06 +02:00
Sébastien Helleu 8fc8f728d4 core: add reverse of string for screen in evaluation of expressions with "revscr:" 2019-10-12 20:14:36 +02:00
Sébastien Helleu cbeecc0cde core: ensure completion_item is not NULL before using it 2019-10-06 21:47:56 +02:00
Sébastien Helleu 528c769e71 core: fix crash in completion of filenames 2019-10-06 21:45:27 +02:00
Sébastien Helleu 6e382d26a9 core: add optional default path (evaluated) in completion "filename" (issue #60) 2019-10-06 09:38:20 +02:00
Sébastien Helleu 88aa82d672 core: add support of modifiers in evaluation of expressions with "modifier:name,data,string" (issue #60) 2019-10-06 09:13:35 +02:00
Sébastien Helleu 3a356f109f core: add power operator "**" in calc expressions (issue #997) 2019-09-24 21:03:56 +02:00
Sébastien Helleu 7d795c4d53 core: fix wrong results with the unary minus in calc expressions 2019-09-24 20:49:48 +02:00
Sébastien Helleu e1a4612797 core: ignore color codes in ${length:xxx} and ${lengthscr:xxx} 2019-09-21 13:54:36 +02:00
Sébastien Helleu dcfc4e8ed5 core: add "length:xxx" and "lengthscr:xxx" in evaluation of expressions 2019-09-21 07:56:21 +02:00
Sébastien Helleu 997894edc0 core: add calculation of expression in evaluation of expressions with "calc:..." (issue #997) 2019-09-20 21:37:01 +02:00
Sébastien Helleu 5cf419dd63 core: remove extra spaces in arguments of /help uptime and /help version 2019-09-19 21:25:27 +02:00
Tobias Stoeckmann f7b84fcc67 Fixed segfault during excessive evaluation.
It is possible to trigger a segmentation fault while processing
an evaluation of repeating string. On a Linux 64 bit system,
enter this (or adjust arguments for 32 bit accordingly):

/eval -n ${repeat:1073741824,----}

It will overflow an integer calculation because int instead of
size_t is used. Proper check of int limitations fixes this issue.

I haven't changed this specific piece of code to size_t because it
would crash in other parts of the code tree instead. For now, int
is a limitating factor when it comes to strings (and should be
enough for sane use cases).

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-09-17 21:26:52 +02:00
Sébastien Helleu e8be4f62af core: mention possible background color in /help weechat.look.nick_color_force 2019-09-16 20:58:12 +02:00
Sébastien Helleu 1beebdf01e core: fix compilation with autotools on FreeBSD 12.0 2019-08-31 14:18:55 +02:00
Sébastien Helleu 608ec9f483 core: add values djb2_32 and sum_32 for option weechat.look.nick_color_hash (issue #1394) 2019-08-20 21:20:33 +02:00
Sébastien Helleu 7f62985f89 core: use fixed-width integer for computing hashtable DJB2 key hash (closes #1394) 2019-08-19 23:29:22 +02:00
Sébastien Helleu c411ee475a core: create or update option weechat.notify.xxx when function buffer_set is called with "notify" property (closes #1390) 2019-08-10 17:48:34 +02:00
Andrew Potter 0957231d30 api: add function list_user_data (issue #666) 2019-08-10 12:55:43 +02:00
Sébastien Helleu fbc022a77a core: return NULL immediately if string is NULL in function hook_modifier_exec 2019-08-04 13:30:53 +02:00
Sébastien Helleu 015ec85f10 core: add some missing default keys in /help cursor 2019-07-29 22:49:29 +02:00
Sébastien Helleu 1d6714e428 core: auto disable upgrade process (command line option "--upgrade") if the file weechat.upgrade is not found 2019-06-24 21:35:37 +02:00
Sébastien Helleu f15a24b2ec core: add option "close" in command /window (closes #853) 2019-06-17 21:08:07 +02:00
Sébastien Helleu 087d4c7af3 core: add Curl options for versions 7.53.0 to 7.63.0 2019-06-16 22:28:08 +02:00
Sébastien Helleu fe90a5ed4e core: replace newlines by spaces in argument "completion" of function hook_command (closes #538) 2019-06-16 08:14:24 +02:00