Constify data parameter to *_process_data

svn path=/trunk/netsurf/; revision=10234
This commit is contained in:
John Mark Bell 2010-04-03 16:37:36 +00:00
parent 4839adaff3
commit 43a99ab683
13 changed files with 22 additions and 19 deletions

View File

@ -247,7 +247,8 @@ const char * const content_status_name[] = {
/** An entry in handler_map. */ /** An entry in handler_map. */
struct handler_entry { struct handler_entry {
bool (*create)(struct content *c, const http_parameter *params); bool (*create)(struct content *c, const http_parameter *params);
bool (*process_data)(struct content *c, char *data, unsigned int size); bool (*process_data)(struct content *c,
const char *data, unsigned int size);
bool (*convert)(struct content *c); bool (*convert)(struct content *c);
void (*reformat)(struct content *c, int width, int height); void (*reformat)(struct content *c, int width, int height);
void (*destroy)(struct content *c); void (*destroy)(struct content *c);
@ -519,7 +520,7 @@ nserror content_llcache_callback(llcache_handle *llcache,
case LLCACHE_EVENT_HAD_DATA: case LLCACHE_EVENT_HAD_DATA:
if (handler_map[c->type].process_data) { if (handler_map[c->type].process_data) {
if (handler_map[c->type].process_data(c, if (handler_map[c->type].process_data(c,
(char *) event->data.data.buf, (const char *) event->data.data.buf,
event->data.data.len) == false) { event->data.data.len) == false) {
c->status = CONTENT_STATUS_ERROR; c->status = CONTENT_STATUS_ERROR;
/** \todo It's not clear what error this is */ /** \todo It's not clear what error this is */

View File

@ -117,7 +117,7 @@ nserror nscss_create_css_data(struct content_css_data *c,
* \param size Number of bytes to process * \param size Number of bytes to process
* \return true on success, false on failure * \return true on success, false on failure
*/ */
bool nscss_process_data(struct content *c, char *data, unsigned int size) bool nscss_process_data(struct content *c, const char *data, unsigned int size)
{ {
union content_msg_data msg_data; union content_msg_data msg_data;
css_error error; css_error error;
@ -139,7 +139,7 @@ bool nscss_process_data(struct content *c, char *data, unsigned int size)
* \param size Number of bytes to process * \param size Number of bytes to process
* \return CSS_OK on success, appropriate error otherwise * \return CSS_OK on success, appropriate error otherwise
*/ */
css_error nscss_process_css_data(struct content_css_data *c, char *data, css_error nscss_process_css_data(struct content_css_data *c, const char *data,
unsigned int size) unsigned int size)
{ {
return css_stylesheet_append_data(c->sheet, return css_stylesheet_append_data(c->sheet,

View File

@ -51,7 +51,7 @@ struct nscss_import {
bool nscss_create(struct content *c, const struct http_parameter *params); bool nscss_create(struct content *c, const struct http_parameter *params);
bool nscss_process_data(struct content *c, char *data, unsigned int size); bool nscss_process_data(struct content *c, const char *data, unsigned int size);
bool nscss_convert(struct content *c); bool nscss_convert(struct content *c);
@ -59,7 +59,7 @@ void nscss_destroy(struct content *c);
nserror nscss_create_css_data(struct content_css_data *c, nserror nscss_create_css_data(struct content_css_data *c,
const char *url, const char *charset, bool quirks); const char *url, const char *charset, bool quirks);
css_error nscss_process_css_data(struct content_css_data *c, char *data, css_error nscss_process_css_data(struct content_css_data *c, const char *data,
unsigned int size); unsigned int size);
css_error nscss_convert_css_data(struct content_css_data *c); css_error nscss_convert_css_data(struct content_css_data *c);
void nscss_destroy_css_data(struct content_css_data *c); void nscss_destroy_css_data(struct content_css_data *c);

View File

@ -267,7 +267,7 @@ mng_bool nsmng_processheader(mng_handle mng, mng_uint32 width,
*/ */
bool nsmng_process_data(struct content *c, char *data, unsigned int size) bool nsmng_process_data(struct content *c, const char *data, unsigned int size)
{ {
mng_retcode status; mng_retcode status;

View File

@ -42,7 +42,7 @@ struct content_mng_data {
}; };
bool nsmng_create(struct content *c, const struct http_parameter *params); bool nsmng_create(struct content *c, const struct http_parameter *params);
bool nsmng_process_data(struct content *c, char *data, unsigned int size); bool nsmng_process_data(struct content *c, const char *data, unsigned int size);
bool nsmng_convert(struct content *c); bool nsmng_convert(struct content *c);
void nsmng_destroy(struct content *c); void nsmng_destroy(struct content *c);
bool nsmng_redraw(struct content *c, int x, int y, bool nsmng_redraw(struct content *c, int x, int y,

View File

@ -104,7 +104,7 @@ bool nspng_create(struct content *c, const struct http_parameter *params)
} }
bool nspng_process_data(struct content *c, char *data, unsigned int size) bool nspng_process_data(struct content *c, const char *data, unsigned int size)
{ {
union content_msg_data msg_data; union content_msg_data msg_data;

View File

@ -43,7 +43,7 @@ struct content_png_data {
}; };
bool nspng_create(struct content *c, const struct http_parameter *params); bool nspng_create(struct content *c, const struct http_parameter *params);
bool nspng_process_data(struct content *c, char *data, unsigned int size); bool nspng_process_data(struct content *c, const char *data, unsigned int size);
bool nspng_convert(struct content *c); bool nspng_convert(struct content *c);
void nspng_destroy(struct content *c); void nspng_destroy(struct content *c);
bool nspng_redraw(struct content *c, int x, int y, bool nspng_redraw(struct content *c, int x, int y,

View File

@ -69,7 +69,7 @@ bool rsvg_create(struct content *c, const struct http_parameter *params)
return true; return true;
} }
bool rsvg_process_data(struct content *c, char *data, bool rsvg_process_data(struct content *c, const char *data,
unsigned int size) unsigned int size)
{ {
struct content_rsvg_data *d = &c->data.rsvg; struct content_rsvg_data *d = &c->data.rsvg;

View File

@ -43,7 +43,7 @@ struct content_rsvg_data {
}; };
bool rsvg_create(struct content *c, const struct http_parameter *params); bool rsvg_create(struct content *c, const struct http_parameter *params);
bool rsvg_process_data(struct content *c, char *data, unsigned int size); bool rsvg_process_data(struct content *c, const char *data, unsigned int size);
bool rsvg_convert(struct content *c); bool rsvg_convert(struct content *c);
void rsvg_destroy(struct content *c); void rsvg_destroy(struct content *c);
bool rsvg_redraw(struct content *c, int x, int y, bool rsvg_redraw(struct content *c, int x, int y,

View File

@ -192,7 +192,7 @@ error:
* The data is parsed in chunks of size CHUNK, multitasking in between. * The data is parsed in chunks of size CHUNK, multitasking in between.
*/ */
bool html_process_data(struct content *c, char *data, unsigned int size) bool html_process_data(struct content *c, const char *data, unsigned int size)
{ {
unsigned long x; unsigned long x;
binding_error err; binding_error err;
@ -200,7 +200,7 @@ bool html_process_data(struct content *c, char *data, unsigned int size)
for (x = 0; x + CHUNK <= size; x += CHUNK) { for (x = 0; x + CHUNK <= size; x += CHUNK) {
err = binding_parse_chunk(c->data.html.parser_binding, err = binding_parse_chunk(c->data.html.parser_binding,
(uint8_t *) data + x, CHUNK); (const uint8_t *) data + x, CHUNK);
if (err == BINDING_ENCODINGCHANGE) { if (err == BINDING_ENCODINGCHANGE) {
goto encoding_change; goto encoding_change;
} else if (err != BINDING_OK) { } else if (err != BINDING_OK) {
@ -216,7 +216,7 @@ bool html_process_data(struct content *c, char *data, unsigned int size)
} }
err = binding_parse_chunk(c->data.html.parser_binding, err = binding_parse_chunk(c->data.html.parser_binding,
(uint8_t *) data + x, (size - x)); (const uint8_t *) data + x, (size - x));
if (err == BINDING_ENCODINGCHANGE) { if (err == BINDING_ENCODINGCHANGE) {
goto encoding_change; goto encoding_change;
} else if (err != BINDING_OK) { } else if (err != BINDING_OK) {
@ -294,7 +294,7 @@ encoding_change:
/* Recurse to reprocess all that data. This is safe because /* Recurse to reprocess all that data. This is safe because
* the encoding is now specified at parser-start which means * the encoding is now specified at parser-start which means
* it cannot be changed again. */ * it cannot be changed again. */
return html_process_data(c, (char *) source_data, source_size); return html_process_data(c, source_data, source_size);
} }
} }

View File

@ -186,7 +186,7 @@ extern bool html_redraw_debug;
bool html_create(struct content *c, const struct http_parameter *params); bool html_create(struct content *c, const struct http_parameter *params);
bool html_process_data(struct content *c, char *data, unsigned int size); bool html_process_data(struct content *c, const char *data, unsigned int size);
bool html_convert(struct content *c); bool html_convert(struct content *c);
void html_reformat(struct content *c, int width, int height); void html_reformat(struct content *c, int width, int height);
void html_destroy(struct content *c); void html_destroy(struct content *c);

View File

@ -133,7 +133,8 @@ no_memory:
* Process data for CONTENT_TEXTPLAIN. * Process data for CONTENT_TEXTPLAIN.
*/ */
bool textplain_process_data(struct content *c, char *data, unsigned int size) bool textplain_process_data(struct content *c,
const char *data, unsigned int size)
{ {
iconv_t iconv_cd = c->data.textplain.iconv_cd; iconv_t iconv_cd = c->data.textplain.iconv_cd;
size_t count; size_t count;

View File

@ -49,7 +49,8 @@ struct content_textplain_data {
}; };
bool textplain_create(struct content *c, const struct http_parameter *params); bool textplain_create(struct content *c, const struct http_parameter *params);
bool textplain_process_data(struct content *c, char *data, unsigned int size); bool textplain_process_data(struct content *c,
const char *data, unsigned int size);
bool textplain_convert(struct content *c); bool textplain_convert(struct content *c);
void textplain_reformat(struct content *c, int width, int height); void textplain_reformat(struct content *c, int width, int height);
void textplain_destroy(struct content *c); void textplain_destroy(struct content *c);