1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

- Make Curl_write and it's callees accept a const pointer, in preparation

of tetetest's patch for curl_easy_send()
This commit is contained in:
Michal Marek 2008-05-09 11:27:54 +00:00
parent cf4570a06f
commit e2b82b4325
13 changed files with 32 additions and 22 deletions

View File

@ -7,6 +7,10 @@
Changelog Changelog
Michal Marek (9 May 2008)
- Make Curl_write and it's callees accept a const pointer, in preparation
of tetetest's patch for curl_easy_send()
Daniel Stenberg (7 May 2008) Daniel Stenberg (7 May 2008)
- Liam Healy filed the debian bug report #480044 - Liam Healy filed the debian bug report #480044
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=480044) identifying a (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=480044) identifying a

View File

@ -151,17 +151,20 @@ krb4_overhead(void *app_data, int level, int len)
} }
static int static int
krb4_encode(void *app_data, void *from, int length, int level, void **to, krb4_encode(void *app_data, const void *from, int length, int level, void **to,
struct connectdata *conn) struct connectdata *conn)
{ {
struct krb4_data *d = app_data; struct krb4_data *d = app_data;
*to = malloc(length + 31); *to = malloc(length + 31);
if(level == prot_safe) if(level == prot_safe)
return krb_mk_safe(from, *to, length, &d->key, /* NOTE that the void* cast is safe, krb_mk_safe/priv don't modify the
* input buffer
*/
return krb_mk_safe((void*)from, *to, length, &d->key,
(struct sockaddr_in *)LOCAL_ADDR, (struct sockaddr_in *)LOCAL_ADDR,
(struct sockaddr_in *)REMOTE_ADDR); (struct sockaddr_in *)REMOTE_ADDR);
else if(level == prot_private) else if(level == prot_private)
return krb_mk_priv(from, *to, length, d->schedule, &d->key, return krb_mk_priv((void*)from, *to, length, d->schedule, &d->key,
(struct sockaddr_in *)LOCAL_ADDR, (struct sockaddr_in *)LOCAL_ADDR,
(struct sockaddr_in *)REMOTE_ADDR); (struct sockaddr_in *)REMOTE_ADDR);
else else

View File

@ -31,7 +31,7 @@ struct Curl_sec_client_mech {
void (*end)(void *); void (*end)(void *);
int (*check_prot)(void *, int); int (*check_prot)(void *, int);
int (*overhead)(void *, int, int); int (*overhead)(void *, int, int);
int (*encode)(void *, void*, int, int, void**, struct connectdata *); int (*encode)(void *, const void*, int, int, void**, struct connectdata *);
int (*decode)(void *, void*, int, int, struct connectdata *); int (*decode)(void *, void*, int, int, struct connectdata *);
}; };
@ -58,8 +58,8 @@ int Curl_sec_read_msg (struct connectdata *conn, char *, int);
int Curl_sec_vfprintf(struct connectdata *, FILE *, const char *, va_list); int Curl_sec_vfprintf(struct connectdata *, FILE *, const char *, va_list);
int Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...); int Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...);
int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list); int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list);
ssize_t Curl_sec_send(struct connectdata *conn, int, char *, int); ssize_t Curl_sec_send(struct connectdata *conn, int, const char *, int);
int Curl_sec_write(struct connectdata *conn, int, char *, int); int Curl_sec_write(struct connectdata *conn, int, const char *, int);
void Curl_sec_end (struct connectdata *); void Curl_sec_end (struct connectdata *);
int Curl_sec_login (struct connectdata *); int Curl_sec_login (struct connectdata *);

View File

