diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-01-30 22:19:41 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-01-30 22:19:41 +0000 |
commit | 76f896e7145ac85b354ad603794f569b20ca85c8 (patch) | |
tree | a3da57ca81cfda646587f3e62c18e63913d7d585 /src | |
parent | 1894e7ea01154d91c3842926a71ae32843264a24 (diff) | |
download | tor-76f896e7145ac85b354ad603794f569b20ca85c8.tar.gz tor-76f896e7145ac85b354ad603794f569b20ca85c8.zip |
r11607@catbus: nickm | 2007-01-30 17:19:27 -0500
Audit non-const char arguments; make a lot more of them const.
svn:r9466
Diffstat (limited to 'src')
-rw-r--r-- | src/common/compat.c | 2 | ||||
-rw-r--r-- | src/common/compat.h | 2 | ||||
-rw-r--r-- | src/common/tortls.c | 2 | ||||
-rw-r--r-- | src/common/tortls.h | 2 | ||||
-rw-r--r-- | src/or/circuitbuild.c | 13 | ||||
-rw-r--r-- | src/or/config.c | 2 | ||||
-rw-r--r-- | src/or/connection.c | 2 | ||||
-rw-r--r-- | src/or/control.c | 11 | ||||
-rw-r--r-- | src/or/directory.c | 10 | ||||
-rw-r--r-- | src/or/or.h | 10 |
10 files changed, 30 insertions, 26 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 8b7867c719..6838db9043 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -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; diff --git a/src/common/compat.h b/src/common/compat.h index 536fd052c6..3589091414 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -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 diff --git a/src/common/tortls.c b/src/common/tortls.c index b93d761b0c..8238073a39 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -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); diff --git a/src/common/tortls.h b/src/common/tortls.h index e2b738da4b..50e798cc22 100644 --- a/src/common/tortls.h +++ b/src/common/tortls.h @@ -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); diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 847f079a3a..5198aac1b9 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -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; diff --git a/src/or/config.c b/src/or/config.c index 35f91f4f9b..d332c60fbc 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -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) { diff --git a/src/or/connection.c b/src/or/connection.c index f1962d9614..31e758b278 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -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; diff --git a/src/or/control.c b/src/or/control.c index 37cef7a29c..be404bfddd 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -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) { diff --git a/src/or/directory.c b/src/or/directory.c index e5b136d28e..87977a9c0d 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -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(); diff --git a/src/or/or.h b/src/or/or.h index d068c26d2b..83607af3ee 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -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); |