1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 06:46:38 +02:00

core: move functions string_base_encode and string_base_decode from plugin-api.c to wee-string.c

This commit is contained in:
Sébastien Helleu
2020-05-21 00:02:24 +02:00
parent 0ac936a5cf
commit 1994d5641d
6 changed files with 117 additions and 51 deletions
-39
View File
@@ -97,45 +97,6 @@ plugin_api_ngettext (const char *single, const char *plural, int count)
return NG_(single, plural, count);
}
/*
* Encodes a string in base 16, 32, or 64.
*/
int
plugin_api_string_base_encode (int base, const char *from, int length,
char *to)
{
switch (base)
{
case 16:
return string_base16_encode (from, length, to);
case 32:
return string_base32_encode (from, length, to);
case 64:
return string_base64_encode (from, length, to);
}
return -1;
}
/*
* Decodes a string encoded in base 16, 32, or 64.
*/
int
plugin_api_string_base_decode (int base, const char *from, char *to)
{
switch (base)
{
case 16:
return string_base16_decode (from, to);
case 32:
return string_base32_decode (from, to);
case 64:
return string_base64_decode (from, to);
}
return -1;
}
/*
* Computes hash of data using the given algorithm.
*
-4
View File
@@ -28,10 +28,6 @@ extern void plugin_api_charset_set (struct t_weechat_plugin *plugin,
extern const char *plugin_api_gettext (const char *string);
extern const char *plugin_api_ngettext (const char *single, const char *plural,
int count);
extern int plugin_api_string_base_encode (int base, const char *from,
int length, char *to);
extern int plugin_api_string_base_decode (int base, const char *from,
char *to);
/* crypto */
extern int plugin_api_crypto_hash (const void *data, int data_size,
+2 -2
View File
@@ -633,8 +633,8 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv)
new_plugin->string_free_split_command = &string_free_split_command;
new_plugin->string_format_size = &string_format_size;
new_plugin->string_remove_color = &gui_color_decode;
new_plugin->string_base_encode = &plugin_api_string_base_encode;
new_plugin->string_base_decode = &plugin_api_string_base_decode;
new_plugin->string_base_encode = &string_base_encode;
new_plugin->string_base_decode = &string_base_decode;
new_plugin->string_hex_dump = &string_hex_dump;
new_plugin->string_is_command_char = &string_is_command_char;
new_plugin->string_input_for_buffer = &string_input_for_buffer;