Navigation Menu

Skip to content

Commit

Permalink
Import fixes from raptor
Browse files Browse the repository at this point in the history
* const'ify string literals and char pointers that needn't be changed
  - librdfa (start_element): const'ify umap_key
  - librdfa (rdfa_complete_object_literal_triples): const'ifty
    current_object_literal
* (rdfa_init_base): Fix <base href >
* (end_element): Do not call rdfa_complete_list_triples() with no
  new subject [coverity]
* (rdfa_init_base): Fix uri_start dead code [coverity]
* (end_element): Add parent_context check around block [coverity]
* (rdfa_init_base): Check for uri_start before use [coverity]
* librdfa fixes for -Wunreachable-code [clang]
* (rdfa_complete_object_literal_triples) strchr on NULL [coverity]
* (rdfa_complete_object_literal_triples): Need non NULL
  context->xml_literal to do strchr() on it [coverity]
* (rdfa_complete_current_property_value_triples): Remove duplicate
  variable [coverity]
* (rdfa_complete_object_literal_triples): NULL check for
  context->xml_literal [coverity]
  • Loading branch information
dajobe committed Oct 11, 2014
1 parent 5b73975 commit 10e5304
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions c/rdfa.c
Expand Up @@ -143,11 +143,10 @@ static size_t rdfa_init_base(
{
char* base_start = strstr(*working_buffer, "<base ");
char* href_start = NULL;
if(base_start == NULL) {
if(base_start == NULL)
base_start = strstr(*working_buffer, "<BASE ");
if(base_start != NULL)
href_start = strstr(base_start, "href=");
}
if(base_start != NULL)
href_start = strstr(base_start, "href=");

if(href_start != NULL)
{
Expand Down Expand Up @@ -314,7 +313,7 @@ static void start_element(void *parser_context, const char* name,
#else
void** umap = context->uri_mappings;
#endif
char* umap_key = NULL;
const char* umap_key = NULL;
void* umap_value = NULL;

/* if the namespaces are not defined, then neither is the xml:lang */
Expand All @@ -338,9 +337,9 @@ static void start_element(void *parser_context, const char* name,
#ifdef LIBRDFA_IN_RAPTOR
ns=ns_list[--ns_size];

umap_key = (char*)raptor_namespace_get_prefix(ns);
umap_key = (const char*)raptor_namespace_get_prefix(ns);
if(!umap_key)
umap_key=(char*)XMLNS_DEFAULT_MAPPING;
umap_key=(const char*)XMLNS_DEFAULT_MAPPING;
umap_value = (char*)raptor_uri_as_string(raptor_namespace_get_uri(ns));
#else
rdfa_next_mapping(umap++, &umap_key, &umap_value);
Expand Down
4 changes: 2 additions & 2 deletions c/triple.c
Expand Up @@ -540,7 +540,7 @@ void rdfa_complete_object_literal_triples(rdfacontext* context)
* @property. If present, a URI is obtained according to the
* section on CURIE and URI Processing, and then the actual literal
* value is obtained as follows: */
char* current_object_literal = NULL;
const char* current_object_literal = NULL;
rdfresource_t type = RDF_TYPE_UNKNOWN;

unsigned int i;
Expand Down Expand Up @@ -571,7 +571,7 @@ void rdfa_complete_object_literal_triples(rdfacontext* context)
}
else if(strlen(context->plain_literal) == 0)
{
current_object_literal = (char*)"";
current_object_literal = (const char*)"";
type = RDF_TYPE_PLAIN_LITERAL;
}
else if((context->xml_literal != NULL) &&
Expand Down

0 comments on commit 10e5304

Please sign in to comment.