- 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
Родитель cf4570a06f
Коммит e2b82b4325
13 изменённых файлов: 32 добавлений и 22 удалений

Просмотреть файл

@ -7,6 +7,10 @@
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)
- Liam Healy filed the debian bug report #480044
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=480044) identifying a

Просмотреть файл

@ -151,17 +151,20 @@ krb4_overhead(void *app_data, int level, int len)
}
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 krb4_data *d = app_data;
*to = malloc(length + 31);
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 *)REMOTE_ADDR);
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 *)REMOTE_ADDR);
else

Просмотреть файл

@ -31,7 +31,7 @@ struct Curl_sec_client_mech {
void (*end)(void *);
int (*check_prot)(void *, 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 *);
};
@ -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_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...);
int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list);
ssize_t Curl_sec_send(struct connectdata *conn, int, char *, int);
int Curl_sec_write(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, const char *, int);
void Curl_sec_end (struct connectdata *);
int Curl_sec_login (struct connectdata *);

Просмотреть файл

@ -116,7 +116,7 @@ krb5_overhead(void *app_data, int level, int len)
}
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)
{
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 */
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;
maj = gss_seal(&min, *context,
level == prot_private,

Просмотреть файл

@ -237,7 +237,7 @@ Curl_sec_read(struct connectdata *conn, int fd, void *buffer, int length)
}
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;
void *buf;
@ -292,7 +292,7 @@ Curl_sec_fflush_fd(struct connectdata *conn, int fd)
}
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 tx = 0;
@ -315,7 +315,7 @@ Curl_sec_write(struct connectdata *conn, int fd, char *buffer, int length)
}
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];
return (ssize_t)Curl_sec_write(conn, fd, buffer, length);

Просмотреть файл

@ -312,7 +312,7 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn,
static ssize_t send_plain(struct connectdata *conn,
int num,
void *mem,
const void *mem,
size_t len)
{
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,
curl_socket_t sockfd,
void *mem,
const void *mem,
size_t len,
ssize_t *written)
{

Просмотреть файл

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

Просмотреть файл

@ -2199,7 +2199,7 @@ static CURLcode scp_done(struct connectdata *conn, CURLcode status,
/* return number of received (decrypted) bytes */
ssize_t Curl_scp_send(struct connectdata *conn, int sockindex,
void *mem, size_t len)
const void *mem, size_t len)
{
ssize_t nwrite;
(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 */
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
but is changed to ssize_t in 0.15. These days we don't

Просмотреть файл

@ -29,12 +29,12 @@ extern const struct Curl_handler Curl_handler_scp;
extern const struct Curl_handler Curl_handler_sftp;
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,
char *mem, size_t len);
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,
char *mem, size_t len);

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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