]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/tools/vcpkg/ports/avro-c/avro.patch
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / tools / vcpkg / ports / avro-c / avro.patch
1 diff --git a/lang/c/CMakeLists.txt b/lang/c/CMakeLists.txt
2 index 11cbf01..620490d 100644
3 --- a/lang/c/CMakeLists.txt
4 +++ b/lang/c/CMakeLists.txt
5 @@ -149,7 +149,10 @@ else (ZLIB_FOUND)
6 message("Disabled deflate codec. zlib not found.")
7 endif (ZLIB_FOUND)
8
9 -find_package(Snappy)
10 +find_library(SNAPPY_LIBRARY_RELEASE NAMES snappy PATH_SUFFIXES lib)
11 +find_library(SNAPPY_LIBRARY_DEBUG NAMES snappyd PATH_SUFFIXES debug/lib)
12 +find_path(SNAPPY_INCLUDE_DIR snappy-c.h)
13 +select_library_configurations(SNAPPY)
14 if (SNAPPY_FOUND AND ZLIB_FOUND) # Snappy borrows crc32 from zlib
15 set(SNAPPY_PKG libsnappy)
16 add_definitions(-DSNAPPY_CODEC)
17 @@ -161,32 +164,36 @@ else (SNAPPY_FOUND AND ZLIB_FOUND)
18 message("Disabled snappy codec. libsnappy not found or zlib not found.")
19 endif (SNAPPY_FOUND AND ZLIB_FOUND)
20
21 -find_package(PkgConfig)
22 -pkg_check_modules(LZMA liblzma)
23 -if (LZMA_FOUND)
24 +find_package(LibLZMA)
25 +if (LibLZMA_FOUND)
26 + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
27 + set(SNAPPY_LIBRARIES ${SNAPPY_LIBRARIES} -lstdc++)
28 + endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
29 set(LZMA_PKG liblzma)
30 add_definitions(-DLZMA_CODEC)
31 - include_directories(${LZMA_INCLUDE_DIRS})
32 - link_directories(${LZMA_LIBRARY_DIRS})
33 + include_directories(${LibLZMA_INCLUDE_DIRS})
34 + link_directories(${LibLZMA_LIBRARY_DIRS})
35 message("Enabled lzma codec")
36 -else (LZMA_FOUND)
37 +else (LibLZMA_FOUND)
38 set(LZMA_PKG "")
39 - set(LZMA_LIBRARIES "")
40 + set(LibLZMA_LIBRARIES "")
41 message("Disabled lzma codec. liblzma not found.")
42 -endif (LZMA_FOUND)
43 +endif (LIBLZMA_FOUND)
44
45 -set(CODEC_LIBRARIES ${ZLIB_LIBRARIES} ${LZMA_LIBRARIES} ${SNAPPY_LIBRARIES})
46 +set(CODEC_LIBRARIES ${ZLIB_LIBRARIES} ${LibLZMA_LIBRARIES} ${SNAPPY_LIBRARIES})
47 set(CODEC_PKG "@ZLIB_PKG@ @LZMA_PKG@ @SNAPPY_PKG@")
48
49 # Jansson JSON library
50 -pkg_check_modules(JANSSON jansson>=2.3)
51 -if (JANSSON_FOUND)
52 +find_path(JANSSON_INCLUDE_DIR NAMES jansson.h)
53 +find_library(JANSSON_LIBRARY NAMES jansson)
54 +if (JANSSON_LIBRARY)
55 set(JANSSON_PKG libjansson)
56 + set(JANSSON_LIBRARIES ${JANSSON_LIBRARY})
57 include_directories(${JANSSON_INCLUDE_DIRS})
58 link_directories(${JANSSON_LIBRARY_DIRS})
59 -else (JANSSON_FOUND)
60 +else (JANSSON_LIBRARY)
61 message(FATAL_ERROR "libjansson >=2.3 not found")
62 -endif (JANSSON_FOUND)
63 +endif (JANSSON_LIBRARY)
64
65
66 add_subdirectory(src)
67 diff --git a/lang/c/examples/quickstop.c b/lang/c/examples/quickstop.c
68 index f18225b..78e2b1b 100644
69 --- a/lang/c/examples/quickstop.c
70 +++ b/lang/c/examples/quickstop.c
71 @@ -16,6 +16,7 @@
72 */
73
74 #include <avro.h>
75 +#include <avro/platform.h>
76 #include <stdio.h>
77 #include <stdlib.h>
78
79 @@ -102,7 +103,7 @@ int print_person(avro_file_reader_t db, avro_schema_t reader_schema)
80
81 if (avro_record_get(person, "ID", &id_datum) == 0) {
82 avro_int64_get(id_datum, &i64);
83 - fprintf(stdout, "%"PRId64" | ", i64);
84 + fprintf(stdout, "%" PRId64 " | ", i64);
85 }
86 if (avro_record_get(person, "First", &first_datum) == 0) {
87 avro_string_get(first_datum, &p);
88 diff --git a/lang/c/src/avro/msinttypes.h b/lang/c/src/avro/msinttypes.h
89 index 29be14b..7efc702 100644
90 --- a/lang/c/src/avro/msinttypes.h
91 +++ b/lang/c/src/avro/msinttypes.h
92 @@ -54,6 +54,10 @@
93
94 // 7.8 Format conversion of integer types
95
96 +#if (_MSC_VER >= 1900)
97 +# include <inttypes.h>
98 +#else
99 +
100 typedef struct {
101 intmax_t quot;
102 intmax_t rem;
103 @@ -311,5 +315,6 @@ imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
104 #define wcstoimax _wcstoi64
105 #define wcstoumax _wcstoui64
106
107 +#endif // (_MSC_VER >= 1900)
108
109 #endif // _MSC_INTTYPES_H_ ]
110 diff --git a/lang/c/src/avro/msstdint.h b/lang/c/src/avro/msstdint.h
111 index d02608a..54e8972 100644
112 --- a/lang/c/src/avro/msstdint.h
113 +++ b/lang/c/src/avro/msstdint.h
114 @@ -42,6 +42,10 @@
115
116 #include <limits.h>
117
118 +#if (_MSC_VER >= 1900)
119 +# include <stdint.h>
120 +#else
121 +
122 // For Visual Studio 6 in C++ mode and for many Visual Studio versions when
123 // compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
124 // or compiler give many errors like this:
125 @@ -243,5 +247,6 @@ typedef uint64_t uintmax_t;
126
127 #endif // __STDC_CONSTANT_MACROS ]
128
129 +#endif // (_MSC_VER >= 1900)
130
131 #endif // _MSC_STDINT_H_ ]
132 diff --git a/lang/c/src/avro/platform.h b/lang/c/src/avro/platform.h
133 index 9293055..edfe1e0 100644
134 --- a/lang/c/src/avro/platform.h
135 +++ b/lang/c/src/avro/platform.h
136 @@ -35,8 +35,10 @@ extern "C" {
137 // Defines for printing size_t.
138 #if defined(_WIN64)
139 #define PRIsz PRIu64
140 + typedef __int64 ssize_t;
141 #elif defined(_WIN32)
142 #define PRIsz PRIu32
143 + typedef long ssize_t;
144 #else // GCC
145 #define PRIsz "zu"
146 #endif
147 diff --git a/lang/c/src/avro_private.h b/lang/c/src/avro_private.h
148 index f97ef6b..6b29104 100644
149 --- a/lang/c/src/avro_private.h
150 +++ b/lang/c/src/avro_private.h
151 @@ -34,7 +34,7 @@ extern "C" {
152 #endif
153
154 #ifdef _WIN32
155 -#define snprintf _snprintf
156 + // #define snprintf _snprintf
157 #endif
158
159 /* Note that AVRO_PLATFORM_IS_BIG_ENDIAN is *always* defined. It is
160 diff --git a/lang/c/src/avroappend.c b/lang/c/src/avroappend.c
161 index 7243c60..39656ff 100644
162 --- a/lang/c/src/avroappend.c
163 +++ b/lang/c/src/avroappend.c
164 @@ -20,7 +20,7 @@
165 #include <sys/types.h>
166 #include <sys/stat.h>
167 #ifdef _WIN32
168 -#include <unistd.h>
169 +#include <io.h>
170 #endif
171
172 #include "avro.h"
173 diff --git a/lang/c/src/codec.c b/lang/c/src/codec.c
174 index 5b55b35..49789f2 100644
175 --- a/lang/c/src/codec.c
176 +++ b/lang/c/src/codec.c
177 @@ -269,7 +269,7 @@ static int encode_deflate(avro_codec_t c, void * data, int64_t len)
178 s->next_in = (Bytef*)data;
179 s->avail_in = (uInt)len;
180
181 - s->next_out = c->block_data;
182 + s->next_out = (Bytef*)c->block_data;
183 s->avail_out = (uInt)c->block_size;
184
185 s->total_out = 0;
186 @@ -313,10 +313,10 @@ static int decode_deflate(avro_codec_t c, void * data, int64_t len)
187
188 c->used_size = 0;
189
190 - s->next_in = data;
191 + s->next_in = (Bytef*)data;
192 s->avail_in = len;
193
194 - s->next_out = c->block_data;
195 + s->next_out = (Bytef*)c->block_data;
196 s->avail_out = c->block_size;
197
198 s->total_out = 0;
199 @@ -337,7 +337,7 @@ static int decode_deflate(avro_codec_t c, void * data, int64_t len)
200 if (err == Z_BUF_ERROR)
201 {
202 c->block_data = avro_realloc(c->block_data, c->block_size, c->block_size * 2);
203 - s->next_out = c->block_data + s->total_out;
204 + s->next_out = (Bytef*)c->block_data + s->total_out;
205 s->avail_out += c->block_size;
206 c->block_size = c->block_size * 2;
207 }
208 @@ -440,7 +440,7 @@ static int encode_lzma(avro_codec_t codec, void * data, int64_t len)
209 return 1;
210 }
211
212 - ret = lzma_raw_buffer_encode(filters, NULL, data, len, codec->block_data, &written, codec->block_size);
213 + ret = lzma_raw_buffer_encode(filters, NULL, (const uint8_t*)data, len, (uint8_t*)codec->block_data, &written, codec->block_size);
214
215 codec->used_size = written;
216
217 @@ -471,8 +471,8 @@ static int decode_lzma(avro_codec_t codec, void * data, int64_t len)
218
219 do
220 {
221 - ret = lzma_raw_buffer_decode(filters, NULL, data,
222 - &read_pos, len, codec->block_data, &write_pos,
223 + ret = lzma_raw_buffer_decode(filters, NULL, (const uint8_t*)data,
224 + &read_pos, len, (uint8_t*)codec->block_data, &write_pos,
225 codec->block_size);
226
227 codec->used_size = write_pos;
228 diff --git a/lang/c/src/schema.c b/lang/c/src/schema.c
229 index 7b38900..50fa0db 100644
230 --- a/lang/c/src/schema.c
231 +++ b/lang/c/src/schema.c
232 @@ -74,7 +74,7 @@ static int is_avro_id(const char *name)
233 * namespace (as a newly allocated buffer using Avro's allocator). */
234 static char *split_namespace_name(const char *fullname, const char **name_out)
235 {
236 - char *last_dot = strrchr(fullname, '.');
237 + const char *last_dot = strrchr(fullname, '.');
238 if (last_dot == NULL) {
239 *name_out = fullname;
240 return NULL;
241 @@ -770,12 +770,12 @@ avro_schema_t avro_schema_link_target(avro_schema_t schema)
242 }
243
244 static const char *
245 -qualify_name(const char *name, const char *namespace)
246 +qualify_name(const char *name, const char *namespaceX)
247 {
248 char *full_name;
249 - if (namespace != NULL && strchr(name, '.') == NULL) {
250 - full_name = avro_str_alloc(strlen(name) + strlen(namespace) + 2);
251 - sprintf(full_name, "%s.%s", namespace, name);
252 + if (namespaceX != NULL && strchr(name, '.') == NULL) {
253 + full_name = avro_str_alloc(strlen(name) + strlen(namespaceX) + 2);
254 + sprintf(full_name, "%s.%s", namespaceX, name);
255 } else {
256 full_name = avro_strdup(name);
257 }
258 @@ -786,20 +786,20 @@ static int
259 save_named_schemas(const avro_schema_t schema, st_table *st)
260 {
261 const char *name = avro_schema_name(schema);
262 - const char *namespace = avro_schema_namespace(schema);
263 - const char *full_name = qualify_name(name, namespace);
264 + const char *namespaceX = avro_schema_namespace(schema);
265 + const char *full_name = qualify_name(name, namespaceX);
266 int rval = st_insert(st, (st_data_t) full_name, (st_data_t) schema);
267 return rval;
268 }
269
270 static avro_schema_t
271 -find_named_schemas(const char *name, const char *namespace, st_table *st)
272 +find_named_schemas(const char *name, const char *namespaceX, st_table *st)
273 {
274 union {
275 avro_schema_t schema;
276 st_data_t data;
277 } val;
278 - const char *full_name = qualify_name(name, namespace);
279 + const char *full_name = qualify_name(name, namespaceX);
280 int rval = st_lookup(st, (st_data_t) full_name, &(val.data));
281 avro_str_free((char *)full_name);
282 if (rval) {
283 @@ -812,7 +812,7 @@ find_named_schemas(const char *name, const char *namespace, st_table *st)
284 static int
285 avro_type_from_json_t(json_t *json, avro_type_t *type,
286 st_table *named_schemas, avro_schema_t *named_type,
287 - const char *namespace)
288 + const char *namespaceX)
289 {
290 json_t *json_type;
291 const char *type_str;
292 @@ -863,7 +863,7 @@ avro_type_from_json_t(json_t *json, avro_type_t *type,
293 *type = AVRO_MAP;
294 } else if (strcmp(type_str, "fixed") == 0) {
295 *type = AVRO_FIXED;
296 - } else if ((*named_type = find_named_schemas(type_str, namespace, named_schemas))) {
297 + } else if ((*named_type = find_named_schemas(type_str, namespaceX, named_schemas))) {
298 *type = AVRO_LINK;
299 } else {
300 avro_set_error("Unknown Avro \"type\": %s", type_str);
301 @@ -954,15 +954,15 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema,
302 }
303
304 if (strchr(fullname, '.')) {
305 - char *namespace = split_namespace_name(fullname, &name);
306 - *schema = avro_schema_record(name, namespace);
307 - avro_str_free(namespace);
308 + char *namespaceX = split_namespace_name(fullname, &name);
309 + *schema = avro_schema_record(name, namespaceX);
310 + avro_str_free(namespaceX);
311 } else if (json_is_string(json_namespace)) {
312 - const char *namespace = json_string_value(json_namespace);
313 - if (strlen(namespace) == 0) {
314 - namespace = NULL;
315 + const char *namespaceX = json_string_value(json_namespace);
316 + if (strlen(namespaceX) == 0) {
317 + namespaceX = NULL;
318 }
319 - *schema = avro_schema_record(fullname, namespace);
320 + *schema = avro_schema_record(fullname, namespaceX);
321 } else {
322 *schema = avro_schema_record(fullname, parent_namespace);
323 }
324 @@ -1053,16 +1053,16 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema,
325 }
326
327 if (strchr(fullname, '.')) {
328 - char *namespace;
329 - namespace = split_namespace_name(fullname, &name);
330 - *schema = avro_schema_enum_ns(name, namespace);
331 - avro_str_free(namespace);
332 + char *namespaceX;
333 + namespaceX = split_namespace_name(fullname, &name);
334 + *schema = avro_schema_enum_ns(name, namespaceX);
335 + avro_str_free(namespaceX);
336 } else if (json_is_string(json_namespace)) {
337 - const char *namespace = json_string_value(json_namespace);
338 - if (strlen(namespace) == 0) {
339 - namespace = NULL;
340 + const char *namespaceX = json_string_value(json_namespace);
341 + if (strlen(namespaceX) == 0) {
342 + namespaceX = NULL;
343 }
344 - *schema = avro_schema_enum_ns(fullname, namespace);
345 + *schema = avro_schema_enum_ns(fullname, namespaceX);
346 } else {
347 *schema = avro_schema_enum_ns(fullname, parent_namespace);
348 }
349 @@ -1190,16 +1190,16 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema,
350 fullname = json_string_value(json_name);
351
352 if (strchr(fullname, '.')) {
353 - char *namespace;
354 - namespace = split_namespace_name(fullname, &name);
355 - *schema = avro_schema_fixed_ns(name, namespace, (int64_t) size);
356 - avro_str_free(namespace);
357 + char *namespaceX;
358 + namespaceX = split_namespace_name(fullname, &name);
359 + *schema = avro_schema_fixed_ns(name, namespaceX, (int64_t) size);
360 + avro_str_free(namespaceX);
361 } else if (json_is_string(json_namespace)) {
362 - const char *namespace = json_string_value(json_namespace);
363 - if (strlen(namespace) == 0) {
364 - namespace = NULL;
365 + const char *namespaceX = json_string_value(json_namespace);
366 + if (strlen(namespaceX) == 0) {
367 + namespaceX = NULL;
368 }
369 - *schema = avro_schema_fixed_ns(fullname, namespace, (int64_t) size);
370 + *schema = avro_schema_fixed_ns(fullname, namespaceX, (int64_t) size);
371 } else {
372 *schema = avro_schema_fixed_ns(fullname, parent_namespace, (int64_t) size);
373 }
374 @@ -1821,9 +1821,9 @@ static int write_link(avro_writer_t out, const struct avro_link_schema_t *link,
375 {
376 int rval;
377 check(rval, avro_write_str(out, "\""));
378 - const char *namespace = avro_schema_namespace(link->to);
379 - if (namespace && nullstrcmp(namespace, parent_namespace)) {
380 - check(rval, avro_write_str(out, namespace));
381 + const char *namespaceX = avro_schema_namespace(link->to);
382 + if (namespaceX && nullstrcmp(namespaceX, parent_namespace)) {
383 + check(rval, avro_write_str(out, namespaceX));
384 check(rval, avro_write_str(out, "."));
385 }
386 check(rval, avro_write_str(out, avro_schema_name(link->to)));
387 diff --git a/lang/c/tests/test_avro_data.c b/lang/c/tests/test_avro_data.c
388 index 1da09e6..714d5d8 100644
389 --- a/lang/c/tests/test_avro_data.c
390 +++ b/lang/c/tests/test_avro_data.c
391 @@ -28,6 +28,10 @@ avro_writer_t writer;
392
393 typedef int (*avro_test) (void);
394
395 +#ifdef _WIN32
396 +# define strcasecmp stricmp
397 +#endif
398 +
399 /*
400 * Use a custom allocator that verifies that the size that we use to
401 * free an object matches the size that we use to allocate it.
402 @@ -112,7 +116,7 @@ write_read_check(avro_schema_t writers_schema, avro_datum_t datum,
403 if (size != avro_writer_tell(writer)) {
404 fprintf(stderr,
405 "Unable to calculate size %s validate=%d "
406 - "(%"PRId64" != %"PRId64")\n %s\n",
407 + "(%" PRId64 " != %" PRId64 ")\n %s\n",
408 type, validate, size, avro_writer_tell(writer),
409 avro_strerror());
410 exit(EXIT_FAILURE);