Type improvements to the internal encrypt/decrypt and CTCP quoting API

Use size_t for passing buffer lengths, and const char * for encryption keys and other non-modified buffer
arguments.

Remove pointless helper function do_crypt().
This commit is contained in:
Kevin Easton
2017-06-28 16:54:11 +10:00
parent c62e099d80
commit 9b0d3e4ab5
6 changed files with 61 additions and 76 deletions

View File

@@ -64,8 +64,8 @@ extern int in_ctcp_flag;
#define CTCP_QUOTE_EM "\r\n\001\\"
extern char * ctcp_quote_it (char *, int);
extern char * ctcp_unquote_it (char *, int *);
extern char *ctcp_quote_it(const char *, size_t);
extern char *ctcp_unquote_it(const char *, size_t *);
extern char * do_ctcp (char *, char *, char *);
extern char * do_notice_ctcp (char *, char *, char *);
extern int in_ctcp (void);

View File

@@ -12,12 +12,12 @@
#ifndef ENCRYPT_H_
#define ENCRYPT_H_
char *crypt_msg (char *, char *);
char *decrypt_msg (char *, char *);
void encrypt_cmd (char *, char *, char *, char *);
char *is_crypted (char *);
void BX_my_decrypt (char *, int, char *);
void BX_my_encrypt (char *, int, char *);
char *crypt_msg(char *, const char *);
char *decrypt_msg(const char *, const char *);
void encrypt_cmd(char *, char *, char *, char *);
const char *is_crypted(char *);
void BX_my_decrypt(char *, int, const char *);
void BX_my_encrypt(char *, int, const char *);
#define CRYPT_HEADER ""
#define CRYPT_HEADER_LEN 5

View File

@@ -249,8 +249,8 @@ extern Function_ptr *global;
#define bsd_globfree (*(void (*)(glob_t *))global[BSD_GLOBFREE])
/* misc commands */
#define my_encrypt (*(void (*)(char *, int , char *))global[MY_ENCRYPT])
#define my_decrypt (*(void (*)(char *, int , char *))global[MY_DECRYPT])
#define my_encrypt (*(void (*)(char *, int , const char *))global[MY_ENCRYPT])
#define my_decrypt (*(void (*)(char *, int , const char *))global[MY_DECRYPT])
#define prepare_command (*(ChannelList *(*)(int *, char *, int))global[PREPARE_COMMAND])
#define convert_output_format (*(char *(*)(const char *, const char *, ...))global[CONVERT_OUTPUT_FORMAT])
#define userage (*(void (*)(char *, char *))global[USERAGE])