Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 6 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
2  src/librdf.h.in
@@ -76,8 +76,10 @@ extern "C" {
*/
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
#define REDLAND_DEPRECATED __attribute__((deprecated))
+#define REDLAND_NORETURN __attribute__((__noreturn__))
#else
#define REDLAND_DEPRECATED
+#define REDLAND_NORETURN
#endif
View
1  src/rdf_log.c
@@ -197,6 +197,7 @@ librdf_log(librdf_world* world, int code,
* If world is NULL, the error ocurred in redland startup before
* the world was created.
**/
+REDLAND_NORETURN
void
librdf_fatal(librdf_world* world, int facility,
const char *file, int line, const char *function,
View
1  src/rdf_log_internal.h
@@ -30,6 +30,7 @@
extern "C" {
#endif
+REDLAND_NORETURN
void librdf_fatal(librdf_world* world, int facility, const char *file, int line, const char *function, const char *message);
void librdf_test_error(librdf_world* world, const char *message);
View
4 src/rdf_storage_mysql.c
@@ -251,7 +251,7 @@ typedef struct {
} librdf_storage_mysql_get_contexts_context;
static u64 librdf_storage_mysql_hash(librdf_storage* storage, const char *type,
- const char *string, int length);
+ const char *string, size_t length);
#define NODE_HASH_MODE_GET_HASH 0
#define NODE_HASH_MODE_STORE_NODE 1
@@ -302,7 +302,7 @@ void librdf_storage_module_register_factory(librdf_world *world);
**/
static u64
librdf_storage_mysql_hash(librdf_storage* storage, const char *type,
- const char *string, int length)
+ const char *string, size_t length)
{
librdf_storage_mysql_instance* context=(librdf_storage_mysql_instance*)storage->instance;
u64 hash;
View
17 src/rdf_storage_postgresql.c
@@ -337,27 +337,28 @@ librdf_storage_postgresql_get_handle(librdf_storage* storage)
/* Expand connection pool if no closed connection was found */
if (!connection) {
/* Allocate new buffer with two extra slots */
- int new_pool_size = context->connections_count+pool_increment;
+ int new_pool_size = context->connections_count + pool_increment;
librdf_storage_postgresql_connection* connections;
connections = LIBRDF_CALLOC(librdf_storage_postgresql_connection*,
- new_pool_size,
+ LIBRDF_GOOD_CAST(size_t, new_pool_size),
sizeof(librdf_storage_postgresql_connection));
if(!connections)
return NULL;
- if (context->connections_count) {
+ if(context->connections_count) {
/* Copy old buffer to new */
- memcpy(connections, context->connections, sizeof(librdf_storage_postgresql_connection)*context->connections_count);
+ memcpy(connections, context->connections,
+ sizeof(librdf_storage_postgresql_connection) * context->connections_count);
/* Free old buffer */
LIBRDF_FREE(librdf_storage_postgresql_connection*, context->connections);
}
/* Initialize expanded pool */
- context->connections=connections;
- connection=&(context->connections[context->connections_count]);
+ context->connections = connections;
+ connection = &(context->connections[context->connections_count]);
while (context->connections_count < new_pool_size) {
- context->connections[context->connections_count].status=LIBRDF_STORAGE_POSTGRESQL_CONNECTION_CLOSED;
- context->connections[context->connections_count].handle=NULL;
+ context->connections[context->connections_count].status = LIBRDF_STORAGE_POSTGRESQL_CONNECTION_CLOSED;
+ context->connections[context->connections_count].handle = NULL;
context->connections_count++;
}
}
View
15 src/rdf_utf8.c
@@ -118,6 +118,7 @@ unsigned char*
librdf_utf8_to_latin1(const unsigned char *input, int length,
int *output_length)
{
+ size_t slength = LIBRDF_BAD_CAST(size_t, length);
size_t utf8_char_length = 0;
size_t utf8_byte_length = 0;
size_t i;
@@ -126,10 +127,10 @@ librdf_utf8_to_latin1(const unsigned char *input, int length,
i = 0;
while(input[i]) {
- size_t slen = LIBRDF_BAD_CAST(size_t, length - i);
- int size = raptor_unicode_utf8_string_get_char(&input[i], slen, NULL);
+ int size = raptor_unicode_utf8_string_get_char(&input[i], slength - i, NULL);
if(size <= 0)
return NULL;
+
utf8_char_length++;
i += LIBRDF_GOOD_CAST(size_t, size);
@@ -149,9 +150,8 @@ librdf_utf8_to_latin1(const unsigned char *input, int length,
i = 0; j = 0;
while(i < utf8_byte_length) {
librdf_unichar c;
- size_t slen = LIBRDF_BAD_CAST(size_t, length - i);
- int size = raptor_unicode_utf8_string_get_char(&input[i], slen, &c);
+ int size = raptor_unicode_utf8_string_get_char(&input[i], slength - i, &c);
if(size <= 0) {
LIBRDF_FREE(byte_string, output);
return NULL;
@@ -191,14 +191,14 @@ unsigned char*
librdf_latin1_to_utf8(const unsigned char *input, int length,
int *output_length)
{
+ size_t slength = LIBRDF_BAD_CAST(size_t, length);
size_t utf8_length = 0;
size_t i;
size_t j;
unsigned char *output;
for(i = 0; input[i]; i++) {
- size_t slen = LIBRDF_BAD_CAST(size_t, length - i);
- int size = raptor_unicode_utf8_string_put_char(input[i], NULL, slen);
+ int size = raptor_unicode_utf8_string_put_char(input[i], NULL, slength - i);
if(size <= 0)
return NULL;
@@ -212,9 +212,8 @@ librdf_latin1_to_utf8(const unsigned char *input, int length,
j = 0;
for(i = 0; input[i]; i++) {
- size_t slen = LIBRDF_BAD_CAST(size_t, length - i);
int size = raptor_unicode_utf8_string_put_char(input[i], &output[j],
- slen);
+ slength - i);
if(size <= 0) {
LIBRDF_FREE(byte_string, output);
return NULL;
View
27 utils/rdfproc.c
@@ -274,7 +274,7 @@ main(int argc, char *argv[])
int type;
int result;
char *p;
- int i;
+ unsigned int i;
int rc;
int transactions=0;
char *storage_name=(char*)default_storage_name;
@@ -351,7 +351,7 @@ main(int argc, char *argv[])
if(optarg) {
if(!strcmp(optarg, "help")) {
fprintf(stderr, "%s: Valid serializers are:\n", program);
- for(i=0; 1; i++) {
+ for(i = 0; 1; i++) {
const raptor_syntax_description* desc;
desc = librdf_serializer_get_description(world, i);
@@ -438,7 +438,7 @@ main(int argc, char *argv[])
if(optarg) {
if(!strcmp(optarg, "help")) {
fprintf(stderr, "%s: Valid query result formats are:\n", program);
- for(i=0; 1; i++) {
+ for(i = 0; 1; i++) {
const raptor_syntax_description* desc;
desc = librdf_query_results_formats_get_description(world, i);
@@ -464,13 +464,14 @@ main(int argc, char *argv[])
if(optarg) {
if(!strcmp(optarg, "help")) {
fprintf(stderr, "%s: Valid storage names are:\n", program);
- for(i=0; 1; i++) {
+ for(i = 0; 1; i++) {
const char *format_name;
const char *format_label;
if(librdf_storage_enumerate(world, i,
&format_name,
&format_label))
break;
+
printf(" %-10s %s\n", format_name, format_label);
}
exit(0);
@@ -527,7 +528,7 @@ main(int argc, char *argv[])
cmd=argv[0];
- for(i=0; commands[i].name; i++)
+ for(i = 0; commands[i].name; i++)
if(!strcmp(cmd, commands[i].name)) {
cmd_index=i;
break;
@@ -579,7 +580,7 @@ main(int argc, char *argv[])
puts(HELP_TEXT(h, "help ", "Print this help, then exit"));
puts(HELP_TEXT(n, "new ", "Create a new store (default no)"));
puts(HELP_TEXT(o, "output FORMAT ", "Set the triple output format"));
- for(i=0; 1; i++) {
+ for(i = 0; 1; i++) {
const raptor_syntax_description* desc;
desc = librdf_serializer_get_description(world, i);
@@ -595,7 +596,7 @@ main(int argc, char *argv[])
puts(HELP_TEXT(p, "password ", "Read storage option 'password' from standard input"));
puts(HELP_TEXT(q, "quiet ", "Do not print information messages"));
puts(HELP_TEXT(r, "results FORMAT ", "Set the query results format (no default)"));
- for(i=0; 1; i++) {
+ for(i = 0; 1; i++) {
const raptor_syntax_description* desc;
desc = librdf_query_results_formats_get_description(world, i);
@@ -605,11 +606,12 @@ main(int argc, char *argv[])
printf(" %-10s %s\n", desc->names[0], desc->label);
}
puts(HELP_TEXT(s, "storage TYPE ", "Set the graph storage type"));
- for(i=0; 1; i++) {
+ for(i = 0; 1; i++) {
const char *help_name;
const char *help_label;
if(librdf_storage_enumerate(world, i, &help_name, &help_label))
break;
+
printf(" %-10s %s", help_name, help_label);
if(!strcmp(help_name, default_storage_name))
puts(" (default)");
@@ -1011,9 +1013,12 @@ main(int argc, char *argv[])
if(verbosity)
fputs("result: ", stdout);
fputs("[", stdout);
- for(i=0; i<librdf_query_results_get_bindings_count(results); i++) {
- librdf_node *value=librdf_query_results_get_binding_value(results, i);
- name=(char*)librdf_query_results_get_binding_name(results, i);
+ for(i = 0; 1 ; i++) {
+ librdf_node *value = librdf_query_results_get_binding_value(results, i);
+ if(!value)
+ break;
+
+ name = (char*)librdf_query_results_get_binding_name(results, i);
if(i>0)
fputs(", ", stdout);

No commit comments for this range

Something went wrong with that request. Please try again.