mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
smtp: Fixed const'ness of nread parameter in Curl_smtp_escape_eob()
...and some comment typos!
This commit is contained in:
parent
4bd860a001
commit
854049f962
10
lib/smtp.c
10
lib/smtp.c
@ -2308,7 +2308,7 @@ static CURLcode smtp_calc_sasl_details(struct connectdata *conn,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread)
|
CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread)
|
||||||
{
|
{
|
||||||
/* When sending a SMTP payload we must detect CRLF. sequences making sure
|
/* When sending a SMTP payload we must detect CRLF. sequences making sure
|
||||||
they are sent as CRLF.. instead, as a . on the beginning of a line will
|
they are sent as CRLF.. instead, as a . on the beginning of a line will
|
||||||
@ -2323,7 +2323,7 @@ CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread)
|
|||||||
char *scratch = data->state.scratch;
|
char *scratch = data->state.scratch;
|
||||||
char *oldscratch = NULL;
|
char *oldscratch = NULL;
|
||||||
|
|
||||||
/* Do we need to allocate the scatch buffer? */
|
/* Do we need to allocate a scratch buffer? */
|
||||||
if(!scratch || data->set.crlf) {
|
if(!scratch || data->set.crlf) {
|
||||||
oldscratch = scratch;
|
oldscratch = scratch;
|
||||||
|
|
||||||
@ -2380,10 +2380,8 @@ CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread)
|
|||||||
smtp->eob = 0;
|
smtp->eob = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Only use the new buffer if we replaced something */
|
||||||
if(si != nread) {
|
if(si != nread) {
|
||||||
/* Only use the new buffer if we replaced something */
|
|
||||||
nread = si;
|
|
||||||
|
|
||||||
/* Upload from the new (replaced) buffer instead */
|
/* Upload from the new (replaced) buffer instead */
|
||||||
data->req.upload_fromhere = scratch;
|
data->req.upload_fromhere = scratch;
|
||||||
|
|
||||||
@ -2394,7 +2392,7 @@ CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread)
|
|||||||
Curl_safefree(oldscratch);
|
Curl_safefree(oldscratch);
|
||||||
|
|
||||||
/* Set the new amount too */
|
/* Set the new amount too */
|
||||||
data->req.upload_present = nread;
|
data->req.upload_present = si;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Curl_safefree(scratch);
|
Curl_safefree(scratch);
|
||||||
|
@ -101,6 +101,6 @@ extern const struct Curl_handler Curl_handler_smtps;
|
|||||||
#define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e"
|
#define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e"
|
||||||
#define SMTP_EOB_REPL_LEN 4
|
#define SMTP_EOB_REPL_LEN 4
|
||||||
|
|
||||||
CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread);
|
CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread);
|
||||||
|
|
||||||
#endif /* HEADER_CURL_SMTP_H */
|
#endif /* HEADER_CURL_SMTP_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user