@ -116,7 +116,7 @@ krb5_overhead(void *app_data, int level, int len)
} }
static int static int
krb5_encode(void *app_data, void *from, int length, int level, void **to, krb5_encode(void *app_data, const void *from, int length, int level, void **to,
struct connectdata *conn) struct connectdata *conn)
{ {
gss_ctx_id_t *context = app_data; gss_ctx_id_t *context = app_data;
@ -128,7 +128,10 @@ krb5_encode(void *app_data, void *from, int length, int level, void **to,
/* shut gcc up */ /* shut gcc up */
conn = NULL; conn = NULL;
dec.value = from; /* NOTE that the cast is safe, neither of the krb5, gnu gss and heimdal
* libraries modify the input buffer in gss_seal()
*/
dec.value = (void*)from;
dec.length = length; dec.length = length;
maj = gss_seal(&min, *context, maj = gss_seal(&min, *context,
level == prot_private, level == prot_private,

View File

@ -237,7 +237,7 @@ Curl_sec_read(struct connectdata *conn, int fd, void *buffer, int length)
} }
static int static int
sec_send(struct connectdata *conn, int fd, char *from, int length) sec_send(struct connectdata *conn, int fd, const char *from, int length)
{ {
int bytes; int bytes;
void *buf; void *buf;
@ -292,7 +292,7 @@ Curl_sec_fflush_fd(struct connectdata *conn, int fd)
} }
int int
Curl_sec_write(struct connectdata *conn, int fd, char *buffer, int length) Curl_sec_write(struct connectdata *conn, int fd, const char *buffer, int length)
{ {
int len = conn->buffer_size; int len = conn->buffer_size;
int tx = 0; int tx = 0;
@ -315,7 +315,7 @@ Curl_sec_write(struct connectdata *conn, int fd, char *buffer, int length)
} }
ssize_t ssize_t
Curl_sec_send(struct connectdata *conn, int num, char *buffer, int length) Curl_sec_send(struct connectdata *conn, int num, const char *buffer, int length)
{ {
curl_socket_t fd = conn->sock[num]; curl_socket_t fd = conn->sock[num];
return (ssize_t)Curl_sec_write(conn, fd, buffer, length); return (ssize_t)Curl_sec_write(conn, fd, buffer, length);

View File

@ -312,7 +312,7 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn,
static ssize_t send_plain(struct connectdata *conn, static ssize_t send_plain(struct connectdata *conn,
int num, int num,
void *mem, const void *mem,
size_t len) size_t len)
{ {
curl_socket_t sockfd = conn->sock[num]; curl_socket_t sockfd = conn->sock[num];
@ -347,7 +347,7 @@ static ssize_t send_plain(struct connectdata *conn,
*/ */
CURLcode Curl_write(struct connectdata *conn, CURLcode Curl_write(struct connectdata *conn,
curl_socket_t sockfd, curl_socket_t sockfd,
void *mem, const void *mem,
size_t len, size_t len,
ssize_t *written) ssize_t *written)
{ {

View File

@ -65,7 +65,7 @@ int Curl_read(struct connectdata *conn, curl_socket_t sockfd,
/* internal write-function, does plain socket, SSL and krb4 */ /* internal write-function, does plain socket, SSL and krb4 */
CURLcode Curl_write(struct connectdata *conn, CURLcode Curl_write(struct connectdata *conn,
curl_socket_t sockfd, curl_socket_t sockfd,
void *mem, size_t len, const void *mem, size_t len,
ssize_t *written); ssize_t *written);
/* the function used to output verbose information */ /* the function used to output verbose information */

View File

@ -2199,7 +2199,7 @@ static CURLcode scp_done(struct connectdata *conn, CURLcode status,
/* return number of received (decrypted) bytes */ /* return number of received (decrypted) bytes */
ssize_t Curl_scp_send(struct connectdata *conn, int sockindex, ssize_t Curl_scp_send(struct connectdata *conn, int sockindex,
void *mem, size_t len) const void *mem, size_t len)
{ {
ssize_t nwrite; ssize_t nwrite;
(void)sockindex; /* we only support SCP on the fixed known primary socket */ (void)sockindex; /* we only support SCP on the fixed known primary socket */
@ -2347,7 +2347,7 @@ static CURLcode sftp_done(struct connectdata *conn, CURLcode status,
/* return number of sent bytes */ /* return number of sent bytes */
ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex, ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex,
void *mem, size_t len) const void *mem, size_t len)
{ {
ssize_t nwrite; /* libssh2_sftp_write() used to return size_t in 0.14 ssize_t nwrite; /* libssh2_sftp_write() used to return size_t in 0.14
but is changed to ssize_t in 0.15. These days we don't but is changed to ssize_t in 0.15. These days we don't

View File

@ -29,12 +29,12 @@ extern const struct Curl_handler Curl_handler_scp;
extern const struct Curl_handler Curl_handler_sftp; extern const struct Curl_handler Curl_handler_sftp;
ssize_t Curl_scp_send(struct connectdata *conn, int sockindex, ssize_t Curl_scp_send(struct connectdata *conn, int sockindex,
void *mem, size_t len); const void *mem, size_t len);
ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex, ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex,
char *mem, size_t len); char *mem, size_t len);
ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex, ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex,
void *mem, size_t len); const void *mem, size_t len);
ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex, ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex,
char *mem, size_t len); char *mem, size_t len);

View File

@ -578,7 +578,7 @@ struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data)
/* return number of sent (non-SSL) bytes */ /* return number of sent (non-SSL) bytes */
ssize_t Curl_ssl_send(struct connectdata *conn, ssize_t Curl_ssl_send(struct connectdata *conn,
int sockindex, int sockindex,
void *mem, const void *mem,
size_t len) size_t len)
{ {
#ifdef USE_SSLEAY #ifdef USE_SSLEAY

View File

@ -44,7 +44,7 @@ CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);
CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data); CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);
ssize_t Curl_ssl_send(struct connectdata *conn, ssize_t Curl_ssl_send(struct connectdata *conn,
int sockindex, int sockindex,
void *mem, const void *mem,
size_t len); size_t len);
ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */ ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */
int sockindex, /* socketindex */ int sockindex, /* socketindex */

View File

@ -1872,7 +1872,7 @@ Curl_ossl_connect(struct connectdata *conn,
/* return number of sent (non-SSL) bytes */ /* return number of sent (non-SSL) bytes */
ssize_t Curl_ossl_send(struct connectdata *conn, ssize_t Curl_ossl_send(struct connectdata *conn,
int sockindex, int sockindex,
void *mem, const void *mem,
size_t len) size_t len)
{ {
/* SSL_write() is said to return 'int' while write() and send() returns /* SSL_write() is said to return 'int' while write() and send() returns

View File

@ -58,7 +58,7 @@ void Curl_ossl_cleanup(void);
ssize_t Curl_ossl_send(struct connectdata *conn, ssize_t Curl_ossl_send(struct connectdata *conn,
int sockindex, int sockindex,
void *mem, const void *mem,
size_t len); size_t len);
ssize_t Curl_ossl_recv(struct connectdata *conn, /* connection data */ ssize_t Curl_ossl_recv(struct connectdata *conn, /* connection data */
int num, /* socketindex */ int num, /* socketindex */