mirror of
https://github.com/lexborisov/Modest
synced 2024-11-22 05:41:32 +03:00
Fixes for serialization status
This commit is contained in:
parent
c476946ddd
commit
9fe5924a04
@ -68,9 +68,10 @@ mycss_entry_t * parse_css(const char* data, size_t data_size)
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_result(modest_t* modest, myhtml_tree_t* myhtml_tree, myhtml_tree_node_t* scope_node, mycss_entry_t *mycss_entry)
|
void print_result(modest_t* modest, myhtml_tree_t* myhtml_tree, myhtml_tree_node_t* scope_node, mycss_entry_t *mycss_entry)
|
||||||
|
@ -29,9 +29,10 @@
|
|||||||
#define DIE(msg, ...) do { fprintf(stderr, msg, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
|
#define DIE(msg, ...) do { fprintf(stderr, msg, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
|
||||||
#define check_status(msg, ...) do {if(status) DIE(msg, ##__VA_ARGS__);} while(0)
|
#define check_status(msg, ...) do {if(status) DIE(msg, ##__VA_ARGS__);} while(0)
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
myhtml_tree_t * parse_html(const char* data, size_t data_size, myhtml_callback_tree_node_f cai, void* cai_ctx)
|
myhtml_tree_t * parse_html(const char* data, size_t data_size, myhtml_callback_tree_node_f cai, void* cai_ctx)
|
||||||
|
@ -32,13 +32,16 @@
|
|||||||
#define DIE(msg, ...) do { fprintf(stderr, msg, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
|
#define DIE(msg, ...) do { fprintf(stderr, msg, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
|
||||||
#define CHECK_STATUS(msg, ...) do {if(status) DIE(msg, ##__VA_ARGS__);} while(0)
|
#define CHECK_STATUS(msg, ...) do {if(status) DIE(msg, ##__VA_ARGS__);} while(0)
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialization_bad_selectors(const char* buffer, size_t size, void* ctx) {
|
mystatus_t serialization_bad_selectors(const char* buffer, size_t size, void* ctx)
|
||||||
|
{
|
||||||
printf("%.*s", (int)size, buffer);
|
printf("%.*s", (int)size, buffer);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
myhtml_tree_t * parse_html(const char* data, size_t data_size)
|
myhtml_tree_t * parse_html(const char* data, size_t data_size)
|
||||||
|
@ -29,13 +29,16 @@
|
|||||||
#include <mycss/selectors/init.h>
|
#include <mycss/selectors/init.h>
|
||||||
#include <mycss/selectors/serialization.h>
|
#include <mycss/selectors/serialization.h>
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialization_bad_selectors(const char* buffer, size_t size, void* ctx) {
|
mystatus_t serialization_bad_selectors(const char* data, size_t len, void* ctx)
|
||||||
printf("%.*s", (int)size, buffer);
|
{
|
||||||
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
myhtml_tree_t * parse_html(myhtml_t* myhtml, const char* data, size_t data_size)
|
myhtml_tree_t * parse_html(myhtml_t* myhtml, const char* data, size_t data_size)
|
||||||
|
@ -33,9 +33,10 @@
|
|||||||
#define DIE(msg, ...) do { fprintf(stderr, msg, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
|
#define DIE(msg, ...) do { fprintf(stderr, msg, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
|
||||||
#define CHECK_STATUS(msg, ...) do {if(status) DIE(msg, ##__VA_ARGS__);} while(0)
|
#define CHECK_STATUS(msg, ...) do {if(status) DIE(msg, ##__VA_ARGS__);} while(0)
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
myhtml_tree_t * parse_html(const char* data, size_t data_size)
|
myhtml_tree_t * parse_html(const char* data, size_t data_size)
|
||||||
|
@ -74,9 +74,10 @@ struct res_data load_data_file(const char* filename)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -25,9 +25,10 @@
|
|||||||
#include <mycss/mycss.h>
|
#include <mycss/mycss.h>
|
||||||
#include <mycss/declaration/init.h>
|
#include <mycss/declaration/init.h>
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -25,9 +25,10 @@
|
|||||||
#include <mycss/mycss.h>
|
#include <mycss/mycss.h>
|
||||||
#include <mycss/selectors/init.h>
|
#include <mycss/selectors/init.h>
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -24,9 +24,10 @@
|
|||||||
|
|
||||||
#include <mycss/mycss.h>
|
#include <mycss/mycss.h>
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <myhtml/api.h>
|
#include <myhtml/api.h>
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -24,9 +24,10 @@
|
|||||||
|
|
||||||
#include <myhtml/api.h>
|
#include <myhtml/api.h>
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -26,9 +26,10 @@
|
|||||||
|
|
||||||
#include "example.h"
|
#include "example.h"
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <myhtml/api.h>
|
#include <myhtml/api.h>
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <myhtml/api.h>
|
#include <myhtml/api.h>
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -22,9 +22,10 @@
|
|||||||
* @param size
|
* @param size
|
||||||
* @param ptr
|
* @param ptr
|
||||||
*/
|
*/
|
||||||
void write_output(const char *buffer, size_t size, void *ptr)
|
mystatus_t write_output(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
fwrite(buffer, 1, size, stdout);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,9 +74,10 @@ struct res_html load_html_file(const char* filename)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -157,9 +157,10 @@ struct res_argv get_argv(int len, int argc, const char ** argv)
|
|||||||
return rargv;
|
return rargv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -73,9 +73,10 @@ struct res_html load_html_file(const char* filename)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <myhtml/api.h>
|
#include <myhtml/api.h>
|
||||||
|
|
||||||
void serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
printf("%.*s", (int)len, data);
|
printf("%.*s", (int)len, data);
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -256,7 +256,7 @@ test_stat_t test_read_dir(const char* dir_path, test_read_dir_callback_f callbac
|
|||||||
bool test_process_elements(test_data_t *test_data, myhtml_collection_t *collection, test_stat_t* result_stat);
|
bool test_process_elements(test_data_t *test_data, myhtml_collection_t *collection, test_stat_t* result_stat);
|
||||||
mycore_string_raw_t test_process_result_from_node(test_data_t *test_data, myhtml_tree_node_t *node);
|
mycore_string_raw_t test_process_result_from_node(test_data_t *test_data, myhtml_tree_node_t *node);
|
||||||
mycore_string_raw_t test_process_serialize_stype(test_data_t *test_data, const char* style, size_t style_size);
|
mycore_string_raw_t test_process_serialize_stype(test_data_t *test_data, const char* style, size_t style_size);
|
||||||
void test_process_serialize_callback(const char* buffer, size_t size, void* ctx);
|
mystatus_t test_process_serialize_callback(const char* buffer, size_t size, void* ctx);
|
||||||
|
|
||||||
bool test_process_callback(const char* filename, size_t filename_len, void* context)
|
bool test_process_callback(const char* filename, size_t filename_len, void* context)
|
||||||
{
|
{
|
||||||
@ -367,7 +367,7 @@ mycore_string_raw_t test_process_serialize_stype(test_data_t *test_data, const c
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_process_serialize_callback(const char* buffer, size_t size, void* ctx)
|
mystatus_t test_process_serialize_callback(const char* buffer, size_t size, void* ctx)
|
||||||
{
|
{
|
||||||
mycore_string_raw_t *str = (mycore_string_raw_t*)ctx;
|
mycore_string_raw_t *str = (mycore_string_raw_t*)ctx;
|
||||||
|
|
||||||
@ -376,6 +376,8 @@ void test_process_serialize_callback(const char* buffer, size_t size, void* ctx)
|
|||||||
|
|
||||||
memcpy(&str->data[ str->length ], buffer, sizeof(char) * size);
|
memcpy(&str->data[ str->length ], buffer, sizeof(char) * size);
|
||||||
str->length += size;
|
str->length += size;
|
||||||
|
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
|
@ -94,10 +94,12 @@ test_res_t test_load_file(const char* filename)
|
|||||||
return (test_res_t){file_data, (size_t)size};
|
return (test_res_t){file_data, (size_t)size};
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_serialization_callback(const char* data, size_t len, void* ctx)
|
mystatus_t test_serialization_callback(const char* data, size_t len, void* ctx)
|
||||||
{
|
{
|
||||||
mycore_string_t *str = ctx;
|
mycore_string_t *str = ctx;
|
||||||
mycore_string_append(str, data, len);
|
mycore_string_append(str, data, len);
|
||||||
|
|
||||||
|
return MyCORE_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
myurl_entry_t * test_parse_url(const char *data, size_t length, myurl_entry_t* base_url)
|
myurl_entry_t * test_parse_url(const char *data, size_t length, myurl_entry_t* base_url)
|
||||||
|
Loading…
Reference in New Issue
Block a user