mirror of
https://github.com/lexborisov/Modest
synced 2024-11-25 07:09:35 +03:00
Sync with myhtml
This commit is contained in:
parent
10435746a3
commit
1cf5d4c0e8
@ -42,8 +42,9 @@ struct myhtml_incoming_buffer {
|
||||
|
||||
|
||||
// incoming buffer
|
||||
myhtml_incoming_buffer_t * myhtml_incomming_buffer_add(myhtml_incoming_buffer_t *current, mcobject_t *mcobject, const char *html, size_t html_size);
|
||||
void myhtml_incomming_buffer_clean(myhtml_incoming_buffer_t *current);
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_add(myhtml_incoming_buffer_t *current, mcobject_t *mcobject, const char *html, size_t html_size);
|
||||
void myhtml_incoming_buffer_clean(myhtml_incoming_buffer_t *current);
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_split(myhtml_incoming_buffer_t *current, mcobject_t *mcobject, size_t global_pos);
|
||||
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_find_by_position(myhtml_incoming_buffer_t *inc_buf, size_t begin);
|
||||
|
||||
|
@ -24,8 +24,8 @@
|
||||
|
||||
mycss_status_t mycss_tokenizer_chunk(mycss_entry_t* entry, const char* css, size_t css_length)
|
||||
{
|
||||
entry->current_buffer = myhtml_incomming_buffer_add(entry->current_buffer, entry->mcobject_incoming_buffer,
|
||||
css, css_length);
|
||||
entry->current_buffer = myhtml_incoming_buffer_add(entry->current_buffer, entry->mcobject_incoming_buffer,
|
||||
css, css_length);
|
||||
|
||||
if(entry->current_buffer == NULL)
|
||||
return MyCSS_STATUS_ERROR_TOKENIZER_INCOMING_BUFFER_ADD;
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "myhtml/incoming.h"
|
||||
#include "myhtml/utils/resources.h"
|
||||
|
||||
myhtml_incoming_buffer_t * myhtml_incomming_buffer_add(myhtml_incoming_buffer_t *current, mcobject_t *mcobject,
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_add(myhtml_incoming_buffer_t *current, mcobject_t *mcobject,
|
||||
const char *html, size_t html_size)
|
||||
{
|
||||
myhtml_incoming_buffer_t *inc_buf = mcobject_malloc(mcobject, NULL);
|
||||
@ -44,11 +44,30 @@ myhtml_incoming_buffer_t * myhtml_incomming_buffer_add(myhtml_incoming_buffer_t
|
||||
return inc_buf;
|
||||
}
|
||||
|
||||
void myhtml_incomming_buffer_clean(myhtml_incoming_buffer_t *current)
|
||||
void myhtml_incoming_buffer_clean(myhtml_incoming_buffer_t *current)
|
||||
{
|
||||
memset(current, 0, sizeof(myhtml_incoming_buffer_t));
|
||||
}
|
||||
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_split(myhtml_incoming_buffer_t *current, mcobject_t *mcobject, size_t global_pos)
|
||||
{
|
||||
size_t relative_pos = global_pos - current->offset;
|
||||
myhtml_incoming_buffer_t *inc_buf = mcobject_malloc(mcobject, NULL);
|
||||
|
||||
inc_buf->size = current->size - relative_pos;
|
||||
inc_buf->length = inc_buf->size;
|
||||
inc_buf->data = ¤t->data[relative_pos];
|
||||
inc_buf->offset = current->offset + relative_pos;
|
||||
inc_buf->next = NULL;
|
||||
inc_buf->prev = current;
|
||||
|
||||
current->next = inc_buf;
|
||||
current->size = relative_pos;
|
||||
current->length = relative_pos;
|
||||
|
||||
return inc_buf;
|
||||
}
|
||||
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_find_by_position(myhtml_incoming_buffer_t *inc_buf, size_t begin)
|
||||
{
|
||||
if(inc_buf->offset < begin) {
|
||||
|
@ -42,8 +42,9 @@ struct myhtml_incoming_buffer {
|
||||
|
||||
|
||||
// incoming buffer
|
||||
myhtml_incoming_buffer_t * myhtml_incomming_buffer_add(myhtml_incoming_buffer_t *current, mcobject_t *mcobject, const char *html, size_t html_size);
|
||||
void myhtml_incomming_buffer_clean(myhtml_incoming_buffer_t *current);
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_add(myhtml_incoming_buffer_t *current, mcobject_t *mcobject, const char *html, size_t html_size);
|
||||
void myhtml_incoming_buffer_clean(myhtml_incoming_buffer_t *current);
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_split(myhtml_incoming_buffer_t *current, mcobject_t *mcobject, size_t global_pos);
|
||||
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_find_by_position(myhtml_incoming_buffer_t *inc_buf, size_t begin);
|
||||
|
||||
|
@ -160,13 +160,13 @@ void myhtml_serialization_attributes(myhtml_tree_t* tree, myhtml_tree_attr_t* at
|
||||
The attribute's serialized name is the string "xmlns:" followed by the attribute's local name.
|
||||
*/
|
||||
if(attr->key.data && attr->key.length == 5 && myhtml_strcmp(attr->key.data, "xmlns")) {
|
||||
callback("xmlns:", 6, callback);
|
||||
callback("xmlns:", 6, ptr);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case MyHTML_NAMESPACE_XLINK: {
|
||||
callback("xlink:", 6, callback);
|
||||
callback("xlink:", 6, ptr);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -309,7 +309,7 @@ void myhtml_serialization_append_attr(const char* data, size_t size, myhtml_call
|
||||
break;
|
||||
case 0xA0:
|
||||
if (notwritten) callback(data + i - notwritten, notwritten, ptr);
|
||||
callback(" ", 6, NULL);
|
||||
callback(" ", 6, ptr);
|
||||
notwritten = 0;
|
||||
break;
|
||||
default:
|
||||
|
@ -46,7 +46,7 @@ myhtml_status_t myhtml_tokenizer_chunk_process(myhtml_tree_t* tree, const char*
|
||||
myhtml_tokenizer_state_f* state_f = myhtml->parse_state_func;
|
||||
|
||||
// add for a chunk
|
||||
tree->incoming_buf = myhtml_incomming_buffer_add(tree->incoming_buf, tree->mcobject_incoming_buf, html, html_length);
|
||||
tree->incoming_buf = myhtml_incoming_buffer_add(tree->incoming_buf, tree->mcobject_incoming_buf, html, html_length);
|
||||
|
||||
#ifndef MyHTML_BUILD_WITHOUT_THREADS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user