summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2017-01-08 22:10:08 -0800
committerDave Beckett <dave@dajobe.org>2017-01-08 22:10:08 -0800
commitcd184bbbf5a291bee64c8183a2c06fdefbbbcd0c (patch)
treeb1238a98a5038cd0d945f3829ed10f1736d68690
parent9309f2702f5e7f3a20b370638fd9a7a8f3a02b58 (diff)
downloadraptor-cd184bbbf5a291bee64c8183a2c06fdefbbbcd0c.tar.gz
Add RAPTOR_VOIDP macro for casting fprint %p object arguments.
-rw-r--r--src/raptor_avltree.c21
-rw-r--r--src/raptor_grddl.c79
-rw-r--r--src/raptor_internal.h3
-rw-r--r--src/raptor_rss_common.c2
-rw-r--r--src/raptor_serialize_rdfxmla.c2
-rw-r--r--src/raptor_serialize_rss.c6
-rw-r--r--src/raptor_serialize_turtle.c2
7 files changed, 71 insertions, 44 deletions
diff --git a/src/raptor_avltree.c b/src/raptor_avltree.c
index 779a4f83..32311071 100644
--- a/src/raptor_avltree.c
+++ b/src/raptor_avltree.c
@@ -378,7 +378,11 @@ static void
raptor_avltree_print_node(raptor_avltree_node* node)
{
fprintf(stderr, "%p: parent %p left %p right %p data %p",
- node, node->parent, node->left, node->right, node->data);
+ RAPTOR_VOIDP(node),
+ RAPTOR_VOIDP(node->parent),
+ RAPTOR_VOIDP(node->left),
+ RAPTOR_VOIDP(node->right),
+ RAPTOR_VOIDP(node->data));
}
@@ -688,7 +692,7 @@ raptor_avltree_sprout(raptor_avltree* tree, raptor_avltree_node* parent,
}
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 1
- RAPTOR_DEBUG2("Creating new node %p\n", *node_pp);
+ RAPTOR_DEBUG2("Creating new node %p\n", RAPTOR_VOIDP(*node_pp));
#endif
(*node_pp)->parent = parent;
@@ -1467,7 +1471,7 @@ raptor_avltree_print(raptor_avltree* tree, FILE* stream)
if(tree->print_handler)
tree->print_handler(data, stream);
else
- fprintf(stream, "Data Node %p\n", data);
+ fprintf(stream, "Data Node %p\n", RAPTOR_VOIDP(data));
}
/*assert(i == tree->size);*/
@@ -1491,7 +1495,11 @@ raptor_avltree_dump_internal(raptor_avltree* tree, raptor_avltree_node* node,
for(i = 0; i < depth; i++)
fputs(" ", stream);
fprintf(stream, "Node %p: parent %p left %p right %p data %p\n",
- node, node->parent, node->left, node->right, node->data);
+ RAPTOR_VOIDP(node),
+ RAPTOR_VOIDP(node->parent),
+ RAPTOR_VOIDP(node->left),
+ RAPTOR_VOIDP(node->right),
+ RAPTOR_VOIDP(node->data));
if(tree->print_handler) {
for(i= 0; i < depth; i++)
fputs(" ", stream);
@@ -1512,7 +1520,8 @@ raptor_avltree_dump_internal(raptor_avltree* tree, raptor_avltree_node* node,
int
raptor_avltree_dump(raptor_avltree* tree, FILE* stream)
{
- fprintf(stream, "Dumping avltree %p size %u\n", tree, tree->size);
+ fprintf(stream, "Dumping avltree %p size %u\n", RAPTOR_VOIDP(tree),
+ tree->size);
return raptor_avltree_dump_internal(tree, tree->root, 0, stream);
}
@@ -1544,7 +1553,7 @@ raptor_avltree_check(raptor_avltree* tree)
raptor_avltree_check_internal(tree, tree->root, &count);
if(count != tree->size) {
fprintf(stderr, "Tree %p nodes count is %u. actual count %u\n",
- tree, tree->size, count);
+ RAPTOR_VOIDP(tree), tree->size, count);
abort();
}
}
diff --git a/src/raptor_grddl.c b/src/raptor_grddl.c
index 5dcefe9f..bf824211 100644
--- a/src/raptor_grddl.c
+++ b/src/raptor_grddl.c
@@ -533,14 +533,15 @@ raptor_grddl_filter_triples(void *user_data, raptor_statement *statement)
return;
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 2
- RAPTOR_DEBUG2("Parser %p: Relaying statement: ", rdf_parser);
+ RAPTOR_DEBUG2("Parser %p: Relaying statement: ", RAPTOR_VOIDP(rdf_parser));
raptor_statement_print(statement, stderr);
fputc('\n', stderr);
#endif
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 1
RAPTOR_DEBUG3("Parser %p: Checking against %d profile URIs\n",
- rdf_parser, raptor_sequence_size(grddl_parser->profile_uris));
+ RAPTOR_VOIDP(rdf_parser),
+ raptor_sequence_size(grddl_parser->profile_uris));
#endif
/* Look for(i = 0, root namespace URI)
@@ -571,7 +572,8 @@ raptor_grddl_filter_triples(void *user_data, raptor_statement *statement)
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 1
RAPTOR_DEBUG4("Parser %p: Matches profile URI #%d '%s'\n",
- rdf_parser, i, raptor_uri_as_string(profile_uri));
+ RAPTOR_VOIDP(rdf_parser),
+ i, raptor_uri_as_string(profile_uri));
#endif
new_xml_context = raptor_new_xml_context(rdf_parser->world, uri,
@@ -580,7 +582,8 @@ raptor_grddl_filter_triples(void *user_data, raptor_statement *statement)
} else {
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 1
RAPTOR_DEBUG4("Parser %p: Failed to match profile URI #%d '%s'\n",
- rdf_parser, i, raptor_uri_as_string(profile_uri));
+ RAPTOR_VOIDP(rdf_parser),
+ i, raptor_uri_as_string(profile_uri));
#endif
}
@@ -612,7 +615,8 @@ raptor_grddl_ensure_internal_parser(raptor_parser* rdf_parser,
rdf_parser->emit_graph_marks = our_emit_flags ? 1 : 0;
RAPTOR_DEBUG3("Parser %p: Freeing internal %s parser.\n",
- rdf_parser, grddl_parser->internal_parser_name);
+ RAPTOR_VOIDP(rdf_parser),
+ grddl_parser->internal_parser_name);
raptor_free_parser(grddl_parser->internal_parser);
grddl_parser->internal_parser = NULL;
@@ -620,7 +624,7 @@ raptor_grddl_ensure_internal_parser(raptor_parser* rdf_parser,
}
RAPTOR_DEBUG3("Parser %p: Allocating new internal %s parser.\n",
- rdf_parser, parser_name);
+ RAPTOR_VOIDP(rdf_parser), parser_name);
grddl_parser->internal_parser = raptor_new_parser(rdf_parser->world,
parser_name);
if(!grddl_parser->internal_parser) {
@@ -797,16 +801,16 @@ raptor_grddl_run_grddl_transform_doc(raptor_parser* rdf_parser,
doc_txt, doc_txt_len, NULL);
if(!parser_name) {
RAPTOR_DEBUG3("Parser %p: Guessed no parser from mime type '%s' and content - ending",
- rdf_parser, sheet->mediaType);
+ RAPTOR_VOIDP(rdf_parser), sheet->mediaType);
goto cleanup_xslt;
}
RAPTOR_DEBUG4("Parser %p: Guessed parser %s from mime type '%s' and content\n",
- rdf_parser, parser_name, sheet->mediaType);
+ RAPTOR_VOIDP(rdf_parser), parser_name, sheet->mediaType);
if(!strcmp((const char*)parser_name, "grddl")) {
RAPTOR_DEBUG2("Parser %p: Ignoring guess to run grddl parser - ending",
- rdf_parser);
+ RAPTOR_VOIDP(rdf_parser));
goto cleanup_xslt;
}
@@ -1236,14 +1240,15 @@ raptor_grddl_check_recursive_content_type_handler(raptor_www* www,
if(!strncmp(content_type, "application/rdf+xml", 19)) {
grddl_parser->process_this_as_rdfxml = 1;
- RAPTOR_DEBUG2("Parser %p: Found RDF/XML content type\n", rdf_parser);
+ RAPTOR_DEBUG2("Parser %p: Found RDF/XML content type\n",
+ RAPTOR_VOIDP(rdf_parser));
raptor_parser_save_content(rdf_parser, 1);
}
if(!strncmp(content_type, "text/html", 9) ||
!strncmp(content_type, "application/html+xml", 20)) {
RAPTOR_DEBUG3("Parser %p: Found HTML content type '%s'\n",
- rdf_parser, content_type);
+ RAPTOR_VOIDP(rdf_parser), content_type);
grddl_parser->html_base_processing = 1;
}
@@ -1388,13 +1393,13 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
grddl_parser->content_type_check++;
if(!strncmp(grddl_parser->content_type, "application/rdf+xml", 19)) {
RAPTOR_DEBUG3("Parser %p: Found document with type '%s' is RDF/XML\n",
- rdf_parser, grddl_parser->content_type);
+ RAPTOR_VOIDP(rdf_parser), grddl_parser->content_type);
grddl_parser->process_this_as_rdfxml = 1;
}
if(!strncmp(grddl_parser->content_type, "text/html", 9) ||
!strncmp(grddl_parser->content_type, "application/html+xml", 20)) {
RAPTOR_DEBUG3("Parser %p: Found document with type '%s' is HTML\n",
- rdf_parser, grddl_parser->content_type);
+ RAPTOR_VOIDP(rdf_parser), grddl_parser->content_type);
grddl_parser->html_base_processing = 1;
}
}
@@ -1420,7 +1425,7 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
raptor_world_internal_set_ignore_errors(rdf_parser->world, 1);
RAPTOR_DEBUG4("Parser %p: URI %s: processing %d bytes of content\n",
- rdf_parser, uri_string, (int)buffer_len);
+ RAPTOR_VOIDP(rdf_parser), uri_string, (int)buffer_len);
for(loop = 0; loop < 2; loop++) {
int rc;
@@ -1428,7 +1433,8 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
if(loop == 0) {
int libxml_options = 0;
- RAPTOR_DEBUG2("Parser %p: Creating an XML parser\n", rdf_parser);
+ RAPTOR_DEBUG2("Parser %p: Creating an XML parser\n",
+ RAPTOR_VOIDP(rdf_parser));
/* try to create an XML parser context */
grddl_parser->xml_ctxt = xmlCreatePushParserCtxt(NULL, NULL,
@@ -1436,7 +1442,8 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
RAPTOR_BAD_CAST(int, buffer_len),
(const char*)uri_string);
if(!grddl_parser->xml_ctxt) {
- RAPTOR_DEBUG2("Parser %p: Creating an XML parser failed\n", rdf_parser);
+ RAPTOR_DEBUG2("Parser %p: Creating an XML parser failed\n",
+ RAPTOR_VOIDP(rdf_parser));
continue;
}
@@ -1461,7 +1468,8 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
xmlCharEncoding enc;
int options;
- RAPTOR_DEBUG2("Parser %p: Creating an HTML parser\n", rdf_parser);
+ RAPTOR_DEBUG2("Parser %p: Creating an HTML parser\n",
+ RAPTOR_VOIDP(rdf_parser));
enc = xmlDetectCharEncoding((const unsigned char*)buffer,
RAPTOR_BAD_CAST(int, buffer_len));
@@ -1473,7 +1481,7 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
enc);
if(!grddl_parser->html_ctxt) {
RAPTOR_DEBUG2("Parser %p: Creating an HTML parser failed\n",
- rdf_parser);
+ RAPTOR_VOIDP(rdf_parser));
continue;
}
@@ -1502,9 +1510,10 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
if(grddl_parser->html_ctxt) {
- RAPTOR_DEBUG2("Parser %p: Parsing as HTML\n", rdf_parser);
+ RAPTOR_DEBUG2("Parser %p: Parsing as HTML\n", RAPTOR_VOIDP(rdf_parser));
rc = htmlParseChunk(grddl_parser->html_ctxt, (const char*)s, 0, 1);
- RAPTOR_DEBUG3("Parser %p: Parsing as HTML %s\n", rdf_parser,
+ RAPTOR_DEBUG3("Parser %p: Parsing as HTML %s\n",
+ RAPTOR_VOIDP(rdf_parser),
(rc ? "failed" : "succeeded"));
if(rc) {
if(grddl_parser->html_ctxt->myDoc) {
@@ -1515,9 +1524,9 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
grddl_parser->html_ctxt = NULL;
}
} else {
- RAPTOR_DEBUG2("Parser %p: Parsing as XML\n", rdf_parser);
+ RAPTOR_DEBUG2("Parser %p: Parsing as XML\n", RAPTOR_VOIDP(rdf_parser));
rc = xmlParseChunk(grddl_parser->xml_ctxt, (const char*)s, 0, 1);
- RAPTOR_DEBUG3("Parser %p: Parsing as XML %s\n", rdf_parser,
+ RAPTOR_DEBUG3("Parser %p: Parsing as XML %s\n", RAPTOR_VOIDP(rdf_parser),
(rc ? "failed" : "succeeded"));
if(rc) {
if(grddl_parser->xml_ctxt->myDoc) {
@@ -1562,7 +1571,8 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
if(grddl_parser->xinclude_processing) {
RAPTOR_DEBUG3("Parser %p: Running XInclude processing on URI '%s'\n",
- rdf_parser, raptor_uri_as_string(rdf_parser->base_uri));
+ RAPTOR_VOIDP(rdf_parser),
+ raptor_uri_as_string(rdf_parser->base_uri));
if(xmlXIncludeProcess(doc) < 0) {
raptor_parser_error(rdf_parser,
"XInclude processing failed for GRDDL document");
@@ -1579,13 +1589,14 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
buffer_is_libxml = 1;
RAPTOR_DEBUG3("Parser %p: XML Include processing returned %d bytes document\n",
- rdf_parser, (int)buffer_len);
+ RAPTOR_VOIDP(rdf_parser), (int)buffer_len);
}
}
RAPTOR_DEBUG3("Parser %p: Running top-level GRDDL on URI '%s'\n",
- rdf_parser, raptor_uri_as_string(rdf_parser->base_uri));
+ RAPTOR_VOIDP(rdf_parser),
+ raptor_uri_as_string(rdf_parser->base_uri));
/* Work out if there is a root namespace URI */
if(1) {
@@ -1604,13 +1615,14 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
int n;
RAPTOR_DEBUG3("Parser %p: Root namespace URI is %s\n",
- rdf_parser, ns_uri_string);
+ RAPTOR_VOIDP(rdf_parser), ns_uri_string);
if(!strcmp((const char*)ns_uri_string,
(const char*)raptor_rdf_namespace_uri) &&
!strcmp((const char*)xnp->name, "RDF")) {
RAPTOR_DEBUG3("Parser %p: Root element of %s is rdf:RDF - process this as RDF/XML later\n",
- rdf_parser, raptor_uri_as_string(rdf_parser->base_uri));
+ RAPTOR_VOIDP(rdf_parser),
+ raptor_uri_as_string(rdf_parser->base_uri));
grddl_parser->process_this_as_rdfxml = 1;
}
@@ -1619,7 +1631,7 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
(const char*)ns_uri_string)) {
/* ignore this namespace */
RAPTOR_DEBUG3("Parser %p: Ignoring GRDDL for namespace URI '%s'\n",
- rdf_parser, ns_uri_string);
+ RAPTOR_VOIDP(rdf_parser), ns_uri_string);
ns_uri_string = NULL;
break;
}
@@ -1636,7 +1648,7 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
raptor_sequence_push(grddl_parser->profile_uris, xml_context);
RAPTOR_DEBUG3("Parser %p: Processing GRDDL namespace URI '%s'\n",
- rdf_parser,
+ RAPTOR_VOIDP(rdf_parser),
raptor_uri_as_string(grddl_parser->root_ns_uri));
raptor_grddl_run_recursive(rdf_parser, grddl_parser->root_ns_uri,
"grddl",
@@ -1685,7 +1697,7 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
int size;
RAPTOR_DEBUG4("Parser %p: Found %d <head profile> URIs in URI '%s'\n",
- rdf_parser, raptor_sequence_size(result),
+ RAPTOR_VOIDP(rdf_parser), raptor_sequence_size(result),
raptor_uri_as_string(rdf_parser->base_uri));
@@ -1745,7 +1757,7 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
0);
if(result) {
RAPTOR_DEBUG4("Parser %p: Found %d <link> URIs in URI '%s'\n",
- rdf_parser, raptor_sequence_size(result),
+ RAPTOR_VOIDP(rdf_parser), raptor_sequence_size(result),
raptor_uri_as_string(rdf_parser->base_uri));
/* Recursively parse all the <link> URIs, skipping NULLs */
@@ -1792,7 +1804,7 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
/* Ignore what matched, use a hardcoded XSLT URI */
uri_string = match_table[expri].xslt_sheet_uri;
RAPTOR_DEBUG3("Parser %p: Using hard-coded XSLT URI '%s'\n",
- rdf_parser, uri_string);
+ RAPTOR_VOIDP(rdf_parser), uri_string);
raptor_free_sequence(result);
result = raptor_new_sequence((raptor_data_free_handler)grddl_free_xml_context, NULL);
@@ -1837,7 +1849,8 @@ raptor_grddl_parse_chunk(raptor_parser* rdf_parser,
/* Process this document's content buffer as RDF/XML */
if(grddl_parser->process_this_as_rdfxml && buffer) {
RAPTOR_DEBUG3("Parser %p: Running additional RDF/XML parse on root document URI '%s' content\n",
- rdf_parser, raptor_uri_as_string(rdf_parser->base_uri));
+ RAPTOR_VOIDP(rdf_parser),
+ raptor_uri_as_string(rdf_parser->base_uri));
if(raptor_grddl_ensure_internal_parser(rdf_parser, "rdfxml", 0))
ret = 1;
diff --git a/src/raptor_internal.h b/src/raptor_internal.h
index 8a9010b2..dc412b95 100644
--- a/src/raptor_internal.h
+++ b/src/raptor_internal.h
@@ -1506,6 +1506,9 @@ void raptor_www_finish(raptor_world* world);
/* Unsafe casts: narrowing a value */
#define RAPTOR_BAD_CAST(t, v) (t)(v)
+/* Cast to void* for debugging prints with %p */
+#define RAPTOR_VOIDP(p) (void*)p
+
/* end of RAPTOR_INTERNAL */
#endif
diff --git a/src/raptor_rss_common.c b/src/raptor_rss_common.c
index 625d4926..b6db4240 100644
--- a/src/raptor_rss_common.c
+++ b/src/raptor_rss_common.c
@@ -586,7 +586,7 @@ raptor_rss_item_equals_statement_subject(const raptor_rss_item *item,
int
raptor_rss_item_set_uri(raptor_rss_item *item, raptor_uri* uri)
{
- RAPTOR_DEBUG3("Set node %p to URI <%s>\n", item,
+ RAPTOR_DEBUG3("Set node %p to URI <%s>\n", RAPTOR_VOIDP(item),
raptor_uri_as_string(uri));
item->uri = raptor_uri_copy(uri);
diff --git a/src/raptor_serialize_rdfxmla.c b/src/raptor_serialize_rdfxmla.c
index db291f38..e77f162f 100644
--- a/src/raptor_serialize_rdfxmla.c
+++ b/src/raptor_serialize_rdfxmla.c
@@ -1388,7 +1388,7 @@ raptor_rdfxmla_serialize_statement(raptor_serializer* serializer,
if(rv < 0) {
raptor_log_error_formatted(serializer->world, RAPTOR_LOG_LEVEL_ERROR, NULL,
"Unable to add properties to subject %p",
- subject);
+ RAPTOR_VOIDP(subject));
return rv;
}
}
diff --git a/src/raptor_serialize_rss.c b/src/raptor_serialize_rss.c
index 1b074ac6..90f1f238 100644
--- a/src/raptor_serialize_rss.c
+++ b/src/raptor_serialize_rss.c
@@ -570,7 +570,8 @@ raptor_rss10_remove_mapped_item_fields(raptor_rss10_serializer_context *rss_seri
if(saw_mapped && saw_non_mapped) {
raptor_rss_field* last_field = NULL;
- RAPTOR_DEBUG6("Item %p Field %d - %s: %d mapped %d non-mapped\n", item,
+ RAPTOR_DEBUG6("Item %p Field %d - %s: %d mapped %d non-mapped\n",
+ RAPTOR_VOIDP(item),
f, raptor_rss_fields_info[f].name,
saw_mapped, saw_non_mapped);
@@ -730,7 +731,8 @@ raptor_rss10_store_statement(raptor_rss10_serializer_context *rss_serializer,
RAPTOR_DEBUG1("Adding field\n");
raptor_rss_item_add_field(item, f, field);
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 1
- RAPTOR_DEBUG2("Stored statement under typed node %p\n", item);
+ RAPTOR_DEBUG2("Stored statement under typed node %p\n",
+ RAPTOR_VOIDP(item));
#endif
handled = 1;
diff --git a/src/raptor_serialize_turtle.c b/src/raptor_serialize_turtle.c
index 72c8aa8b..aa3930ad 100644
--- a/src/raptor_serialize_turtle.c
+++ b/src/raptor_serialize_turtle.c
@@ -1436,7 +1436,7 @@ raptor_turtle_serialize_statement(raptor_serializer* serializer,
if(rv < 0) {
raptor_log_error_formatted(serializer->world, RAPTOR_LOG_LEVEL_ERROR, NULL,
"Unable to add properties to subject %p",
- subject);
+ RAPTOR_VOIDP(subject));
return rv;
}