Fixed some compiler warnings and made some more tables 'const'.

This commit is contained in:
Dan Fandrich 2007-04-18 21:03:42 +00:00
parent 9b81a01376
commit 1a6e00cfef
3 changed files with 12 additions and 12 deletions

View File

@ -636,25 +636,25 @@ static int libssh2_kex_method_diffie_hellman_group_exchange_sha1_key_exchange(LI
#define LIBSSH2_KEX_METHOD_FLAG_REQ_ENC_HOSTKEY 0x0001 #define LIBSSH2_KEX_METHOD_FLAG_REQ_ENC_HOSTKEY 0x0001
#define LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY 0x0002 #define LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY 0x0002
const LIBSSH2_KEX_METHOD libssh2_kex_method_diffie_helman_group1_sha1 = { static const LIBSSH2_KEX_METHOD libssh2_kex_method_diffie_helman_group1_sha1 = {
"diffie-hellman-group1-sha1", "diffie-hellman-group1-sha1",
libssh2_kex_method_diffie_hellman_group1_sha1_key_exchange, libssh2_kex_method_diffie_hellman_group1_sha1_key_exchange,
LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY, LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY,
}; };
const LIBSSH2_KEX_METHOD libssh2_kex_method_diffie_helman_group14_sha1 = { static const LIBSSH2_KEX_METHOD libssh2_kex_method_diffie_helman_group14_sha1 = {
"diffie-hellman-group14-sha1", "diffie-hellman-group14-sha1",
libssh2_kex_method_diffie_hellman_group14_sha1_key_exchange, libssh2_kex_method_diffie_hellman_group14_sha1_key_exchange,
LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY, LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY,
}; };
const LIBSSH2_KEX_METHOD libssh2_kex_method_diffie_helman_group_exchange_sha1 = { static const LIBSSH2_KEX_METHOD libssh2_kex_method_diffie_helman_group_exchange_sha1 = {
"diffie-hellman-group-exchange-sha1", "diffie-hellman-group-exchange-sha1",
libssh2_kex_method_diffie_hellman_group_exchange_sha1_key_exchange, libssh2_kex_method_diffie_hellman_group_exchange_sha1_key_exchange,
LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY, LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY,
}; };
const LIBSSH2_KEX_METHOD *libssh2_kex_methods[] = { static const LIBSSH2_KEX_METHOD *libssh2_kex_methods[] = {
&libssh2_kex_method_diffie_helman_group14_sha1, &libssh2_kex_method_diffie_helman_group14_sha1,
&libssh2_kex_method_diffie_helman_group_exchange_sha1, &libssh2_kex_method_diffie_helman_group_exchange_sha1,
&libssh2_kex_method_diffie_helman_group1_sha1, &libssh2_kex_method_diffie_helman_group1_sha1,
@ -1110,7 +1110,7 @@ static int libssh2_kex_agree_mac(LIBSSH2_SESSION *session, libssh2_endpoint_data
*/ */
static int libssh2_kex_agree_comp(LIBSSH2_SESSION *session, libssh2_endpoint_data *endpoint, unsigned char *comp, unsigned long comp_len) static int libssh2_kex_agree_comp(LIBSSH2_SESSION *session, libssh2_endpoint_data *endpoint, unsigned char *comp, unsigned long comp_len)
{ {
LIBSSH2_COMP_METHOD **compp = libssh2_comp_methods(); const LIBSSH2_COMP_METHOD **compp = libssh2_comp_methods();
unsigned char *s; unsigned char *s;
(void)session; (void)session;

View File

@ -52,11 +52,11 @@ struct _LIBSSH2_PUBLICKEY {
typedef struct _LIBSSH2_PUBLICKEY_CODE_LIST { typedef struct _LIBSSH2_PUBLICKEY_CODE_LIST {
int code; int code;
char *name; const char *name;
int name_len; int name_len;
} LIBSSH2_PUBLICKEY_CODE_LIST; } LIBSSH2_PUBLICKEY_CODE_LIST;
static LIBSSH2_PUBLICKEY_CODE_LIST libssh2_publickey_response_codes[] = { static const LIBSSH2_PUBLICKEY_CODE_LIST libssh2_publickey_response_codes[] = {
{ LIBSSH2_PUBLICKEY_RESPONSE_STATUS, "status", sizeof("status") - 1 }, { LIBSSH2_PUBLICKEY_RESPONSE_STATUS, "status", sizeof("status") - 1 },
{ LIBSSH2_PUBLICKEY_RESPONSE_VERSION, "version", sizeof("version") - 1 }, { LIBSSH2_PUBLICKEY_RESPONSE_VERSION, "version", sizeof("version") - 1 },
{ LIBSSH2_PUBLICKEY_RESPONSE_PUBLICKEY, "publickey", sizeof("publickey") - 1 }, { LIBSSH2_PUBLICKEY_RESPONSE_PUBLICKEY, "publickey", sizeof("publickey") - 1 },
@ -76,7 +76,7 @@ static LIBSSH2_PUBLICKEY_CODE_LIST libssh2_publickey_response_codes[] = {
#define LIBSSH2_PUBLICKEY_STATUS_CODE_MAX 8 #define LIBSSH2_PUBLICKEY_STATUS_CODE_MAX 8
static LIBSSH2_PUBLICKEY_CODE_LIST libssh2_publickey_status_codes[] = { static const LIBSSH2_PUBLICKEY_CODE_LIST libssh2_publickey_status_codes[] = {
{ LIBSSH2_PUBLICKEY_SUCCESS, "success", sizeof("success") - 1 }, { LIBSSH2_PUBLICKEY_SUCCESS, "success", sizeof("success") - 1 },
{ LIBSSH2_PUBLICKEY_ACCESS_DENIED, "access denied", sizeof("access denied") - 1 }, { LIBSSH2_PUBLICKEY_ACCESS_DENIED, "access denied", sizeof("access denied") - 1 },
{ LIBSSH2_PUBLICKEY_STORAGE_EXCEEDED, "storage exceeded", sizeof("storage exceeded") - 1 }, { LIBSSH2_PUBLICKEY_STORAGE_EXCEEDED, "storage exceeded", sizeof("storage exceeded") - 1 },
@ -95,9 +95,9 @@ static LIBSSH2_PUBLICKEY_CODE_LIST libssh2_publickey_status_codes[] = {
#define LIBSSH2_PUBLICKEY_STATUS_TEXT_START "Publickey Subsystem Error: \"" #define LIBSSH2_PUBLICKEY_STATUS_TEXT_START "Publickey Subsystem Error: \""
#define LIBSSH2_PUBLICKEY_STATUS_TEXT_MID "\" Server Resports: \"" #define LIBSSH2_PUBLICKEY_STATUS_TEXT_MID "\" Server Resports: \""
#define LIBSSH2_PUBLICKEY_STATUS_TEXT_END "\"" #define LIBSSH2_PUBLICKEY_STATUS_TEXT_END "\""
static void libssh2_publickey_status_error(LIBSSH2_PUBLICKEY *pkey, LIBSSH2_SESSION *session, int status, unsigned char *message, int message_len) static void libssh2_publickey_status_error(const LIBSSH2_PUBLICKEY *pkey, LIBSSH2_SESSION *session, int status, const unsigned char *message, int message_len)
{ {
char *status_text; const char *status_text;
int status_text_len; int status_text_len;
char *m, *s; char *m, *s;
int m_len; int m_len;
@ -180,7 +180,7 @@ static int libssh2_publickey_response_id(unsigned char **pdata, int data_len)
{ {
unsigned long response_len; unsigned long response_len;
unsigned char *data = *pdata; unsigned char *data = *pdata;
LIBSSH2_PUBLICKEY_CODE_LIST *codes = libssh2_publickey_response_codes; const LIBSSH2_PUBLICKEY_CODE_LIST *codes = libssh2_publickey_response_codes;
if (data_len < 4) { if (data_len < 4) {
/* Malformed response */ /* Malformed response */

View File

@ -303,7 +303,7 @@ static int libssh2_file_read_publickey(LIBSSH2_SESSION *session, unsigned char *
sp2 = pubkey + pubkey_len; sp2 = pubkey + pubkey_len;
} }
if (libssh2_base64_decode(session, &tmp, &tmp_len, (char *)sp1, sp2 - sp1)) { if (libssh2_base64_decode(session, (char **)&tmp, &tmp_len, (char *)sp1, sp2 - sp1)) {
libssh2_error(session, LIBSSH2_ERROR_FILE, "Invalid key data, not base64 encoded", 0); libssh2_error(session, LIBSSH2_ERROR_FILE, "Invalid key data, not base64 encoded", 0);
LIBSSH2_FREE(session, pubkey); LIBSSH2_FREE(session, pubkey);
return -1; return -1;