1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-26 02:46:13 -04:00

1008: make http_post.post_data point to const

Because init_http_post() now copies the file names,
http_read_post_inline() no longer writes '\0' into post_data.
This commit is contained in:
Kalle Olavi Niemitalo 2008-07-11 15:18:01 +03:00 committed by Kalle Olavi Niemitalo
parent 42123dab87
commit 1ab55c27a4
2 changed files with 9 additions and 11 deletions

View File

@ -87,19 +87,19 @@ done_http_post(struct http_post *http_post)
*
* @relates http_post */
int
open_http_post(struct http_post *http_post, unsigned char *post_data,
open_http_post(struct http_post *http_post, const unsigned char *post_data,
enum connection_state *error)
{
off_t size = 0;
size_t length = strlen(post_data);
unsigned char *end = post_data;
const unsigned char *end = post_data;
done_http_post(http_post);
http_post->post_data = end;
while (1) {
struct stat sb;
unsigned char *begin;
const unsigned char *begin;
int res;
struct http_post_file *new_files;
unsigned char *filename;
@ -159,8 +159,8 @@ read_http_post_inline(struct http_post *http_post,
unsigned char buffer[], int max,
enum connection_state *error)
{
unsigned char *post = http_post->post_data;
unsigned char *end = strchr(post, FILE_CHAR);
const unsigned char *post = http_post->post_data;
const unsigned char *end = strchr(post, FILE_CHAR);
int total = 0;
assert(http_post->post_fd < 0);

View File

@ -27,11 +27,9 @@ struct http_post {
* read_http_post() increments this. */
off_t uploaded;
/** Points to the next byte to be read from connection.uri->post.
* Does not point to const because http_read_post() momentarily
* substitutes a null character for the FILE_CHAR at the end of
* each file name. */
unsigned char *post_data;
/** Points to the next byte to be read from
* connection.uri->post. */
const unsigned char *post_data;
/** File descriptor from which data is being read, or -1 if
* none. */
@ -56,7 +54,7 @@ struct http_post {
void init_http_post(struct http_post *http_post);
void done_http_post(struct http_post *http_post);
int open_http_post(struct http_post *http_post, unsigned char *post_data,
int open_http_post(struct http_post *http_post, const unsigned char *post_data,
enum connection_state *error);
int read_http_post(struct http_post *http_post,
unsigned char buffer[], int max,