r11607@catbus: nickm | 2007-01-30 17:19:27 -0500

Audit non-const char arguments; make a lot more of them const.


svn:r9466
This commit is contained in:
Nick Mathewson
2007-01-30 22:19:41 +00:00
parent 1894e7ea01
commit 76f896e714
10 changed files with 30 additions and 26 deletions
+1 -1
View File
@@ -645,7 +645,7 @@ set_max_file_descriptors(unsigned long limit, unsigned long cap)
* success. On failure, log and return -1.
*/
int
switch_id(char *user, char *group)
switch_id(const char *user, const char *group)
{
#ifndef MS_WINDOWS
struct passwd *pw = NULL;
+1 -1
View File
@@ -282,7 +282,7 @@ void set_uint16(char *cp, uint16_t v) ATTR_NONNULL((1));
void set_uint32(char *cp, uint32_t v) ATTR_NONNULL((1));
int set_max_file_descriptors(unsigned long limit, unsigned long cap);
int switch_id(char *user, char *group);
int switch_id(const char *user, const char *group);
#ifdef HAVE_PWD_H
char *get_user_homedir(const char *username);
#endif
+1 -1
View File
@@ -538,7 +538,7 @@ tor_tls_read(tor_tls_t *tls, char *cp, size_t len)
* TOR_TLS_WANTREAD, or TOR_TLS_WANTWRITE.
*/
int
tor_tls_write(tor_tls_t *tls, char *cp, size_t n)
tor_tls_write(tor_tls_t *tls, const char *cp, size_t n)
{
int r, err;
tor_assert(tls);
+1 -1
View File
@@ -55,7 +55,7 @@ int tor_tls_get_peer_cert_nickname(int severity, tor_tls_t *tls,
int tor_tls_verify(int severity, tor_tls_t *tls, crypto_pk_env_t **identity);
int tor_tls_check_lifetime(tor_tls_t *tls, int tolerance);
int tor_tls_read(tor_tls_t *tls, char *cp, size_t len);
int tor_tls_write(tor_tls_t *tls, char *cp, size_t n);
int tor_tls_write(tor_tls_t *tls, const char *cp, size_t n);
int tor_tls_handshake(tor_tls_t *tls);
int tor_tls_shutdown(tor_tls_t *tls);
int tor_tls_get_pending_bytes(tor_tls_t *tls);
+7 -6
View File
@@ -46,7 +46,7 @@ static int entry_guards_dirty = 0;
/********* END VARIABLES ************/
static int circuit_deliver_create_cell(circuit_t *circ,
uint8_t cell_type, char *payload);
uint8_t cell_type, const char *payload);
static int onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit);
static crypt_path_t *onion_next_hop_in_cpath(crypt_path_t *cpath);
static int onion_extend_cpath(origin_circuit_t *circ);
@@ -468,7 +468,7 @@ circuit_n_conn_done(or_connection_t *or_conn, int status)
*/
static int
circuit_deliver_create_cell(circuit_t *circ, uint8_t cell_type,
char *payload)
const char *payload)
{
cell_t cell;
uint16_t id;
@@ -788,7 +788,8 @@ circuit_extend(cell_t *cell, circuit_t *circ)
* (If 'reverse' is true, then f_XX and b_XX are swapped.)
*/
int
circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse)
circuit_init_cpath_crypto(crypt_path_t *cpath, const char *key_data,
int reverse)
{
crypto_digest_env_t *tmp_digest;
crypto_cipher_env_t *tmp_crypto;
@@ -838,7 +839,7 @@ circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse)
*/
int
circuit_finish_handshake(origin_circuit_t *circ, uint8_t reply_type,
char *reply)
const char *reply)
{
char keys[CPATH_KEY_MATERIAL_LEN];
crypt_path_t *hop;
@@ -946,8 +947,8 @@ circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer)
* cell back.
*/
int
onionskin_answer(or_circuit_t *circ, uint8_t cell_type, char *payload,
char *keys)
onionskin_answer(or_circuit_t *circ, uint8_t cell_type, const char *payload,
const char *keys)
{
cell_t cell;
crypt_path_t *tmp_cpath;
+1 -1
View File
@@ -1121,7 +1121,7 @@ config_line_append(config_line_t **lst,
/** Helper: parse the config string and strdup into key/value
* strings. Set *result to the list, or NULL if parsing the string
* failed. Return 0 on success, -1 on failure. Warn and ignore any
* misformatted lines. */
* misformatted lines. Modifies the contents of <b>string</b>. */
int
config_get_lines(char *string, config_line_t **result)
{
+1 -1
View File
@@ -876,7 +876,7 @@ connection_init_accepted_conn(connection_t *conn, uint8_t listener_type)
* On success, add conn to the list of polled connections.
*/
int
connection_connect(connection_t *conn, char *address,
connection_connect(connection_t *conn, const char *address,
uint32_t addr, uint16_t port)
{
int s, inprogress = 0;
+7 -4
View File
@@ -779,7 +779,8 @@ get_stream(const char *id)
}
/** Helper for setconf and resetconf. Acts like setconf, except
* it passes <b>use_defaults</b> on to options_trial_assign().
* it passes <b>use_defaults</b> on to options_trial_assign(). Modifies the
* contents of body.
*/
static int
control_setconf_helper(control_connection_t *conn, uint32_t len, char *body,
@@ -885,7 +886,8 @@ control_setconf_helper(control_connection_t *conn, uint32_t len, char *body,
}
/** Called when we receive a SETCONF message: parse the body and try
* to update our configuration. Reply with a DONE or ERROR message. */
* to update our configuration. Reply with a DONE or ERROR message.
* Modifies the contents of body.*/
static int
handle_control_setconf(control_connection_t *conn, uint32_t len, char *body)
{
@@ -893,7 +895,8 @@ handle_control_setconf(control_connection_t *conn, uint32_t len, char *body)
}
/** Called when we receive a RESETCONF message: parse the body and try
* to update our configuration. Reply with a DONE or ERROR message. */
* to update our configuration. Reply with a DONE or ERROR message.
* Modifies the contents of body. */
static int
handle_control_resetconf(control_connection_t *conn, uint32_t len, char *body)
{
@@ -2583,7 +2586,7 @@ handle_control_usefeature(control_connection_t *conn,
*/
static int
handle_control_fragments(control_connection_t *conn, uint16_t command_type,
uint32_t body_len, char *body)
uint32_t body_len, const char *body)
{
if (command_type == CONTROL0_CMD_FRAGMENTHEADER) {
if (conn->incoming_cmd) {
+5 -5
View File
@@ -633,7 +633,7 @@ directory_send_command(dir_connection_t *conn,
* Otherwise, return -1.
*/
static int
parse_http_url(char *headers, char **url)
parse_http_url(const char *headers, char **url)
{
char *s, *start, *tmp;
@@ -1516,8 +1516,8 @@ directory_dump_request_log(void)
* conn-\>outbuf. If the request is unrecognized, send a 400.
* Always return 0. */
static int
directory_handle_command_get(dir_connection_t *conn, char *headers,
char *body, size_t body_len)
directory_handle_command_get(dir_connection_t *conn, const char *headers,
const char *body, size_t body_len)
{
size_t dlen;
const char *cp;
@@ -1811,8 +1811,8 @@ directory_handle_command_get(dir_connection_t *conn, char *headers,
* response into conn-\>outbuf. If the request is unrecognized, send a
* 400. Always return 0. */
static int
directory_handle_command_post(dir_connection_t *conn, char *headers,
char *body, size_t body_len)
directory_handle_command_post(dir_connection_t *conn, const char *headers,
const char *body, size_t body_len)
{
char *url = NULL;
or_options_t *options = get_options();
+5 -5
View File
@@ -1892,13 +1892,13 @@ int inform_testing_reachability(void);
int circuit_send_next_onion_skin(origin_circuit_t *circ);
void circuit_note_clock_jumped(int seconds_elapsed);
int circuit_extend(cell_t *cell, circuit_t *circ);
int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data,
int circuit_init_cpath_crypto(crypt_path_t *cpath, const char *key_data,
int reverse);
int circuit_finish_handshake(origin_circuit_t *circ, uint8_t cell_type,
char *reply);
const char *reply);
int circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer);
int onionskin_answer(or_circuit_t *circ, uint8_t cell_type, char *payload,
char *keys);
int onionskin_answer(or_circuit_t *circ, uint8_t cell_type,
const char *payload, const char *keys);
int circuit_all_predicted_ports_handled(time_t now, int *need_uptime,
int *need_capacity);
@@ -2059,7 +2059,7 @@ void _connection_mark_for_close(connection_t *conn,int line, const char *file);
void connection_expire_held_open(void);
int connection_connect(connection_t *conn, char *address, uint32_t addr,
int connection_connect(connection_t *conn, const char *address, uint32_t addr,
uint16_t port);
int retry_all_listeners(int force, smartlist_t *replaced_conns,
smartlist_t *new_conns);