From 4023f97cc35084cdcc33bd955ae852884c15d139 Mon Sep 17 00:00:00 2001 From: cao-fei8 Date: Mon, 16 Jan 2023 23:11:48 +0800 Subject: [PATCH] Fix unreachable codes - break after return mostly Reference: https://github.com/dajobe/librdf/commit/fdd8af8d038d44d304bfaad198144af57cee370c Signed-off-by: cao-fei8 --- ...able-codes-break-after-return-mostly.patch | 123 ++++++++++++++++++ redland.spec | 7 +- 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-unreachable-codes-break-after-return-mostly.patch diff --git a/0001-Fix-unreachable-codes-break-after-return-mostly.patch b/0001-Fix-unreachable-codes-break-after-return-mostly.patch new file mode 100644 index 0000000..309063c --- /dev/null +++ b/0001-Fix-unreachable-codes-break-after-return-mostly.patch @@ -0,0 +1,123 @@ +From fdd8af8d038d44d304bfaad198144af57cee370c Mon Sep 17 00:00:00 2001 +From: Dave Beckett +Date: Thu, 27 Feb 2014 09:38:29 -0600 +Subject: [PATCH] Fix unreachable codes - break after return mostly + +--- + src/rdf_hash.c | 6 ------ + src/rdf_query_rasqal.c | 3 --- + src/rdf_query_virtuoso.c | 1 - + src/rdf_raptor.c | 1 - + src/rdf_storage.c | 1 - + src/rdf_storage_hashes.c | 1 - + src/rdf_storage_virtuoso.c | 1 - + 7 files changed, 14 deletions(-) + +diff --git a/src/rdf_hash.c b/src/rdf_hash.c +index e297918e..9853f895 100644 +--- a/src/rdf_hash.c ++++ b/src/rdf_hash.c +@@ -1507,12 +1507,6 @@ librdf_hash_from_string(librdf_hash* hash, const char *string) + p++; + + break; +- +- default: +- librdf_log(hash->world, +- 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_HASH, NULL, +- "No such state %d", state); +- return 1; + } + } + return 0; +diff --git a/src/rdf_query_rasqal.c b/src/rdf_query_rasqal.c +index 3370f288..b2389925 100644 +--- a/src/rdf_query_rasqal.c ++++ b/src/rdf_query_rasqal.c +@@ -1279,7 +1279,6 @@ librdf_query_rasqal_constructor(librdf_world *world) + + if(!world->rasqal_world_ptr) { + LIBRDF_FATAL1(world, LIBRDF_FROM_QUERY, "failed to initialize rasqal"); +- return 1; + } + + /* Make sure rasqal works with the same raptor instance as everyone else. */ +@@ -1292,7 +1291,6 @@ librdf_query_rasqal_constructor(librdf_world *world) + + if(rasqal_world_open(world->rasqal_world_ptr)) { + LIBRDF_FATAL1(world, LIBRDF_FROM_QUERY, "failed to initialize rasqal"); +- return 1; + } + } + +@@ -1314,7 +1312,6 @@ librdf_query_rasqal_constructor(librdf_world *world) + desc = rasqal_world_get_query_language_description(world->rasqal_world_ptr, i); + if(!desc) { + LIBRDF_FATAL1(world, LIBRDF_FROM_QUERY, "failed to initialize rasqal"); +- return 1; + } + } + +diff --git a/src/rdf_query_virtuoso.c b/src/rdf_query_virtuoso.c +index 92c34859..a6b15617 100644 +--- a/src/rdf_query_virtuoso.c ++++ b/src/rdf_query_virtuoso.c +@@ -694,7 +694,6 @@ librdf_query_virtuoso_results_get_binding_value_by_name(librdf_query_results *qu + for(col = 0; col < context->numCols; col++) { + if(!strcmp((const char*)name, (const char*)context->colNames[col])) { + return context->colValues[col]; +- break; + } + } + +diff --git a/src/rdf_raptor.c b/src/rdf_raptor.c +index 5f5fbbdf..37a07ab0 100644 +--- a/src/rdf_raptor.c ++++ b/src/rdf_raptor.c +@@ -192,7 +192,6 @@ librdf_init_raptor(librdf_world* world) + + if(!world->raptor_world_ptr || raptor_world_open(world->raptor_world_ptr)) { + LIBRDF_FATAL1(world, LIBRDF_FROM_PARSER, "failed to initialize raptor"); +- return 1; + } + } + +diff --git a/src/rdf_storage.c b/src/rdf_storage.c +index a2dcc4bd..d0173edd 100644 +--- a/src/rdf_storage.c ++++ b/src/rdf_storage.c +@@ -414,7 +414,6 @@ librdf_storage_register_factory(librdf_world* world, + + failed: + LIBRDF_FATAL1(world, LIBRDF_FROM_STORAGE, "Registering storage failed"); +- return 1; + } + + +diff --git a/src/rdf_storage_hashes.c b/src/rdf_storage_hashes.c +index cb7871b3..11afc9be 100644 +--- a/src/rdf_storage_hashes.c ++++ b/src/rdf_storage_hashes.c +@@ -1252,7 +1252,6 @@ librdf_storage_hashes_node_iterator_get_method(void* iterator, int flags) + librdf_statement_set_predicate(&context->statement2, node); + librdf_statement_set_object(&context->statement2, librdf_statement_get_object(&context->statement)); + return (void*)&context->statement2; +- break; + + default: /* error */ + librdf_log(context->iterator->world, +diff --git a/src/rdf_storage_virtuoso.c b/src/rdf_storage_virtuoso.c +index ca9b2655..3d27f023 100644 +--- a/src/rdf_storage_virtuoso.c ++++ b/src/rdf_storage_virtuoso.c +@@ -596,7 +596,6 @@ rdf2node(librdf_storage *storage, librdf_storage_virtuoso_connection *handle, + + case VIRTUOSO_DV_TIMESTAMP_OBJ: /* ? what is this */ + return NULL; +- break; + + case VIRTUOSO_DV_IRI_ID: + node = librdf_new_node_from_literal(storage->world, +-- +2.33.0 + diff --git a/redland.spec b/redland.spec index 84df989..c97f8d3 100644 --- a/redland.spec +++ b/redland.spec @@ -1,11 +1,13 @@ Name: redland Version: 1.0.17 -Release: 18 +Release: 19 Summary: RDF iprovids support for the Resource Description Framework. License: LGPLv2+ or ASL 2.0 URL: http://librdf.org/ Source0: http://download.librdf.org/source/%{name}-%{version}.tar.gz +Patch0: 0001-Fix-unreachable-codes-break-after-return-mostly.patch + BuildRequires: curl-devel gcc-c++ libdb-devel libtool-ltdl-devel libxml2-devel >= 2.4.0 mysql-devel BuildRequires: perl-interpreter postgresql-devel raptor2-devel rasqal-devel >= 0.9.26 BuildRequires: mariadb-connector-c-devel sqlite-devel libpq-devel @@ -112,6 +114,9 @@ make check %changelog +* Tue Jan 17 2023 caofei - 1.0.17-19 +- Fix unreachable codes - break after return mostly + * Sat Mar 5 2022 duyiwei - 1.0.17-18 - add support of sqlite and mariadb