diff options
3 files changed, 451 insertions, 10 deletions
diff --git a/meta-oe/recipes-support/avro/avro-c/0001-AVRO-3957-C-Fix-typos-in-docs-and-examples-2795.patch b/meta-oe/recipes-support/avro/avro-c/0001-AVRO-3957-C-Fix-typos-in-docs-and-examples-2795.patch new file mode 100644 index 0000000000..bfe2ea6367 --- /dev/null +++ b/meta-oe/recipes-support/avro/avro-c/0001-AVRO-3957-C-Fix-typos-in-docs-and-examples-2795.patch | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | From 52f051dbeefad0b7e73187becad6c33747b047d3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sahil Kang <sahil.kang@asilaycomputing.com> | ||
| 3 | Date: Mon, 11 Mar 2024 03:01:21 -0700 | ||
| 4 | Subject: [PATCH] AVRO-3957: [C] Fix typos in docs and examples (#2795) | ||
| 5 | |||
| 6 | * AVRO-3957: [C] Fix misformatted type in docs | ||
| 7 | |||
| 8 | Signed-off-by: Sahil Kang <sahil.kang@asilaycomputing.com> | ||
| 9 | Signed-off-by: Sahil Kang <sahilkang@google.com> | ||
| 10 | |||
| 11 | * AVRO-3957: [C] Fix type in quickstop example | ||
| 12 | |||
| 13 | This removes the following warning: | ||
| 14 | |||
| 15 | avro/lang/c/examples/quickstop.c:123:40: warning: incompatible pointer types passing 'int32_t **' (aka 'int **') to parameter of type | ||
| 16 | 'const char **' [-Wincompatible-pointer-types] | ||
| 17 | avro_value_get_string(&first_value, &p, &size); | ||
| 18 | |||
| 19 | Signed-off-by: Sahil Kang <sahil.kang@asilaycomputing.com> | ||
| 20 | Signed-off-by: Sahil Kang <sahilkang@google.com> | ||
| 21 | |||
| 22 | --------- | ||
| 23 | |||
| 24 | Signed-off-by: Sahil Kang <sahil.kang@asilaycomputing.com> | ||
| 25 | Signed-off-by: Sahil Kang <sahilkang@google.com> | ||
| 26 | |||
| 27 | Upstream-Status: Backport [52f051dbee AVRO-3957: [C] Fix typos in docs and examples (#2795)] | ||
| 28 | Signed-off-by: mark.yang <mark.yang@lge.com> | ||
| 29 | --- | ||
| 30 | lang/c/docs/index.txt | 2 +- | ||
| 31 | lang/c/examples/quickstop.c | 2 +- | ||
| 32 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
| 33 | |||
| 34 | diff --git a/lang/c/docs/index.txt b/lang/c/docs/index.txt | ||
| 35 | index a439a0526..df16f9d96 100644 | ||
| 36 | --- a/lang/c/docs/index.txt | ||
| 37 | +++ b/lang/c/docs/index.txt | ||
| 38 | @@ -178,7 +178,7 @@ different versions of the Avro library. That means that it's really | ||
| 39 | only safe to use these hash values internally within the context of a | ||
| 40 | single execution of a single application. | ||
| 41 | |||
| 42 | -The +reset+ method “clears out” an +avro_value_t instance, making sure | ||
| 43 | +The +reset+ method “clears out” an +avro_value_t+ instance, making sure | ||
| 44 | that it's ready to accept the contents of a new value. For scalars, | ||
| 45 | this is usually a no-op, since the new value will just overwrite the old | ||
| 46 | one. For arrays and maps, this removes any existing elements from the | ||
| 47 | diff --git a/lang/c/examples/quickstop.c b/lang/c/examples/quickstop.c | ||
| 48 | index ff9e97005..b26dad10c 100644 | ||
| 49 | --- a/lang/c/examples/quickstop.c | ||
| 50 | +++ b/lang/c/examples/quickstop.c | ||
| 51 | @@ -107,7 +107,7 @@ int print_person(avro_file_reader_t db, avro_schema_t reader_schema) | ||
| 52 | if (rval == 0) { | ||
| 53 | int64_t id; | ||
| 54 | int32_t age; | ||
| 55 | - int32_t *p; | ||
| 56 | + const char *p; | ||
| 57 | size_t size; | ||
| 58 | avro_value_t id_value; | ||
| 59 | avro_value_t first_value; | ||
diff --git a/meta-oe/recipes-support/avro/avro-c/0001-AVRO-3960-C-Fix-st-ANYARGS-warning-2798.patch b/meta-oe/recipes-support/avro/avro-c/0001-AVRO-3960-C-Fix-st-ANYARGS-warning-2798.patch new file mode 100644 index 0000000000..8f7bbc868a --- /dev/null +++ b/meta-oe/recipes-support/avro/avro-c/0001-AVRO-3960-C-Fix-st-ANYARGS-warning-2798.patch | |||
| @@ -0,0 +1,386 @@ | |||
| 1 | From 03ea96b48f7e668abd9f3b33799635e4e50a526c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sahil Kang <sahilkang@google.com> | ||
| 3 | Date: Mon, 25 Mar 2024 04:41:41 -0700 | ||
| 4 | Subject: [PATCH] AVRO-3960: [C] Fix st ANYARGS warning (#2798) | ||
| 5 | |||
| 6 | This removes the following warning: | ||
| 7 | |||
| 8 | avro/lang/c/src/st.c:240:13: warning: passing arguments to a function without a prototype is deprecated in all versions of C and is not | ||
| 9 | supported in C2x [-Wdeprecated-non-prototype] | ||
| 10 | hash_val = do_hash(key, table); | ||
| 11 | |||
| 12 | Signed-off-by: Sahil Kang <sahil.kang@asilaycomputing.com> | ||
| 13 | Signed-off-by: Sahil Kang <sahilkang@google.com> | ||
| 14 | |||
| 15 | Upstream-Status: Backport [03ea96b48f AVRO-3960: [C] Fix st ANYARGS warning (#2798)] | ||
| 16 | Signed-off-by: mark.yang <mark.yang@lge.com> | ||
| 17 | --- | ||
| 18 | lang/c/src/datum.c | 12 ++++++------ | ||
| 19 | lang/c/src/datum_equal.c | 4 ++-- | ||
| 20 | lang/c/src/datum_size.c | 2 +- | ||
| 21 | lang/c/src/datum_validate.c | 2 +- | ||
| 22 | lang/c/src/memoize.c | 6 +++--- | ||
| 23 | lang/c/src/schema.c | 10 +++++----- | ||
| 24 | lang/c/src/st.c | 34 ++++++++++++++++++---------------- | ||
| 25 | lang/c/src/st.h | 22 +++++++++------------- | ||
| 26 | 8 files changed, 45 insertions(+), 47 deletions(-) | ||
| 27 | |||
| 28 | diff --git a/lang/c/src/datum.c b/lang/c/src/datum.c | ||
| 29 | index 53dfa5ca0..5307c7a83 100644 | ||
| 30 | --- a/lang/c/src/datum.c | ||
| 31 | +++ b/lang/c/src/datum.c | ||
| 32 | @@ -1095,7 +1095,7 @@ static void avro_datum_free(avro_datum_t datum) | ||
| 33 | record = avro_datum_to_record(datum); | ||
| 34 | avro_schema_decref(record->schema); | ||
| 35 | st_foreach(record->fields_byname, | ||
| 36 | - HASH_FUNCTION_CAST char_datum_free_foreach, 0); | ||
| 37 | + (hash_function_foreach) char_datum_free_foreach, 0); | ||
| 38 | st_free_table(record->field_order); | ||
| 39 | st_free_table(record->fields_byname); | ||
| 40 | avro_freet(struct avro_record_datum_t, record); | ||
| 41 | @@ -1123,7 +1123,7 @@ static void avro_datum_free(avro_datum_t datum) | ||
| 42 | struct avro_map_datum_t *map; | ||
| 43 | map = avro_datum_to_map(datum); | ||
| 44 | avro_schema_decref(map->schema); | ||
| 45 | - st_foreach(map->map, HASH_FUNCTION_CAST char_datum_free_foreach, | ||
| 46 | + st_foreach(map->map, (hash_function_foreach) char_datum_free_foreach, | ||
| 47 | 0); | ||
| 48 | st_free_table(map->map); | ||
| 49 | st_free_table(map->indices_by_key); | ||
| 50 | @@ -1135,7 +1135,7 @@ static void avro_datum_free(avro_datum_t datum) | ||
| 51 | struct avro_array_datum_t *array; | ||
| 52 | array = avro_datum_to_array(datum); | ||
| 53 | avro_schema_decref(array->schema); | ||
| 54 | - st_foreach(array->els, HASH_FUNCTION_CAST array_free_foreach, 0); | ||
| 55 | + st_foreach(array->els, (hash_function_foreach) array_free_foreach, 0); | ||
| 56 | st_free_table(array->els); | ||
| 57 | avro_freet(struct avro_array_datum_t, array); | ||
| 58 | } | ||
| 59 | @@ -1183,7 +1183,7 @@ avro_datum_reset(avro_datum_t datum) | ||
| 60 | { | ||
| 61 | struct avro_array_datum_t *array; | ||
| 62 | array = avro_datum_to_array(datum); | ||
| 63 | - st_foreach(array->els, HASH_FUNCTION_CAST array_free_foreach, 0); | ||
| 64 | + st_foreach(array->els, (hash_function_foreach) array_free_foreach, 0); | ||
| 65 | st_free_table(array->els); | ||
| 66 | |||
| 67 | rval = avro_init_array(array); | ||
| 68 | @@ -1198,7 +1198,7 @@ avro_datum_reset(avro_datum_t datum) | ||
| 69 | { | ||
| 70 | struct avro_map_datum_t *map; | ||
| 71 | map = avro_datum_to_map(datum); | ||
| 72 | - st_foreach(map->map, HASH_FUNCTION_CAST char_datum_free_foreach, 0); | ||
| 73 | + st_foreach(map->map, (hash_function_foreach) char_datum_free_foreach, 0); | ||
| 74 | st_free_table(map->map); | ||
| 75 | st_free_table(map->indices_by_key); | ||
| 76 | st_free_table(map->keys_by_index); | ||
| 77 | @@ -1217,7 +1217,7 @@ avro_datum_reset(avro_datum_t datum) | ||
| 78 | record = avro_datum_to_record(datum); | ||
| 79 | rval = 0; | ||
| 80 | st_foreach(record->fields_byname, | ||
| 81 | - HASH_FUNCTION_CAST datum_reset_foreach, (st_data_t) &rval); | ||
| 82 | + (hash_function_foreach) datum_reset_foreach, (st_data_t) &rval); | ||
| 83 | return rval; | ||
| 84 | } | ||
| 85 | |||
| 86 | diff --git a/lang/c/src/datum_equal.c b/lang/c/src/datum_equal.c | ||
| 87 | index 3875bea04..7e7c9b940 100644 | ||
| 88 | --- a/lang/c/src/datum_equal.c | ||
| 89 | +++ b/lang/c/src/datum_equal.c | ||
| 90 | @@ -78,7 +78,7 @@ static int map_equal(struct avro_map_datum_t *a, struct avro_map_datum_t *b) | ||
| 91 | if (a->map->num_entries != b->map->num_entries) { | ||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | - st_foreach(a->map, HASH_FUNCTION_CAST st_equal_foreach, (st_data_t) & args); | ||
| 95 | + st_foreach(a->map, (hash_function_foreach) st_equal_foreach, (st_data_t) & args); | ||
| 96 | return args.rval; | ||
| 97 | } | ||
| 98 | |||
| 99 | @@ -93,7 +93,7 @@ static int record_equal(struct avro_record_datum_t *a, | ||
| 100 | if (a->fields_byname->num_entries != b->fields_byname->num_entries) { | ||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | - st_foreach(a->fields_byname, HASH_FUNCTION_CAST st_equal_foreach, (st_data_t) & args); | ||
| 104 | + st_foreach(a->fields_byname, (hash_function_foreach) st_equal_foreach, (st_data_t) & args); | ||
| 105 | return args.rval; | ||
| 106 | } | ||
| 107 | |||
| 108 | diff --git a/lang/c/src/datum_size.c b/lang/c/src/datum_size.c | ||
| 109 | index be9b98004..3877f3138 100644 | ||
| 110 | --- a/lang/c/src/datum_size.c | ||
| 111 | +++ b/lang/c/src/datum_size.c | ||
| 112 | @@ -126,7 +126,7 @@ size_map(avro_writer_t writer, const avro_encoding_t * enc, | ||
| 113 | if (datum->map->num_entries) { | ||
| 114 | size_accum(rval, size, | ||
| 115 | enc->size_long(writer, datum->map->num_entries)); | ||
| 116 | - st_foreach(datum->map, HASH_FUNCTION_CAST size_map_foreach, (st_data_t) & args); | ||
| 117 | + st_foreach(datum->map, (hash_function_foreach) size_map_foreach, (st_data_t) & args); | ||
| 118 | size += args.size; | ||
| 119 | } | ||
| 120 | if (!args.rval) { | ||
| 121 | diff --git a/lang/c/src/datum_validate.c b/lang/c/src/datum_validate.c | ||
| 122 | index 6167bd63f..e997d3067 100644 | ||
| 123 | --- a/lang/c/src/datum_validate.c | ||
| 124 | +++ b/lang/c/src/datum_validate.c | ||
| 125 | @@ -123,7 +123,7 @@ avro_schema_datum_validate(avro_schema_t expected_schema, avro_datum_t datum) | ||
| 126 | { avro_schema_to_map(expected_schema)->values, 1 | ||
| 127 | }; | ||
| 128 | st_foreach(avro_datum_to_map(datum)->map, | ||
| 129 | - HASH_FUNCTION_CAST schema_map_validate_foreach, | ||
| 130 | + (hash_function_foreach) schema_map_validate_foreach, | ||
| 131 | (st_data_t) & vst); | ||
| 132 | return vst.rval; | ||
| 133 | } | ||
| 134 | diff --git a/lang/c/src/memoize.c b/lang/c/src/memoize.c | ||
| 135 | index 933fecbd0..e3602884d 100644 | ||
| 136 | --- a/lang/c/src/memoize.c | ||
| 137 | +++ b/lang/c/src/memoize.c | ||
| 138 | @@ -52,8 +52,8 @@ avro_memoize_key_hash(avro_memoize_key_t *a) | ||
| 139 | |||
| 140 | |||
| 141 | static struct st_hash_type avro_memoize_hash_type = { | ||
| 142 | - HASH_FUNCTION_CAST avro_memoize_key_cmp, | ||
| 143 | - HASH_FUNCTION_CAST avro_memoize_key_hash | ||
| 144 | + (hash_function_compare) avro_memoize_key_cmp, | ||
| 145 | + (hash_function_hash) avro_memoize_key_hash | ||
| 146 | }; | ||
| 147 | |||
| 148 | |||
| 149 | @@ -78,7 +78,7 @@ avro_memoize_free_key(avro_memoize_key_t *key, void *result, void *dummy) | ||
| 150 | void | ||
| 151 | avro_memoize_done(avro_memoize_t *mem) | ||
| 152 | { | ||
| 153 | - st_foreach((st_table *) mem->cache, HASH_FUNCTION_CAST avro_memoize_free_key, 0); | ||
| 154 | + st_foreach((st_table *) mem->cache, (hash_function_foreach) avro_memoize_free_key, 0); | ||
| 155 | st_free_table((st_table *) mem->cache); | ||
| 156 | memset(mem, 0, sizeof(avro_memoize_t)); | ||
| 157 | } | ||
| 158 | diff --git a/lang/c/src/schema.c b/lang/c/src/schema.c | ||
| 159 | index 2acad51a1..a4d8e9f89 100644 | ||
| 160 | --- a/lang/c/src/schema.c | ||
| 161 | +++ b/lang/c/src/schema.c | ||
| 162 | @@ -137,7 +137,7 @@ static void avro_schema_free(avro_schema_t schema) | ||
| 163 | if (record->space) { | ||
| 164 | avro_str_free(record->space); | ||
| 165 | } | ||
| 166 | - st_foreach(record->fields, HASH_FUNCTION_CAST record_free_foreach, | ||
| 167 | + st_foreach(record->fields, (hash_function_foreach) record_free_foreach, | ||
| 168 | 0); | ||
| 169 | st_free_table(record->fields_byname); | ||
| 170 | st_free_table(record->fields); | ||
| 171 | @@ -152,7 +152,7 @@ static void avro_schema_free(avro_schema_t schema) | ||
| 172 | if (enump->space) { | ||
| 173 | avro_str_free(enump->space); | ||
| 174 | } | ||
| 175 | - st_foreach(enump->symbols, HASH_FUNCTION_CAST enum_free_foreach, | ||
| 176 | + st_foreach(enump->symbols, (hash_function_foreach) enum_free_foreach, | ||
| 177 | 0); | ||
| 178 | st_free_table(enump->symbols); | ||
| 179 | st_free_table(enump->symbols_byname); | ||
| 180 | @@ -189,7 +189,7 @@ static void avro_schema_free(avro_schema_t schema) | ||
| 181 | case AVRO_UNION:{ | ||
| 182 | struct avro_union_schema_t *unionp; | ||
| 183 | unionp = avro_schema_to_union(schema); | ||
| 184 | - st_foreach(unionp->branches, HASH_FUNCTION_CAST union_free_foreach, | ||
| 185 | + st_foreach(unionp->branches, (hash_function_foreach) union_free_foreach, | ||
| 186 | 0); | ||
| 187 | st_free_table(unionp->branches); | ||
| 188 | st_free_table(unionp->branches_byname); | ||
| 189 | @@ -1239,7 +1239,7 @@ avro_schema_from_json_root(json_t *root, avro_schema_t *schema) | ||
| 190 | /* json_dumpf(root, stderr, 0); */ | ||
| 191 | rval = avro_schema_from_json_t(root, schema, named_schemas, NULL); | ||
| 192 | json_decref(root); | ||
| 193 | - st_foreach(named_schemas, HASH_FUNCTION_CAST named_schema_free_foreach, 0); | ||
| 194 | + st_foreach(named_schemas, (hash_function_foreach) named_schema_free_foreach, 0); | ||
| 195 | st_free_table(named_schemas); | ||
| 196 | return rval; | ||
| 197 | } | ||
| 198 | @@ -1455,7 +1455,7 @@ avro_schema_t avro_schema_copy(avro_schema_t schema) | ||
| 199 | } | ||
| 200 | |||
| 201 | new_schema = avro_schema_copy_root(schema, named_schemas); | ||
| 202 | - st_foreach(named_schemas, HASH_FUNCTION_CAST named_schema_free_foreach, 0); | ||
| 203 | + st_foreach(named_schemas, (hash_function_foreach) named_schema_free_foreach, 0); | ||
| 204 | st_free_table(named_schemas); | ||
| 205 | return new_schema; | ||
| 206 | } | ||
| 207 | diff --git a/lang/c/src/st.c b/lang/c/src/st.c | ||
| 208 | index 27578289e..8437777cb 100644 | ||
| 209 | --- a/lang/c/src/st.c | ||
| 210 | +++ b/lang/c/src/st.c | ||
| 211 | @@ -39,8 +39,8 @@ struct st_table_entry { | ||
| 212 | static int numcmp(long, long); | ||
| 213 | static int numhash(long); | ||
| 214 | static struct st_hash_type type_numhash = { | ||
| 215 | - HASH_FUNCTION_CAST numcmp, | ||
| 216 | - HASH_FUNCTION_CAST numhash | ||
| 217 | + (hash_function_compare) numcmp, | ||
| 218 | + (hash_function_hash) numhash | ||
| 219 | }; | ||
| 220 | |||
| 221 | /* | ||
| 222 | @@ -48,8 +48,8 @@ static struct st_hash_type type_numhash = { | ||
| 223 | */ | ||
| 224 | static int strhash(const char *); | ||
| 225 | static struct st_hash_type type_strhash = { | ||
| 226 | - HASH_FUNCTION_CAST strcmp, | ||
| 227 | - HASH_FUNCTION_CAST strhash | ||
| 228 | + (hash_function_compare) strcmp, | ||
| 229 | + (hash_function_hash) strhash | ||
| 230 | }; | ||
| 231 | |||
| 232 | static void rehash(st_table *); | ||
| 233 | @@ -212,7 +212,7 @@ void st_free_table(st_table *table) | ||
| 234 | } | ||
| 235 | |||
| 236 | #define PTR_NOT_EQUAL(table, ptr, hash_val, key) \ | ||
| 237 | -((ptr) != 0 && (ptr->hash != (hash_val) || !EQUAL((table), (key), (ptr)->key))) | ||
| 238 | +((ptr) != 0 && (ptr->hash != (hash_val) || !EQUAL((table), (void*) (key), (void*) (ptr)->key))) | ||
| 239 | |||
| 240 | #ifdef HASH_LOG | ||
| 241 | #define COLLISION collision++ | ||
| 242 | @@ -237,7 +237,7 @@ int st_lookup(st_table *table, register st_data_t key, st_data_t *value) | ||
| 243 | unsigned int hash_val, bin_pos; | ||
| 244 | register st_table_entry *ptr; | ||
| 245 | |||
| 246 | - hash_val = do_hash(key, table); | ||
| 247 | + hash_val = do_hash((void*) key, table); | ||
| 248 | FIND_ENTRY(table, ptr, hash_val, bin_pos); | ||
| 249 | |||
| 250 | if (ptr == 0) { | ||
| 251 | @@ -272,7 +272,7 @@ int st_insert(register st_table *table, register st_data_t key, st_data_t value) | ||
| 252 | unsigned int hash_val, bin_pos; | ||
| 253 | register st_table_entry *ptr; | ||
| 254 | |||
| 255 | - hash_val = do_hash(key, table); | ||
| 256 | + hash_val = do_hash((void*) key, table); | ||
| 257 | FIND_ENTRY(table, ptr, hash_val, bin_pos); | ||
| 258 | |||
| 259 | if (ptr == 0) { | ||
| 260 | @@ -288,7 +288,7 @@ void st_add_direct(st_table *table,st_data_t key,st_data_t value) | ||
| 261 | { | ||
| 262 | unsigned int hash_val, bin_pos; | ||
| 263 | |||
| 264 | - hash_val = do_hash(key, table); | ||
| 265 | + hash_val = do_hash((void*) key, table); | ||
| 266 | bin_pos = hash_val % table->num_bins; | ||
| 267 | ADD_DIRECT(table, key, value, hash_val, bin_pos); | ||
| 268 | } | ||
| 269 | @@ -363,7 +363,7 @@ int st_delete(register st_table *table,register st_data_t *key,st_data_t *value) | ||
| 270 | st_table_entry *tmp; | ||
| 271 | register st_table_entry *ptr; | ||
| 272 | |||
| 273 | - hash_val = do_hash_bin(*key, table); | ||
| 274 | + hash_val = do_hash_bin((void*) *key, table); | ||
| 275 | ptr = table->bins[hash_val]; | ||
| 276 | |||
| 277 | if (ptr == 0) { | ||
| 278 | @@ -372,7 +372,7 @@ int st_delete(register st_table *table,register st_data_t *key,st_data_t *value) | ||
| 279 | return 0; | ||
| 280 | } | ||
| 281 | |||
| 282 | - if (EQUAL(table, *key, ptr->key)) { | ||
| 283 | + if (EQUAL(table, (void*) *key, (void*) ptr->key)) { | ||
| 284 | table->bins[hash_val] = ptr->next; | ||
| 285 | table->num_entries--; | ||
| 286 | if (value != 0) | ||
| 287 | @@ -383,7 +383,7 @@ int st_delete(register st_table *table,register st_data_t *key,st_data_t *value) | ||
| 288 | } | ||
| 289 | |||
| 290 | for (; ptr->next != 0; ptr = ptr->next) { | ||
| 291 | - if (EQUAL(table, ptr->next->key, *key)) { | ||
| 292 | + if (EQUAL(table, (void*) ptr->next->key, (void*) *key)) { | ||
| 293 | tmp = ptr->next; | ||
| 294 | ptr->next = ptr->next->next; | ||
| 295 | table->num_entries--; | ||
| 296 | @@ -403,7 +403,7 @@ int st_delete_safe(register st_table *table,register st_data_t *key,st_data_t *v | ||
| 297 | unsigned int hash_val; | ||
| 298 | register st_table_entry *ptr; | ||
| 299 | |||
| 300 | - hash_val = do_hash_bin(*key, table); | ||
| 301 | + hash_val = do_hash_bin((void*) *key, table); | ||
| 302 | ptr = table->bins[hash_val]; | ||
| 303 | |||
| 304 | if (ptr == 0) { | ||
| 305 | @@ -413,7 +413,7 @@ int st_delete_safe(register st_table *table,register st_data_t *key,st_data_t *v | ||
| 306 | } | ||
| 307 | |||
| 308 | for (; ptr != 0; ptr = ptr->next) { | ||
| 309 | - if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) { | ||
| 310 | + if ((ptr->key != never) && EQUAL(table, (void*) ptr->key, (void*) *key)) { | ||
| 311 | table->num_entries--; | ||
| 312 | *key = ptr->key; | ||
| 313 | if (value != 0) | ||
| 314 | @@ -439,11 +439,11 @@ void st_cleanup_safe(st_table *table,st_data_t never) | ||
| 315 | { | ||
| 316 | int num_entries = table->num_entries; | ||
| 317 | |||
| 318 | - st_foreach(table, HASH_FUNCTION_CAST delete_never, never); | ||
| 319 | + st_foreach(table, (hash_function_foreach) delete_never, never); | ||
| 320 | table->num_entries = num_entries; | ||
| 321 | } | ||
| 322 | |||
| 323 | -int st_foreach(st_table *table,int (*func) (ANYARGS),st_data_t arg) | ||
| 324 | +int st_foreach(st_table *table,int (*func) (void*, void*, void*),st_data_t arg) | ||
| 325 | { | ||
| 326 | st_table_entry *ptr, *last, *tmp; | ||
| 327 | enum st_retval retval; | ||
| 328 | @@ -452,7 +452,9 @@ int st_foreach(st_table *table,int (*func) (ANYARGS),st_data_t arg) | ||
| 329 | for (i = 0; i < table->num_bins; i++) { | ||
| 330 | last = 0; | ||
| 331 | for (ptr = table->bins[i]; ptr != 0;) { | ||
| 332 | - retval = (enum st_retval) (*func) (ptr->key, ptr->record, arg); | ||
| 333 | + retval = (enum st_retval) (*func) ((void*) ptr->key, | ||
| 334 | + (void*) ptr->record, | ||
| 335 | + (void*) arg); | ||
| 336 | switch (retval) { | ||
| 337 | case ST_CHECK: /* check if hash is modified during | ||
| 338 | * iteration */ | ||
| 339 | diff --git a/lang/c/src/st.h b/lang/c/src/st.h | ||
| 340 | index cf8a22491..93da018bd 100644 | ||
| 341 | --- a/lang/c/src/st.h | ||
| 342 | +++ b/lang/c/src/st.h | ||
| 343 | @@ -20,26 +20,22 @@ extern "C" { | ||
| 344 | |||
| 345 | #pragma GCC visibility push(hidden) | ||
| 346 | |||
| 347 | -#ifndef ANYARGS | ||
| 348 | - #ifdef __cplusplus | ||
| 349 | - #define ANYARGS ... | ||
| 350 | - #else | ||
| 351 | - #define ANYARGS | ||
| 352 | - #endif | ||
| 353 | -#endif | ||
| 354 | - | ||
| 355 | #ifdef _WIN32 | ||
| 356 | - #define HASH_FUNCTION_CAST (int (__cdecl *)(ANYARGS)) | ||
| 357 | + typedef int (__cdecl *hash_function_compare)(void*, void*); | ||
| 358 | + typedef int (__cdecl *hash_function_hash)(void*); | ||
| 359 | + typedef int (__cdecl *hash_function_foreach)(void*, void*, void*); | ||
| 360 | #else | ||
| 361 | - #define HASH_FUNCTION_CAST | ||
| 362 | + typedef int (*hash_function_compare)(void*, void*); | ||
| 363 | + typedef int (*hash_function_hash)(void*); | ||
| 364 | + typedef int (*hash_function_foreach)(void*, void*, void*); | ||
| 365 | #endif | ||
| 366 | |||
| 367 | typedef uintptr_t st_data_t; | ||
| 368 | typedef struct st_table st_table; | ||
| 369 | |||
| 370 | struct st_hash_type { | ||
| 371 | - int (*compare) (ANYARGS); | ||
| 372 | - int (*hash) (ANYARGS); | ||
| 373 | + hash_function_compare compare; | ||
| 374 | + hash_function_hash hash; | ||
| 375 | }; | ||
| 376 | |||
| 377 | struct st_table { | ||
| 378 | @@ -67,7 +63,7 @@ int st_delete _((st_table *, st_data_t *, st_data_t *)); | ||
| 379 | int st_delete_safe _((st_table *, st_data_t *, st_data_t *, st_data_t)); | ||
| 380 | int st_insert _((st_table *, st_data_t, st_data_t)); | ||
| 381 | int st_lookup _((st_table *, st_data_t, st_data_t *)); | ||
| 382 | -int st_foreach _((st_table *, int (*)(ANYARGS), st_data_t)); | ||
| 383 | +int st_foreach _((st_table *, hash_function_foreach, st_data_t)); | ||
| 384 | void st_add_direct _((st_table *, st_data_t, st_data_t)); | ||
| 385 | void st_free_table _((st_table *)); | ||
| 386 | void st_cleanup_safe _((st_table *, st_data_t)); | ||
diff --git a/meta-oe/recipes-support/avro/avro-c_1.11.3.bb b/meta-oe/recipes-support/avro/avro-c_1.11.3.bb index bf84242e29..37a12006ba 100644 --- a/meta-oe/recipes-support/avro/avro-c_1.11.3.bb +++ b/meta-oe/recipes-support/avro/avro-c_1.11.3.bb | |||
| @@ -8,16 +8,12 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=6d502b41f76179fc84e536236f359cae" | |||
| 8 | DEPENDS = "jansson zlib xz" | 8 | DEPENDS = "jansson zlib xz" |
| 9 | 9 | ||
| 10 | BRANCH = "branch-1.11" | 10 | BRANCH = "branch-1.11" |
| 11 | SRCREV = "35ff8b997738e4d983871902d47bfb67b3250734" | 11 | SRCREV = "579a36762293fa4c9f2831e27e7af7713a0838a0" |
| 12 | SRC_URI = "git://github.com/apache/avro;branch=${BRANCH};protocol=https \ | 12 | SRC_URI = " \ |
| 13 | " | 13 | git://github.com/apache/avro;branch=${BRANCH};protocol=https \ |
| 14 | 14 | file://0001-AVRO-3960-C-Fix-st-ANYARGS-warning-2798.patch;patchdir=../.. \ | |
| 15 | file://0001-AVRO-3957-C-Fix-typos-in-docs-and-examples-2795.patch;patchdir=../.. \ | ||
| 16 | " | ||
| 15 | S = "${WORKDIR}/git/lang/c" | 17 | S = "${WORKDIR}/git/lang/c" |
| 16 | 18 | ||
| 17 | inherit cmake pkgconfig | 19 | inherit cmake pkgconfig |
| 18 | |||
| 19 | # http://errors.yoctoproject.org/Errors/Details/766902/ | ||
| 20 | # avro-c/1.11.3/git/lang/c/examples/quickstop.c:123:61: error: passing argument 3 of 'first_value.iface->get_string' from incompatible pointer type [-Wincompatible-pointer-types] | ||
| 21 | # avro-c/1.11.3/git/lang/c/examples/quickstop.c:127:60: error: passing argument 3 of 'last_value.iface->get_string' from incompatible pointer type [-Wincompatible-pointer-types] | ||
| 22 | # avro-c/1.11.3/git/lang/c/examples/quickstop.c:131:61: error: passing argument 3 of 'phone_value.iface->get_string' from incompatible pointer type [-Wincompatible-pointer-types] | ||
| 23 | CFLAGS += "-Wno-error=incompatible-pointer-types" | ||
