Imported Upstream version 0.14
Robert S. Edmonds
10 years ago
0 | 0.14: | |
1 | - build fix (missing dependency in test directory) | |
2 | - add generation / installation of pkg-config files. (Bobby Powers) | |
3 | - support for packed repeated fields (Dave Benson) | |
4 | - bug in dsk_dispatch_close_fd(), which usually only | |
5 | showed up in later function calls. | |
6 | - support for deprecated fields -- enable a GCC warning | |
7 | if a field has the "deprecated" option enabled. (Andrei Nigmatulin) | |
8 | - hackery to try to avoid touching inttypes.h on windows (Issue #41) | |
9 | - fix for protobuf_c_message_unpack() to issue error if any | |
10 | "required" field is missing in input stream. (Andrei Nigmatulin) | |
11 | ||
12 | 0.13: | |
13 | - Fix for when the number of connections gets too great in RPC. | |
14 | (Leszek Swirski) (issue #32) | |
15 | - Add --disable-protoc to only build libprotobuf-c (daveb) | |
16 | - Bug fixes for protobuf_c_enum_descriptor_get_value_by_name() | |
17 | and protobuf_c_service_descriptor_get_method_by_name() | |
18 | - if descriptor->message_init != NULL, use it from unpack() | |
19 | as an optimization (daveb) | |
20 | - implement protobuf_c_{client,server}_set_error_handler() | |
21 | ||
0 | 22 | 0.12: |
1 | 23 | - for field names which are reserved words, use the real name |
2 | 24 | given in the protobuf-c file, not the mangled name which |
0 | 0 | SUBDIRS = src |
1 | 1 | |
2 | 2 | EXTRA_DIST = scripts pkgwriteinfo.in |
3 | ||
4 | pkgconfigdir = $(libdir)/pkgconfig | |
5 | pkgconfig_DATA = libprotobuf-c.pc | |
3 | 6 | |
4 | 7 | # --- packages --- |
5 | 8 | DEBARCH = `dpkg --print-architecture` |
12 | 12 | # PARTICULAR PURPOSE. |
13 | 13 | |
14 | 14 | @SET_MAKE@ |
15 | ||
15 | 16 | srcdir = @srcdir@ |
16 | 17 | top_srcdir = @top_srcdir@ |
17 | 18 | VPATH = @srcdir@ |
35 | 36 | build_triplet = @build@ |
36 | 37 | host_triplet = @host@ |
37 | 38 | DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ |
38 | $(srcdir)/Makefile.in $(srcdir)/pkgwriteinfo.in \ | |
39 | $(top_srcdir)/configure ChangeLog TODO config.guess config.sub \ | |
40 | depcomp install-sh ltmain.sh missing | |
39 | $(srcdir)/Makefile.in $(srcdir)/libprotobuf-c.pc.in \ | |
40 | $(srcdir)/pkgwriteinfo.in $(top_srcdir)/configure ChangeLog \ | |
41 | TODO config.guess config.sub depcomp install-sh ltmain.sh \ | |
42 | missing | |
41 | 43 | subdir = . |
42 | 44 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
43 | 45 | am__aclocal_m4_deps = $(top_srcdir)/configure.ac |
46 | 48 | am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ |
47 | 49 | configure.lineno configure.status.lineno |
48 | 50 | mkinstalldirs = $(install_sh) -d |
49 | CONFIG_CLEAN_FILES = pkgwriteinfo | |
51 | CONFIG_CLEAN_FILES = pkgwriteinfo libprotobuf-c.pc | |
50 | 52 | SOURCES = |
51 | 53 | DIST_SOURCES = |
52 | 54 | RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ |
55 | 57 | install-recursive installcheck-recursive installdirs-recursive \ |
56 | 58 | pdf-recursive ps-recursive uninstall-info-recursive \ |
57 | 59 | uninstall-recursive |
60 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | |
61 | am__vpath_adj = case $$p in \ | |
62 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | |
63 | *) f=$$p;; \ | |
64 | esac; | |
65 | am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; | |
66 | am__installdirs = "$(DESTDIR)$(pkgconfigdir)" | |
67 | pkgconfigDATA_INSTALL = $(INSTALL_DATA) | |
68 | DATA = $(pkgconfig_DATA) | |
58 | 69 | ETAGS = etags |
59 | 70 | CTAGS = ctags |
60 | 71 | DIST_SUBDIRS = $(SUBDIRS) |
78 | 89 | AUTOHEADER = @AUTOHEADER@ |
79 | 90 | AUTOMAKE = @AUTOMAKE@ |
80 | 91 | AWK = @AWK@ |
92 | BUILD_PROTOC_C_FALSE = @BUILD_PROTOC_C_FALSE@ | |
93 | BUILD_PROTOC_C_TRUE = @BUILD_PROTOC_C_TRUE@ | |
81 | 94 | CC = @CC@ |
82 | 95 | CCDEPMODE = @CCDEPMODE@ |
83 | 96 | CFLAGS = @CFLAGS@ |
176 | 189 | target_alias = @target_alias@ |
177 | 190 | SUBDIRS = src |
178 | 191 | EXTRA_DIST = scripts pkgwriteinfo.in |
192 | pkgconfigdir = $(libdir)/pkgconfig | |
193 | pkgconfig_DATA = libprotobuf-c.pc | |
179 | 194 | |
180 | 195 | # --- packages --- |
181 | 196 | DEBARCH = `dpkg --print-architecture` |
217 | 232 | cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) |
218 | 233 | pkgwriteinfo: $(top_builddir)/config.status $(srcdir)/pkgwriteinfo.in |
219 | 234 | cd $(top_builddir) && $(SHELL) ./config.status $@ |
235 | libprotobuf-c.pc: $(top_builddir)/config.status $(srcdir)/libprotobuf-c.pc.in | |
236 | cd $(top_builddir) && $(SHELL) ./config.status $@ | |
220 | 237 | |
221 | 238 | mostlyclean-libtool: |
222 | 239 | -rm -f *.lo |
227 | 244 | distclean-libtool: |
228 | 245 | -rm -f libtool |
229 | 246 | uninstall-info-am: |
247 | install-pkgconfigDATA: $(pkgconfig_DATA) | |
248 | @$(NORMAL_INSTALL) | |
249 | test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)" | |
250 | @list='$(pkgconfig_DATA)'; for p in $$list; do \ | |
251 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | |
252 | f=$(am__strip_dir) \ | |
253 | echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ | |
254 | $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ | |
255 | done | |
256 | ||
257 | uninstall-pkgconfigDATA: | |
258 | @$(NORMAL_UNINSTALL) | |
259 | @list='$(pkgconfig_DATA)'; for p in $$list; do \ | |
260 | f=$(am__strip_dir) \ | |
261 | echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ | |
262 | rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ | |
263 | done | |
230 | 264 | |
231 | 265 | # This directory's subdirectories are mostly independent; you can cd |
232 | 266 | # into them and run `make' without going through this Makefile. |
504 | 538 | exit 1; } >&2 |
505 | 539 | check-am: all-am |
506 | 540 | check: check-recursive |
507 | all-am: Makefile | |
541 | all-am: Makefile $(DATA) | |
508 | 542 | installdirs: installdirs-recursive |
509 | 543 | installdirs-am: |
544 | for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ | |
545 | test -z "$$dir" || $(mkdir_p) "$$dir"; \ | |
546 | done | |
510 | 547 | install: install-recursive |
511 | 548 | install-exec: install-exec-recursive |
512 | 549 | install-data: install-data-recursive |
551 | 588 | |
552 | 589 | info-am: |
553 | 590 | |
554 | install-data-am: | |
591 | install-data-am: install-pkgconfigDATA | |
555 | 592 | |
556 | 593 | install-exec-am: |
557 | 594 | |
579 | 616 | |
580 | 617 | ps-am: |
581 | 618 | |
582 | uninstall-am: uninstall-info-am | |
619 | uninstall-am: uninstall-info-am uninstall-pkgconfigDATA | |
583 | 620 | |
584 | 621 | uninstall-info: uninstall-info-recursive |
585 | 622 | |
591 | 628 | distclean-tags distcleancheck distdir distuninstallcheck dvi \ |
592 | 629 | dvi-am html html-am info info-am install install-am \ |
593 | 630 | install-data install-data-am install-exec install-exec-am \ |
594 | install-info install-info-am install-man install-strip \ | |
595 | installcheck installcheck-am installdirs installdirs-am \ | |
596 | maintainer-clean maintainer-clean-generic \ | |
631 | install-info install-info-am install-man install-pkgconfigDATA \ | |
632 | install-strip installcheck installcheck-am installdirs \ | |
633 | installdirs-am maintainer-clean maintainer-clean-generic \ | |
597 | 634 | maintainer-clean-recursive mostlyclean mostlyclean-generic \ |
598 | 635 | mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ |
599 | tags tags-recursive uninstall uninstall-am uninstall-info-am | |
636 | tags tags-recursive uninstall uninstall-am uninstall-info-am \ | |
637 | uninstall-pkgconfigDATA | |
600 | 638 | |
601 | 639 | deb: |
602 | 640 | test -r protobuf-c-@VERSION@.tar.gz || $(MAKE) dist |
0 | 0 | ---------------------- |
1 | 1 | --- IMPORTANT TODO --- |
2 | 2 | ---------------------- |
3 | - proper support for extensions | |
4 | - slot for ranges in descriptor | |
5 | - extends is implemented as c-style function | |
6 | whose name is built from the package, the base message type-name | |
7 | and the member. which takes the base message and returns the | |
8 | value, if it is found in "unknown_values". | |
9 | boolean package__extension_member_name__get(Message *message, | |
10 | type *out); | |
11 | void package__extension_member_name__set_raw(type in, | |
12 | ProtobufCUnknownValue *to_init); | |
13 | 3 | - ensure enums are int-size |
4 | - per comments on the main page: wire_format_inl.h is now | |
5 | wire_format_lite_inl.h .. adjust somehow .. possibly write an email | |
14 | 6 | |
15 | 7 | -------------------- |
16 | 8 | --- NEEDED TESTS --- |
22 | 14 | - default values |
23 | 15 | - message unpack alloc failures when allocating new slab |
24 | 16 | - message unpack alloc failures when allocating unknown field buffers |
17 | - packed message corruption. | |
18 | - meta-todo: get a list of all the unpack errors together to check off | |
19 | - run gcov | |
25 | 20 | |
26 | 21 | --------------------- |
27 | 22 | --- DOCUMENTATION --- |
34 | 29 | --- LOW PRIORITY STUFF --- |
35 | 30 | -------------------------- |
36 | 31 | - support Group (whatever it is) |
37 | - almost no code generator options are obeyed | |
32 | - proper support for extensions | |
33 | - slot for ranges in descriptor | |
34 | - extends is implemented as c-style function | |
35 | whose name is built from the package, the base message type-name | |
36 | and the member. which takes the base message and returns the | |
37 | value, if it is found in "unknown_values". | |
38 | boolean package__extension_member_name__get(Message *message, | |
39 | type *out); | |
40 | void package__extension_member_name__set_raw(type in, | |
41 | ProtobufCUnknownValue *to_init); | |
38 | 42 | |
39 | 43 | ------------------------------------ |
40 | 44 | --- EXTREMELY LOW PRIORITY STUFF --- |
49 | 53 | ------------------------- |
50 | 54 | --- IDEAS TO CONSIDER --- |
51 | 55 | ------------------------- |
56 | ||
57 | - optimization: structures without repeated members could skip | |
58 | the ScannedMember phase | |
59 | ||
60 | - optimization: a way to ignore unknown-fields when unpacking | |
61 | ||
62 | - optimization: certain functions are not well setup for WORDSIZE==64; | |
63 | especially the int64 routines are inefficient that way. | |
64 | The best might be an internal #define WORDSIZE (sizeof(long)*8)" | |
65 | except w/ a real constant there, one that the preprocessor can use. | |
66 | I think the functions in protobuf-c.c are already tagged. | |
52 | 67 | |
53 | 68 | - lifetime functions for messages: |
54 | 69 | message__new() |
65 | 80 | - Rewrite the code-generator in C, including the parser. |
66 | 81 | - This would have the huge advantage that we could use ".proto" files |
67 | 82 | directly, instead of having to invoke the compilers. |
83 | - keep in a separate c file for static linking optimziation purposes | |
84 | - need alignment tests | |
85 | - the CAVEATS should discuss our structure-packing assumptions |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.61 for protobuf-c 0.12. | |
2 | # Generated by GNU Autoconf 2.61 for protobuf-c 0.14. | |
3 | 3 | # |
4 | 4 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
5 | 5 | # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. |
725 | 725 | # Identity of this package. |
726 | 726 | PACKAGE_NAME='protobuf-c' |
727 | 727 | PACKAGE_TARNAME='protobuf-c' |
728 | PACKAGE_VERSION='0.12' | |
729 | PACKAGE_STRING='protobuf-c 0.12' | |
728 | PACKAGE_VERSION='0.14' | |
729 | PACKAGE_STRING='protobuf-c 0.14' | |
730 | 730 | PACKAGE_BUGREPORT='' |
731 | 731 | |
732 | 732 | # Factoring default headers for most tests. |
869 | 869 | ac_ct_F77 |
870 | 870 | LIBTOOL |
871 | 871 | PROTOC |
872 | BUILD_PROTOC_C_TRUE | |
873 | BUILD_PROTOC_C_FALSE | |
872 | 874 | LIBOBJS |
873 | 875 | LTLIBOBJS' |
874 | 876 | ac_subst_files='' |
1389 | 1391 | # Omit some internal or obsolete options to make the list less imposing. |
1390 | 1392 | # This message is too long to be a string in the A/UX 3.1 sh. |
1391 | 1393 | cat <<_ACEOF |
1392 | \`configure' configures protobuf-c 0.12 to adapt to many kinds of systems. | |
1394 | \`configure' configures protobuf-c 0.14 to adapt to many kinds of systems. | |
1393 | 1395 | |
1394 | 1396 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1395 | 1397 | |
1459 | 1461 | |
1460 | 1462 | if test -n "$ac_init_help"; then |
1461 | 1463 | case $ac_init_help in |
1462 | short | recursive ) echo "Configuration of protobuf-c 0.12:";; | |
1464 | short | recursive ) echo "Configuration of protobuf-c 0.14:";; | |
1463 | 1465 | esac |
1464 | 1466 | cat <<\_ACEOF |
1465 | 1467 | |
1473 | 1475 | --enable-fast-install[=PKGS] |
1474 | 1476 | optimize for fast installation [default=yes] |
1475 | 1477 | --disable-libtool-lock avoid locking (might break parallel builds) |
1478 | --disable-protoc Suppress build of protoc_c | |
1476 | 1479 | |
1477 | 1480 | Optional Packages: |
1478 | 1481 | --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] |
1560 | 1563 | test -n "$ac_init_help" && exit $ac_status |
1561 | 1564 | if $ac_init_version; then |
1562 | 1565 | cat <<\_ACEOF |
1563 | protobuf-c configure 0.12 | |
1566 | protobuf-c configure 0.14 | |
1564 | 1567 | generated by GNU Autoconf 2.61 |
1565 | 1568 | |
1566 | 1569 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, |
1574 | 1577 | This file contains any messages produced by compilers while |
1575 | 1578 | running configure, to aid debugging if configure makes a mistake. |
1576 | 1579 | |
1577 | It was created by protobuf-c $as_me 0.12, which was | |
1580 | It was created by protobuf-c $as_me 0.14, which was | |
1578 | 1581 | generated by GNU Autoconf 2.61. Invocation command line was |
1579 | 1582 | |
1580 | 1583 | $ $0 $@ |
2244 | 2247 | |
2245 | 2248 | # Define the identity of the package. |
2246 | 2249 | PACKAGE='protobuf-c' |
2247 | VERSION='0.12' | |
2250 | VERSION='0.14' | |
2248 | 2251 | |
2249 | 2252 | |
2250 | 2253 | cat >>confdefs.h <<_ACEOF |
4765 | 4768 | ;; |
4766 | 4769 | *-*-irix6*) |
4767 | 4770 | # Find out which ABI we are using. |
4768 | echo '#line 4769 "configure"' > conftest.$ac_ext | |
4771 | echo '#line 4772 "configure"' > conftest.$ac_ext | |
4769 | 4772 | if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 |
4770 | 4773 | (eval $ac_compile) 2>&5 |
4771 | 4774 | ac_status=$? |
7345 | 7348 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
7346 | 7349 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
7347 | 7350 | -e 's:$: $lt_compiler_flag:'` |
7348 | (eval echo "\"\$as_me:7349: $lt_compile\"" >&5) | |
7351 | (eval echo "\"\$as_me:7352: $lt_compile\"" >&5) | |
7349 | 7352 | (eval "$lt_compile" 2>conftest.err) |
7350 | 7353 | ac_status=$? |
7351 | 7354 | cat conftest.err >&5 |
7352 | echo "$as_me:7353: \$? = $ac_status" >&5 | |
7355 | echo "$as_me:7356: \$? = $ac_status" >&5 | |
7353 | 7356 | if (exit $ac_status) && test -s "$ac_outfile"; then |
7354 | 7357 | # The compiler can only warn and ignore the option if not recognized |
7355 | 7358 | # So say no if there are warnings other than the usual output. |
7635 | 7638 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
7636 | 7639 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
7637 | 7640 | -e 's:$: $lt_compiler_flag:'` |
7638 | (eval echo "\"\$as_me:7639: $lt_compile\"" >&5) | |
7641 | (eval echo "\"\$as_me:7642: $lt_compile\"" >&5) | |
7639 | 7642 | (eval "$lt_compile" 2>conftest.err) |
7640 | 7643 | ac_status=$? |
7641 | 7644 | cat conftest.err >&5 |
7642 | echo "$as_me:7643: \$? = $ac_status" >&5 | |
7645 | echo "$as_me:7646: \$? = $ac_status" >&5 | |
7643 | 7646 | if (exit $ac_status) && test -s "$ac_outfile"; then |
7644 | 7647 | # The compiler can only warn and ignore the option if not recognized |
7645 | 7648 | # So say no if there are warnings other than the usual output. |
7739 | 7742 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
7740 | 7743 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
7741 | 7744 | -e 's:$: $lt_compiler_flag:'` |
7742 | (eval echo "\"\$as_me:7743: $lt_compile\"" >&5) | |
7745 | (eval echo "\"\$as_me:7746: $lt_compile\"" >&5) | |
7743 | 7746 | (eval "$lt_compile" 2>out/conftest.err) |
7744 | 7747 | ac_status=$? |
7745 | 7748 | cat out/conftest.err >&5 |
7746 | echo "$as_me:7747: \$? = $ac_status" >&5 | |
7749 | echo "$as_me:7750: \$? = $ac_status" >&5 | |
7747 | 7750 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
7748 | 7751 | then |
7749 | 7752 | # The compiler can only warn and ignore the option if not recognized |
10116 | 10119 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
10117 | 10120 | lt_status=$lt_dlunknown |
10118 | 10121 | cat > conftest.$ac_ext <<EOF |
10119 | #line 10120 "configure" | |
10122 | #line 10123 "configure" | |
10120 | 10123 | #include "confdefs.h" |
10121 | 10124 | |
10122 | 10125 | #if HAVE_DLFCN_H |
10216 | 10219 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
10217 | 10220 | lt_status=$lt_dlunknown |
10218 | 10221 | cat > conftest.$ac_ext <<EOF |
10219 | #line 10220 "configure" | |
10222 | #line 10223 "configure" | |
10220 | 10223 | #include "confdefs.h" |
10221 | 10224 | |
10222 | 10225 | #if HAVE_DLFCN_H |
12617 | 12620 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
12618 | 12621 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
12619 | 12622 | -e 's:$: $lt_compiler_flag:'` |
12620 | (eval echo "\"\$as_me:12621: $lt_compile\"" >&5) | |
12623 | (eval echo "\"\$as_me:12624: $lt_compile\"" >&5) | |
12621 | 12624 | (eval "$lt_compile" 2>conftest.err) |
12622 | 12625 | ac_status=$? |
12623 | 12626 | cat conftest.err >&5 |
12624 | echo "$as_me:12625: \$? = $ac_status" >&5 | |
12627 | echo "$as_me:12628: \$? = $ac_status" >&5 | |
12625 | 12628 | if (exit $ac_status) && test -s "$ac_outfile"; then |
12626 | 12629 | # The compiler can only warn and ignore the option if not recognized |
12627 | 12630 | # So say no if there are warnings other than the usual output. |
12721 | 12724 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
12722 | 12725 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
12723 | 12726 | -e 's:$: $lt_compiler_flag:'` |
12724 | (eval echo "\"\$as_me:12725: $lt_compile\"" >&5) | |
12727 | (eval echo "\"\$as_me:12728: $lt_compile\"" >&5) | |
12725 | 12728 | (eval "$lt_compile" 2>out/conftest.err) |
12726 | 12729 | ac_status=$? |
12727 | 12730 | cat out/conftest.err >&5 |
12728 | echo "$as_me:12729: \$? = $ac_status" >&5 | |
12731 | echo "$as_me:12732: \$? = $ac_status" >&5 | |
12729 | 12732 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
12730 | 12733 | then |
12731 | 12734 | # The compiler can only warn and ignore the option if not recognized |
14319 | 14322 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
14320 | 14323 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
14321 | 14324 | -e 's:$: $lt_compiler_flag:'` |
14322 | (eval echo "\"\$as_me:14323: $lt_compile\"" >&5) | |
14325 | (eval echo "\"\$as_me:14326: $lt_compile\"" >&5) | |
14323 | 14326 | (eval "$lt_compile" 2>conftest.err) |
14324 | 14327 | ac_status=$? |
14325 | 14328 | cat conftest.err >&5 |
14326 | echo "$as_me:14327: \$? = $ac_status" >&5 | |
14329 | echo "$as_me:14330: \$? = $ac_status" >&5 | |
14327 | 14330 | if (exit $ac_status) && test -s "$ac_outfile"; then |
14328 | 14331 | # The compiler can only warn and ignore the option if not recognized |
14329 | 14332 | # So say no if there are warnings other than the usual output. |
14423 | 14426 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
14424 | 14427 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
14425 | 14428 | -e 's:$: $lt_compiler_flag:'` |
14426 | (eval echo "\"\$as_me:14427: $lt_compile\"" >&5) | |
14429 | (eval echo "\"\$as_me:14430: $lt_compile\"" >&5) | |
14427 | 14430 | (eval "$lt_compile" 2>out/conftest.err) |
14428 | 14431 | ac_status=$? |
14429 | 14432 | cat out/conftest.err >&5 |
14430 | echo "$as_me:14431: \$? = $ac_status" >&5 | |
14433 | echo "$as_me:14434: \$? = $ac_status" >&5 | |
14431 | 14434 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
14432 | 14435 | then |
14433 | 14436 | # The compiler can only warn and ignore the option if not recognized |
16643 | 16646 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
16644 | 16647 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
16645 | 16648 | -e 's:$: $lt_compiler_flag:'` |
16646 | (eval echo "\"\$as_me:16647: $lt_compile\"" >&5) | |
16649 | (eval echo "\"\$as_me:16650: $lt_compile\"" >&5) | |
16647 | 16650 | (eval "$lt_compile" 2>conftest.err) |
16648 | 16651 | ac_status=$? |
16649 | 16652 | cat conftest.err >&5 |
16650 | echo "$as_me:16651: \$? = $ac_status" >&5 | |
16653 | echo "$as_me:16654: \$? = $ac_status" >&5 | |
16651 | 16654 | if (exit $ac_status) && test -s "$ac_outfile"; then |
16652 | 16655 | # The compiler can only warn and ignore the option if not recognized |
16653 | 16656 | # So say no if there are warnings other than the usual output. |
16933 | 16936 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
16934 | 16937 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
16935 | 16938 | -e 's:$: $lt_compiler_flag:'` |
16936 | (eval echo "\"\$as_me:16937: $lt_compile\"" >&5) | |
16939 | (eval echo "\"\$as_me:16940: $lt_compile\"" >&5) | |
16937 | 16940 | (eval "$lt_compile" 2>conftest.err) |
16938 | 16941 | ac_status=$? |
16939 | 16942 | cat conftest.err >&5 |
16940 | echo "$as_me:16941: \$? = $ac_status" >&5 | |
16943 | echo "$as_me:16944: \$? = $ac_status" >&5 | |
16941 | 16944 | if (exit $ac_status) && test -s "$ac_outfile"; then |
16942 | 16945 | # The compiler can only warn and ignore the option if not recognized |
16943 | 16946 | # So say no if there are warnings other than the usual output. |
17037 | 17040 | -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
17038 | 17041 | -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
17039 | 17042 | -e 's:$: $lt_compiler_flag:'` |
17040 | (eval echo "\"\$as_me:17041: $lt_compile\"" >&5) | |
17043 | (eval echo "\"\$as_me:17044: $lt_compile\"" >&5) | |
17041 | 17044 | (eval "$lt_compile" 2>out/conftest.err) |
17042 | 17045 | ac_status=$? |
17043 | 17046 | cat out/conftest.err >&5 |
17044 | echo "$as_me:17045: \$? = $ac_status" >&5 | |
17047 | echo "$as_me:17048: \$? = $ac_status" >&5 | |
17045 | 17048 | if (exit $ac_status) && test -s out/conftest2.$ac_objext |
17046 | 17049 | then |
17047 | 17050 | # The compiler can only warn and ignore the option if not recognized |
20608 | 20611 | done |
20609 | 20612 | |
20610 | 20613 | |
20614 | BUILD_PROTOC_C=1 | |
20615 | # Check whether --enable-protoc was given. | |
20616 | if test "${enable_protoc+set}" = set; then | |
20617 | enableval=$enable_protoc; if test "x$enableval" = xno ; then | |
20618 | BUILD_PROTOC_C=0 | |
20619 | fi | |
20620 | fi | |
20621 | ||
20622 | ||
20623 | ||
20624 | if test $BUILD_PROTOC_C = 1; then | |
20625 | BUILD_PROTOC_C_TRUE= | |
20626 | BUILD_PROTOC_C_FALSE='#' | |
20627 | else | |
20628 | BUILD_PROTOC_C_TRUE='#' | |
20629 | BUILD_PROTOC_C_FALSE= | |
20630 | fi | |
20631 | ||
20632 | ||
20611 | 20633 | # --- Check for the protobuf library. --- |
20612 | ac_ext=cpp | |
20634 | if test $BUILD_PROTOC_C = 1; then | |
20635 | ac_ext=cpp | |
20613 | 20636 | ac_cpp='$CXXCPP $CPPFLAGS' |
20614 | 20637 | ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' |
20615 | 20638 | ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' |
20745 | 20768 | : |
20746 | 20769 | else |
20747 | 20770 | { { echo "$as_me:$LINENO: error: |
20748 | ERROR: protobuf headers are required. | |
20749 | ||
20750 | You must either install protobuf from google, | |
20751 | or if you have it installed in a custom location | |
20752 | you must add '-Iincludedir' to CXXFLAGS | |
20753 | and '-Llibdir' to LDFLAGS. | |
20754 | " >&5 | |
20771 | ERROR: protobuf headers are required. | |
20772 | ||
20773 | You must either install protobuf from google, | |
20774 | or if you have it installed in a custom location | |
20775 | you must add '-Iincludedir' to CXXFLAGS | |
20776 | and '-Llibdir' to LDFLAGS. | |
20777 | ||
20778 | If you did not specify a prefix when installing | |
20779 | protobuf, try | |
20780 | './configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib' | |
20781 | In some 64-bit environments, try LDFLAGS=-L/usr/local/lib64. | |
20782 | " >&5 | |
20755 | 20783 | echo "$as_me: error: |
20756 | ERROR: protobuf headers are required. | |
20757 | ||
20758 | You must either install protobuf from google, | |
20759 | or if you have it installed in a custom location | |
20760 | you must add '-Iincludedir' to CXXFLAGS | |
20761 | and '-Llibdir' to LDFLAGS. | |
20762 | " >&2;} | |
20784 | ERROR: protobuf headers are required. | |
20785 | ||
20786 | You must either install protobuf from google, | |
20787 | or if you have it installed in a custom location | |
20788 | you must add '-Iincludedir' to CXXFLAGS | |
20789 | and '-Llibdir' to LDFLAGS. | |
20790 | ||
20791 | If you did not specify a prefix when installing | |
20792 | protobuf, try | |
20793 | './configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib' | |
20794 | In some 64-bit environments, try LDFLAGS=-L/usr/local/lib64. | |
20795 | " >&2;} | |
20763 | 20796 | { (exit 1); exit 1; }; } |
20764 | 20797 | fi |
20765 | 20798 | |
20766 | 20799 | |
20767 | pbc_savelibs="$LIBS" | |
20768 | LIBS="$LIBS -lprotoc -lprotobuf -lpthread" | |
20769 | cat >conftest.$ac_ext <<_ACEOF | |
20800 | pbc_savelibs="$LIBS" | |
20801 | LIBS="$LIBS -lprotoc -lprotobuf -lpthread" | |
20802 | cat >conftest.$ac_ext <<_ACEOF | |
20770 | 20803 | /* confdefs.h. */ |
20771 | 20804 | _ACEOF |
20772 | 20805 | cat confdefs.h >>conftest.$ac_ext |
20805 | 20838 | sed 's/^/| /' conftest.$ac_ext >&5 |
20806 | 20839 | |
20807 | 20840 | { { echo "$as_me:$LINENO: error: |
20808 | ERROR: | |
20809 | protobuf test program failed to link: | |
20810 | perhaps you need to add -Llibdir to your LDFLAGS." >&5 | |
20841 | ERROR: | |
20842 | protobuf test program failed to link: | |
20843 | perhaps you need to add -Llibdir to your LDFLAGS." >&5 | |
20811 | 20844 | echo "$as_me: error: |
20812 | ERROR: | |
20813 | protobuf test program failed to link: | |
20814 | perhaps you need to add -Llibdir to your LDFLAGS." >&2;} | |
20845 | ERROR: | |
20846 | protobuf test program failed to link: | |
20847 | perhaps you need to add -Llibdir to your LDFLAGS." >&2;} | |
20815 | 20848 | { (exit 1); exit 1; }; } |
20816 | 20849 | fi |
20817 | 20850 | |
20818 | 20851 | rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ |
20819 | 20852 | conftest$ac_exeext conftest.$ac_ext |
20820 | LIBS="$pbc_savelibs" | |
20821 | ac_ext=c | |
20853 | LIBS="$pbc_savelibs" | |
20854 | ac_ext=c | |
20822 | 20855 | ac_cpp='$CPP $CPPFLAGS' |
20823 | 20856 | ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' |
20824 | 20857 | ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' |
20825 | 20858 | ac_compiler_gnu=$ac_cv_c_compiler_gnu |
20826 | 20859 | |
20827 | 20860 | |
20828 | if test -n $PROTOC; then | |
20829 | { echo "$as_me:$LINENO: checking which version of protoc is installed" >&5 | |
20830 | echo $ECHO_N "checking which version of protoc is installed... $ECHO_C" >&6; } | |
20831 | raw_vers=`protoc --version 2>/dev/null | sed -e 's/libprotoc //'` | |
20832 | vers=`echo $raw_vers | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` | |
20833 | cat >>confdefs.h <<_ACEOF | |
20834 | #define PROTOC_VERSION $vers | |
20835 | _ACEOF | |
20836 | ||
20837 | { echo "$as_me:$LINENO: result: $raw_vers" >&5 | |
20838 | echo "${ECHO_T}$raw_vers" >&6; } | |
20839 | fi | |
20840 | ||
20861 | if test "x$PROTOC" = x; then | |
20862 | echo "ERROR: missing google's protoc program; adjust \$PATH (or use --disable-protoc)" 1>&2 | |
20863 | exit 1 | |
20864 | fi | |
20865 | fi | |
20841 | 20866 | |
20842 | 20867 | # We try to use, where possible the headers <endian.h>, <mach/endian.h>, |
20843 | 20868 | # and <machine/endian.h>, in that order. They must define the macros |
21483 | 21508 | _ACEOF |
21484 | 21509 | |
21485 | 21510 | |
21486 | ac_config_files="$ac_config_files Makefile src/Makefile src/test/Makefile pkgwriteinfo" | |
21511 | ac_config_files="$ac_config_files Makefile src/Makefile src/test/Makefile pkgwriteinfo libprotobuf-c.pc" | |
21487 | 21512 | |
21488 | 21513 | cat >confcache <<\_ACEOF |
21489 | 21514 | # This file is a shell script that caches the results of configure |
21632 | 21657 | Usually this means the macro was only invoked conditionally." >&2;} |
21633 | 21658 | { (exit 1); exit 1; }; } |
21634 | 21659 | fi |
21660 | if test -z "${BUILD_PROTOC_C_TRUE}" && test -z "${BUILD_PROTOC_C_FALSE}"; then | |
21661 | { { echo "$as_me:$LINENO: error: conditional \"BUILD_PROTOC_C\" was never defined. | |
21662 | Usually this means the macro was only invoked conditionally." >&5 | |
21663 | echo "$as_me: error: conditional \"BUILD_PROTOC_C\" was never defined. | |
21664 | Usually this means the macro was only invoked conditionally." >&2;} | |
21665 | { (exit 1); exit 1; }; } | |
21666 | fi | |
21635 | 21667 | |
21636 | 21668 | : ${CONFIG_STATUS=./config.status} |
21637 | 21669 | ac_clean_files_save=$ac_clean_files |
21932 | 21964 | # report actual input values of CONFIG_FILES etc. instead of their |
21933 | 21965 | # values after options handling. |
21934 | 21966 | ac_log=" |
21935 | This file was extended by protobuf-c $as_me 0.12, which was | |
21967 | This file was extended by protobuf-c $as_me 0.14, which was | |
21936 | 21968 | generated by GNU Autoconf 2.61. Invocation command line was |
21937 | 21969 | |
21938 | 21970 | CONFIG_FILES = $CONFIG_FILES |
21979 | 22011 | _ACEOF |
21980 | 22012 | cat >>$CONFIG_STATUS <<_ACEOF |
21981 | 22013 | ac_cs_version="\\ |
21982 | protobuf-c config.status 0.12 | |
22014 | protobuf-c config.status 0.14 | |
21983 | 22015 | configured by $0, generated by GNU Autoconf 2.61, |
21984 | 22016 | with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" |
21985 | 22017 | |
22088 | 22120 | "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; |
22089 | 22121 | "src/test/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;; |
22090 | 22122 | "pkgwriteinfo") CONFIG_FILES="$CONFIG_FILES pkgwriteinfo" ;; |
22123 | "libprotobuf-c.pc") CONFIG_FILES="$CONFIG_FILES libprotobuf-c.pc" ;; | |
22091 | 22124 | |
22092 | 22125 | *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 |
22093 | 22126 | echo "$as_me: error: invalid argument: $ac_config_target" >&2;} |
22294 | 22327 | ac_ct_F77!$ac_ct_F77$ac_delim |
22295 | 22328 | LIBTOOL!$LIBTOOL$ac_delim |
22296 | 22329 | PROTOC!$PROTOC$ac_delim |
22330 | BUILD_PROTOC_C_TRUE!$BUILD_PROTOC_C_TRUE$ac_delim | |
22331 | BUILD_PROTOC_C_FALSE!$BUILD_PROTOC_C_FALSE$ac_delim | |
22297 | 22332 | LIBOBJS!$LIBOBJS$ac_delim |
22298 | 22333 | LTLIBOBJS!$LTLIBOBJS$ac_delim |
22299 | 22334 | _ACEOF |
22300 | 22335 | |
22301 | if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 9; then | |
22336 | if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 11; then | |
22302 | 22337 | break |
22303 | 22338 | elif $ac_last_try; then |
22304 | 22339 | { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 |
0 | AC_INIT([protobuf-c], [0.12]) | |
0 | AC_INIT([protobuf-c], [0.14]) | |
1 | 1 | AM_INIT_AUTOMAKE([1.9 foreign]) |
2 | 2 | PACKAGE=protobuf-c |
3 | 3 | AC_PROG_CC |
11 | 11 | AC_CHECK_HEADERS(malloc.h) |
12 | 12 | AC_CHECK_HEADERS(winsock.h) |
13 | 13 | |
14 | BUILD_PROTOC_C=1 | |
15 | AC_ARG_ENABLE(protoc, [ --disable-protoc Suppress build of protoc_c], | |
16 | if test "x$enableval" = xno ; then | |
17 | BUILD_PROTOC_C=0 | |
18 | fi) | |
19 | AM_CONDITIONAL(BUILD_PROTOC_C, test $BUILD_PROTOC_C = 1) | |
20 | ||
14 | 21 | # --- Check for the protobuf library. --- |
15 | AC_LANG_PUSH([C++]) | |
16 | AC_CHECK_HEADER(google/protobuf/stubs/common.h,, | |
17 | [AC_MSG_ERROR([ | |
18 | ERROR: protobuf headers are required. | |
22 | if test $BUILD_PROTOC_C = 1; then | |
23 | AC_LANG_PUSH([C++]) | |
24 | AC_CHECK_HEADER(google/protobuf/stubs/common.h,, | |
25 | [AC_MSG_ERROR([ | |
26 | ERROR: protobuf headers are required. | |
19 | 27 | |
20 | You must either install protobuf from google, | |
21 | or if you have it installed in a custom location | |
22 | you must add '-Iincludedir' to CXXFLAGS | |
23 | and '-Llibdir' to LDFLAGS. | |
24 | ])]) | |
25 | pbc_savelibs="$LIBS" | |
26 | LIBS="$LIBS -lprotoc -lprotobuf -lpthread" | |
27 | AC_TRY_LINK([#include <google/protobuf/compiler/command_line_interface.h>], | |
28 | [google::protobuf::compiler::CommandLineInterface cli;], | |
29 | [], | |
30 | [AC_MSG_ERROR([ | |
31 | ERROR: | |
32 | protobuf test program failed to link: | |
33 | perhaps you need to add -Llibdir to your LDFLAGS.])]) | |
34 | LIBS="$pbc_savelibs" | |
35 | AC_LANG_POP() | |
28 | You must either install protobuf from google, | |
29 | or if you have it installed in a custom location | |
30 | you must add '-Iincludedir' to CXXFLAGS | |
31 | and '-Llibdir' to LDFLAGS. | |
36 | 32 | |
37 | dnl Determine the version of the protoc compiler. | |
38 | dnl (only needed for c++ packed-data comparison) | |
39 | if test -n $PROTOC; then | |
40 | AC_MSG_CHECKING([which version of protoc is installed]) | |
41 | raw_vers=`protoc --version 2>/dev/null | sed -e 's/libprotoc //'` | |
42 | vers=`echo $raw_vers | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` | |
43 | AC_DEFINE_UNQUOTED([PROTOC_VERSION], [$vers]) | |
44 | AC_MSG_RESULT([$raw_vers]) | |
33 | If you did not specify a prefix when installing | |
34 | protobuf, try | |
35 | './configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib' | |
36 | In some 64-bit environments, try LDFLAGS=-L/usr/local/lib64. | |
37 | ])]) | |
38 | pbc_savelibs="$LIBS" | |
39 | LIBS="$LIBS -lprotoc -lprotobuf -lpthread" | |
40 | AC_TRY_LINK([#include <google/protobuf/compiler/command_line_interface.h>], | |
41 | [google::protobuf::compiler::CommandLineInterface cli;], | |
42 | [], | |
43 | [AC_MSG_ERROR([ | |
44 | ERROR: | |
45 | protobuf test program failed to link: | |
46 | perhaps you need to add -Llibdir to your LDFLAGS.])]) | |
47 | LIBS="$pbc_savelibs" | |
48 | AC_LANG_POP() | |
49 | ||
50 | dnl We need $PROTOC around for the test code generation. | |
51 | dnl This is merely needed for c++ packed-data comparison. | |
52 | if test "x$PROTOC" = x; then | |
53 | echo "ERROR: missing google's protoc program; adjust \$PATH (or use --disable-protoc)" 1>&2 | |
54 | exit 1 | |
55 | fi | |
45 | 56 | fi |
46 | ||
47 | 57 | |
48 | 58 | dnl ------ define IS_LITTLE_ENDIAN ------ |
49 | 59 | # We try to use, where possible the headers <endian.h>, <mach/endian.h>, |
103 | 113 | fi |
104 | 114 | AC_DEFINE_UNQUOTED(IS_LITTLE_ENDIAN, $is_little_endian) |
105 | 115 | |
106 | AC_OUTPUT( Makefile src/Makefile src/test/Makefile pkgwriteinfo ) | |
116 | AC_OUTPUT(Makefile src/Makefile src/test/Makefile pkgwriteinfo libprotobuf-c.pc) | |
107 | 117 | |
108 | 118 |
0 | prefix=@prefix@ | |
1 | exec_prefix=@exec_prefix@ | |
2 | libdir=@libdir@ | |
3 | includedir=@includedir@ | |
4 | ||
5 | Name: libprotobuf-c | |
6 | Description: C-API for Google's protocol buffers | |
7 | Version: @VERSION@ | |
8 | URL: http://code.google.com/p/protobuf-c/ | |
9 | Requires: | |
10 | Libs: -L${libdir} -lprotobuf-c | |
11 | Cflags: -I${includedir} | |
12 |
0 | 0 | 9 |
1 | 1 | |
2 | 2 | dir |
3 | 196 | |
3 | 245 | |
4 | 4 | https://protobuf-c.googlecode.com/svn/trunk/scripts |
5 | 5 | https://protobuf-c.googlecode.com/svn |
6 | 6 |
0 | if BUILD_PROTOC_C | |
0 | 1 | SUBDIRS = . test |
1 | 2 | bin_PROGRAMS = protoc-c |
2 | lib_LTLIBRARIES = libprotobuf-c.la | |
3 | protobufcincludedir = $(includedir)/google/protobuf-c | |
4 | 3 | protoc_c_SOURCES = \ |
5 | 4 | google/protobuf/compiler/c/c_service.cc \ |
6 | 5 | google/protobuf/compiler/c/c_helpers.cc \ |
16 | 15 | google/protobuf/compiler/c/c_message_field.cc \ |
17 | 16 | google/protobuf/compiler/c/main.cc \ |
18 | 17 | google/protobuf/compiler/c/c_bytes_field.cc |
19 | ||
20 | 18 | protoc_c_LDADD = \ |
21 | 19 | -lprotoc -lprotobuf -lpthread |
20 | endif | |
21 | ||
22 | lib_LTLIBRARIES = libprotobuf-c.la | |
23 | protobufcincludedir = $(includedir)/google/protobuf-c | |
24 | ||
22 | 25 | |
23 | 26 | libprotobuf_c_la_SOURCES = \ |
24 | 27 | google/protobuf-c/protobuf-c-dispatch.c \ |
37 | 37 | POST_UNINSTALL = : |
38 | 38 | build_triplet = @build@ |
39 | 39 | host_triplet = @host@ |
40 | bin_PROGRAMS = protoc-c$(EXEEXT) | |
40 | @BUILD_PROTOC_C_TRUE@bin_PROGRAMS = protoc-c$(EXEEXT) | |
41 | 41 | subdir = src |
42 | 42 | DIST_COMMON = $(noinst_HEADERS) $(protobufcinclude_HEADERS) \ |
43 | 43 | $(srcdir)/Makefile.am $(srcdir)/Makefile.in compile |
63 | 63 | libprotobuf_c_la_OBJECTS = $(am_libprotobuf_c_la_OBJECTS) |
64 | 64 | binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) |
65 | 65 | PROGRAMS = $(bin_PROGRAMS) |
66 | am_protoc_c_OBJECTS = c_service.$(OBJEXT) c_helpers.$(OBJEXT) \ | |
67 | c_enum.$(OBJEXT) c_enum_field.$(OBJEXT) \ | |
68 | c_string_field.$(OBJEXT) c_primitive_field.$(OBJEXT) \ | |
69 | c_extension.$(OBJEXT) c_file.$(OBJEXT) c_field.$(OBJEXT) \ | |
70 | c_message.$(OBJEXT) c_generator.$(OBJEXT) \ | |
71 | c_message_field.$(OBJEXT) main.$(OBJEXT) \ | |
72 | c_bytes_field.$(OBJEXT) | |
66 | am__protoc_c_SOURCES_DIST = google/protobuf/compiler/c/c_service.cc \ | |
67 | google/protobuf/compiler/c/c_helpers.cc \ | |
68 | google/protobuf/compiler/c/c_enum.cc \ | |
69 | google/protobuf/compiler/c/c_enum_field.cc \ | |
70 | google/protobuf/compiler/c/c_string_field.cc \ | |
71 | google/protobuf/compiler/c/c_primitive_field.cc \ | |
72 | google/protobuf/compiler/c/c_extension.cc \ | |
73 | google/protobuf/compiler/c/c_file.cc \ | |
74 | google/protobuf/compiler/c/c_field.cc \ | |
75 | google/protobuf/compiler/c/c_message.cc \ | |
76 | google/protobuf/compiler/c/c_generator.cc \ | |
77 | google/protobuf/compiler/c/c_message_field.cc \ | |
78 | google/protobuf/compiler/c/main.cc \ | |
79 | google/protobuf/compiler/c/c_bytes_field.cc | |
80 | @BUILD_PROTOC_C_TRUE@am_protoc_c_OBJECTS = c_service.$(OBJEXT) \ | |
81 | @BUILD_PROTOC_C_TRUE@ c_helpers.$(OBJEXT) c_enum.$(OBJEXT) \ | |
82 | @BUILD_PROTOC_C_TRUE@ c_enum_field.$(OBJEXT) \ | |
83 | @BUILD_PROTOC_C_TRUE@ c_string_field.$(OBJEXT) \ | |
84 | @BUILD_PROTOC_C_TRUE@ c_primitive_field.$(OBJEXT) \ | |
85 | @BUILD_PROTOC_C_TRUE@ c_extension.$(OBJEXT) c_file.$(OBJEXT) \ | |
86 | @BUILD_PROTOC_C_TRUE@ c_field.$(OBJEXT) c_message.$(OBJEXT) \ | |
87 | @BUILD_PROTOC_C_TRUE@ c_generator.$(OBJEXT) \ | |
88 | @BUILD_PROTOC_C_TRUE@ c_message_field.$(OBJEXT) main.$(OBJEXT) \ | |
89 | @BUILD_PROTOC_C_TRUE@ c_bytes_field.$(OBJEXT) | |
73 | 90 | protoc_c_OBJECTS = $(am_protoc_c_OBJECTS) |
74 | 91 | protoc_c_DEPENDENCIES = |
75 | 92 | DEFAULT_INCLUDES = -I. -I$(srcdir) |
92 | 109 | CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ |
93 | 110 | $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ |
94 | 111 | SOURCES = $(libprotobuf_c_la_SOURCES) $(protoc_c_SOURCES) |
95 | DIST_SOURCES = $(libprotobuf_c_la_SOURCES) $(protoc_c_SOURCES) | |
112 | DIST_SOURCES = $(libprotobuf_c_la_SOURCES) \ | |
113 | $(am__protoc_c_SOURCES_DIST) | |
96 | 114 | RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ |
97 | 115 | html-recursive info-recursive install-data-recursive \ |
98 | 116 | install-exec-recursive install-info-recursive \ |
103 | 121 | HEADERS = $(noinst_HEADERS) $(protobufcinclude_HEADERS) |
104 | 122 | ETAGS = etags |
105 | 123 | CTAGS = ctags |
106 | DIST_SUBDIRS = $(SUBDIRS) | |
124 | DIST_SUBDIRS = . test | |
107 | 125 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
108 | 126 | ACLOCAL = @ACLOCAL@ |
109 | 127 | AMDEP_FALSE = @AMDEP_FALSE@ |
114 | 132 | AUTOHEADER = @AUTOHEADER@ |
115 | 133 | AUTOMAKE = @AUTOMAKE@ |
116 | 134 | AWK = @AWK@ |
135 | BUILD_PROTOC_C_FALSE = @BUILD_PROTOC_C_FALSE@ | |
136 | BUILD_PROTOC_C_TRUE = @BUILD_PROTOC_C_TRUE@ | |
117 | 137 | CC = @CC@ |
118 | 138 | CCDEPMODE = @CCDEPMODE@ |
119 | 139 | CFLAGS = @CFLAGS@ |
210 | 230 | sharedstatedir = @sharedstatedir@ |
211 | 231 | sysconfdir = @sysconfdir@ |
212 | 232 | target_alias = @target_alias@ |
213 | SUBDIRS = . test | |
233 | @BUILD_PROTOC_C_TRUE@SUBDIRS = . test | |
234 | @BUILD_PROTOC_C_TRUE@protoc_c_SOURCES = \ | |
235 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_service.cc \ | |
236 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_helpers.cc \ | |
237 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_enum.cc \ | |
238 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_enum_field.cc \ | |
239 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_string_field.cc \ | |
240 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_primitive_field.cc \ | |
241 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_extension.cc \ | |
242 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_file.cc \ | |
243 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_field.cc \ | |
244 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_message.cc \ | |
245 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_generator.cc \ | |
246 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_message_field.cc \ | |
247 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/main.cc \ | |
248 | @BUILD_PROTOC_C_TRUE@google/protobuf/compiler/c/c_bytes_field.cc | |
249 | ||
250 | @BUILD_PROTOC_C_TRUE@protoc_c_LDADD = \ | |
251 | @BUILD_PROTOC_C_TRUE@-lprotoc -lprotobuf -lpthread | |
252 | ||
214 | 253 | lib_LTLIBRARIES = libprotobuf-c.la |
215 | 254 | protobufcincludedir = $(includedir)/google/protobuf-c |
216 | protoc_c_SOURCES = \ | |
217 | google/protobuf/compiler/c/c_service.cc \ | |
218 | google/protobuf/compiler/c/c_helpers.cc \ | |
219 | google/protobuf/compiler/c/c_enum.cc \ | |
220 | google/protobuf/compiler/c/c_enum_field.cc \ | |
221 | google/protobuf/compiler/c/c_string_field.cc \ | |
222 | google/protobuf/compiler/c/c_primitive_field.cc \ | |
223 | google/protobuf/compiler/c/c_extension.cc \ | |
224 | google/protobuf/compiler/c/c_file.cc \ | |
225 | google/protobuf/compiler/c/c_field.cc \ | |
226 | google/protobuf/compiler/c/c_message.cc \ | |
227 | google/protobuf/compiler/c/c_generator.cc \ | |
228 | google/protobuf/compiler/c/c_message_field.cc \ | |
229 | google/protobuf/compiler/c/main.cc \ | |
230 | google/protobuf/compiler/c/c_bytes_field.cc | |
231 | ||
232 | protoc_c_LDADD = \ | |
233 | -lprotoc -lprotobuf -lpthread | |
234 | ||
235 | 255 | libprotobuf_c_la_SOURCES = \ |
236 | 256 | google/protobuf-c/protobuf-c-dispatch.c \ |
237 | 257 | google/protobuf-c/protobuf-c-data-buffer.c \ |
37 | 37 | (*variables)["name"] = FieldName(descriptor); |
38 | 38 | (*variables)["default"] = |
39 | 39 | "\"" + CEscape(descriptor->default_value_string()) + "\""; |
40 | (*variables)["deprecated"] = FieldDeprecated(descriptor); | |
40 | 41 | } |
41 | 42 | |
42 | 43 | // =================================================================== |
56 | 57 | { |
57 | 58 | switch (descriptor_->label()) { |
58 | 59 | case FieldDescriptor::LABEL_REQUIRED: |
59 | printer->Print(variables_, "ProtobufCBinaryData $name$;\n"); | |
60 | printer->Print(variables_, "ProtobufCBinaryData $name$$deprecated$;\n"); | |
60 | 61 | break; |
61 | 62 | case FieldDescriptor::LABEL_OPTIONAL: |
62 | printer->Print(variables_, "protobuf_c_boolean has_$name$;\n"); | |
63 | printer->Print(variables_, "ProtobufCBinaryData $name$;\n"); | |
63 | printer->Print(variables_, "protobuf_c_boolean has_$name$$deprecated$;\n"); | |
64 | printer->Print(variables_, "ProtobufCBinaryData $name$$deprecated$;\n"); | |
64 | 65 | break; |
65 | 66 | case FieldDescriptor::LABEL_REPEATED: |
66 | printer->Print(variables_, "size_t n_$name$;\n"); | |
67 | printer->Print(variables_, "ProtobufCBinaryData *$name$;\n"); | |
67 | printer->Print(variables_, "size_t n_$name$$deprecated$;\n"); | |
68 | printer->Print(variables_, "ProtobufCBinaryData *$name$$deprecated$;\n"); | |
68 | 69 | break; |
69 | 70 | } |
70 | 71 | } |
44 | 44 | + "__" + ToUpper(default_value->name()); |
45 | 45 | } else |
46 | 46 | (*variables)["default"] = "0"; |
47 | (*variables)["deprecated"] = FieldDeprecated(descriptor); | |
47 | 48 | } |
48 | 49 | |
49 | 50 | // =================================================================== |
61 | 62 | { |
62 | 63 | switch (descriptor_->label()) { |
63 | 64 | case FieldDescriptor::LABEL_REQUIRED: |
64 | printer->Print(variables_, "$type$ $name$;\n"); | |
65 | printer->Print(variables_, "$type$ $name$$deprecated$;\n"); | |
65 | 66 | break; |
66 | 67 | case FieldDescriptor::LABEL_OPTIONAL: |
67 | printer->Print(variables_, "protobuf_c_boolean has_$name$;\n"); | |
68 | printer->Print(variables_, "$type$ $name$;\n"); | |
68 | printer->Print(variables_, "protobuf_c_boolean has_$name$$deprecated$;\n"); | |
69 | printer->Print(variables_, "$type$ $name$$deprecated$;\n"); | |
69 | 70 | break; |
70 | 71 | case FieldDescriptor::LABEL_REPEATED: |
71 | printer->Print(variables_, "size_t n_$name$;\n"); | |
72 | printer->Print(variables_, "$type$ *$name$;\n"); | |
72 | printer->Print(variables_, "size_t n_$name$$deprecated$;\n"); | |
73 | printer->Print(variables_, "$type$ *$name$$deprecated$;\n"); | |
73 | 74 | break; |
74 | 75 | } |
75 | 76 | } |
38 | 38 | FieldGenerator::~FieldGenerator() |
39 | 39 | { |
40 | 40 | } |
41 | static bool is_packable_type(FieldDescriptor::Type type) | |
42 | { | |
43 | return type == FieldDescriptor::TYPE_DOUBLE | |
44 | || type == FieldDescriptor::TYPE_FLOAT | |
45 | || type == FieldDescriptor::TYPE_INT64 | |
46 | || type == FieldDescriptor::TYPE_UINT64 | |
47 | || type == FieldDescriptor::TYPE_INT32 | |
48 | || type == FieldDescriptor::TYPE_FIXED64 | |
49 | || type == FieldDescriptor::TYPE_FIXED32 | |
50 | || type == FieldDescriptor::TYPE_BOOL | |
51 | || type == FieldDescriptor::TYPE_UINT32 | |
52 | || type == FieldDescriptor::TYPE_ENUM | |
53 | || type == FieldDescriptor::TYPE_SFIXED32 | |
54 | || type == FieldDescriptor::TYPE_SFIXED64 | |
55 | || type == FieldDescriptor::TYPE_SINT32 | |
56 | || type == FieldDescriptor::TYPE_SINT64; | |
57 | //TYPE_BYTES | |
58 | //TYPE_STRING | |
59 | //TYPE_GROUP | |
60 | //TYPE_MESSAGE | |
61 | } | |
41 | 62 | |
42 | 63 | void FieldGenerator::GenerateDescriptorInitializerGeneric(io::Printer* printer, |
43 | 64 | bool optional_uses_has, |
61 | 82 | variables["default_value"] = "NULL"; |
62 | 83 | } |
63 | 84 | |
85 | if (descriptor_->label() == FieldDescriptor::LABEL_REPEATED | |
86 | && is_packable_type (descriptor_->type()) | |
87 | && descriptor_->options().packed()) | |
88 | variables["packed"] = "1"; | |
89 | else | |
90 | variables["packed"] = "0"; | |
91 | ||
64 | 92 | printer->Print(variables, |
65 | 93 | "{\n" |
66 | 94 | " \"$proto_name$\",\n" |
67 | 95 | " $value$,\n" |
68 | 96 | " PROTOBUF_C_LABEL_$LABEL$,\n" |
69 | 97 | " PROTOBUF_C_TYPE_$TYPE$,\n"); |
98 | bool packed = false; | |
70 | 99 | switch (descriptor_->label()) { |
71 | 100 | case FieldDescriptor::LABEL_REQUIRED: |
72 | 101 | printer->Print(variables, " 0, /* quantifier_offset */\n"); |
85 | 114 | printer->Print(variables, " PROTOBUF_C_OFFSETOF($classname$, $name$),\n"); |
86 | 115 | printer->Print(variables, " $descriptor_addr$,\n"); |
87 | 116 | printer->Print(variables, " $default_value$,\n"); |
88 | printer->Print(variables, " NULL,NULL /* reserved1, reserved2 */\n"); | |
117 | printer->Print(variables, " $packed$, /* packed */\n"); | |
118 | printer->Print(variables, " 0,NULL,NULL /* reserved1,reserved2, etc */\n"); | |
89 | 119 | printer->Print("},\n"); |
90 | 120 | } |
91 | 121 |
179 | 179 | void FileGenerator::GenerateSource(io::Printer* printer) { |
180 | 180 | printer->Print( |
181 | 181 | "/* Generated by the protocol buffer compiler. DO NOT EDIT! */\n" |
182 | "\n" | |
183 | "/* Do not generate deprecated warnings for self */\n" | |
184 | "#ifndef PROTOBUF_C_NO_DEPRECATED\n" | |
185 | "#define PROTOBUF_C_NO_DEPRECATED\n" | |
186 | "#endif\n" | |
182 | 187 | "\n" |
183 | 188 | "#include \"$basename$.pb-c.h\"\n", |
184 | 189 | "basename", StripProto(file_->name())); |
235 | 235 | result.append("_"); |
236 | 236 | } |
237 | 237 | return result; |
238 | } | |
239 | ||
240 | string FieldDeprecated(const FieldDescriptor* field) { | |
241 | if (field->options().deprecated()) { | |
242 | return " PROTOBUF_C_DEPRECATED"; | |
243 | } | |
244 | return ""; | |
238 | 245 | } |
239 | 246 | |
240 | 247 | string StripProto(const string& filename) { |
25 | 25 | #include <string> |
26 | 26 | #include <vector> |
27 | 27 | #include <google/protobuf/descriptor.h> |
28 | #include <google/protobuf/descriptor.pb.h> | |
28 | 29 | #include <google/protobuf/io/printer.h> |
29 | 30 | |
30 | 31 | namespace google { |
60 | 61 | // should be using lowercase-with-underscores style for proto field names |
61 | 62 | // anyway, so normally this just returns field->name(). |
62 | 63 | string FieldName(const FieldDescriptor* field); |
64 | ||
65 | // Get macro string for deprecated field | |
66 | string FieldDeprecated(const FieldDescriptor* field); | |
63 | 67 | |
64 | 68 | // Returns the scope where the field was defined (for extensions, this is |
65 | 69 | // different from the message type to which the field applies). |
45 | 45 | map<string, string> vars; |
46 | 46 | vars["name"] = FieldName(descriptor_); |
47 | 47 | vars["type"] = FullNameToC(descriptor_->message_type()->full_name()); |
48 | vars["deprecated"] = FieldDeprecated(descriptor_); | |
48 | 49 | switch (descriptor_->label()) { |
49 | 50 | case FieldDescriptor::LABEL_REQUIRED: |
50 | 51 | case FieldDescriptor::LABEL_OPTIONAL: |
51 | printer->Print(vars, "$type$ *$name$;\n"); | |
52 | printer->Print(vars, "$type$ *$name$$deprecated$;\n"); | |
52 | 53 | break; |
53 | 54 | case FieldDescriptor::LABEL_REPEATED: |
54 | printer->Print(vars, "size_t n_$name$;\n"); | |
55 | printer->Print(vars, "$type$ **$name$;\n"); | |
55 | printer->Print(vars, "size_t n_$name$$deprecated$;\n"); | |
56 | printer->Print(vars, "$type$ **$name$$deprecated$;\n"); | |
56 | 57 | break; |
57 | 58 | } |
58 | 59 | } |
65 | 65 | } |
66 | 66 | vars["c_type"] = c_type; |
67 | 67 | vars["name"] = FieldName(descriptor_); |
68 | vars["deprecated"] = FieldDeprecated(descriptor_); | |
68 | 69 | |
69 | 70 | switch (descriptor_->label()) { |
70 | 71 | case FieldDescriptor::LABEL_REQUIRED: |
71 | printer->Print(vars, "$c_type$ $name$;\n"); | |
72 | printer->Print(vars, "$c_type$ $name$$deprecated$;\n"); | |
72 | 73 | break; |
73 | 74 | case FieldDescriptor::LABEL_OPTIONAL: |
74 | printer->Print(vars, "protobuf_c_boolean has_$name$;\n"); | |
75 | printer->Print(vars, "$c_type$ $name$;\n"); | |
75 | printer->Print(vars, "protobuf_c_boolean has_$name$$deprecated$;\n"); | |
76 | printer->Print(vars, "$c_type$ $name$$deprecated$;\n"); | |
76 | 77 | break; |
77 | 78 | case FieldDescriptor::LABEL_REPEATED: |
78 | printer->Print(vars, "size_t n_$name$;\n"); | |
79 | printer->Print(vars, "$c_type$ *$name$;\n"); | |
79 | printer->Print(vars, "size_t n_$name$$deprecated$;\n"); | |
80 | printer->Print(vars, "$c_type$ *$name$$deprecated$;\n"); | |
80 | 81 | break; |
81 | 82 | } |
82 | 83 | } |
37 | 37 | (*variables)["name"] = FieldName(descriptor); |
38 | 38 | (*variables)["default"] = FullNameToLower(descriptor->full_name()) |
39 | 39 | + "__default_value"; |
40 | (*variables)["deprecated"] = FieldDeprecated(descriptor); | |
40 | 41 | } |
41 | 42 | |
42 | 43 | // =================================================================== |
54 | 55 | switch (descriptor_->label()) { |
55 | 56 | case FieldDescriptor::LABEL_REQUIRED: |
56 | 57 | case FieldDescriptor::LABEL_OPTIONAL: |
57 | printer->Print(variables_, "char *$name$;\n"); | |
58 | printer->Print(variables_, "char *$name$$deprecated$;\n"); | |
58 | 59 | break; |
59 | 60 | case FieldDescriptor::LABEL_REPEATED: |
60 | printer->Print(variables_, "size_t n_$name$;\n"); | |
61 | printer->Print(variables_, "char **$name$;\n"); | |
61 | printer->Print(variables_, "size_t n_$name$$deprecated$;\n"); | |
62 | printer->Print(variables_, "char **$name$$deprecated$;\n"); | |
62 | 63 | break; |
63 | 64 | } |
64 | 65 | } |
299 | 299 | { |
300 | 300 | unsigned new_size = d->notifies_desired_alloced * 2; |
301 | 301 | ProtobufC_FDNotify *n = ALLOC (new_size * sizeof (ProtobufC_FDNotify)); |
302 | Callback *c = ALLOC (new_size * sizeof (Callback)); | |
302 | 303 | memcpy (n, d->base.notifies_desired, d->notifies_desired_alloced * sizeof (ProtobufC_FDNotify)); |
303 | 304 | FREE (d->base.notifies_desired); |
305 | memcpy (c, d->callbacks, d->notifies_desired_alloced * sizeof (Callback)); | |
306 | FREE (d->callbacks); | |
304 | 307 | d->base.notifies_desired = n; |
308 | d->callbacks = c; | |
305 | 309 | d->notifies_desired_alloced = new_size; |
306 | 310 | } |
307 | 311 | #if DEBUG_DISPATCH_INTERNALS |
372 | 376 | unsigned ch_ind = fm->change_index; |
373 | 377 | unsigned from = d->base.n_changes - 1; |
374 | 378 | ProtobufC_FD from_fd; |
379 | fm->change_index = -1; | |
375 | 380 | if (ch_ind == from) |
376 | 381 | { |
377 | 382 | d->base.n_changes--; |
404 | 409 | from_fd = d->base.notifies_desired[from].fd; |
405 | 410 | get_fd_map (d, from_fd)->notify_desired_index = nd_ind; |
406 | 411 | d->base.notifies_desired[nd_ind] = d->base.notifies_desired[from]; |
412 | d->callbacks[nd_ind] = d->callbacks[from]; | |
407 | 413 | d->base.n_notifies_desired--; |
408 | 414 | } |
409 | 415 |
447 | 447 | return le; |
448 | 448 | #else |
449 | 449 | return (le << 24) | (le >> 24) |
450 | | ((le >> 8) & 0xff0000) | |
451 | | ((le << 8) & 0xff00); | |
450 | | ((le >> 8) & 0xff00) | |
451 | | ((le << 8) & 0xff0000); | |
452 | 452 | #endif |
453 | 453 | } |
454 | 454 | #define uint32_from_le uint32_to_le /* make the code more readable, i guess */ |
776 | 776 | client->autoreconnect = 1; |
777 | 777 | client->autoreconnect_millis = millis; |
778 | 778 | } |
779 | ||
780 | ||
781 | void | |
782 | protobuf_c_rpc_client_set_error_handler (ProtobufC_RPC_Client *client, | |
783 | ProtobufC_RPC_Error_Func func, | |
784 | void *func_data) | |
785 | { | |
786 | client->error_handler = func; | |
787 | client->error_handler_data = func_data; | |
788 | } | |
789 | ||
779 | 790 | void |
780 | 791 | protobuf_c_rpc_client_disable_autoreconnect (ProtobufC_RPC_Client *client) |
781 | 792 | { |
1342 | 1353 | |
1343 | 1354 | return rv; |
1344 | 1355 | } |
1356 | ||
1357 | void | |
1358 | protobuf_c_rpc_server_set_error_handler (ProtobufC_RPC_Server *server, | |
1359 | ProtobufC_RPC_Error_Func func, | |
1360 | void *error_func_data) | |
1361 | { | |
1362 | server->error_handler = func; | |
1363 | server->error_handler_data = error_func_data; | |
1364 | } |
45 | 45 | ProtobufCService *protobuf_c_rpc_client_new (ProtobufC_RPC_AddressType type, |
46 | 46 | const char *name, |
47 | 47 | const ProtobufCServiceDescriptor *descriptor, |
48 | ProtobufCDispatch *dispatch); | |
48 | ProtobufCDispatch *dispatch /* or NULL */ | |
49 | ); | |
49 | 50 | |
50 | 51 | /* forcing the client to connect */ |
51 | 52 | typedef enum |
100 | 101 | protobuf_c_rpc_server_new (ProtobufC_RPC_AddressType type, |
101 | 102 | const char *name, |
102 | 103 | ProtobufCService *service, |
103 | ProtobufCDispatch *dispatch); | |
104 | ProtobufCDispatch *dispatch /* or NULL */ | |
105 | ); | |
104 | 106 | ProtobufCService * |
105 | 107 | protobuf_c_rpc_server_destroy (ProtobufC_RPC_Server *server, |
106 | 108 | protobuf_c_boolean free_underlying_service); |
14 | 14 | * under the License. |
15 | 15 | */ |
16 | 16 | |
17 | /* TODO: certain implementations use 32-bit math even for | |
18 | (uint64_size, uint64_pack, parse_uint64) */ | |
19 | ||
20 | /* TODO: get_packed_size and pack seem to use type-prefixed names, | |
21 | whereas parse uses type-suffixed names. pick one and stick with it. | |
22 | Decision: go with type-suffixed, since the type (or its instance) | |
23 | is typically the object of the verb. | |
24 | NOTE: perhaps the "parse" methods should be reanemd to "unpack" | |
25 | at the same time. | |
17 | /* TODO items: | |
18 | ||
19 | * 64-BIT OPTIMIZATION: certain implementations use 32-bit math even on 64-bit platforms | |
20 | (uint64_size, uint64_pack, parse_uint64) | |
21 | ||
22 | * get_packed_size and pack seem to use type-prefixed names, | |
23 | whereas parse uses type-suffixed names. pick one and stick with it. | |
24 | Decision: go with type-suffixed, since the type (or its instance) | |
25 | is typically the object of the verb. | |
26 | NOTE: perhaps the "parse" methods should be reanemd to "unpack" | |
27 | at the same time. (this only affects internal (static) functions) | |
28 | ||
29 | * use TRUE and FALSE instead of 1 and 0 as appropriate | |
30 | ||
31 | * use size_t consistently | |
26 | 32 | */ |
27 | 33 | |
28 | 34 | #include <stdio.h> /* for occasional printf()s */ |
372 | 378 | size_t count, |
373 | 379 | const void *member) |
374 | 380 | { |
375 | size_t rv = get_tag_size (field->id) * count; | |
381 | size_t header_size; | |
382 | size_t rv = 0; | |
376 | 383 | unsigned i; |
377 | 384 | void *array = * (void * const *) member; |
385 | if (count == 0) | |
386 | return 0; | |
387 | header_size = get_tag_size (field->id); | |
388 | if (!field->packed) | |
389 | header_size *= count; | |
378 | 390 | switch (field->type) |
379 | 391 | { |
380 | 392 | case PROTOBUF_C_TYPE_SINT32: |
436 | 448 | break; |
437 | 449 | //case PROTOBUF_C_TYPE_GROUP: // NOT SUPPORTED |
438 | 450 | } |
439 | return rv; | |
451 | if (field->packed) | |
452 | header_size += uint32_size (rv); | |
453 | return header_size + rv; | |
440 | 454 | } |
441 | 455 | |
442 | 456 | /* Get the packed size of a unknown field (meaning one that |
465 | 479 | rv += required_field_get_packed_size (field, member); |
466 | 480 | else if (field->label == PROTOBUF_C_LABEL_OPTIONAL) |
467 | 481 | rv += optional_field_get_packed_size (field, qmember, member); |
468 | else | |
482 | else | |
469 | 483 | rv += repeated_field_get_packed_size (field, * (const size_t *) qmember, member); |
470 | 484 | } |
471 | 485 | for (i = 0; i < message->n_unknown_fields; i++) |
472 | 486 | rv += unknown_field_get_packed_size (&message->unknown_fields[i]); |
473 | ||
474 | 487 | return rv; |
475 | 488 | } |
476 | 489 | /* === pack() === */ |
800 | 813 | return 0; |
801 | 814 | } |
802 | 815 | |
816 | static void | |
817 | copy_to_little_endian_32 (void *out, const void *in, unsigned N) | |
818 | { | |
819 | #if IS_LITTLE_ENDIAN | |
820 | memcpy (out, in, N * 4); | |
821 | #else | |
822 | unsigned i; | |
823 | const uint32_t *ini = in; | |
824 | for (i = 0; i < N; i++) | |
825 | fixed32_pack (ini[i], (uint32_t*)out + i); | |
826 | #endif | |
827 | } | |
828 | static void | |
829 | copy_to_little_endian_64 (void *out, const void *in, unsigned N) | |
830 | { | |
831 | #if IS_LITTLE_ENDIAN | |
832 | memcpy (out, in, N * 8); | |
833 | #else | |
834 | unsigned i; | |
835 | const uint64_t *ini = in; | |
836 | for (i = 0; i < N; i++) | |
837 | fixed64_pack (ini[i], (uint64_t*)out + i); | |
838 | #endif | |
839 | } | |
840 | ||
841 | static unsigned | |
842 | get_type_min_size (ProtobufCType type) | |
843 | { | |
844 | if (type == PROTOBUF_C_TYPE_SFIXED32 | |
845 | || type == PROTOBUF_C_TYPE_FIXED32 | |
846 | || type == PROTOBUF_C_TYPE_FLOAT) | |
847 | return 4; | |
848 | if (type == PROTOBUF_C_TYPE_SFIXED64 | |
849 | || type == PROTOBUF_C_TYPE_FIXED64 | |
850 | || type == PROTOBUF_C_TYPE_DOUBLE) | |
851 | return 8; | |
852 | return 1; | |
853 | } | |
854 | ||
803 | 855 | static size_t |
804 | 856 | repeated_field_pack (const ProtobufCFieldDescriptor *field, |
805 | 857 | size_t count, |
807 | 859 | uint8_t *out) |
808 | 860 | { |
809 | 861 | char *array = * (char * const *) member; |
810 | size_t siz; | |
811 | 862 | unsigned i; |
812 | size_t rv = 0; | |
813 | /* CONSIDER: optimize this case a bit (by putting the loop inside the switch) */ | |
814 | siz = sizeof_elt_in_repeated_array (field->type); | |
815 | for (i = 0; i < count; i++) | |
816 | { | |
817 | rv += required_field_pack (field, array, out + rv); | |
818 | array += siz; | |
819 | } | |
820 | return rv; | |
863 | if (field->packed) | |
864 | { | |
865 | unsigned header_len; | |
866 | unsigned len_start; | |
867 | unsigned min_length; | |
868 | unsigned payload_len; | |
869 | unsigned length_size_min; | |
870 | unsigned actual_length_size; | |
871 | uint8_t *payload_at; | |
872 | if (count == 0) | |
873 | return 0; | |
874 | header_len = tag_pack (field->id, out); | |
875 | out[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; | |
876 | len_start = header_len; | |
877 | min_length = get_type_min_size (field->type) * count; | |
878 | length_size_min = uint32_size (min_length); | |
879 | header_len += length_size_min; | |
880 | payload_at = out + header_len; | |
881 | switch (field->type) | |
882 | { | |
883 | case PROTOBUF_C_TYPE_SFIXED32: | |
884 | case PROTOBUF_C_TYPE_FIXED32: | |
885 | case PROTOBUF_C_TYPE_FLOAT: | |
886 | copy_to_little_endian_32 (payload_at, array, count); | |
887 | payload_at += count * 4; | |
888 | break; | |
889 | ||
890 | case PROTOBUF_C_TYPE_SFIXED64: | |
891 | case PROTOBUF_C_TYPE_FIXED64: | |
892 | case PROTOBUF_C_TYPE_DOUBLE: | |
893 | copy_to_little_endian_64 (payload_at, array, count); | |
894 | payload_at += count * 8; | |
895 | break; | |
896 | ||
897 | case PROTOBUF_C_TYPE_INT32: | |
898 | { | |
899 | const int32_t *arr = (const int32_t *) array; | |
900 | for (i = 0; i < count; i++) | |
901 | payload_at += int32_pack (arr[i], payload_at); | |
902 | } | |
903 | break; | |
904 | ||
905 | case PROTOBUF_C_TYPE_SINT32: | |
906 | { | |
907 | const int32_t *arr = (const int32_t *) array; | |
908 | for (i = 0; i < count; i++) | |
909 | payload_at += sint32_pack (arr[i], payload_at); | |
910 | } | |
911 | break; | |
912 | ||
913 | case PROTOBUF_C_TYPE_SINT64: | |
914 | { | |
915 | const int64_t *arr = (const int64_t *) array; | |
916 | for (i = 0; i < count; i++) | |
917 | payload_at += sint64_pack (arr[i], payload_at); | |
918 | } | |
919 | break; | |
920 | case PROTOBUF_C_TYPE_ENUM: | |
921 | case PROTOBUF_C_TYPE_UINT32: | |
922 | { | |
923 | const uint32_t *arr = (const uint32_t *) array; | |
924 | for (i = 0; i < count; i++) | |
925 | payload_at += uint32_pack (arr[i], payload_at); | |
926 | } | |
927 | break; | |
928 | case PROTOBUF_C_TYPE_INT64: | |
929 | case PROTOBUF_C_TYPE_UINT64: | |
930 | { | |
931 | const uint64_t *arr = (const uint64_t *) array; | |
932 | for (i = 0; i < count; i++) | |
933 | payload_at += uint64_pack (arr[i], payload_at); | |
934 | } | |
935 | break; | |
936 | case PROTOBUF_C_TYPE_BOOL: | |
937 | { | |
938 | const protobuf_c_boolean *arr = (const protobuf_c_boolean *) array; | |
939 | for (i = 0; i < count; i++) | |
940 | payload_at += boolean_pack (arr[i], payload_at); | |
941 | } | |
942 | break; | |
943 | ||
944 | default: | |
945 | assert (0); | |
946 | } | |
947 | payload_len = payload_at - (out + header_len); | |
948 | actual_length_size = uint32_size (payload_len); | |
949 | if (length_size_min != actual_length_size) | |
950 | { | |
951 | assert (actual_length_size == length_size_min + 1); | |
952 | memmove (out + header_len + 1, out + header_len, payload_len); | |
953 | header_len++; | |
954 | } | |
955 | uint32_pack (payload_len, out + len_start); | |
956 | return header_len + payload_len; | |
957 | } | |
958 | else | |
959 | { | |
960 | /* CONSIDER: optimize this case a bit (by putting the loop inside the switch) */ | |
961 | size_t rv = 0; | |
962 | unsigned siz = sizeof_elt_in_repeated_array (field->type); | |
963 | for (i = 0; i < count; i++) | |
964 | { | |
965 | rv += required_field_pack (field, array, out + rv); | |
966 | array += siz; | |
967 | } | |
968 | return rv; | |
969 | } | |
821 | 970 | } |
822 | 971 | static size_t |
823 | 972 | unknown_field_pack (const ProtobufCMessageUnknownField *field, |
991 | 1140 | } |
992 | 1141 | |
993 | 1142 | static size_t |
1143 | get_packed_payload_length (const ProtobufCFieldDescriptor *field, | |
1144 | unsigned count, | |
1145 | const void *array) | |
1146 | { | |
1147 | unsigned rv = 0; | |
1148 | unsigned i; | |
1149 | switch (field->type) | |
1150 | { | |
1151 | case PROTOBUF_C_TYPE_SFIXED32: | |
1152 | case PROTOBUF_C_TYPE_FIXED32: | |
1153 | case PROTOBUF_C_TYPE_FLOAT: | |
1154 | return count * 4; | |
1155 | ||
1156 | case PROTOBUF_C_TYPE_SFIXED64: | |
1157 | case PROTOBUF_C_TYPE_FIXED64: | |
1158 | case PROTOBUF_C_TYPE_DOUBLE: | |
1159 | return count * 8; | |
1160 | ||
1161 | case PROTOBUF_C_TYPE_INT32: | |
1162 | { | |
1163 | const int32_t *arr = (const int32_t *) array; | |
1164 | for (i = 0; i < count; i++) | |
1165 | rv += int32_size (arr[i]); | |
1166 | } | |
1167 | break; | |
1168 | ||
1169 | case PROTOBUF_C_TYPE_SINT32: | |
1170 | { | |
1171 | const int32_t *arr = (const int32_t *) array; | |
1172 | for (i = 0; i < count; i++) | |
1173 | rv += sint32_size (arr[i]); | |
1174 | } | |
1175 | break; | |
1176 | case PROTOBUF_C_TYPE_ENUM: | |
1177 | case PROTOBUF_C_TYPE_UINT32: | |
1178 | { | |
1179 | const uint32_t *arr = (const uint32_t *) array; | |
1180 | for (i = 0; i < count; i++) | |
1181 | rv += uint32_size (arr[i]); | |
1182 | } | |
1183 | break; | |
1184 | ||
1185 | case PROTOBUF_C_TYPE_SINT64: | |
1186 | { | |
1187 | const int64_t *arr = (const int64_t *) array; | |
1188 | for (i = 0; i < count; i++) | |
1189 | rv += sint64_size (arr[i]); | |
1190 | } | |
1191 | break; | |
1192 | case PROTOBUF_C_TYPE_INT64: | |
1193 | case PROTOBUF_C_TYPE_UINT64: | |
1194 | { | |
1195 | const uint64_t *arr = (const uint64_t *) array; | |
1196 | for (i = 0; i < count; i++) | |
1197 | rv += uint64_size (arr[i]); | |
1198 | } | |
1199 | break; | |
1200 | case PROTOBUF_C_TYPE_BOOL: | |
1201 | return count; | |
1202 | default: | |
1203 | assert (0); | |
1204 | } | |
1205 | return rv; | |
1206 | } | |
1207 | static size_t | |
1208 | pack_buffer_packed_payload (const ProtobufCFieldDescriptor *field, | |
1209 | unsigned count, | |
1210 | const void *array, | |
1211 | ProtobufCBuffer *buffer) | |
1212 | { | |
1213 | uint8_t scratch[16]; | |
1214 | size_t rv = 0; | |
1215 | unsigned i; | |
1216 | switch (field->type) | |
1217 | { | |
1218 | case PROTOBUF_C_TYPE_SFIXED32: | |
1219 | case PROTOBUF_C_TYPE_FIXED32: | |
1220 | case PROTOBUF_C_TYPE_FLOAT: | |
1221 | #if IS_LITTLE_ENDIAN | |
1222 | rv = count * 4; | |
1223 | goto no_packing_needed; | |
1224 | #else | |
1225 | for (i = 0; i < count; i++) | |
1226 | { | |
1227 | unsigned len = fixed32_pack (((uint32_t*)array)[i], scratch); | |
1228 | buffer->append (buffer, len, scratch); | |
1229 | rv += len; | |
1230 | } | |
1231 | #endif | |
1232 | break; | |
1233 | case PROTOBUF_C_TYPE_SFIXED64: | |
1234 | case PROTOBUF_C_TYPE_FIXED64: | |
1235 | case PROTOBUF_C_TYPE_DOUBLE: | |
1236 | #if IS_LITTLE_ENDIAN | |
1237 | rv = count * 8; | |
1238 | goto no_packing_needed; | |
1239 | #else | |
1240 | for (i = 0; i < count; i++) | |
1241 | { | |
1242 | unsigned len = fixed64_pack (((uint64_t*)array)[i], scratch); | |
1243 | buffer->append (buffer, len, scratch); | |
1244 | rv += len; | |
1245 | } | |
1246 | break; | |
1247 | #endif | |
1248 | case PROTOBUF_C_TYPE_INT32: | |
1249 | for (i = 0; i < count; i++) | |
1250 | { | |
1251 | unsigned len = int32_pack (((int32_t*)array)[i], scratch); | |
1252 | buffer->append (buffer, len, scratch); | |
1253 | rv += len; | |
1254 | } | |
1255 | break; | |
1256 | ||
1257 | case PROTOBUF_C_TYPE_SINT32: | |
1258 | for (i = 0; i < count; i++) | |
1259 | { | |
1260 | unsigned len = sint32_pack (((int32_t*)array)[i], scratch); | |
1261 | buffer->append (buffer, len, scratch); | |
1262 | rv += len; | |
1263 | } | |
1264 | break; | |
1265 | case PROTOBUF_C_TYPE_ENUM: | |
1266 | case PROTOBUF_C_TYPE_UINT32: | |
1267 | for (i = 0; i < count; i++) | |
1268 | { | |
1269 | unsigned len = uint32_pack (((uint32_t*)array)[i], scratch); | |
1270 | buffer->append (buffer, len, scratch); | |
1271 | rv += len; | |
1272 | } | |
1273 | break; | |
1274 | ||
1275 | case PROTOBUF_C_TYPE_SINT64: | |
1276 | for (i = 0; i < count; i++) | |
1277 | { | |
1278 | unsigned len = sint64_pack (((int64_t*)array)[i], scratch); | |
1279 | buffer->append (buffer, len, scratch); | |
1280 | rv += len; | |
1281 | } | |
1282 | break; | |
1283 | case PROTOBUF_C_TYPE_INT64: | |
1284 | case PROTOBUF_C_TYPE_UINT64: | |
1285 | for (i = 0; i < count; i++) | |
1286 | { | |
1287 | unsigned len = uint64_pack (((uint64_t*)array)[i], scratch); | |
1288 | buffer->append (buffer, len, scratch); | |
1289 | rv += len; | |
1290 | } | |
1291 | break; | |
1292 | case PROTOBUF_C_TYPE_BOOL: | |
1293 | for (i = 0; i < count; i++) | |
1294 | { | |
1295 | unsigned len = boolean_pack (((protobuf_c_boolean*)array)[i], scratch); | |
1296 | buffer->append (buffer, len, scratch); | |
1297 | rv += len; | |
1298 | } | |
1299 | return count; | |
1300 | default: | |
1301 | assert(0); | |
1302 | } | |
1303 | return rv; | |
1304 | ||
1305 | no_packing_needed: | |
1306 | buffer->append (buffer, rv, array); | |
1307 | return rv; | |
1308 | } | |
1309 | ||
1310 | static size_t | |
994 | 1311 | repeated_field_pack_to_buffer (const ProtobufCFieldDescriptor *field, |
995 | 1312 | unsigned count, |
996 | 1313 | const void *member, |
997 | 1314 | ProtobufCBuffer *buffer) |
998 | 1315 | { |
999 | 1316 | char *array = * (char * const *) member; |
1000 | size_t siz; | |
1001 | unsigned i; | |
1002 | /* CONSIDER: optimize this case a bit (by putting the loop inside the switch) */ | |
1003 | unsigned rv = 0; | |
1004 | siz = sizeof_elt_in_repeated_array (field->type); | |
1005 | for (i = 0; i < count; i++) | |
1006 | { | |
1007 | rv += required_field_pack_to_buffer (field, array, buffer); | |
1008 | array += siz; | |
1009 | } | |
1010 | return rv; | |
1317 | if (count == 0) | |
1318 | return 0; | |
1319 | if (field->packed) | |
1320 | { | |
1321 | uint8_t scratch[MAX_UINT64_ENCODED_SIZE * 2]; | |
1322 | size_t rv = tag_pack (field->id, scratch); | |
1323 | size_t payload_len = get_packed_payload_length (field, count, array); | |
1324 | size_t tmp; | |
1325 | scratch[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; | |
1326 | rv += uint32_pack (payload_len, scratch + rv); | |
1327 | buffer->append (buffer, rv, scratch); | |
1328 | tmp = pack_buffer_packed_payload (field, count, array, buffer); | |
1329 | assert (tmp == payload_len); | |
1330 | return rv + payload_len; | |
1331 | } | |
1332 | else | |
1333 | { | |
1334 | size_t siz; | |
1335 | unsigned i; | |
1336 | /* CONSIDER: optimize this case a bit (by putting the loop inside the switch) */ | |
1337 | unsigned rv = 0; | |
1338 | siz = sizeof_elt_in_repeated_array (field->type); | |
1339 | for (i = 0; i < count; i++) | |
1340 | { | |
1341 | rv += required_field_pack_to_buffer (field, array, buffer); | |
1342 | array += siz; | |
1343 | } | |
1344 | return rv; | |
1345 | } | |
1011 | 1346 | } |
1012 | 1347 | |
1013 | 1348 | static size_t |
1137 | 1472 | const uint8_t *data; |
1138 | 1473 | }; |
1139 | 1474 | |
1140 | #define MESSAGE_GET_UNKNOWNS(message) \ | |
1141 | STRUCT_MEMBER_PTR (ProtobufCMessageUnknownFieldArray, \ | |
1142 | (message), (message)->descriptor->unknown_field_array_offset) | |
1143 | ||
1144 | 1475 | static inline uint32_t |
1145 | 1476 | scan_length_prefixed_data (size_t len, const uint8_t *data, size_t *prefix_len_out) |
1146 | 1477 | { |
1170 | 1501 | return 0; |
1171 | 1502 | } |
1172 | 1503 | return hdr_len + val; |
1504 | } | |
1505 | ||
1506 | static size_t | |
1507 | max_b128_numbers (size_t len, const uint8_t *data) | |
1508 | { | |
1509 | size_t rv = 0; | |
1510 | while (len--) | |
1511 | if ((*data++ & 0x80) == 0) | |
1512 | ++rv; | |
1513 | return rv; | |
1514 | } | |
1515 | ||
1516 | ||
1517 | /* Given a raw slab of packed-repeated values, | |
1518 | determine the number of elements. | |
1519 | This function detects certain kinds of errors | |
1520 | but not others; the remaining error checking is done by | |
1521 | parse_packed_repeated_member() */ | |
1522 | static protobuf_c_boolean | |
1523 | count_packed_elements (ProtobufCType type, | |
1524 | size_t len, | |
1525 | const uint8_t *data, | |
1526 | size_t *count_out) | |
1527 | { | |
1528 | switch (type) | |
1529 | { | |
1530 | case PROTOBUF_C_TYPE_SFIXED32: | |
1531 | case PROTOBUF_C_TYPE_FIXED32: | |
1532 | case PROTOBUF_C_TYPE_FLOAT: | |
1533 | if (len % 4 != 0) | |
1534 | { | |
1535 | UNPACK_ERROR (("length must be a multiple of 4 for fixed-length 32-bit types")); | |
1536 | return FALSE; | |
1537 | } | |
1538 | *count_out = len / 4; | |
1539 | return TRUE; | |
1540 | ||
1541 | case PROTOBUF_C_TYPE_SFIXED64: | |
1542 | case PROTOBUF_C_TYPE_FIXED64: | |
1543 | case PROTOBUF_C_TYPE_DOUBLE: | |
1544 | if (len % 8 != 0) | |
1545 | { | |
1546 | UNPACK_ERROR (("length must be a multiple of 8 for fixed-length 64-bit types")); | |
1547 | return FALSE; | |
1548 | } | |
1549 | *count_out = len / 8; | |
1550 | return TRUE; | |
1551 | ||
1552 | case PROTOBUF_C_TYPE_INT32: | |
1553 | case PROTOBUF_C_TYPE_SINT32: | |
1554 | case PROTOBUF_C_TYPE_ENUM: | |
1555 | case PROTOBUF_C_TYPE_UINT32: | |
1556 | case PROTOBUF_C_TYPE_INT64: | |
1557 | case PROTOBUF_C_TYPE_SINT64: | |
1558 | case PROTOBUF_C_TYPE_UINT64: | |
1559 | *count_out = max_b128_numbers (len, data); | |
1560 | return TRUE; | |
1561 | case PROTOBUF_C_TYPE_BOOL: | |
1562 | *count_out = len; | |
1563 | return TRUE; | |
1564 | ||
1565 | case PROTOBUF_C_TYPE_STRING: | |
1566 | case PROTOBUF_C_TYPE_BYTES: | |
1567 | case PROTOBUF_C_TYPE_MESSAGE: | |
1568 | default: | |
1569 | UNPACK_ERROR (("bad protobuf-c type %u for packed-repeated", type)); | |
1570 | return FALSE; | |
1571 | } | |
1173 | 1572 | } |
1174 | 1573 | |
1175 | 1574 | static inline uint32_t |
1416 | 1815 | return 1; |
1417 | 1816 | } |
1418 | 1817 | |
1818 | static unsigned scan_varint (unsigned len, const uint8_t *data) | |
1819 | { | |
1820 | unsigned i; | |
1821 | if (len > 10) | |
1822 | len = 10; | |
1823 | for (i = 0; i < len; i++) | |
1824 | if ((data[i] & 0x80) == 0) | |
1825 | break; | |
1826 | if (i == len) | |
1827 | return 0; | |
1828 | return i + 1; | |
1829 | } | |
1830 | ||
1831 | static protobuf_c_boolean | |
1832 | parse_packed_repeated_member (ScannedMember *scanned_member, | |
1833 | void *member, | |
1834 | ProtobufCMessage *message) | |
1835 | { | |
1836 | const ProtobufCFieldDescriptor *field = scanned_member->field; | |
1837 | size_t *p_n = STRUCT_MEMBER_PTR(size_t, message, field->quantifier_offset); | |
1838 | size_t siz = sizeof_elt_in_repeated_array (field->type); | |
1839 | char *array = *(char**)member + siz * (*p_n); | |
1840 | const uint8_t *at = scanned_member->data + scanned_member->length_prefix_len; | |
1841 | size_t rem = scanned_member->len - scanned_member->length_prefix_len; | |
1842 | size_t count = 0; | |
1843 | unsigned i; | |
1844 | switch (field->type) | |
1845 | { | |
1846 | case PROTOBUF_C_TYPE_SFIXED32: | |
1847 | case PROTOBUF_C_TYPE_FIXED32: | |
1848 | case PROTOBUF_C_TYPE_FLOAT: | |
1849 | count = (scanned_member->len - scanned_member->length_prefix_len) / 4; | |
1850 | #if IS_LITTLE_ENDIAN | |
1851 | goto no_unpacking_needed; | |
1852 | #else | |
1853 | for (i = 0; i < count; i++) | |
1854 | { | |
1855 | ((uint32_t*)array)[i] = parse_fixed_uint32 (at); | |
1856 | at += 4; | |
1857 | } | |
1858 | #endif | |
1859 | break; | |
1860 | case PROTOBUF_C_TYPE_SFIXED64: | |
1861 | case PROTOBUF_C_TYPE_FIXED64: | |
1862 | case PROTOBUF_C_TYPE_DOUBLE: | |
1863 | count = (scanned_member->len - scanned_member->length_prefix_len) / 8; | |
1864 | #if IS_LITTLE_ENDIAN | |
1865 | goto no_unpacking_needed; | |
1866 | #else | |
1867 | for (i = 0; i < count; i++) | |
1868 | { | |
1869 | ((uint64_t*)array)[i] = parse_fixed_uint64 (at); | |
1870 | at += 8; | |
1871 | } | |
1872 | break; | |
1873 | #endif | |
1874 | case PROTOBUF_C_TYPE_INT32: | |
1875 | while (rem > 0) | |
1876 | { | |
1877 | unsigned s = scan_varint (rem, at); | |
1878 | if (s == 0) | |
1879 | { | |
1880 | UNPACK_ERROR (("bad packed-repeated int32 value")); | |
1881 | return FALSE; | |
1882 | } | |
1883 | ((int32_t*)array)[count++] = parse_int32 (s, at); | |
1884 | at += s; | |
1885 | rem -= s; | |
1886 | } | |
1887 | break; | |
1888 | ||
1889 | case PROTOBUF_C_TYPE_SINT32: | |
1890 | while (rem > 0) | |
1891 | { | |
1892 | unsigned s = scan_varint (rem, at); | |
1893 | if (s == 0) | |
1894 | { | |
1895 | UNPACK_ERROR (("bad packed-repeated sint32 value")); | |
1896 | return FALSE; | |
1897 | } | |
1898 | ((int32_t*)array)[count++] = unzigzag32 (parse_uint32 (s, at)); | |
1899 | at += s; | |
1900 | rem -= s; | |
1901 | } | |
1902 | break; | |
1903 | case PROTOBUF_C_TYPE_ENUM: | |
1904 | case PROTOBUF_C_TYPE_UINT32: | |
1905 | while (rem > 0) | |
1906 | { | |
1907 | unsigned s = scan_varint (rem, at); | |
1908 | if (s == 0) | |
1909 | { | |
1910 | UNPACK_ERROR (("bad packed-repeated enum or uint32 value")); | |
1911 | return FALSE; | |
1912 | } | |
1913 | ((uint32_t*)array)[count++] = parse_uint32 (s, at); | |
1914 | at += s; | |
1915 | rem -= s; | |
1916 | } | |
1917 | break; | |
1918 | ||
1919 | case PROTOBUF_C_TYPE_SINT64: | |
1920 | while (rem > 0) | |
1921 | { | |
1922 | unsigned s = scan_varint (rem, at); | |
1923 | if (s == 0) | |
1924 | { | |
1925 | UNPACK_ERROR (("bad packed-repeated sint64 value")); | |
1926 | return FALSE; | |
1927 | } | |
1928 | ((int64_t*)array)[count++] = unzigzag64 (parse_uint64 (s, at)); | |
1929 | at += s; | |
1930 | rem -= s; | |
1931 | } | |
1932 | break; | |
1933 | case PROTOBUF_C_TYPE_INT64: | |
1934 | case PROTOBUF_C_TYPE_UINT64: | |
1935 | while (rem > 0) | |
1936 | { | |
1937 | unsigned s = scan_varint (rem, at); | |
1938 | if (s == 0) | |
1939 | { | |
1940 | UNPACK_ERROR (("bad packed-repeated int64/uint64 value")); | |
1941 | return FALSE; | |
1942 | } | |
1943 | ((int64_t*)array)[count++] = parse_uint64 (s, at); | |
1944 | at += s; | |
1945 | rem -= s; | |
1946 | } | |
1947 | break; | |
1948 | case PROTOBUF_C_TYPE_BOOL: | |
1949 | count = rem; | |
1950 | for (i = 0; i < count; i++) | |
1951 | { | |
1952 | if (at[i] > 1) | |
1953 | { | |
1954 | UNPACK_ERROR (("bad packed-repeated boolean value")); | |
1955 | return FALSE; | |
1956 | } | |
1957 | ((protobuf_c_boolean*)array)[i] = at[i]; | |
1958 | } | |
1959 | break; | |
1960 | default: | |
1961 | assert(0); | |
1962 | } | |
1963 | *p_n += count; | |
1964 | return TRUE; | |
1965 | ||
1966 | no_unpacking_needed: | |
1967 | memcpy (array, at, count * siz); | |
1968 | *p_n += count; | |
1969 | return TRUE; | |
1970 | } | |
1971 | ||
1419 | 1972 | static protobuf_c_boolean |
1420 | 1973 | parse_member (ScannedMember *scanned_member, |
1421 | 1974 | ProtobufCMessage *message, |
1441 | 1994 | case PROTOBUF_C_LABEL_OPTIONAL: |
1442 | 1995 | return parse_optional_member (scanned_member, member, message, allocator); |
1443 | 1996 | case PROTOBUF_C_LABEL_REPEATED: |
1444 | return parse_repeated_member (scanned_member, member, message, allocator); | |
1997 | if (field->packed | |
1998 | && scanned_member->wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) | |
1999 | return parse_packed_repeated_member (scanned_member, member, message); | |
2000 | else | |
2001 | return parse_repeated_member (scanned_member, member, message, allocator); | |
1445 | 2002 | } |
1446 | 2003 | PROTOBUF_C_ASSERT_NOT_REACHED (); |
1447 | 2004 | return 0; |
1448 | 2005 | } |
1449 | 2006 | |
1450 | static inline void | |
1451 | setup_default_values (ProtobufCMessage *message) | |
1452 | { | |
1453 | const ProtobufCMessageDescriptor *desc = message->descriptor; | |
2007 | ||
2008 | /* TODO: expose/use this function if desc->message_init==NULL | |
2009 | (which occurs for old code, and may be useful for certain | |
2010 | programatic techniques for generating descriptors). */ | |
2011 | void | |
2012 | protobuf_c_message_init_generic (const ProtobufCMessageDescriptor *desc, | |
2013 | ProtobufCMessage *message) | |
2014 | { | |
1454 | 2015 | unsigned i; |
2016 | memset (message, 0, desc->sizeof_message); | |
2017 | message->descriptor = desc; | |
1455 | 2018 | for (i = 0; i < desc->n_fields; i++) |
1456 | 2019 | if (desc->fields[i].default_value != NULL |
1457 | 2020 | && desc->fields[i].label != PROTOBUF_C_LABEL_REPEATED) |
1539 | 2102 | size_t n_unknown = 0; |
1540 | 2103 | unsigned f; |
1541 | 2104 | unsigned i_slab; |
2105 | unsigned last_field_index = 0; | |
2106 | unsigned long *required_fields_bitmap; | |
2107 | unsigned required_fields_bitmap_len; | |
2108 | static const unsigned word_bits = sizeof(long) * 8; | |
1542 | 2109 | |
1543 | 2110 | ASSERT_IS_MESSAGE_DESCRIPTOR (desc); |
1544 | 2111 | |
1545 | 2112 | if (allocator == NULL) |
1546 | 2113 | allocator = &protobuf_c_default_allocator; |
2114 | ||
2115 | required_fields_bitmap_len = (desc->n_fields + word_bits - 1) / word_bits; | |
2116 | required_fields_bitmap = alloca(required_fields_bitmap_len * sizeof(long)); | |
2117 | memset(required_fields_bitmap, 0, required_fields_bitmap_len * sizeof(long)); | |
2118 | ||
1547 | 2119 | DO_ALLOC (rv, allocator, desc->sizeof_message, return NULL); |
1548 | 2120 | scanned_member_slabs[0] = first_member_slab; |
1549 | 2121 | |
1550 | memset (rv, 0, desc->sizeof_message); | |
1551 | rv->descriptor = desc; | |
1552 | ||
1553 | setup_default_values (rv); | |
2122 | /* Generated code always defines "message_init". | |
2123 | However, we provide a fallback for (1) users of old protobuf-c | |
2124 | generated-code that do not provide the function, | |
2125 | and (2) descriptors constructed from some other source | |
2126 | (most likely, direct construction from the .proto file) */ | |
2127 | if (desc->message_init != NULL) | |
2128 | protobuf_c_message_init (desc, rv); | |
2129 | else | |
2130 | protobuf_c_message_init_generic (desc, rv); | |
1554 | 2131 | |
1555 | 2132 | while (rem > 0) |
1556 | 2133 | { |
1581 | 2158 | { |
1582 | 2159 | field = desc->fields + field_index; |
1583 | 2160 | last_field = field; |
2161 | last_field_index = field_index; | |
1584 | 2162 | } |
1585 | 2163 | } |
1586 | 2164 | else |
1587 | 2165 | field = last_field; |
2166 | ||
2167 | if (field != NULL && field->label == PROTOBUF_C_LABEL_REQUIRED) | |
2168 | required_fields_bitmap[last_field_index / word_bits] |= (1UL << (last_field_index % word_bits)); | |
1588 | 2169 | |
1589 | 2170 | at += used; |
1590 | 2171 | rem -= used; |
1666 | 2247 | |
1667 | 2248 | if (field != NULL && field->label == PROTOBUF_C_LABEL_REPEATED) |
1668 | 2249 | { |
1669 | STRUCT_MEMBER (size_t, rv, field->quantifier_offset) += 1; | |
2250 | size_t *n = STRUCT_MEMBER_PTR (size_t, rv, field->quantifier_offset); | |
2251 | if (field->packed | |
2252 | && wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) | |
2253 | { | |
2254 | size_t count; | |
2255 | if (!count_packed_elements (field->type, | |
2256 | tmp.len - tmp.length_prefix_len, | |
2257 | tmp.data + tmp.length_prefix_len, | |
2258 | &count)) | |
2259 | { | |
2260 | UNPACK_ERROR (("counting packed elements")); | |
2261 | goto error_cleanup_during_scan; | |
2262 | } | |
2263 | *n += count; | |
2264 | } | |
2265 | else | |
2266 | *n += 1; | |
1670 | 2267 | } |
1671 | 2268 | |
1672 | 2269 | at += tmp.len; |
1673 | 2270 | rem -= tmp.len; |
1674 | 2271 | } |
1675 | 2272 | |
1676 | /* allocate space for repeated fields */ | |
2273 | /* allocate space for repeated fields, also check that all required fields have been set */ | |
1677 | 2274 | for (f = 0; f < desc->n_fields; f++) |
1678 | if (desc->fields[f].label == PROTOBUF_C_LABEL_REPEATED) | |
1679 | { | |
1680 | const ProtobufCFieldDescriptor *field = desc->fields + f; | |
2275 | { | |
2276 | const ProtobufCFieldDescriptor *field = desc->fields + f; | |
2277 | if (field->label == PROTOBUF_C_LABEL_REPEATED) | |
2278 | { | |
1681 | 2279 | size_t siz = sizeof_elt_in_repeated_array (field->type); |
1682 | 2280 | size_t *n_ptr = STRUCT_MEMBER_PTR (size_t, rv, field->quantifier_offset); |
1683 | 2281 | if (*n_ptr != 0) |
1697 | 2295 | CLEAR_REMAINING_N_PTRS (); goto error_cleanup); |
1698 | 2296 | #undef CLEAR_REMAINING_N_PTRS |
1699 | 2297 | } |
2298 | } | |
2299 | else if (field->label == PROTOBUF_C_LABEL_REQUIRED) | |
2300 | { | |
2301 | if (field->default_value == NULL && 0 == (required_fields_bitmap[f / word_bits] & (1UL << (f % word_bits)))) | |
2302 | { | |
2303 | UNPACK_ERROR (("message '%s': missing required field '%s'", desc->name, field->name)); | |
2304 | goto error_cleanup; | |
1700 | 2305 | } |
2306 | } | |
2307 | } | |
1701 | 2308 | |
1702 | 2309 | /* allocate space for unknown fields */ |
1703 | 2310 | if (n_unknown) |
1826 | 2433 | } |
1827 | 2434 | |
1828 | 2435 | /* === services === */ |
1829 | typedef void (*DestroyHandler)(void *service); | |
1830 | 2436 | typedef void (*GenericHandler)(void *service, |
1831 | 2437 | const ProtobufCMessage *input, |
1832 | 2438 | ProtobufCClosure closure, |
1890 | 2496 | return desc->values + desc->values_by_name[mid].index; |
1891 | 2497 | else if (rv < 0) |
1892 | 2498 | { |
1893 | count = start + count - (mid - 1); | |
2499 | count = start + count - (mid + 1); | |
1894 | 2500 | start = mid + 1; |
1895 | 2501 | } |
1896 | 2502 | else |
1973 | 2579 | return desc->methods + desc->method_indices_by_name[mid]; |
1974 | 2580 | if (rv < 0) |
1975 | 2581 | { |
1976 | count = start + count - (mid - 1); | |
2582 | count = start + count - (mid + 1); | |
1977 | 2583 | start = mid + 1; |
1978 | 2584 | } |
1979 | 2585 | else |
17 | 17 | #ifndef __PROTOBUF_C_RUNTIME_H_ |
18 | 18 | #define __PROTOBUF_C_RUNTIME_H_ |
19 | 19 | |
20 | #include <inttypes.h> | |
21 | 20 | #include <stddef.h> |
22 | 21 | #include <assert.h> |
23 | 22 | |
27 | 26 | #else |
28 | 27 | # define PROTOBUF_C_BEGIN_DECLS |
29 | 28 | # define PROTOBUF_C_END_DECLS |
29 | #endif | |
30 | ||
31 | #if !defined(PROTOBUF_C_NO_DEPRECATED) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) | |
32 | #define PROTOBUF_C_DEPRECATED __attribute__((__deprecated__)) | |
33 | #else | |
34 | #define PROTOBUF_C_DEPRECATED | |
35 | #endif | |
36 | ||
37 | /* Define int32_t, int64_t, uint32_t, uint64_t, uint8_t. | |
38 | ||
39 | Usually, just include <inttypes.h> to do the work. | |
40 | XXX: should we use stdint.h? | |
41 | */ | |
42 | #ifndef PROTOBUF_C_SKIP_INTTYPES_H | |
43 | # if defined(_MSC_VER) | |
44 | /* On windows, in ms visual studio, define the types ourselves */ | |
45 | # define int32_t signed __int32 | |
46 | # define uint32_t unsigned __int32 | |
47 | # define int64_t signed __int64 | |
48 | # define uint64_t unsigned __int64 | |
49 | # define uint8_t unsigned char | |
50 | # else | |
51 | /* Use the system inttypes.h */ | |
52 | # include <inttypes.h> | |
53 | # endif | |
30 | 54 | #endif |
31 | 55 | |
32 | 56 | PROTOBUF_C_BEGIN_DECLS |
88 | 112 | |
89 | 113 | /* This is a configurable allocator. |
90 | 114 | * By default, it uses the system allocator (meaning malloc() and free()). |
91 | * This is typically done to incorporate into frameworks that provide | |
115 | * This is typically changed to adapt to frameworks that provide | |
92 | 116 | * some nonstandard allocation functions. |
117 | * | |
118 | * NOTE: you may modify this allocator. | |
93 | 119 | */ |
94 | 120 | extern ProtobufCAllocator protobuf_c_default_allocator; /* settable */ |
95 | 121 | |
96 | /* This is the system allocator, meaning it uses malloc() and free() */ | |
122 | /* This is the system allocator, meaning it uses malloc() and free(). | |
123 | * | |
124 | * NOTE: please do NOT modify this allocator. | |
125 | */ | |
97 | 126 | extern ProtobufCAllocator protobuf_c_system_allocator; /* use malloc, free etc */ |
98 | 127 | |
99 | 128 | /* This is the function that our default allocators call when they |
203 | 232 | unsigned offset; |
204 | 233 | const void *descriptor; /* for MESSAGE and ENUM types */ |
205 | 234 | const void *default_value; /* or NULL if no default-value */ |
206 | ||
207 | void *reserved1; | |
235 | protobuf_c_boolean packed; | |
236 | ||
237 | unsigned reserved_flags; | |
208 | 238 | void *reserved2; |
239 | void *reserved3; | |
209 | 240 | }; |
210 | 241 | /* ProtobufCMessageDescriptor: description of a message. |
211 | 242 | * |
299 | 330 | void protobuf_c_message_free_unpacked (ProtobufCMessage *message, |
300 | 331 | ProtobufCAllocator *allocator); |
301 | 332 | |
302 | /* WARNING: 'to_init' must be a block of memory | |
333 | /* WARNING: 'message' must be a block of memory | |
303 | 334 | of size descriptor->sizeof_message. */ |
304 | #define protobuf_c_message_init(descriptor, message) (descriptor)->message_init(message) | |
335 | #define protobuf_c_message_init(descriptor, message) ((descriptor)->message_init((ProtobufCMessage*) (message))) | |
305 | 336 | |
306 | 337 | /* --- services --- */ |
307 | 338 | typedef struct _ProtobufCMethodDescriptor ProtobufCMethodDescriptor; |
17 | 17 | ../libprotobuf-c.la |
18 | 18 | cxx_generate_packed_data_SOURCES = \ |
19 | 19 | cxx-generate-packed-data.cc generated-code/test-full.pb.cc |
20 | cxx-generate-packed-data.$(OBJEXT): generated-code/test-full.pb.h | |
20 | 21 | cxx_generate_packed_data_LDADD = -lprotobuf |
21 | 22 | cxx_generate_packed_data_LDFLAGS = -pthread |
22 | 23 | example_server_SOURCES = \ |
111 | 111 | AUTOHEADER = @AUTOHEADER@ |
112 | 112 | AUTOMAKE = @AUTOMAKE@ |
113 | 113 | AWK = @AWK@ |
114 | BUILD_PROTOC_C_FALSE = @BUILD_PROTOC_C_FALSE@ | |
115 | BUILD_PROTOC_C_TRUE = @BUILD_PROTOC_C_TRUE@ | |
114 | 116 | CC = @CC@ |
115 | 117 | CCDEPMODE = @CCDEPMODE@ |
116 | 118 | CFLAGS = @CFLAGS@ |
672 | 674 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ |
673 | 675 | tags uninstall uninstall-am uninstall-info-am |
674 | 676 | |
677 | cxx-generate-packed-data.$(OBJEXT): generated-code/test-full.pb.h | |
675 | 678 | |
676 | 679 | generated-code/test.pb-c.c generated-code/test.pb-c.h: ../protoc-c$(EXEEXT) $(srcdir)/test.proto |
677 | 680 | mkdir -p generated-code |
23 | 23 | generated-code/test.pb-c.c Protobuf-C generated code based on test.proto |
24 | 24 | |
25 | 25 | test-generated-code2 |
26 | test-full.proto | |
27 | .. | |
26 | test-full.proto Protobuf declarations for the exhaustive test. | |
27 | cxx-generate-packed-data.cc C++ code to generated data to compare with C. | |
28 | cxx-generate-packed-data Program whichs generates data (using C++ api) | |
29 | generated-code/test-full-cxx-output.inc Output of cxx-generate-packed-data. | |
30 | test-generated-code2.c Actual test code. | |
31 | test-generated-code2 Test executable. |
55 | 55 | T(0), T(2097152), T(268435455), T(127), T(16383), T(16384) }; |
56 | 56 | #undef T |
57 | 57 | |
58 | char *repeated_strings_0[] = { "onestring" }; | |
59 | char *repeated_strings_1[] = { "two", "string" }; | |
60 | char *repeated_strings_2[] = { "many", "tiny", "little", "strings", "should", "be", "handled" }; | |
61 | char *repeated_strings_3[] = { "one very long strings XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" }; | |
58 | char *repeated_strings_0[] = { (char*)"onestring" }; | |
59 | char *repeated_strings_1[] = { (char*)"two", (char*)"string" }; | |
60 | char *repeated_strings_2[] = { (char*)"many", (char*)"tiny", (char*)"little", (char*)"strings", (char*)"should", (char*)"be", (char*)"handled" }; | |
61 | char *repeated_strings_3[] = { (char*)"one very long strings XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" }; |
751 | 751 | mess.add_test_message()->set_test(667); |
752 | 752 | dump_message_bytes(&mess, "test_repeated_submess_1"); |
753 | 753 | } |
754 | #undef DUMP_STATIC_ARRAY_GENERIC | |
755 | ||
756 | #define DUMP_STATIC_ARRAY_GENERIC(member, static_array, output_array_name) \ | |
757 | do{ \ | |
758 | TestMessPacked mess; \ | |
759 | for (unsigned i = 0; i < N_ELEMENTS (static_array); i++) \ | |
760 | mess.add_##member(static_array[i]); \ | |
761 | dump_message_bytes(&mess, output_array_name); \ | |
762 | }while(0) | |
763 | static void dump_test_packed_repeated_int32 (void) | |
764 | { | |
765 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
766 | DUMP_STATIC_ARRAY_GENERIC(test_int32, static_array, output_array_name) | |
767 | ||
768 | DUMP_STATIC_ARRAY (int32_arr0, "test_packed_repeated_int32_arr0"); | |
769 | DUMP_STATIC_ARRAY (int32_arr1, "test_packed_repeated_int32_arr1"); | |
770 | DUMP_STATIC_ARRAY (int32_arr_min_max, "test_packed_repeated_int32_arr_min_max"); | |
771 | ||
772 | #undef DUMP_STATIC_ARRAY | |
773 | } | |
774 | static void dump_test_packed_repeated_sint32 (void) | |
775 | { | |
776 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
777 | DUMP_STATIC_ARRAY_GENERIC(test_sint32, static_array, output_array_name) | |
778 | ||
779 | DUMP_STATIC_ARRAY (int32_arr0, "test_packed_repeated_sint32_arr0"); | |
780 | DUMP_STATIC_ARRAY (int32_arr1, "test_packed_repeated_sint32_arr1"); | |
781 | DUMP_STATIC_ARRAY (int32_arr_min_max, "test_packed_repeated_sint32_arr_min_max"); | |
782 | ||
783 | #undef DUMP_STATIC_ARRAY | |
784 | } | |
785 | static void dump_test_packed_repeated_uint32 (void) | |
786 | { | |
787 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
788 | DUMP_STATIC_ARRAY_GENERIC(test_uint32, static_array, output_array_name) | |
789 | ||
790 | DUMP_STATIC_ARRAY (uint32_roundnumbers, "test_packed_repeated_uint32_roundnumbers"); | |
791 | DUMP_STATIC_ARRAY (uint32_0_max, "test_packed_repeated_uint32_0_max"); | |
792 | ||
793 | #undef DUMP_STATIC_ARRAY | |
794 | } | |
795 | static void dump_test_packed_repeated_sfixed32 (void) | |
796 | { | |
797 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
798 | DUMP_STATIC_ARRAY_GENERIC(test_sfixed32, static_array, output_array_name) | |
799 | ||
800 | DUMP_STATIC_ARRAY (int32_arr0, "test_packed_repeated_sfixed32_arr0"); | |
801 | DUMP_STATIC_ARRAY (int32_arr1, "test_packed_repeated_sfixed32_arr1"); | |
802 | DUMP_STATIC_ARRAY (int32_arr_min_max, "test_packed_repeated_sfixed32_arr_min_max"); | |
803 | ||
804 | #undef DUMP_STATIC_ARRAY | |
805 | } | |
806 | ||
807 | static void dump_test_packed_repeated_fixed32 (void) | |
808 | { | |
809 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
810 | DUMP_STATIC_ARRAY_GENERIC(test_fixed32, static_array, output_array_name) | |
811 | ||
812 | DUMP_STATIC_ARRAY (uint32_roundnumbers, "test_packed_repeated_fixed32_roundnumbers"); | |
813 | DUMP_STATIC_ARRAY (uint32_0_max, "test_packed_repeated_fixed32_0_max"); | |
814 | ||
815 | #undef DUMP_STATIC_ARRAY | |
816 | } | |
817 | static void dump_test_packed_repeated_int64 (void) | |
818 | { | |
819 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
820 | DUMP_STATIC_ARRAY_GENERIC(test_int64, static_array, output_array_name) | |
821 | ||
822 | DUMP_STATIC_ARRAY (int64_roundnumbers, "test_packed_repeated_int64_roundnumbers"); | |
823 | DUMP_STATIC_ARRAY (int64_min_max, "test_packed_repeated_int64_min_max"); | |
824 | ||
825 | #undef DUMP_STATIC_ARRAY | |
826 | } | |
827 | ||
828 | static void dump_test_packed_repeated_sint64 (void) | |
829 | { | |
830 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
831 | DUMP_STATIC_ARRAY_GENERIC(test_sint64, static_array, output_array_name) | |
832 | ||
833 | DUMP_STATIC_ARRAY (int64_roundnumbers, "test_packed_repeated_sint64_roundnumbers"); | |
834 | DUMP_STATIC_ARRAY (int64_min_max, "test_packed_repeated_sint64_min_max"); | |
835 | ||
836 | #undef DUMP_STATIC_ARRAY | |
837 | } | |
838 | ||
839 | static void dump_test_packed_repeated_sfixed64 (void) | |
840 | { | |
841 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
842 | DUMP_STATIC_ARRAY_GENERIC(test_sfixed64, static_array, output_array_name) | |
843 | ||
844 | DUMP_STATIC_ARRAY (int64_roundnumbers, "test_packed_repeated_sfixed64_roundnumbers"); | |
845 | DUMP_STATIC_ARRAY (int64_min_max, "test_packed_repeated_sfixed64_min_max"); | |
846 | ||
847 | #undef DUMP_STATIC_ARRAY | |
848 | } | |
849 | static void dump_test_packed_repeated_uint64 (void) | |
850 | { | |
851 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
852 | DUMP_STATIC_ARRAY_GENERIC (test_uint64, static_array, output_array_name) | |
853 | ||
854 | DUMP_STATIC_ARRAY(uint64_roundnumbers, "test_packed_repeated_uint64_roundnumbers"); | |
855 | DUMP_STATIC_ARRAY(uint64_0_1_max, "test_packed_repeated_uint64_0_1_max"); | |
856 | DUMP_STATIC_ARRAY(uint64_random, "test_packed_repeated_uint64_random"); | |
857 | ||
858 | #undef DUMP_STATIC_ARRAY | |
859 | } | |
860 | static void dump_test_packed_repeated_fixed64 (void) | |
861 | { | |
862 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
863 | DUMP_STATIC_ARRAY_GENERIC(test_fixed64, static_array, output_array_name) | |
864 | ||
865 | DUMP_STATIC_ARRAY(uint64_roundnumbers, "test_packed_repeated_fixed64_roundnumbers"); | |
866 | DUMP_STATIC_ARRAY(uint64_0_1_max, "test_packed_repeated_fixed64_0_1_max"); | |
867 | DUMP_STATIC_ARRAY(uint64_random, "test_packed_repeated_fixed64_random"); | |
868 | ||
869 | #undef DUMP_STATIC_ARRAY | |
870 | } | |
871 | ||
872 | static void dump_test_packed_repeated_float (void) | |
873 | { | |
874 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
875 | DUMP_STATIC_ARRAY_GENERIC(test_float, static_array, output_array_name) | |
876 | ||
877 | DUMP_STATIC_ARRAY(float_random, "test_packed_repeated_float_random"); | |
878 | ||
879 | #undef DUMP_STATIC_ARRAY | |
880 | } | |
881 | ||
882 | static void dump_test_packed_repeated_double (void) | |
883 | { | |
884 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
885 | DUMP_STATIC_ARRAY_GENERIC(test_double, static_array, output_array_name) | |
886 | ||
887 | DUMP_STATIC_ARRAY(double_random, "test_packed_repeated_double_random"); | |
888 | ||
889 | #undef DUMP_STATIC_ARRAY | |
890 | } | |
891 | static void dump_test_packed_repeated_boolean (void) | |
892 | { | |
893 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
894 | DUMP_STATIC_ARRAY_GENERIC(test_boolean, static_array, output_array_name) | |
895 | ||
896 | DUMP_STATIC_ARRAY(boolean_0, "test_packed_repeated_boolean_0"); | |
897 | DUMP_STATIC_ARRAY(boolean_1, "test_packed_repeated_boolean_1"); | |
898 | DUMP_STATIC_ARRAY(boolean_random, "test_packed_repeated_boolean_random"); | |
899 | ||
900 | #undef DUMP_STATIC_ARRAY | |
901 | } | |
902 | static void dump_test_packed_repeated_enum_small (void) | |
903 | { | |
904 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
905 | DUMP_STATIC_ARRAY_GENERIC (test_enum_small, static_array, output_array_name) | |
906 | ||
907 | DUMP_STATIC_ARRAY (enum_small_0, "test_packed_repeated_enum_small_0"); | |
908 | DUMP_STATIC_ARRAY (enum_small_1, "test_packed_repeated_enum_small_1"); | |
909 | DUMP_STATIC_ARRAY (enum_small_random, "test_packed_repeated_enum_small_random"); | |
910 | ||
911 | #undef DUMP_STATIC_ARRAY | |
912 | } | |
913 | ||
914 | static void dump_test_packed_repeated_enum (void) | |
915 | { | |
916 | #define DUMP_STATIC_ARRAY(static_array, output_array_name) \ | |
917 | DUMP_STATIC_ARRAY_GENERIC (test_enum, static_array, output_array_name) | |
918 | ||
919 | DUMP_STATIC_ARRAY (enum_0, "test_packed_repeated_enum_0"); | |
920 | DUMP_STATIC_ARRAY (enum_1, "test_packed_repeated_enum_1"); | |
921 | DUMP_STATIC_ARRAY (enum_random, "test_packed_repeated_enum_random"); | |
922 | ||
923 | #undef DUMP_STATIC_ARRAY | |
924 | } | |
925 | ||
754 | 926 | |
755 | 927 | static void dump_test_unknown_fields (void) |
756 | 928 | { |
758 | 930 | const google::protobuf::Message::Reflection *reflection = mess.GetReflection(); |
759 | 931 | google::protobuf::UnknownFieldSet *fs = reflection->MutableUnknownFields(&mess); |
760 | 932 | |
761 | #if PROTOC_VERSION >= 2001000 | |
933 | #if GOOGLE_PROTOBUF_VERSION >= 2001000 | |
762 | 934 | fs->AddVarint(5454, 255); |
763 | 935 | fs->AddFixed32(5555, 260); |
764 | 936 | #else |
773 | 945 | |
774 | 946 | fs->Clear(); |
775 | 947 | |
776 | #if PROTOC_VERSION >= 2001000 | |
948 | #if GOOGLE_PROTOBUF_VERSION >= 2001000 | |
777 | 949 | fs->AddLengthDelimited(6666, "xxxxxxxx"); |
778 | 950 | fs->AddFixed64(7777, 0x10101); |
779 | 951 | #else |
845 | 1017 | dump_test_repeated_string (); |
846 | 1018 | dump_test_repeated_bytes (); |
847 | 1019 | dump_test_repeated_SubMess (); |
1020 | dump_test_packed_repeated_int32 (); | |
1021 | dump_test_packed_repeated_sint32 (); | |
1022 | dump_test_packed_repeated_uint32 (); | |
1023 | dump_test_packed_repeated_sfixed32 (); | |
1024 | dump_test_packed_repeated_fixed32 (); | |
1025 | dump_test_packed_repeated_int64 (); | |
1026 | dump_test_packed_repeated_sint64 (); | |
1027 | dump_test_packed_repeated_sfixed64 (); | |
1028 | dump_test_packed_repeated_uint64 (); | |
1029 | dump_test_packed_repeated_fixed64 (); | |
1030 | dump_test_packed_repeated_float (); | |
1031 | dump_test_packed_repeated_double (); | |
1032 | dump_test_packed_repeated_boolean (); | |
1033 | dump_test_packed_repeated_enum_small (); | |
1034 | dump_test_packed_repeated_enum (); | |
848 | 1035 | dump_test_unknown_fields (); |
849 | 1036 | return 0; |
850 | 1037 | } |
0 | 0 | /* Generated by the protocol buffer compiler. DO NOT EDIT! */ |
1 | ||
2 | /* Do not generate deprecated warnings for self */ | |
3 | #ifndef PROTOBUF_C_NO_DEPRECATED | |
4 | #define PROTOBUF_C_NO_DEPRECATED | |
5 | #endif | |
1 | 6 | |
2 | 7 | #include "test-full.pb-c.h" |
3 | 8 | void foo__sub_mess__init |
430 | 435 | PROTOBUF_C_ASSERT (message->base.descriptor == &foo__test_mess__descriptor); |
431 | 436 | protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); |
432 | 437 | } |
438 | void foo__test_mess_packed__init | |
439 | (Foo__TestMessPacked *message) | |
440 | { | |
441 | static Foo__TestMessPacked init_value = FOO__TEST_MESS_PACKED__INIT; | |
442 | *message = init_value; | |
443 | } | |
444 | size_t foo__test_mess_packed__get_packed_size | |
445 | (const Foo__TestMessPacked *message) | |
446 | { | |
447 | PROTOBUF_C_ASSERT (message->base.descriptor == &foo__test_mess_packed__descriptor); | |
448 | return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); | |
449 | } | |
450 | size_t foo__test_mess_packed__pack | |
451 | (const Foo__TestMessPacked *message, | |
452 | uint8_t *out) | |
453 | { | |
454 | PROTOBUF_C_ASSERT (message->base.descriptor == &foo__test_mess_packed__descriptor); | |
455 | return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); | |
456 | } | |
457 | size_t foo__test_mess_packed__pack_to_buffer | |
458 | (const Foo__TestMessPacked *message, | |
459 | ProtobufCBuffer *buffer) | |
460 | { | |
461 | PROTOBUF_C_ASSERT (message->base.descriptor == &foo__test_mess_packed__descriptor); | |
462 | return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); | |
463 | } | |
464 | Foo__TestMessPacked * | |
465 | foo__test_mess_packed__unpack | |
466 | (ProtobufCAllocator *allocator, | |
467 | size_t len, | |
468 | const uint8_t *data) | |
469 | { | |
470 | return (Foo__TestMessPacked *) | |
471 | protobuf_c_message_unpack (&foo__test_mess_packed__descriptor, | |
472 | allocator, len, data); | |
473 | } | |
474 | void foo__test_mess_packed__free_unpacked | |
475 | (Foo__TestMessPacked *message, | |
476 | ProtobufCAllocator *allocator) | |
477 | { | |
478 | PROTOBUF_C_ASSERT (message->base.descriptor == &foo__test_mess_packed__descriptor); | |
479 | protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); | |
480 | } | |
433 | 481 | void foo__test_mess_optional__init |
434 | 482 | (Foo__TestMessOptional *message) |
435 | 483 | { |
1430 | 1478 | PROTOBUF_C_OFFSETOF(Foo__SubMess, test), |
1431 | 1479 | NULL, |
1432 | 1480 | NULL, |
1433 | NULL,NULL /* reserved1, reserved2 */ | |
1481 | 0, /* packed */ | |
1482 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1434 | 1483 | }, |
1435 | 1484 | }; |
1436 | 1485 | static const unsigned foo__sub_mess__field_indices_by_name[] = { |
1467 | 1516 | PROTOBUF_C_OFFSETOF(Foo__TestFieldNo15, test), |
1468 | 1517 | NULL, |
1469 | 1518 | NULL, |
1470 | NULL,NULL /* reserved1, reserved2 */ | |
1519 | 0, /* packed */ | |
1520 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1471 | 1521 | }, |
1472 | 1522 | }; |
1473 | 1523 | static const unsigned foo__test_field_no15__field_indices_by_name[] = { |
1504 | 1554 | PROTOBUF_C_OFFSETOF(Foo__TestFieldNo16, test), |
1505 | 1555 | NULL, |
1506 | 1556 | NULL, |
1507 | NULL,NULL /* reserved1, reserved2 */ | |
1557 | 0, /* packed */ | |
1558 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1508 | 1559 | }, |
1509 | 1560 | }; |
1510 | 1561 | static const unsigned foo__test_field_no16__field_indices_by_name[] = { |
1541 | 1592 | PROTOBUF_C_OFFSETOF(Foo__TestFieldNo2047, test), |
1542 | 1593 | NULL, |
1543 | 1594 | NULL, |
1544 | NULL,NULL /* reserved1, reserved2 */ | |
1595 | 0, /* packed */ | |
1596 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1545 | 1597 | }, |
1546 | 1598 | }; |
1547 | 1599 | static const unsigned foo__test_field_no2047__field_indices_by_name[] = { |
1578 | 1630 | PROTOBUF_C_OFFSETOF(Foo__TestFieldNo2048, test), |
1579 | 1631 | NULL, |
1580 | 1632 | NULL, |
1581 | NULL,NULL /* reserved1, reserved2 */ | |
1633 | 0, /* packed */ | |
1634 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1582 | 1635 | }, |
1583 | 1636 | }; |
1584 | 1637 | static const unsigned foo__test_field_no2048__field_indices_by_name[] = { |
1615 | 1668 | PROTOBUF_C_OFFSETOF(Foo__TestFieldNo262143, test), |
1616 | 1669 | NULL, |
1617 | 1670 | NULL, |
1618 | NULL,NULL /* reserved1, reserved2 */ | |
1671 | 0, /* packed */ | |
1672 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1619 | 1673 | }, |
1620 | 1674 | }; |
1621 | 1675 | static const unsigned foo__test_field_no262143__field_indices_by_name[] = { |
1652 | 1706 | PROTOBUF_C_OFFSETOF(Foo__TestFieldNo262144, test), |
1653 | 1707 | NULL, |
1654 | 1708 | NULL, |
1655 | NULL,NULL /* reserved1, reserved2 */ | |
1709 | 0, /* packed */ | |
1710 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1656 | 1711 | }, |
1657 | 1712 | }; |
1658 | 1713 | static const unsigned foo__test_field_no262144__field_indices_by_name[] = { |
1689 | 1744 | PROTOBUF_C_OFFSETOF(Foo__TestFieldNo33554431, test), |
1690 | 1745 | NULL, |
1691 | 1746 | NULL, |
1692 | NULL,NULL /* reserved1, reserved2 */ | |
1747 | 0, /* packed */ | |
1748 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1693 | 1749 | }, |
1694 | 1750 | }; |
1695 | 1751 | static const unsigned foo__test_field_no33554431__field_indices_by_name[] = { |
1726 | 1782 | PROTOBUF_C_OFFSETOF(Foo__TestFieldNo33554432, test), |
1727 | 1783 | NULL, |
1728 | 1784 | NULL, |
1729 | NULL,NULL /* reserved1, reserved2 */ | |
1785 | 0, /* packed */ | |
1786 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1730 | 1787 | }, |
1731 | 1788 | }; |
1732 | 1789 | static const unsigned foo__test_field_no33554432__field_indices_by_name[] = { |
1763 | 1820 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_int32), |
1764 | 1821 | NULL, |
1765 | 1822 | NULL, |
1766 | NULL,NULL /* reserved1, reserved2 */ | |
1823 | 0, /* packed */ | |
1824 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1767 | 1825 | }, |
1768 | 1826 | { |
1769 | 1827 | "test_sint32", |
1774 | 1832 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_sint32), |
1775 | 1833 | NULL, |
1776 | 1834 | NULL, |
1777 | NULL,NULL /* reserved1, reserved2 */ | |
1835 | 0, /* packed */ | |
1836 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1778 | 1837 | }, |
1779 | 1838 | { |
1780 | 1839 | "test_sfixed32", |
1785 | 1844 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_sfixed32), |
1786 | 1845 | NULL, |
1787 | 1846 | NULL, |
1788 | NULL,NULL /* reserved1, reserved2 */ | |
1847 | 0, /* packed */ | |
1848 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1789 | 1849 | }, |
1790 | 1850 | { |
1791 | 1851 | "test_int64", |
1796 | 1856 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_int64), |
1797 | 1857 | NULL, |
1798 | 1858 | NULL, |
1799 | NULL,NULL /* reserved1, reserved2 */ | |
1859 | 0, /* packed */ | |
1860 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1800 | 1861 | }, |
1801 | 1862 | { |
1802 | 1863 | "test_sint64", |
1807 | 1868 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_sint64), |
1808 | 1869 | NULL, |
1809 | 1870 | NULL, |
1810 | NULL,NULL /* reserved1, reserved2 */ | |
1871 | 0, /* packed */ | |
1872 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1811 | 1873 | }, |
1812 | 1874 | { |
1813 | 1875 | "test_sfixed64", |
1818 | 1880 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_sfixed64), |
1819 | 1881 | NULL, |
1820 | 1882 | NULL, |
1821 | NULL,NULL /* reserved1, reserved2 */ | |
1883 | 0, /* packed */ | |
1884 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1822 | 1885 | }, |
1823 | 1886 | { |
1824 | 1887 | "test_uint32", |
1829 | 1892 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_uint32), |
1830 | 1893 | NULL, |
1831 | 1894 | NULL, |
1832 | NULL,NULL /* reserved1, reserved2 */ | |
1895 | 0, /* packed */ | |
1896 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1833 | 1897 | }, |
1834 | 1898 | { |
1835 | 1899 | "test_fixed32", |
1840 | 1904 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_fixed32), |
1841 | 1905 | NULL, |
1842 | 1906 | NULL, |
1843 | NULL,NULL /* reserved1, reserved2 */ | |
1907 | 0, /* packed */ | |
1908 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1844 | 1909 | }, |
1845 | 1910 | { |
1846 | 1911 | "test_uint64", |
1851 | 1916 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_uint64), |
1852 | 1917 | NULL, |
1853 | 1918 | NULL, |
1854 | NULL,NULL /* reserved1, reserved2 */ | |
1919 | 0, /* packed */ | |
1920 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1855 | 1921 | }, |
1856 | 1922 | { |
1857 | 1923 | "test_fixed64", |
1862 | 1928 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_fixed64), |
1863 | 1929 | NULL, |
1864 | 1930 | NULL, |
1865 | NULL,NULL /* reserved1, reserved2 */ | |
1931 | 0, /* packed */ | |
1932 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1866 | 1933 | }, |
1867 | 1934 | { |
1868 | 1935 | "test_float", |
1873 | 1940 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_float), |
1874 | 1941 | NULL, |
1875 | 1942 | NULL, |
1876 | NULL,NULL /* reserved1, reserved2 */ | |
1943 | 0, /* packed */ | |
1944 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1877 | 1945 | }, |
1878 | 1946 | { |
1879 | 1947 | "test_double", |
1884 | 1952 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_double), |
1885 | 1953 | NULL, |
1886 | 1954 | NULL, |
1887 | NULL,NULL /* reserved1, reserved2 */ | |
1955 | 0, /* packed */ | |
1956 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1888 | 1957 | }, |
1889 | 1958 | { |
1890 | 1959 | "test_boolean", |
1895 | 1964 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_boolean), |
1896 | 1965 | NULL, |
1897 | 1966 | NULL, |
1898 | NULL,NULL /* reserved1, reserved2 */ | |
1967 | 0, /* packed */ | |
1968 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1899 | 1969 | }, |
1900 | 1970 | { |
1901 | 1971 | "test_enum_small", |
1906 | 1976 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_enum_small), |
1907 | 1977 | &foo__test_enum_small__descriptor, |
1908 | 1978 | NULL, |
1909 | NULL,NULL /* reserved1, reserved2 */ | |
1979 | 0, /* packed */ | |
1980 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1910 | 1981 | }, |
1911 | 1982 | { |
1912 | 1983 | "test_enum", |
1917 | 1988 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_enum), |
1918 | 1989 | &foo__test_enum__descriptor, |
1919 | 1990 | NULL, |
1920 | NULL,NULL /* reserved1, reserved2 */ | |
1991 | 0, /* packed */ | |
1992 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1921 | 1993 | }, |
1922 | 1994 | { |
1923 | 1995 | "test_string", |
1928 | 2000 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_string), |
1929 | 2001 | NULL, |
1930 | 2002 | NULL, |
1931 | NULL,NULL /* reserved1, reserved2 */ | |
2003 | 0, /* packed */ | |
2004 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1932 | 2005 | }, |
1933 | 2006 | { |
1934 | 2007 | "test_bytes", |
1939 | 2012 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_bytes), |
1940 | 2013 | NULL, |
1941 | 2014 | NULL, |
1942 | NULL,NULL /* reserved1, reserved2 */ | |
2015 | 0, /* packed */ | |
2016 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1943 | 2017 | }, |
1944 | 2018 | { |
1945 | 2019 | "test_message", |
1950 | 2024 | PROTOBUF_C_OFFSETOF(Foo__TestMess, test_message), |
1951 | 2025 | &foo__sub_mess__descriptor, |
1952 | 2026 | NULL, |
1953 | NULL,NULL /* reserved1, reserved2 */ | |
2027 | 0, /* packed */ | |
2028 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
1954 | 2029 | }, |
1955 | 2030 | }; |
1956 | 2031 | static const unsigned foo__test_mess__field_indices_by_name[] = { |
1993 | 2068 | (ProtobufCMessageInit) foo__test_mess__init, |
1994 | 2069 | NULL,NULL,NULL /* reserved[123] */ |
1995 | 2070 | }; |
2071 | static const ProtobufCFieldDescriptor foo__test_mess_packed__field_descriptors[15] = | |
2072 | { | |
2073 | { | |
2074 | "test_int32", | |
2075 | 1, | |
2076 | PROTOBUF_C_LABEL_REPEATED, | |
2077 | PROTOBUF_C_TYPE_INT32, | |
2078 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_int32), | |
2079 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_int32), | |
2080 | NULL, | |
2081 | NULL, | |
2082 | 1, /* packed */ | |
2083 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2084 | }, | |
2085 | { | |
2086 | "test_sint32", | |
2087 | 2, | |
2088 | PROTOBUF_C_LABEL_REPEATED, | |
2089 | PROTOBUF_C_TYPE_SINT32, | |
2090 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_sint32), | |
2091 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_sint32), | |
2092 | NULL, | |
2093 | NULL, | |
2094 | 1, /* packed */ | |
2095 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2096 | }, | |
2097 | { | |
2098 | "test_sfixed32", | |
2099 | 3, | |
2100 | PROTOBUF_C_LABEL_REPEATED, | |
2101 | PROTOBUF_C_TYPE_SFIXED32, | |
2102 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_sfixed32), | |
2103 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_sfixed32), | |
2104 | NULL, | |
2105 | NULL, | |
2106 | 1, /* packed */ | |
2107 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2108 | }, | |
2109 | { | |
2110 | "test_int64", | |
2111 | 4, | |
2112 | PROTOBUF_C_LABEL_REPEATED, | |
2113 | PROTOBUF_C_TYPE_INT64, | |
2114 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_int64), | |
2115 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_int64), | |
2116 | NULL, | |
2117 | NULL, | |
2118 | 1, /* packed */ | |
2119 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2120 | }, | |
2121 | { | |
2122 | "test_sint64", | |
2123 | 5, | |
2124 | PROTOBUF_C_LABEL_REPEATED, | |
2125 | PROTOBUF_C_TYPE_SINT64, | |
2126 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_sint64), | |
2127 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_sint64), | |
2128 | NULL, | |
2129 | NULL, | |
2130 | 1, /* packed */ | |
2131 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2132 | }, | |
2133 | { | |
2134 | "test_sfixed64", | |
2135 | 6, | |
2136 | PROTOBUF_C_LABEL_REPEATED, | |
2137 | PROTOBUF_C_TYPE_SFIXED64, | |
2138 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_sfixed64), | |
2139 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_sfixed64), | |
2140 | NULL, | |
2141 | NULL, | |
2142 | 1, /* packed */ | |
2143 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2144 | }, | |
2145 | { | |
2146 | "test_uint32", | |
2147 | 7, | |
2148 | PROTOBUF_C_LABEL_REPEATED, | |
2149 | PROTOBUF_C_TYPE_UINT32, | |
2150 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_uint32), | |
2151 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_uint32), | |
2152 | NULL, | |
2153 | NULL, | |
2154 | 1, /* packed */ | |
2155 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2156 | }, | |
2157 | { | |
2158 | "test_fixed32", | |
2159 | 8, | |
2160 | PROTOBUF_C_LABEL_REPEATED, | |
2161 | PROTOBUF_C_TYPE_FIXED32, | |
2162 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_fixed32), | |
2163 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_fixed32), | |
2164 | NULL, | |
2165 | NULL, | |
2166 | 1, /* packed */ | |
2167 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2168 | }, | |
2169 | { | |
2170 | "test_uint64", | |
2171 | 9, | |
2172 | PROTOBUF_C_LABEL_REPEATED, | |
2173 | PROTOBUF_C_TYPE_UINT64, | |
2174 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_uint64), | |
2175 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_uint64), | |
2176 | NULL, | |
2177 | NULL, | |
2178 | 1, /* packed */ | |
2179 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2180 | }, | |
2181 | { | |
2182 | "test_fixed64", | |
2183 | 10, | |
2184 | PROTOBUF_C_LABEL_REPEATED, | |
2185 | PROTOBUF_C_TYPE_FIXED64, | |
2186 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_fixed64), | |
2187 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_fixed64), | |
2188 | NULL, | |
2189 | NULL, | |
2190 | 1, /* packed */ | |
2191 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2192 | }, | |
2193 | { | |
2194 | "test_float", | |
2195 | 11, | |
2196 | PROTOBUF_C_LABEL_REPEATED, | |
2197 | PROTOBUF_C_TYPE_FLOAT, | |
2198 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_float), | |
2199 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_float), | |
2200 | NULL, | |
2201 | NULL, | |
2202 | 1, /* packed */ | |
2203 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2204 | }, | |
2205 | { | |
2206 | "test_double", | |
2207 | 12, | |
2208 | PROTOBUF_C_LABEL_REPEATED, | |
2209 | PROTOBUF_C_TYPE_DOUBLE, | |
2210 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_double), | |
2211 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_double), | |
2212 | NULL, | |
2213 | NULL, | |
2214 | 1, /* packed */ | |
2215 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2216 | }, | |
2217 | { | |
2218 | "test_boolean", | |
2219 | 13, | |
2220 | PROTOBUF_C_LABEL_REPEATED, | |
2221 | PROTOBUF_C_TYPE_BOOL, | |
2222 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_boolean), | |
2223 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_boolean), | |
2224 | NULL, | |
2225 | NULL, | |
2226 | 1, /* packed */ | |
2227 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2228 | }, | |
2229 | { | |
2230 | "test_enum_small", | |
2231 | 14, | |
2232 | PROTOBUF_C_LABEL_REPEATED, | |
2233 | PROTOBUF_C_TYPE_ENUM, | |
2234 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_enum_small), | |
2235 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_enum_small), | |
2236 | &foo__test_enum_small__descriptor, | |
2237 | NULL, | |
2238 | 1, /* packed */ | |
2239 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2240 | }, | |
2241 | { | |
2242 | "test_enum", | |
2243 | 15, | |
2244 | PROTOBUF_C_LABEL_REPEATED, | |
2245 | PROTOBUF_C_TYPE_ENUM, | |
2246 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, n_test_enum), | |
2247 | PROTOBUF_C_OFFSETOF(Foo__TestMessPacked, test_enum), | |
2248 | &foo__test_enum__descriptor, | |
2249 | NULL, | |
2250 | 1, /* packed */ | |
2251 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2252 | }, | |
2253 | }; | |
2254 | static const unsigned foo__test_mess_packed__field_indices_by_name[] = { | |
2255 | 12, /* field[12] = test_boolean */ | |
2256 | 11, /* field[11] = test_double */ | |
2257 | 14, /* field[14] = test_enum */ | |
2258 | 13, /* field[13] = test_enum_small */ | |
2259 | 7, /* field[7] = test_fixed32 */ | |
2260 | 9, /* field[9] = test_fixed64 */ | |
2261 | 10, /* field[10] = test_float */ | |
2262 | 0, /* field[0] = test_int32 */ | |
2263 | 3, /* field[3] = test_int64 */ | |
2264 | 2, /* field[2] = test_sfixed32 */ | |
2265 | 5, /* field[5] = test_sfixed64 */ | |
2266 | 1, /* field[1] = test_sint32 */ | |
2267 | 4, /* field[4] = test_sint64 */ | |
2268 | 6, /* field[6] = test_uint32 */ | |
2269 | 8, /* field[8] = test_uint64 */ | |
2270 | }; | |
2271 | static const ProtobufCIntRange foo__test_mess_packed__number_ranges[1 + 1] = | |
2272 | { | |
2273 | { 1, 0 }, | |
2274 | { 0, 15 } | |
2275 | }; | |
2276 | const ProtobufCMessageDescriptor foo__test_mess_packed__descriptor = | |
2277 | { | |
2278 | PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, | |
2279 | "foo.TestMessPacked", | |
2280 | "TestMessPacked", | |
2281 | "Foo__TestMessPacked", | |
2282 | "foo", | |
2283 | sizeof(Foo__TestMessPacked), | |
2284 | 15, | |
2285 | foo__test_mess_packed__field_descriptors, | |
2286 | foo__test_mess_packed__field_indices_by_name, | |
2287 | 1, foo__test_mess_packed__number_ranges, | |
2288 | (ProtobufCMessageInit) foo__test_mess_packed__init, | |
2289 | NULL,NULL,NULL /* reserved[123] */ | |
2290 | }; | |
1996 | 2291 | static const ProtobufCFieldDescriptor foo__test_mess_optional__field_descriptors[18] = |
1997 | 2292 | { |
1998 | 2293 | { |
2004 | 2299 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_int32), |
2005 | 2300 | NULL, |
2006 | 2301 | NULL, |
2007 | NULL,NULL /* reserved1, reserved2 */ | |
2302 | 0, /* packed */ | |
2303 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2008 | 2304 | }, |
2009 | 2305 | { |
2010 | 2306 | "test_sint32", |
2015 | 2311 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_sint32), |
2016 | 2312 | NULL, |
2017 | 2313 | NULL, |
2018 | NULL,NULL /* reserved1, reserved2 */ | |
2314 | 0, /* packed */ | |
2315 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2019 | 2316 | }, |
2020 | 2317 | { |
2021 | 2318 | "test_sfixed32", |
2026 | 2323 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_sfixed32), |
2027 | 2324 | NULL, |
2028 | 2325 | NULL, |
2029 | NULL,NULL /* reserved1, reserved2 */ | |
2326 | 0, /* packed */ | |
2327 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2030 | 2328 | }, |
2031 | 2329 | { |
2032 | 2330 | "test_int64", |
2037 | 2335 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_int64), |
2038 | 2336 | NULL, |
2039 | 2337 | NULL, |
2040 | NULL,NULL /* reserved1, reserved2 */ | |
2338 | 0, /* packed */ | |
2339 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2041 | 2340 | }, |
2042 | 2341 | { |
2043 | 2342 | "test_sint64", |
2048 | 2347 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_sint64), |
2049 | 2348 | NULL, |
2050 | 2349 | NULL, |
2051 | NULL,NULL /* reserved1, reserved2 */ | |
2350 | 0, /* packed */ | |
2351 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2052 | 2352 | }, |
2053 | 2353 | { |
2054 | 2354 | "test_sfixed64", |
2059 | 2359 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_sfixed64), |
2060 | 2360 | NULL, |
2061 | 2361 | NULL, |
2062 | NULL,NULL /* reserved1, reserved2 */ | |
2362 | 0, /* packed */ | |
2363 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2063 | 2364 | }, |
2064 | 2365 | { |
2065 | 2366 | "test_uint32", |
2070 | 2371 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_uint32), |
2071 | 2372 | NULL, |
2072 | 2373 | NULL, |
2073 | NULL,NULL /* reserved1, reserved2 */ | |
2374 | 0, /* packed */ | |
2375 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2074 | 2376 | }, |
2075 | 2377 | { |
2076 | 2378 | "test_fixed32", |
2081 | 2383 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_fixed32), |
2082 | 2384 | NULL, |
2083 | 2385 | NULL, |
2084 | NULL,NULL /* reserved1, reserved2 */ | |
2386 | 0, /* packed */ | |
2387 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2085 | 2388 | }, |
2086 | 2389 | { |
2087 | 2390 | "test_uint64", |
2092 | 2395 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_uint64), |
2093 | 2396 | NULL, |
2094 | 2397 | NULL, |
2095 | NULL,NULL /* reserved1, reserved2 */ | |
2398 | 0, /* packed */ | |
2399 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2096 | 2400 | }, |
2097 | 2401 | { |
2098 | 2402 | "test_fixed64", |
2103 | 2407 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_fixed64), |
2104 | 2408 | NULL, |
2105 | 2409 | NULL, |
2106 | NULL,NULL /* reserved1, reserved2 */ | |
2410 | 0, /* packed */ | |
2411 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2107 | 2412 | }, |
2108 | 2413 | { |
2109 | 2414 | "test_float", |
2114 | 2419 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_float), |
2115 | 2420 | NULL, |
2116 | 2421 | NULL, |
2117 | NULL,NULL /* reserved1, reserved2 */ | |
2422 | 0, /* packed */ | |
2423 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2118 | 2424 | }, |
2119 | 2425 | { |
2120 | 2426 | "test_double", |
2125 | 2431 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_double), |
2126 | 2432 | NULL, |
2127 | 2433 | NULL, |
2128 | NULL,NULL /* reserved1, reserved2 */ | |
2434 | 0, /* packed */ | |
2435 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2129 | 2436 | }, |
2130 | 2437 | { |
2131 | 2438 | "test_boolean", |
2136 | 2443 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_boolean), |
2137 | 2444 | NULL, |
2138 | 2445 | NULL, |
2139 | NULL,NULL /* reserved1, reserved2 */ | |
2446 | 0, /* packed */ | |
2447 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2140 | 2448 | }, |
2141 | 2449 | { |
2142 | 2450 | "test_enum_small", |
2147 | 2455 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_enum_small), |
2148 | 2456 | &foo__test_enum_small__descriptor, |
2149 | 2457 | NULL, |
2150 | NULL,NULL /* reserved1, reserved2 */ | |
2458 | 0, /* packed */ | |
2459 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2151 | 2460 | }, |
2152 | 2461 | { |
2153 | 2462 | "test_enum", |
2158 | 2467 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_enum), |
2159 | 2468 | &foo__test_enum__descriptor, |
2160 | 2469 | NULL, |
2161 | NULL,NULL /* reserved1, reserved2 */ | |
2470 | 0, /* packed */ | |
2471 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2162 | 2472 | }, |
2163 | 2473 | { |
2164 | 2474 | "test_string", |
2169 | 2479 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_string), |
2170 | 2480 | NULL, |
2171 | 2481 | NULL, |
2172 | NULL,NULL /* reserved1, reserved2 */ | |
2482 | 0, /* packed */ | |
2483 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2173 | 2484 | }, |
2174 | 2485 | { |
2175 | 2486 | "test_bytes", |
2180 | 2491 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_bytes), |
2181 | 2492 | NULL, |
2182 | 2493 | NULL, |
2183 | NULL,NULL /* reserved1, reserved2 */ | |
2494 | 0, /* packed */ | |
2495 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2184 | 2496 | }, |
2185 | 2497 | { |
2186 | 2498 | "test_message", |
2191 | 2503 | PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_message), |
2192 | 2504 | &foo__sub_mess__descriptor, |
2193 | 2505 | NULL, |
2194 | NULL,NULL /* reserved1, reserved2 */ | |
2506 | 0, /* packed */ | |
2507 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2195 | 2508 | }, |
2196 | 2509 | }; |
2197 | 2510 | static const unsigned foo__test_mess_optional__field_indices_by_name[] = { |
2245 | 2558 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredInt32, test), |
2246 | 2559 | NULL, |
2247 | 2560 | NULL, |
2248 | NULL,NULL /* reserved1, reserved2 */ | |
2561 | 0, /* packed */ | |
2562 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2249 | 2563 | }, |
2250 | 2564 | }; |
2251 | 2565 | static const unsigned foo__test_mess_required_int32__field_indices_by_name[] = { |
2282 | 2596 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredSInt32, test), |
2283 | 2597 | NULL, |
2284 | 2598 | NULL, |
2285 | NULL,NULL /* reserved1, reserved2 */ | |
2599 | 0, /* packed */ | |
2600 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2286 | 2601 | }, |
2287 | 2602 | }; |
2288 | 2603 | static const unsigned foo__test_mess_required_sint32__field_indices_by_name[] = { |
2319 | 2634 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredSFixed32, test), |
2320 | 2635 | NULL, |
2321 | 2636 | NULL, |
2322 | NULL,NULL /* reserved1, reserved2 */ | |
2637 | 0, /* packed */ | |
2638 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2323 | 2639 | }, |
2324 | 2640 | }; |
2325 | 2641 | static const unsigned foo__test_mess_required_sfixed32__field_indices_by_name[] = { |
2356 | 2672 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredInt64, test), |
2357 | 2673 | NULL, |
2358 | 2674 | NULL, |
2359 | NULL,NULL /* reserved1, reserved2 */ | |
2675 | 0, /* packed */ | |
2676 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2360 | 2677 | }, |
2361 | 2678 | }; |
2362 | 2679 | static const unsigned foo__test_mess_required_int64__field_indices_by_name[] = { |
2393 | 2710 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredSInt64, test), |
2394 | 2711 | NULL, |
2395 | 2712 | NULL, |
2396 | NULL,NULL /* reserved1, reserved2 */ | |
2713 | 0, /* packed */ | |
2714 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2397 | 2715 | }, |
2398 | 2716 | }; |
2399 | 2717 | static const unsigned foo__test_mess_required_sint64__field_indices_by_name[] = { |
2430 | 2748 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredSFixed64, test), |
2431 | 2749 | NULL, |
2432 | 2750 | NULL, |
2433 | NULL,NULL /* reserved1, reserved2 */ | |
2751 | 0, /* packed */ | |
2752 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2434 | 2753 | }, |
2435 | 2754 | }; |
2436 | 2755 | static const unsigned foo__test_mess_required_sfixed64__field_indices_by_name[] = { |
2467 | 2786 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredUInt32, test), |
2468 | 2787 | NULL, |
2469 | 2788 | NULL, |
2470 | NULL,NULL /* reserved1, reserved2 */ | |
2789 | 0, /* packed */ | |
2790 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2471 | 2791 | }, |
2472 | 2792 | }; |
2473 | 2793 | static const unsigned foo__test_mess_required_uint32__field_indices_by_name[] = { |
2504 | 2824 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredFixed32, test), |
2505 | 2825 | NULL, |
2506 | 2826 | NULL, |
2507 | NULL,NULL /* reserved1, reserved2 */ | |
2827 | 0, /* packed */ | |
2828 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2508 | 2829 | }, |
2509 | 2830 | }; |
2510 | 2831 | static const unsigned foo__test_mess_required_fixed32__field_indices_by_name[] = { |
2541 | 2862 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredUInt64, test), |
2542 | 2863 | NULL, |
2543 | 2864 | NULL, |
2544 | NULL,NULL /* reserved1, reserved2 */ | |
2865 | 0, /* packed */ | |
2866 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2545 | 2867 | }, |
2546 | 2868 | }; |
2547 | 2869 | static const unsigned foo__test_mess_required_uint64__field_indices_by_name[] = { |
2578 | 2900 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredFixed64, test), |
2579 | 2901 | NULL, |
2580 | 2902 | NULL, |
2581 | NULL,NULL /* reserved1, reserved2 */ | |
2903 | 0, /* packed */ | |
2904 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2582 | 2905 | }, |
2583 | 2906 | }; |
2584 | 2907 | static const unsigned foo__test_mess_required_fixed64__field_indices_by_name[] = { |
2615 | 2938 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredFloat, test), |
2616 | 2939 | NULL, |
2617 | 2940 | NULL, |
2618 | NULL,NULL /* reserved1, reserved2 */ | |
2941 | 0, /* packed */ | |
2942 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2619 | 2943 | }, |
2620 | 2944 | }; |
2621 | 2945 | static const unsigned foo__test_mess_required_float__field_indices_by_name[] = { |
2652 | 2976 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredDouble, test), |
2653 | 2977 | NULL, |
2654 | 2978 | NULL, |
2655 | NULL,NULL /* reserved1, reserved2 */ | |
2979 | 0, /* packed */ | |
2980 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2656 | 2981 | }, |
2657 | 2982 | }; |
2658 | 2983 | static const unsigned foo__test_mess_required_double__field_indices_by_name[] = { |
2689 | 3014 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredBool, test), |
2690 | 3015 | NULL, |
2691 | 3016 | NULL, |
2692 | NULL,NULL /* reserved1, reserved2 */ | |
3017 | 0, /* packed */ | |
3018 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2693 | 3019 | }, |
2694 | 3020 | }; |
2695 | 3021 | static const unsigned foo__test_mess_required_bool__field_indices_by_name[] = { |
2726 | 3052 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredEnum, test), |
2727 | 3053 | &foo__test_enum__descriptor, |
2728 | 3054 | NULL, |
2729 | NULL,NULL /* reserved1, reserved2 */ | |
3055 | 0, /* packed */ | |
3056 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2730 | 3057 | }, |
2731 | 3058 | }; |
2732 | 3059 | static const unsigned foo__test_mess_required_enum__field_indices_by_name[] = { |
2763 | 3090 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredEnumSmall, test), |
2764 | 3091 | &foo__test_enum_small__descriptor, |
2765 | 3092 | NULL, |
2766 | NULL,NULL /* reserved1, reserved2 */ | |
3093 | 0, /* packed */ | |
3094 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2767 | 3095 | }, |
2768 | 3096 | }; |
2769 | 3097 | static const unsigned foo__test_mess_required_enum_small__field_indices_by_name[] = { |
2800 | 3128 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredString, test), |
2801 | 3129 | NULL, |
2802 | 3130 | NULL, |
2803 | NULL,NULL /* reserved1, reserved2 */ | |
3131 | 0, /* packed */ | |
3132 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2804 | 3133 | }, |
2805 | 3134 | }; |
2806 | 3135 | static const unsigned foo__test_mess_required_string__field_indices_by_name[] = { |
2837 | 3166 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredBytes, test), |
2838 | 3167 | NULL, |
2839 | 3168 | NULL, |
2840 | NULL,NULL /* reserved1, reserved2 */ | |
3169 | 0, /* packed */ | |
3170 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2841 | 3171 | }, |
2842 | 3172 | }; |
2843 | 3173 | static const unsigned foo__test_mess_required_bytes__field_indices_by_name[] = { |
2874 | 3204 | PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredMessage, test), |
2875 | 3205 | &foo__sub_mess__descriptor, |
2876 | 3206 | NULL, |
2877 | NULL,NULL /* reserved1, reserved2 */ | |
3207 | 0, /* packed */ | |
3208 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2878 | 3209 | }, |
2879 | 3210 | }; |
2880 | 3211 | static const unsigned foo__test_mess_required_message__field_indices_by_name[] = { |
2941 | 3272 | PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_int32), |
2942 | 3273 | NULL, |
2943 | 3274 | &foo__default_required_values__v_int32__default_value, |
2944 | NULL,NULL /* reserved1, reserved2 */ | |
3275 | 0, /* packed */ | |
3276 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2945 | 3277 | }, |
2946 | 3278 | { |
2947 | 3279 | "v_uint32", |
2952 | 3284 | PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_uint32), |
2953 | 3285 | NULL, |
2954 | 3286 | &foo__default_required_values__v_uint32__default_value, |
2955 | NULL,NULL /* reserved1, reserved2 */ | |
3287 | 0, /* packed */ | |
3288 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2956 | 3289 | }, |
2957 | 3290 | { |
2958 | 3291 | "v_int64", |
2963 | 3296 | PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_int64), |
2964 | 3297 | NULL, |
2965 | 3298 | &foo__default_required_values__v_int64__default_value, |
2966 | NULL,NULL /* reserved1, reserved2 */ | |
3299 | 0, /* packed */ | |
3300 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2967 | 3301 | }, |
2968 | 3302 | { |
2969 | 3303 | "v_uint64", |
2974 | 3308 | PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_uint64), |
2975 | 3309 | NULL, |
2976 | 3310 | &foo__default_required_values__v_uint64__default_value, |
2977 | NULL,NULL /* reserved1, reserved2 */ | |
3311 | 0, /* packed */ | |
3312 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2978 | 3313 | }, |
2979 | 3314 | { |
2980 | 3315 | "v_float", |
2985 | 3320 | PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_float), |
2986 | 3321 | NULL, |
2987 | 3322 | &foo__default_required_values__v_float__default_value, |
2988 | NULL,NULL /* reserved1, reserved2 */ | |
3323 | 0, /* packed */ | |
3324 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
2989 | 3325 | }, |
2990 | 3326 | { |
2991 | 3327 | "v_double", |
2996 | 3332 | PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_double), |
2997 | 3333 | NULL, |
2998 | 3334 | &foo__default_required_values__v_double__default_value, |
2999 | NULL,NULL /* reserved1, reserved2 */ | |
3335 | 0, /* packed */ | |
3336 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3000 | 3337 | }, |
3001 | 3338 | { |
3002 | 3339 | "v_string", |
3007 | 3344 | PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_string), |
3008 | 3345 | NULL, |
3009 | 3346 | &foo__default_required_values__v_string__default_value, |
3010 | NULL,NULL /* reserved1, reserved2 */ | |
3347 | 0, /* packed */ | |
3348 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3011 | 3349 | }, |
3012 | 3350 | { |
3013 | 3351 | "v_bytes", |
3018 | 3356 | PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_bytes), |
3019 | 3357 | NULL, |
3020 | 3358 | &foo__default_required_values__v_bytes__default_value, |
3021 | NULL,NULL /* reserved1, reserved2 */ | |
3359 | 0, /* packed */ | |
3360 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3022 | 3361 | }, |
3023 | 3362 | }; |
3024 | 3363 | static const unsigned foo__default_required_values__field_indices_by_name[] = { |
3071 | 3410 | PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_int32), |
3072 | 3411 | NULL, |
3073 | 3412 | &foo__default_optional_values__v_int32__default_value, |
3074 | NULL,NULL /* reserved1, reserved2 */ | |
3413 | 0, /* packed */ | |
3414 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3075 | 3415 | }, |
3076 | 3416 | { |
3077 | 3417 | "v_uint32", |
3082 | 3422 | PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_uint32), |
3083 | 3423 | NULL, |
3084 | 3424 | &foo__default_optional_values__v_uint32__default_value, |
3085 | NULL,NULL /* reserved1, reserved2 */ | |
3425 | 0, /* packed */ | |
3426 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3086 | 3427 | }, |
3087 | 3428 | { |
3088 | 3429 | "v_int64", |
3093 | 3434 | PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_int64), |
3094 | 3435 | NULL, |
3095 | 3436 | &foo__default_optional_values__v_int64__default_value, |
3096 | NULL,NULL /* reserved1, reserved2 */ | |
3437 | 0, /* packed */ | |
3438 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3097 | 3439 | }, |
3098 | 3440 | { |
3099 | 3441 | "v_uint64", |
3104 | 3446 | PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_uint64), |
3105 | 3447 | NULL, |
3106 | 3448 | &foo__default_optional_values__v_uint64__default_value, |
3107 | NULL,NULL /* reserved1, reserved2 */ | |
3449 | 0, /* packed */ | |
3450 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3108 | 3451 | }, |
3109 | 3452 | { |
3110 | 3453 | "v_float", |
3115 | 3458 | PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_float), |
3116 | 3459 | NULL, |
3117 | 3460 | &foo__default_optional_values__v_float__default_value, |
3118 | NULL,NULL /* reserved1, reserved2 */ | |
3461 | 0, /* packed */ | |
3462 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3119 | 3463 | }, |
3120 | 3464 | { |
3121 | 3465 | "v_double", |
3126 | 3470 | PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_double), |
3127 | 3471 | NULL, |
3128 | 3472 | &foo__default_optional_values__v_double__default_value, |
3129 | NULL,NULL /* reserved1, reserved2 */ | |
3473 | 0, /* packed */ | |
3474 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3130 | 3475 | }, |
3131 | 3476 | { |
3132 | 3477 | "v_string", |
3137 | 3482 | PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_string), |
3138 | 3483 | NULL, |
3139 | 3484 | &foo__default_optional_values__v_string__default_value, |
3140 | NULL,NULL /* reserved1, reserved2 */ | |
3485 | 0, /* packed */ | |
3486 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3141 | 3487 | }, |
3142 | 3488 | { |
3143 | 3489 | "v_bytes", |
3148 | 3494 | PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_bytes), |
3149 | 3495 | NULL, |
3150 | 3496 | &foo__default_optional_values__v_bytes__default_value, |
3151 | NULL,NULL /* reserved1, reserved2 */ | |
3497 | 0, /* packed */ | |
3498 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3152 | 3499 | }, |
3153 | 3500 | }; |
3154 | 3501 | static const unsigned foo__default_optional_values__field_indices_by_name[] = { |
3192 | 3539 | PROTOBUF_C_OFFSETOF(Foo__AllocValues, o_bytes), |
3193 | 3540 | NULL, |
3194 | 3541 | NULL, |
3195 | NULL,NULL /* reserved1, reserved2 */ | |
3542 | 0, /* packed */ | |
3543 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3196 | 3544 | }, |
3197 | 3545 | { |
3198 | 3546 | "r_string", |
3203 | 3551 | PROTOBUF_C_OFFSETOF(Foo__AllocValues, r_string), |
3204 | 3552 | NULL, |
3205 | 3553 | NULL, |
3206 | NULL,NULL /* reserved1, reserved2 */ | |
3554 | 0, /* packed */ | |
3555 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3207 | 3556 | }, |
3208 | 3557 | { |
3209 | 3558 | "a_string", |
3214 | 3563 | PROTOBUF_C_OFFSETOF(Foo__AllocValues, a_string), |
3215 | 3564 | NULL, |
3216 | 3565 | NULL, |
3217 | NULL,NULL /* reserved1, reserved2 */ | |
3566 | 0, /* packed */ | |
3567 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3218 | 3568 | }, |
3219 | 3569 | { |
3220 | 3570 | "a_bytes", |
3225 | 3575 | PROTOBUF_C_OFFSETOF(Foo__AllocValues, a_bytes), |
3226 | 3576 | NULL, |
3227 | 3577 | NULL, |
3228 | NULL,NULL /* reserved1, reserved2 */ | |
3578 | 0, /* packed */ | |
3579 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3229 | 3580 | }, |
3230 | 3581 | { |
3231 | 3582 | "a_mess", |
3236 | 3587 | PROTOBUF_C_OFFSETOF(Foo__AllocValues, a_mess), |
3237 | 3588 | &foo__default_required_values__descriptor, |
3238 | 3589 | NULL, |
3239 | NULL,NULL /* reserved1, reserved2 */ | |
3590 | 0, /* packed */ | |
3591 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
3240 | 3592 | }, |
3241 | 3593 | }; |
3242 | 3594 | static const unsigned foo__alloc_values__field_indices_by_name[] = { |
43 | 43 | const ::google::protobuf::Descriptor* TestMess_descriptor_ = NULL; |
44 | 44 | const ::google::protobuf::internal::GeneratedMessageReflection* |
45 | 45 | TestMess_reflection_ = NULL; |
46 | const ::google::protobuf::Descriptor* TestMessPacked_descriptor_ = NULL; | |
47 | const ::google::protobuf::internal::GeneratedMessageReflection* | |
48 | TestMessPacked_reflection_ = NULL; | |
46 | 49 | const ::google::protobuf::Descriptor* TestMessOptional_descriptor_ = NULL; |
47 | 50 | const ::google::protobuf::internal::GeneratedMessageReflection* |
48 | 51 | TestMessOptional_reflection_ = NULL; |
292 | 295 | ::google::protobuf::DescriptorPool::generated_pool(), |
293 | 296 | ::google::protobuf::MessageFactory::generated_factory(), |
294 | 297 | sizeof(TestMess)); |
295 | TestMessOptional_descriptor_ = file->message_type(10); | |
298 | TestMessPacked_descriptor_ = file->message_type(10); | |
299 | static const int TestMessPacked_offsets_[15] = { | |
300 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_int32_), | |
301 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_sint32_), | |
302 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_sfixed32_), | |
303 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_int64_), | |
304 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_sint64_), | |
305 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_sfixed64_), | |
306 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_uint32_), | |
307 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_fixed32_), | |
308 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_uint64_), | |
309 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_fixed64_), | |
310 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_float_), | |
311 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_double_), | |
312 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_boolean_), | |
313 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_enum_small_), | |
314 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, test_enum_), | |
315 | }; | |
316 | TestMessPacked_reflection_ = | |
317 | new ::google::protobuf::internal::GeneratedMessageReflection( | |
318 | TestMessPacked_descriptor_, | |
319 | TestMessPacked::default_instance_, | |
320 | TestMessPacked_offsets_, | |
321 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, _has_bits_[0]), | |
322 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessPacked, _unknown_fields_), | |
323 | -1, | |
324 | ::google::protobuf::DescriptorPool::generated_pool(), | |
325 | ::google::protobuf::MessageFactory::generated_factory(), | |
326 | sizeof(TestMessPacked)); | |
327 | TestMessOptional_descriptor_ = file->message_type(11); | |
296 | 328 | static const int TestMessOptional_offsets_[18] = { |
297 | 329 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessOptional, test_int32_), |
298 | 330 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessOptional, test_sint32_), |
324 | 356 | ::google::protobuf::DescriptorPool::generated_pool(), |
325 | 357 | ::google::protobuf::MessageFactory::generated_factory(), |
326 | 358 | sizeof(TestMessOptional)); |
327 | TestMessRequiredInt32_descriptor_ = file->message_type(11); | |
359 | TestMessRequiredInt32_descriptor_ = file->message_type(12); | |
328 | 360 | static const int TestMessRequiredInt32_offsets_[1] = { |
329 | 361 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredInt32, test_), |
330 | 362 | }; |
339 | 371 | ::google::protobuf::DescriptorPool::generated_pool(), |
340 | 372 | ::google::protobuf::MessageFactory::generated_factory(), |
341 | 373 | sizeof(TestMessRequiredInt32)); |
342 | TestMessRequiredSInt32_descriptor_ = file->message_type(12); | |
374 | TestMessRequiredSInt32_descriptor_ = file->message_type(13); | |
343 | 375 | static const int TestMessRequiredSInt32_offsets_[1] = { |
344 | 376 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredSInt32, test_), |
345 | 377 | }; |
354 | 386 | ::google::protobuf::DescriptorPool::generated_pool(), |
355 | 387 | ::google::protobuf::MessageFactory::generated_factory(), |
356 | 388 | sizeof(TestMessRequiredSInt32)); |
357 | TestMessRequiredSFixed32_descriptor_ = file->message_type(13); | |
389 | TestMessRequiredSFixed32_descriptor_ = file->message_type(14); | |
358 | 390 | static const int TestMessRequiredSFixed32_offsets_[1] = { |
359 | 391 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredSFixed32, test_), |
360 | 392 | }; |
369 | 401 | ::google::protobuf::DescriptorPool::generated_pool(), |
370 | 402 | ::google::protobuf::MessageFactory::generated_factory(), |
371 | 403 | sizeof(TestMessRequiredSFixed32)); |
372 | TestMessRequiredInt64_descriptor_ = file->message_type(14); | |
404 | TestMessRequiredInt64_descriptor_ = file->message_type(15); | |
373 | 405 | static const int TestMessRequiredInt64_offsets_[1] = { |
374 | 406 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredInt64, test_), |
375 | 407 | }; |
384 | 416 | ::google::protobuf::DescriptorPool::generated_pool(), |
385 | 417 | ::google::protobuf::MessageFactory::generated_factory(), |
386 | 418 | sizeof(TestMessRequiredInt64)); |
387 | TestMessRequiredSInt64_descriptor_ = file->message_type(15); | |
419 | TestMessRequiredSInt64_descriptor_ = file->message_type(16); | |
388 | 420 | static const int TestMessRequiredSInt64_offsets_[1] = { |
389 | 421 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredSInt64, test_), |
390 | 422 | }; |
399 | 431 | ::google::protobuf::DescriptorPool::generated_pool(), |
400 | 432 | ::google::protobuf::MessageFactory::generated_factory(), |
401 | 433 | sizeof(TestMessRequiredSInt64)); |
402 | TestMessRequiredSFixed64_descriptor_ = file->message_type(16); | |
434 | TestMessRequiredSFixed64_descriptor_ = file->message_type(17); | |
403 | 435 | static const int TestMessRequiredSFixed64_offsets_[1] = { |
404 | 436 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredSFixed64, test_), |
405 | 437 | }; |
414 | 446 | ::google::protobuf::DescriptorPool::generated_pool(), |
415 | 447 | ::google::protobuf::MessageFactory::generated_factory(), |
416 | 448 | sizeof(TestMessRequiredSFixed64)); |
417 | TestMessRequiredUInt32_descriptor_ = file->message_type(17); | |
449 | TestMessRequiredUInt32_descriptor_ = file->message_type(18); | |
418 | 450 | static const int TestMessRequiredUInt32_offsets_[1] = { |
419 | 451 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredUInt32, test_), |
420 | 452 | }; |
429 | 461 | ::google::protobuf::DescriptorPool::generated_pool(), |
430 | 462 | ::google::protobuf::MessageFactory::generated_factory(), |
431 | 463 | sizeof(TestMessRequiredUInt32)); |
432 | TestMessRequiredFixed32_descriptor_ = file->message_type(18); | |
464 | TestMessRequiredFixed32_descriptor_ = file->message_type(19); | |
433 | 465 | static const int TestMessRequiredFixed32_offsets_[1] = { |
434 | 466 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredFixed32, test_), |
435 | 467 | }; |
444 | 476 | ::google::protobuf::DescriptorPool::generated_pool(), |
445 | 477 | ::google::protobuf::MessageFactory::generated_factory(), |
446 | 478 | sizeof(TestMessRequiredFixed32)); |
447 | TestMessRequiredUInt64_descriptor_ = file->message_type(19); | |
479 | TestMessRequiredUInt64_descriptor_ = file->message_type(20); | |
448 | 480 | static const int TestMessRequiredUInt64_offsets_[1] = { |
449 | 481 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredUInt64, test_), |
450 | 482 | }; |
459 | 491 | ::google::protobuf::DescriptorPool::generated_pool(), |
460 | 492 | ::google::protobuf::MessageFactory::generated_factory(), |
461 | 493 | sizeof(TestMessRequiredUInt64)); |
462 | TestMessRequiredFixed64_descriptor_ = file->message_type(20); | |
494 | TestMessRequiredFixed64_descriptor_ = file->message_type(21); | |
463 | 495 | static const int TestMessRequiredFixed64_offsets_[1] = { |
464 | 496 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredFixed64, test_), |
465 | 497 | }; |
474 | 506 | ::google::protobuf::DescriptorPool::generated_pool(), |
475 | 507 | ::google::protobuf::MessageFactory::generated_factory(), |
476 | 508 | sizeof(TestMessRequiredFixed64)); |
477 | TestMessRequiredFloat_descriptor_ = file->message_type(21); | |
509 | TestMessRequiredFloat_descriptor_ = file->message_type(22); | |
478 | 510 | static const int TestMessRequiredFloat_offsets_[1] = { |
479 | 511 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredFloat, test_), |
480 | 512 | }; |
489 | 521 | ::google::protobuf::DescriptorPool::generated_pool(), |
490 | 522 | ::google::protobuf::MessageFactory::generated_factory(), |
491 | 523 | sizeof(TestMessRequiredFloat)); |
492 | TestMessRequiredDouble_descriptor_ = file->message_type(22); | |
524 | TestMessRequiredDouble_descriptor_ = file->message_type(23); | |
493 | 525 | static const int TestMessRequiredDouble_offsets_[1] = { |
494 | 526 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredDouble, test_), |
495 | 527 | }; |
504 | 536 | ::google::protobuf::DescriptorPool::generated_pool(), |
505 | 537 | ::google::protobuf::MessageFactory::generated_factory(), |
506 | 538 | sizeof(TestMessRequiredDouble)); |
507 | TestMessRequiredBool_descriptor_ = file->message_type(23); | |
539 | TestMessRequiredBool_descriptor_ = file->message_type(24); | |
508 | 540 | static const int TestMessRequiredBool_offsets_[1] = { |
509 | 541 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredBool, test_), |
510 | 542 | }; |
519 | 551 | ::google::protobuf::DescriptorPool::generated_pool(), |
520 | 552 | ::google::protobuf::MessageFactory::generated_factory(), |
521 | 553 | sizeof(TestMessRequiredBool)); |
522 | TestMessRequiredEnum_descriptor_ = file->message_type(24); | |
554 | TestMessRequiredEnum_descriptor_ = file->message_type(25); | |
523 | 555 | static const int TestMessRequiredEnum_offsets_[1] = { |
524 | 556 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredEnum, test_), |
525 | 557 | }; |
534 | 566 | ::google::protobuf::DescriptorPool::generated_pool(), |
535 | 567 | ::google::protobuf::MessageFactory::generated_factory(), |
536 | 568 | sizeof(TestMessRequiredEnum)); |
537 | TestMessRequiredEnumSmall_descriptor_ = file->message_type(25); | |
569 | TestMessRequiredEnumSmall_descriptor_ = file->message_type(26); | |
538 | 570 | static const int TestMessRequiredEnumSmall_offsets_[1] = { |
539 | 571 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredEnumSmall, test_), |
540 | 572 | }; |
549 | 581 | ::google::protobuf::DescriptorPool::generated_pool(), |
550 | 582 | ::google::protobuf::MessageFactory::generated_factory(), |
551 | 583 | sizeof(TestMessRequiredEnumSmall)); |
552 | TestMessRequiredString_descriptor_ = file->message_type(26); | |
584 | TestMessRequiredString_descriptor_ = file->message_type(27); | |
553 | 585 | static const int TestMessRequiredString_offsets_[1] = { |
554 | 586 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredString, test_), |
555 | 587 | }; |
564 | 596 | ::google::protobuf::DescriptorPool::generated_pool(), |
565 | 597 | ::google::protobuf::MessageFactory::generated_factory(), |
566 | 598 | sizeof(TestMessRequiredString)); |
567 | TestMessRequiredBytes_descriptor_ = file->message_type(27); | |
599 | TestMessRequiredBytes_descriptor_ = file->message_type(28); | |
568 | 600 | static const int TestMessRequiredBytes_offsets_[1] = { |
569 | 601 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredBytes, test_), |
570 | 602 | }; |
579 | 611 | ::google::protobuf::DescriptorPool::generated_pool(), |
580 | 612 | ::google::protobuf::MessageFactory::generated_factory(), |
581 | 613 | sizeof(TestMessRequiredBytes)); |
582 | TestMessRequiredMessage_descriptor_ = file->message_type(28); | |
614 | TestMessRequiredMessage_descriptor_ = file->message_type(29); | |
583 | 615 | static const int TestMessRequiredMessage_offsets_[1] = { |
584 | 616 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredMessage, test_), |
585 | 617 | }; |
594 | 626 | ::google::protobuf::DescriptorPool::generated_pool(), |
595 | 627 | ::google::protobuf::MessageFactory::generated_factory(), |
596 | 628 | sizeof(TestMessRequiredMessage)); |
597 | EmptyMess_descriptor_ = file->message_type(29); | |
629 | EmptyMess_descriptor_ = file->message_type(30); | |
598 | 630 | static const int EmptyMess_offsets_[1] = { |
599 | 631 | }; |
600 | 632 | EmptyMess_reflection_ = |
608 | 640 | ::google::protobuf::DescriptorPool::generated_pool(), |
609 | 641 | ::google::protobuf::MessageFactory::generated_factory(), |
610 | 642 | sizeof(EmptyMess)); |
611 | DefaultRequiredValues_descriptor_ = file->message_type(30); | |
643 | DefaultRequiredValues_descriptor_ = file->message_type(31); | |
612 | 644 | static const int DefaultRequiredValues_offsets_[8] = { |
613 | 645 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DefaultRequiredValues, v_int32_), |
614 | 646 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DefaultRequiredValues, v_uint32_), |
630 | 662 | ::google::protobuf::DescriptorPool::generated_pool(), |
631 | 663 | ::google::protobuf::MessageFactory::generated_factory(), |
632 | 664 | sizeof(DefaultRequiredValues)); |
633 | DefaultOptionalValues_descriptor_ = file->message_type(31); | |
665 | DefaultOptionalValues_descriptor_ = file->message_type(32); | |
634 | 666 | static const int DefaultOptionalValues_offsets_[8] = { |
635 | 667 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DefaultOptionalValues, v_int32_), |
636 | 668 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DefaultOptionalValues, v_uint32_), |
652 | 684 | ::google::protobuf::DescriptorPool::generated_pool(), |
653 | 685 | ::google::protobuf::MessageFactory::generated_factory(), |
654 | 686 | sizeof(DefaultOptionalValues)); |
655 | AllocValues_descriptor_ = file->message_type(32); | |
687 | AllocValues_descriptor_ = file->message_type(33); | |
656 | 688 | static const int AllocValues_offsets_[5] = { |
657 | 689 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AllocValues, o_bytes_), |
658 | 690 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AllocValues, r_string_), |
706 | 738 | TestFieldNo33554432_descriptor_, &TestFieldNo33554432::default_instance()); |
707 | 739 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( |
708 | 740 | TestMess_descriptor_, &TestMess::default_instance()); |
741 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( | |
742 | TestMessPacked_descriptor_, &TestMessPacked::default_instance()); | |
709 | 743 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( |
710 | 744 | TestMessOptional_descriptor_, &TestMessOptional::default_instance()); |
711 | 745 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( |
777 | 811 | delete TestFieldNo33554432_reflection_; |
778 | 812 | delete TestMess::default_instance_; |
779 | 813 | delete TestMess_reflection_; |
814 | delete TestMessPacked::default_instance_; | |
815 | delete TestMessPacked_reflection_; | |
780 | 816 | delete TestMessOptional::default_instance_; |
781 | 817 | delete TestMessOptional_reflection_; |
782 | 818 | delete TestMessRequiredInt32::default_instance_; |
851 | 887 | "\030\016 \003(\0162\022.foo.TestEnumSmall\022 \n\ttest_enum\030" |
852 | 888 | "\017 \003(\0162\r.foo.TestEnum\022\023\n\013test_string\030\020 \003(" |
853 | 889 | "\t\022\022\n\ntest_bytes\030\021 \003(\014\022\"\n\014test_message\030\022 " |
854 | "\003(\0132\014.foo.SubMess\"\303\003\n\020TestMessOptional\022\022" | |
855 | "\n\ntest_int32\030\001 \001(\005\022\023\n\013test_sint32\030\002 \001(\021\022" | |
856 | "\025\n\rtest_sfixed32\030\003 \001(\017\022\022\n\ntest_int64\030\004 \001" | |
857 | "(\003\022\023\n\013test_sint64\030\005 \001(\022\022\025\n\rtest_sfixed64" | |
858 | "\030\006 \001(\020\022\023\n\013test_uint32\030\007 \001(\r\022\024\n\014test_fixe" | |
859 | "d32\030\010 \001(\007\022\023\n\013test_uint64\030\t \001(\004\022\024\n\014test_f" | |
860 | "ixed64\030\n \001(\006\022\022\n\ntest_float\030\013 \001(\002\022\023\n\013test" | |
861 | "_double\030\014 \001(\001\022\024\n\014test_boolean\030\r \001(\010\022+\n\017t" | |
862 | "est_enum_small\030\016 \001(\0162\022.foo.TestEnumSmall" | |
863 | "\022 \n\ttest_enum\030\017 \001(\0162\r.foo.TestEnum\022\023\n\013te" | |
864 | "st_string\030\020 \001(\t\022\022\n\ntest_bytes\030\021 \001(\014\022\"\n\014t" | |
865 | "est_message\030\022 \001(\0132\014.foo.SubMess\"%\n\025TestM" | |
866 | "essRequiredInt32\022\014\n\004test\030* \002(\005\"&\n\026TestMe" | |
867 | "ssRequiredSInt32\022\014\n\004test\030+ \002(\021\"(\n\030TestMe" | |
868 | "ssRequiredSFixed32\022\014\n\004test\030d \002(\017\"%\n\025Test" | |
869 | "MessRequiredInt64\022\014\n\004test\030\001 \002(\003\"&\n\026TestM" | |
870 | "essRequiredSInt64\022\014\n\004test\030\013 \002(\022\"(\n\030TestM" | |
871 | "essRequiredSFixed64\022\014\n\004test\030\014 \002(\020\"&\n\026Tes" | |
872 | "tMessRequiredUInt32\022\014\n\004test\030\001 \002(\r\"\'\n\027Tes" | |
873 | "tMessRequiredFixed32\022\014\n\004test\030\001 \002(\007\"&\n\026Te" | |
874 | "stMessRequiredUInt64\022\014\n\004test\030\001 \002(\004\"\'\n\027Te" | |
875 | "stMessRequiredFixed64\022\014\n\004test\030\001 \002(\006\"%\n\025T" | |
876 | "estMessRequiredFloat\022\014\n\004test\030\001 \002(\002\"&\n\026Te" | |
877 | "stMessRequiredDouble\022\014\n\004test\030\001 \002(\001\"$\n\024Te" | |
878 | "stMessRequiredBool\022\014\n\004test\030\001 \002(\010\"3\n\024Test" | |
879 | "MessRequiredEnum\022\033\n\004test\030\001 \002(\0162\r.foo.Tes" | |
880 | "tEnum\"=\n\031TestMessRequiredEnumSmall\022 \n\004te" | |
881 | "st\030\001 \002(\0162\022.foo.TestEnumSmall\"&\n\026TestMess" | |
882 | "RequiredString\022\014\n\004test\030\001 \002(\t\"%\n\025TestMess" | |
883 | "RequiredBytes\022\014\n\004test\030\001 \002(\014\"5\n\027TestMessR" | |
884 | "equiredMessage\022\032\n\004test\030\001 \002(\0132\014.foo.SubMe" | |
885 | "ss\"\013\n\tEmptyMess\"\342\001\n\025DefaultRequiredValue" | |
886 | "s\022\024\n\007v_int32\030\001 \002(\005:\003-42\022\025\n\010v_uint32\030\002 \002(" | |
887 | "\r:\003666\022\027\n\007v_int64\030\003 \002(\005:\006100000\022\030\n\010v_uin" | |
888 | "t64\030\004 \002(\r:\006100001\022\024\n\007v_float\030\005 \002(\002:\0032.5\022" | |
889 | "\025\n\010v_double\030\006 \002(\001:\0034.5\022\031\n\010v_string\030\007 \002(\t" | |
890 | ":\007hi mom\n\022!\n\007v_bytes\030\010 \002(\014:\020a \\000 chara" | |
891 | "cter\"\342\001\n\025DefaultOptionalValues\022\024\n\007v_int3" | |
892 | "2\030\001 \001(\005:\003-42\022\025\n\010v_uint32\030\002 \001(\r:\003666\022\027\n\007v" | |
893 | "_int64\030\003 \001(\005:\006100000\022\030\n\010v_uint64\030\004 \001(\r:\006" | |
894 | "100001\022\024\n\007v_float\030\005 \001(\002:\0032.5\022\025\n\010v_double" | |
895 | "\030\006 \001(\001:\0034.5\022\031\n\010v_string\030\007 \001(\t:\007hi mom\n\022!" | |
896 | "\n\007v_bytes\030\010 \001(\014:\020a \\000 character\"\177\n\013All" | |
897 | "ocValues\022\017\n\007o_bytes\030\001 \001(\014\022\020\n\010r_string\030\002 " | |
898 | "\003(\t\022\020\n\010a_string\030\003 \002(\t\022\017\n\007a_bytes\030\004 \002(\014\022*" | |
899 | "\n\006a_mess\030\005 \002(\0132\032.foo.DefaultRequiredValu" | |
900 | "es*+\n\rTestEnumSmall\022\t\n\005VALUE\020\000\022\017\n\013OTHER_" | |
901 | "VALUE\020\001*\272\001\n\010TestEnum\022\n\n\006VALUE0\020\000\022\n\n\006VALU" | |
902 | "E1\020\001\022\014\n\010VALUE127\020\177\022\r\n\010VALUE128\020\200\001\022\017\n\nVAL" | |
903 | "UE16383\020\377\177\022\020\n\nVALUE16384\020\200\200\001\022\022\n\014VALUE209" | |
904 | "7151\020\377\377\177\022\023\n\014VALUE2097152\020\200\200\200\001\022\025\n\016VALUE26" | |
905 | "8435455\020\377\377\377\177\022\026\n\016VALUE268435456\020\200\200\200\200\001*\202\001\n" | |
906 | "\021TestEnumDupValues\022\013\n\007VALUE_A\020*\022\013\n\007VALUE" | |
907 | "_B\020*\022\013\n\007VALUE_C\020*\022\014\n\007VALUE_D\020\232\005\022\014\n\007VALUE" | |
908 | "_E\020\232\005\022\014\n\007VALUE_F\020\350\007\022\r\n\010VALUE_AA\020\350\007\022\r\n\010VA" | |
909 | "LUE_BB\020\351\007", 2969); | |
890 | "\003(\0132\014.foo.SubMess\"\260\003\n\016TestMessPacked\022\026\n\n" | |
891 | "test_int32\030\001 \003(\005B\002\020\001\022\027\n\013test_sint32\030\002 \003(" | |
892 | "\021B\002\020\001\022\031\n\rtest_sfixed32\030\003 \003(\017B\002\020\001\022\026\n\ntest" | |
893 | "_int64\030\004 \003(\003B\002\020\001\022\027\n\013test_sint64\030\005 \003(\022B\002\020" | |
894 | "\001\022\031\n\rtest_sfixed64\030\006 \003(\020B\002\020\001\022\027\n\013test_uin" | |
895 | "t32\030\007 \003(\rB\002\020\001\022\030\n\014test_fixed32\030\010 \003(\007B\002\020\001\022" | |
896 | "\027\n\013test_uint64\030\t \003(\004B\002\020\001\022\030\n\014test_fixed64" | |
897 | "\030\n \003(\006B\002\020\001\022\026\n\ntest_float\030\013 \003(\002B\002\020\001\022\027\n\013te" | |
898 | "st_double\030\014 \003(\001B\002\020\001\022\030\n\014test_boolean\030\r \003(" | |
899 | "\010B\002\020\001\022/\n\017test_enum_small\030\016 \003(\0162\022.foo.Tes" | |
900 | "tEnumSmallB\002\020\001\022$\n\ttest_enum\030\017 \003(\0162\r.foo." | |
901 | "TestEnumB\002\020\001\"\303\003\n\020TestMessOptional\022\022\n\ntes" | |
902 | "t_int32\030\001 \001(\005\022\023\n\013test_sint32\030\002 \001(\021\022\025\n\rte" | |
903 | "st_sfixed32\030\003 \001(\017\022\022\n\ntest_int64\030\004 \001(\003\022\023\n" | |
904 | "\013test_sint64\030\005 \001(\022\022\025\n\rtest_sfixed64\030\006 \001(" | |
905 | "\020\022\023\n\013test_uint32\030\007 \001(\r\022\024\n\014test_fixed32\030\010" | |
906 | " \001(\007\022\023\n\013test_uint64\030\t \001(\004\022\024\n\014test_fixed6" | |
907 | "4\030\n \001(\006\022\022\n\ntest_float\030\013 \001(\002\022\023\n\013test_doub" | |
908 | "le\030\014 \001(\001\022\024\n\014test_boolean\030\r \001(\010\022+\n\017test_e" | |
909 | "num_small\030\016 \001(\0162\022.foo.TestEnumSmall\022 \n\tt" | |
910 | "est_enum\030\017 \001(\0162\r.foo.TestEnum\022\023\n\013test_st" | |
911 | "ring\030\020 \001(\t\022\022\n\ntest_bytes\030\021 \001(\014\022\"\n\014test_m" | |
912 | "essage\030\022 \001(\0132\014.foo.SubMess\"%\n\025TestMessRe" | |
913 | "quiredInt32\022\014\n\004test\030* \002(\005\"&\n\026TestMessReq" | |
914 | "uiredSInt32\022\014\n\004test\030+ \002(\021\"(\n\030TestMessReq" | |
915 | "uiredSFixed32\022\014\n\004test\030d \002(\017\"%\n\025TestMessR" | |
916 | "equiredInt64\022\014\n\004test\030\001 \002(\003\"&\n\026TestMessRe" | |
917 | "quiredSInt64\022\014\n\004test\030\013 \002(\022\"(\n\030TestMessRe" | |
918 | "quiredSFixed64\022\014\n\004test\030\014 \002(\020\"&\n\026TestMess" | |
919 | "RequiredUInt32\022\014\n\004test\030\001 \002(\r\"\'\n\027TestMess" | |
920 | "RequiredFixed32\022\014\n\004test\030\001 \002(\007\"&\n\026TestMes" | |
921 | "sRequiredUInt64\022\014\n\004test\030\001 \002(\004\"\'\n\027TestMes" | |
922 | "sRequiredFixed64\022\014\n\004test\030\001 \002(\006\"%\n\025TestMe" | |
923 | "ssRequiredFloat\022\014\n\004test\030\001 \002(\002\"&\n\026TestMes" | |
924 | "sRequiredDouble\022\014\n\004test\030\001 \002(\001\"$\n\024TestMes" | |
925 | "sRequiredBool\022\014\n\004test\030\001 \002(\010\"3\n\024TestMessR" | |
926 | "equiredEnum\022\033\n\004test\030\001 \002(\0162\r.foo.TestEnum" | |
927 | "\"=\n\031TestMessRequiredEnumSmall\022 \n\004test\030\001 " | |
928 | "\002(\0162\022.foo.TestEnumSmall\"&\n\026TestMessRequi" | |
929 | "redString\022\014\n\004test\030\001 \002(\t\"%\n\025TestMessRequi" | |
930 | "redBytes\022\014\n\004test\030\001 \002(\014\"5\n\027TestMessRequir" | |
931 | "edMessage\022\032\n\004test\030\001 \002(\0132\014.foo.SubMess\"\013\n" | |
932 | "\tEmptyMess\"\342\001\n\025DefaultRequiredValues\022\024\n\007" | |
933 | "v_int32\030\001 \002(\005:\003-42\022\025\n\010v_uint32\030\002 \002(\r:\00366" | |
934 | "6\022\027\n\007v_int64\030\003 \002(\005:\006100000\022\030\n\010v_uint64\030\004" | |
935 | " \002(\r:\006100001\022\024\n\007v_float\030\005 \002(\002:\0032.5\022\025\n\010v_" | |
936 | "double\030\006 \002(\001:\0034.5\022\031\n\010v_string\030\007 \002(\t:\007hi " | |
937 | "mom\n\022!\n\007v_bytes\030\010 \002(\014:\020a \\000 character\"" | |
938 | "\342\001\n\025DefaultOptionalValues\022\024\n\007v_int32\030\001 \001" | |
939 | "(\005:\003-42\022\025\n\010v_uint32\030\002 \001(\r:\003666\022\027\n\007v_int6" | |
940 | "4\030\003 \001(\005:\006100000\022\030\n\010v_uint64\030\004 \001(\r:\00610000" | |
941 | "1\022\024\n\007v_float\030\005 \001(\002:\0032.5\022\025\n\010v_double\030\006 \001(" | |
942 | "\001:\0034.5\022\031\n\010v_string\030\007 \001(\t:\007hi mom\n\022!\n\007v_b" | |
943 | "ytes\030\010 \001(\014:\020a \\000 character\"\177\n\013AllocVal" | |
944 | "ues\022\017\n\007o_bytes\030\001 \001(\014\022\020\n\010r_string\030\002 \003(\t\022\020" | |
945 | "\n\010a_string\030\003 \002(\t\022\017\n\007a_bytes\030\004 \002(\014\022*\n\006a_m" | |
946 | "ess\030\005 \002(\0132\032.foo.DefaultRequiredValues*+\n" | |
947 | "\rTestEnumSmall\022\t\n\005VALUE\020\000\022\017\n\013OTHER_VALUE" | |
948 | "\020\001*\272\001\n\010TestEnum\022\n\n\006VALUE0\020\000\022\n\n\006VALUE1\020\001\022" | |
949 | "\014\n\010VALUE127\020\177\022\r\n\010VALUE128\020\200\001\022\017\n\nVALUE163" | |
950 | "83\020\377\177\022\020\n\nVALUE16384\020\200\200\001\022\022\n\014VALUE2097151\020" | |
951 | "\377\377\177\022\023\n\014VALUE2097152\020\200\200\200\001\022\025\n\016VALUE2684354" | |
952 | "55\020\377\377\377\177\022\026\n\016VALUE268435456\020\200\200\200\200\001*\202\001\n\021Test" | |
953 | "EnumDupValues\022\013\n\007VALUE_A\020*\022\013\n\007VALUE_B\020*\022" | |
954 | "\013\n\007VALUE_C\020*\022\014\n\007VALUE_D\020\232\005\022\014\n\007VALUE_E\020\232\005" | |
955 | "\022\014\n\007VALUE_F\020\350\007\022\r\n\010VALUE_AA\020\350\007\022\r\n\010VALUE_B" | |
956 | "B\020\351\007", 3404); | |
910 | 957 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( |
911 | 958 | "test-full.proto", &protobuf_RegisterTypes); |
912 | 959 | SubMess::default_instance_ = new SubMess(); |
919 | 966 | TestFieldNo33554431::default_instance_ = new TestFieldNo33554431(); |
920 | 967 | TestFieldNo33554432::default_instance_ = new TestFieldNo33554432(); |
921 | 968 | TestMess::default_instance_ = new TestMess(); |
969 | TestMessPacked::default_instance_ = new TestMessPacked(); | |
922 | 970 | TestMessOptional::default_instance_ = new TestMessOptional(); |
923 | 971 | TestMessRequiredInt32::default_instance_ = new TestMessRequiredInt32(); |
924 | 972 | TestMessRequiredSInt32::default_instance_ = new TestMessRequiredSInt32(); |
952 | 1000 | TestFieldNo33554431::default_instance_->InitAsDefaultInstance(); |
953 | 1001 | TestFieldNo33554432::default_instance_->InitAsDefaultInstance(); |
954 | 1002 | TestMess::default_instance_->InitAsDefaultInstance(); |
1003 | TestMessPacked::default_instance_->InitAsDefaultInstance(); | |
955 | 1004 | TestMessOptional::default_instance_->InitAsDefaultInstance(); |
956 | 1005 | TestMessRequiredInt32::default_instance_->InitAsDefaultInstance(); |
957 | 1006 | TestMessRequiredSInt32::default_instance_->InitAsDefaultInstance(); |
4059 | 4108 | |
4060 | 4109 | // =================================================================== |
4061 | 4110 | |
4111 | #ifndef _MSC_VER | |
4112 | const int TestMessPacked::kTestInt32FieldNumber; | |
4113 | const int TestMessPacked::kTestSint32FieldNumber; | |
4114 | const int TestMessPacked::kTestSfixed32FieldNumber; | |
4115 | const int TestMessPacked::kTestInt64FieldNumber; | |
4116 | const int TestMessPacked::kTestSint64FieldNumber; | |
4117 | const int TestMessPacked::kTestSfixed64FieldNumber; | |
4118 | const int TestMessPacked::kTestUint32FieldNumber; | |
4119 | const int TestMessPacked::kTestFixed32FieldNumber; | |
4120 | const int TestMessPacked::kTestUint64FieldNumber; | |
4121 | const int TestMessPacked::kTestFixed64FieldNumber; | |
4122 | const int TestMessPacked::kTestFloatFieldNumber; | |
4123 | const int TestMessPacked::kTestDoubleFieldNumber; | |
4124 | const int TestMessPacked::kTestBooleanFieldNumber; | |
4125 | const int TestMessPacked::kTestEnumSmallFieldNumber; | |
4126 | const int TestMessPacked::kTestEnumFieldNumber; | |
4127 | #endif // !_MSC_VER | |
4128 | ||
4129 | TestMessPacked::TestMessPacked() | |
4130 | : ::google::protobuf::Message() { | |
4131 | SharedCtor(); | |
4132 | } | |
4133 | ||
4134 | void TestMessPacked::InitAsDefaultInstance() { | |
4135 | } | |
4136 | ||
4137 | TestMessPacked::TestMessPacked(const TestMessPacked& from) | |
4138 | : ::google::protobuf::Message() { | |
4139 | SharedCtor(); | |
4140 | MergeFrom(from); | |
4141 | } | |
4142 | ||
4143 | void TestMessPacked::SharedCtor() { | |
4144 | _cached_size_ = 0; | |
4145 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); | |
4146 | } | |
4147 | ||
4148 | TestMessPacked::~TestMessPacked() { | |
4149 | SharedDtor(); | |
4150 | } | |
4151 | ||
4152 | void TestMessPacked::SharedDtor() { | |
4153 | if (this != default_instance_) { | |
4154 | } | |
4155 | } | |
4156 | ||
4157 | void TestMessPacked::SetCachedSize(int size) const { | |
4158 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | |
4159 | _cached_size_ = size; | |
4160 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); | |
4161 | } | |
4162 | const ::google::protobuf::Descriptor* TestMessPacked::descriptor() { | |
4163 | protobuf_AssignDescriptorsOnce(); | |
4164 | return TestMessPacked_descriptor_; | |
4165 | } | |
4166 | ||
4167 | const TestMessPacked& TestMessPacked::default_instance() { | |
4168 | if (default_instance_ == NULL) protobuf_AddDesc_test_2dfull_2eproto(); return *default_instance_; | |
4169 | } | |
4170 | ||
4171 | TestMessPacked* TestMessPacked::default_instance_ = NULL; | |
4172 | ||
4173 | TestMessPacked* TestMessPacked::New() const { | |
4174 | return new TestMessPacked; | |
4175 | } | |
4176 | ||
4177 | void TestMessPacked::Clear() { | |
4178 | test_int32_.Clear(); | |
4179 | test_sint32_.Clear(); | |
4180 | test_sfixed32_.Clear(); | |
4181 | test_int64_.Clear(); | |
4182 | test_sint64_.Clear(); | |
4183 | test_sfixed64_.Clear(); | |
4184 | test_uint32_.Clear(); | |
4185 | test_fixed32_.Clear(); | |
4186 | test_uint64_.Clear(); | |
4187 | test_fixed64_.Clear(); | |
4188 | test_float_.Clear(); | |
4189 | test_double_.Clear(); | |
4190 | test_boolean_.Clear(); | |
4191 | test_enum_small_.Clear(); | |
4192 | test_enum_.Clear(); | |
4193 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); | |
4194 | mutable_unknown_fields()->Clear(); | |
4195 | } | |
4196 | ||
4197 | bool TestMessPacked::MergePartialFromCodedStream( | |
4198 | ::google::protobuf::io::CodedInputStream* input) { | |
4199 | #define DO_(EXPRESSION) if (!(EXPRESSION)) return false | |
4200 | ::google::protobuf::uint32 tag; | |
4201 | while ((tag = input->ReadTag()) != 0) { | |
4202 | switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { | |
4203 | // repeated int32 test_int32 = 1 [packed = true]; | |
4204 | case 1: { | |
4205 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4206 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4207 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4208 | ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( | |
4209 | input, this->mutable_test_int32()))); | |
4210 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4211 | == ::google::protobuf::internal::WireFormatLite:: | |
4212 | WIRETYPE_VARINT) { | |
4213 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4214 | ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( | |
4215 | 1, 10, input, this->mutable_test_int32()))); | |
4216 | } else { | |
4217 | goto handle_uninterpreted; | |
4218 | } | |
4219 | if (input->ExpectTag(18)) goto parse_test_sint32; | |
4220 | break; | |
4221 | } | |
4222 | ||
4223 | // repeated sint32 test_sint32 = 2 [packed = true]; | |
4224 | case 2: { | |
4225 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4226 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4227 | parse_test_sint32: | |
4228 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4229 | ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_SINT32>( | |
4230 | input, this->mutable_test_sint32()))); | |
4231 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4232 | == ::google::protobuf::internal::WireFormatLite:: | |
4233 | WIRETYPE_VARINT) { | |
4234 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4235 | ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_SINT32>( | |
4236 | 1, 18, input, this->mutable_test_sint32()))); | |
4237 | } else { | |
4238 | goto handle_uninterpreted; | |
4239 | } | |
4240 | if (input->ExpectTag(26)) goto parse_test_sfixed32; | |
4241 | break; | |
4242 | } | |
4243 | ||
4244 | // repeated sfixed32 test_sfixed32 = 3 [packed = true]; | |
4245 | case 3: { | |
4246 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4247 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4248 | parse_test_sfixed32: | |
4249 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4250 | ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_SFIXED32>( | |
4251 | input, this->mutable_test_sfixed32()))); | |
4252 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4253 | == ::google::protobuf::internal::WireFormatLite:: | |
4254 | WIRETYPE_FIXED32) { | |
4255 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4256 | ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_SFIXED32>( | |
4257 | 1, 26, input, this->mutable_test_sfixed32()))); | |
4258 | } else { | |
4259 | goto handle_uninterpreted; | |
4260 | } | |
4261 | if (input->ExpectTag(34)) goto parse_test_int64; | |
4262 | break; | |
4263 | } | |
4264 | ||
4265 | // repeated int64 test_int64 = 4 [packed = true]; | |
4266 | case 4: { | |
4267 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4268 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4269 | parse_test_int64: | |
4270 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4271 | ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( | |
4272 | input, this->mutable_test_int64()))); | |
4273 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4274 | == ::google::protobuf::internal::WireFormatLite:: | |
4275 | WIRETYPE_VARINT) { | |
4276 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4277 | ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( | |
4278 | 1, 34, input, this->mutable_test_int64()))); | |
4279 | } else { | |
4280 | goto handle_uninterpreted; | |
4281 | } | |
4282 | if (input->ExpectTag(42)) goto parse_test_sint64; | |
4283 | break; | |
4284 | } | |
4285 | ||
4286 | // repeated sint64 test_sint64 = 5 [packed = true]; | |
4287 | case 5: { | |
4288 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4289 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4290 | parse_test_sint64: | |
4291 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4292 | ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_SINT64>( | |
4293 | input, this->mutable_test_sint64()))); | |
4294 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4295 | == ::google::protobuf::internal::WireFormatLite:: | |
4296 | WIRETYPE_VARINT) { | |
4297 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4298 | ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_SINT64>( | |
4299 | 1, 42, input, this->mutable_test_sint64()))); | |
4300 | } else { | |
4301 | goto handle_uninterpreted; | |
4302 | } | |
4303 | if (input->ExpectTag(50)) goto parse_test_sfixed64; | |
4304 | break; | |
4305 | } | |
4306 | ||
4307 | // repeated sfixed64 test_sfixed64 = 6 [packed = true]; | |
4308 | case 6: { | |
4309 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4310 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4311 | parse_test_sfixed64: | |
4312 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4313 | ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_SFIXED64>( | |
4314 | input, this->mutable_test_sfixed64()))); | |
4315 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4316 | == ::google::protobuf::internal::WireFormatLite:: | |
4317 | WIRETYPE_FIXED64) { | |
4318 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4319 | ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_SFIXED64>( | |
4320 | 1, 50, input, this->mutable_test_sfixed64()))); | |
4321 | } else { | |
4322 | goto handle_uninterpreted; | |
4323 | } | |
4324 | if (input->ExpectTag(58)) goto parse_test_uint32; | |
4325 | break; | |
4326 | } | |
4327 | ||
4328 | // repeated uint32 test_uint32 = 7 [packed = true]; | |
4329 | case 7: { | |
4330 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4331 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4332 | parse_test_uint32: | |
4333 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4334 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( | |
4335 | input, this->mutable_test_uint32()))); | |
4336 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4337 | == ::google::protobuf::internal::WireFormatLite:: | |
4338 | WIRETYPE_VARINT) { | |
4339 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4340 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( | |
4341 | 1, 58, input, this->mutable_test_uint32()))); | |
4342 | } else { | |
4343 | goto handle_uninterpreted; | |
4344 | } | |
4345 | if (input->ExpectTag(66)) goto parse_test_fixed32; | |
4346 | break; | |
4347 | } | |
4348 | ||
4349 | // repeated fixed32 test_fixed32 = 8 [packed = true]; | |
4350 | case 8: { | |
4351 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4352 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4353 | parse_test_fixed32: | |
4354 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4355 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED32>( | |
4356 | input, this->mutable_test_fixed32()))); | |
4357 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4358 | == ::google::protobuf::internal::WireFormatLite:: | |
4359 | WIRETYPE_FIXED32) { | |
4360 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4361 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED32>( | |
4362 | 1, 66, input, this->mutable_test_fixed32()))); | |
4363 | } else { | |
4364 | goto handle_uninterpreted; | |
4365 | } | |
4366 | if (input->ExpectTag(74)) goto parse_test_uint64; | |
4367 | break; | |
4368 | } | |
4369 | ||
4370 | // repeated uint64 test_uint64 = 9 [packed = true]; | |
4371 | case 9: { | |
4372 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4373 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4374 | parse_test_uint64: | |
4375 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4376 | ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( | |
4377 | input, this->mutable_test_uint64()))); | |
4378 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4379 | == ::google::protobuf::internal::WireFormatLite:: | |
4380 | WIRETYPE_VARINT) { | |
4381 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4382 | ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( | |
4383 | 1, 74, input, this->mutable_test_uint64()))); | |
4384 | } else { | |
4385 | goto handle_uninterpreted; | |
4386 | } | |
4387 | if (input->ExpectTag(82)) goto parse_test_fixed64; | |
4388 | break; | |
4389 | } | |
4390 | ||
4391 | // repeated fixed64 test_fixed64 = 10 [packed = true]; | |
4392 | case 10: { | |
4393 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4394 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4395 | parse_test_fixed64: | |
4396 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4397 | ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED64>( | |
4398 | input, this->mutable_test_fixed64()))); | |
4399 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4400 | == ::google::protobuf::internal::WireFormatLite:: | |
4401 | WIRETYPE_FIXED64) { | |
4402 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4403 | ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED64>( | |
4404 | 1, 82, input, this->mutable_test_fixed64()))); | |
4405 | } else { | |
4406 | goto handle_uninterpreted; | |
4407 | } | |
4408 | if (input->ExpectTag(90)) goto parse_test_float; | |
4409 | break; | |
4410 | } | |
4411 | ||
4412 | // repeated float test_float = 11 [packed = true]; | |
4413 | case 11: { | |
4414 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4415 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4416 | parse_test_float: | |
4417 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4418 | float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( | |
4419 | input, this->mutable_test_float()))); | |
4420 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4421 | == ::google::protobuf::internal::WireFormatLite:: | |
4422 | WIRETYPE_FIXED32) { | |
4423 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4424 | float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( | |
4425 | 1, 90, input, this->mutable_test_float()))); | |
4426 | } else { | |
4427 | goto handle_uninterpreted; | |
4428 | } | |
4429 | if (input->ExpectTag(98)) goto parse_test_double; | |
4430 | break; | |
4431 | } | |
4432 | ||
4433 | // repeated double test_double = 12 [packed = true]; | |
4434 | case 12: { | |
4435 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4436 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4437 | parse_test_double: | |
4438 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4439 | double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( | |
4440 | input, this->mutable_test_double()))); | |
4441 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4442 | == ::google::protobuf::internal::WireFormatLite:: | |
4443 | WIRETYPE_FIXED64) { | |
4444 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4445 | double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( | |
4446 | 1, 98, input, this->mutable_test_double()))); | |
4447 | } else { | |
4448 | goto handle_uninterpreted; | |
4449 | } | |
4450 | if (input->ExpectTag(106)) goto parse_test_boolean; | |
4451 | break; | |
4452 | } | |
4453 | ||
4454 | // repeated bool test_boolean = 13 [packed = true]; | |
4455 | case 13: { | |
4456 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4457 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4458 | parse_test_boolean: | |
4459 | DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< | |
4460 | bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( | |
4461 | input, this->mutable_test_boolean()))); | |
4462 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4463 | == ::google::protobuf::internal::WireFormatLite:: | |
4464 | WIRETYPE_VARINT) { | |
4465 | DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< | |
4466 | bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( | |
4467 | 1, 106, input, this->mutable_test_boolean()))); | |
4468 | } else { | |
4469 | goto handle_uninterpreted; | |
4470 | } | |
4471 | if (input->ExpectTag(114)) goto parse_test_enum_small; | |
4472 | break; | |
4473 | } | |
4474 | ||
4475 | // repeated .foo.TestEnumSmall test_enum_small = 14 [packed = true]; | |
4476 | case 14: { | |
4477 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4478 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4479 | parse_test_enum_small: | |
4480 | ::google::protobuf::uint32 length; | |
4481 | DO_(input->ReadVarint32(&length)); | |
4482 | ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(length); | |
4483 | while (input->BytesUntilLimit() > 0) { | |
4484 | int value; | |
4485 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< | |
4486 | int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( | |
4487 | input, &value))); | |
4488 | if (foo::TestEnumSmall_IsValid(value)) { | |
4489 | add_test_enum_small(static_cast< foo::TestEnumSmall >(value)); | |
4490 | } | |
4491 | } | |
4492 | input->PopLimit(limit); | |
4493 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4494 | == ::google::protobuf::internal::WireFormatLite:: | |
4495 | WIRETYPE_VARINT) { | |
4496 | int value; | |
4497 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< | |
4498 | int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( | |
4499 | input, &value))); | |
4500 | if (foo::TestEnumSmall_IsValid(value)) { | |
4501 | add_test_enum_small(static_cast< foo::TestEnumSmall >(value)); | |
4502 | } else { | |
4503 | mutable_unknown_fields()->AddVarint(14, value); | |
4504 | } | |
4505 | } else { | |
4506 | goto handle_uninterpreted; | |
4507 | } | |
4508 | if (input->ExpectTag(122)) goto parse_test_enum; | |
4509 | break; | |
4510 | } | |
4511 | ||
4512 | // repeated .foo.TestEnum test_enum = 15 [packed = true]; | |
4513 | case 15: { | |
4514 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4515 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { | |
4516 | parse_test_enum: | |
4517 | ::google::protobuf::uint32 length; | |
4518 | DO_(input->ReadVarint32(&length)); | |
4519 | ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(length); | |
4520 | while (input->BytesUntilLimit() > 0) { | |
4521 | int value; | |
4522 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< | |
4523 | int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( | |
4524 | input, &value))); | |
4525 | if (foo::TestEnum_IsValid(value)) { | |
4526 | add_test_enum(static_cast< foo::TestEnum >(value)); | |
4527 | } | |
4528 | } | |
4529 | input->PopLimit(limit); | |
4530 | } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) | |
4531 | == ::google::protobuf::internal::WireFormatLite:: | |
4532 | WIRETYPE_VARINT) { | |
4533 | int value; | |
4534 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< | |
4535 | int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( | |
4536 | input, &value))); | |
4537 | if (foo::TestEnum_IsValid(value)) { | |
4538 | add_test_enum(static_cast< foo::TestEnum >(value)); | |
4539 | } else { | |
4540 | mutable_unknown_fields()->AddVarint(15, value); | |
4541 | } | |
4542 | } else { | |
4543 | goto handle_uninterpreted; | |
4544 | } | |
4545 | if (input->ExpectAtEnd()) return true; | |
4546 | break; | |
4547 | } | |
4548 | ||
4549 | default: { | |
4550 | handle_uninterpreted: | |
4551 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == | |
4552 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { | |
4553 | return true; | |
4554 | } | |
4555 | DO_(::google::protobuf::internal::WireFormat::SkipField( | |
4556 | input, tag, mutable_unknown_fields())); | |
4557 | break; | |
4558 | } | |
4559 | } | |
4560 | } | |
4561 | return true; | |
4562 | #undef DO_ | |
4563 | } | |
4564 | ||
4565 | void TestMessPacked::SerializeWithCachedSizes( | |
4566 | ::google::protobuf::io::CodedOutputStream* output) const { | |
4567 | // repeated int32 test_int32 = 1 [packed = true]; | |
4568 | if (this->test_int32_size() > 0) { | |
4569 | ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4570 | output->WriteVarint32(_test_int32_cached_byte_size_); | |
4571 | } | |
4572 | for (int i = 0; i < this->test_int32_size(); i++) { | |
4573 | ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( | |
4574 | this->test_int32(i), output); | |
4575 | } | |
4576 | ||
4577 | // repeated sint32 test_sint32 = 2 [packed = true]; | |
4578 | if (this->test_sint32_size() > 0) { | |
4579 | ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4580 | output->WriteVarint32(_test_sint32_cached_byte_size_); | |
4581 | } | |
4582 | for (int i = 0; i < this->test_sint32_size(); i++) { | |
4583 | ::google::protobuf::internal::WireFormatLite::WriteSInt32NoTag( | |
4584 | this->test_sint32(i), output); | |
4585 | } | |
4586 | ||
4587 | // repeated sfixed32 test_sfixed32 = 3 [packed = true]; | |
4588 | if (this->test_sfixed32_size() > 0) { | |
4589 | ::google::protobuf::internal::WireFormatLite::WriteTag(3, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4590 | output->WriteVarint32(_test_sfixed32_cached_byte_size_); | |
4591 | } | |
4592 | for (int i = 0; i < this->test_sfixed32_size(); i++) { | |
4593 | ::google::protobuf::internal::WireFormatLite::WriteSFixed32NoTag( | |
4594 | this->test_sfixed32(i), output); | |
4595 | } | |
4596 | ||
4597 | // repeated int64 test_int64 = 4 [packed = true]; | |
4598 | if (this->test_int64_size() > 0) { | |
4599 | ::google::protobuf::internal::WireFormatLite::WriteTag(4, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4600 | output->WriteVarint32(_test_int64_cached_byte_size_); | |
4601 | } | |
4602 | for (int i = 0; i < this->test_int64_size(); i++) { | |
4603 | ::google::protobuf::internal::WireFormatLite::WriteInt64NoTag( | |
4604 | this->test_int64(i), output); | |
4605 | } | |
4606 | ||
4607 | // repeated sint64 test_sint64 = 5 [packed = true]; | |
4608 | if (this->test_sint64_size() > 0) { | |
4609 | ::google::protobuf::internal::WireFormatLite::WriteTag(5, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4610 | output->WriteVarint32(_test_sint64_cached_byte_size_); | |
4611 | } | |
4612 | for (int i = 0; i < this->test_sint64_size(); i++) { | |
4613 | ::google::protobuf::internal::WireFormatLite::WriteSInt64NoTag( | |
4614 | this->test_sint64(i), output); | |
4615 | } | |
4616 | ||
4617 | // repeated sfixed64 test_sfixed64 = 6 [packed = true]; | |
4618 | if (this->test_sfixed64_size() > 0) { | |
4619 | ::google::protobuf::internal::WireFormatLite::WriteTag(6, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4620 | output->WriteVarint32(_test_sfixed64_cached_byte_size_); | |
4621 | } | |
4622 | for (int i = 0; i < this->test_sfixed64_size(); i++) { | |
4623 | ::google::protobuf::internal::WireFormatLite::WriteSFixed64NoTag( | |
4624 | this->test_sfixed64(i), output); | |
4625 | } | |
4626 | ||
4627 | // repeated uint32 test_uint32 = 7 [packed = true]; | |
4628 | if (this->test_uint32_size() > 0) { | |
4629 | ::google::protobuf::internal::WireFormatLite::WriteTag(7, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4630 | output->WriteVarint32(_test_uint32_cached_byte_size_); | |
4631 | } | |
4632 | for (int i = 0; i < this->test_uint32_size(); i++) { | |
4633 | ::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag( | |
4634 | this->test_uint32(i), output); | |
4635 | } | |
4636 | ||
4637 | // repeated fixed32 test_fixed32 = 8 [packed = true]; | |
4638 | if (this->test_fixed32_size() > 0) { | |
4639 | ::google::protobuf::internal::WireFormatLite::WriteTag(8, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4640 | output->WriteVarint32(_test_fixed32_cached_byte_size_); | |
4641 | } | |
4642 | for (int i = 0; i < this->test_fixed32_size(); i++) { | |
4643 | ::google::protobuf::internal::WireFormatLite::WriteFixed32NoTag( | |
4644 | this->test_fixed32(i), output); | |
4645 | } | |
4646 | ||
4647 | // repeated uint64 test_uint64 = 9 [packed = true]; | |
4648 | if (this->test_uint64_size() > 0) { | |
4649 | ::google::protobuf::internal::WireFormatLite::WriteTag(9, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4650 | output->WriteVarint32(_test_uint64_cached_byte_size_); | |
4651 | } | |
4652 | for (int i = 0; i < this->test_uint64_size(); i++) { | |
4653 | ::google::protobuf::internal::WireFormatLite::WriteUInt64NoTag( | |
4654 | this->test_uint64(i), output); | |
4655 | } | |
4656 | ||
4657 | // repeated fixed64 test_fixed64 = 10 [packed = true]; | |
4658 | if (this->test_fixed64_size() > 0) { | |
4659 | ::google::protobuf::internal::WireFormatLite::WriteTag(10, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4660 | output->WriteVarint32(_test_fixed64_cached_byte_size_); | |
4661 | } | |
4662 | for (int i = 0; i < this->test_fixed64_size(); i++) { | |
4663 | ::google::protobuf::internal::WireFormatLite::WriteFixed64NoTag( | |
4664 | this->test_fixed64(i), output); | |
4665 | } | |
4666 | ||
4667 | // repeated float test_float = 11 [packed = true]; | |
4668 | if (this->test_float_size() > 0) { | |
4669 | ::google::protobuf::internal::WireFormatLite::WriteTag(11, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4670 | output->WriteVarint32(_test_float_cached_byte_size_); | |
4671 | } | |
4672 | for (int i = 0; i < this->test_float_size(); i++) { | |
4673 | ::google::protobuf::internal::WireFormatLite::WriteFloatNoTag( | |
4674 | this->test_float(i), output); | |
4675 | } | |
4676 | ||
4677 | // repeated double test_double = 12 [packed = true]; | |
4678 | if (this->test_double_size() > 0) { | |
4679 | ::google::protobuf::internal::WireFormatLite::WriteTag(12, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4680 | output->WriteVarint32(_test_double_cached_byte_size_); | |
4681 | } | |
4682 | for (int i = 0; i < this->test_double_size(); i++) { | |
4683 | ::google::protobuf::internal::WireFormatLite::WriteDoubleNoTag( | |
4684 | this->test_double(i), output); | |
4685 | } | |
4686 | ||
4687 | // repeated bool test_boolean = 13 [packed = true]; | |
4688 | if (this->test_boolean_size() > 0) { | |
4689 | ::google::protobuf::internal::WireFormatLite::WriteTag(13, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); | |
4690 | output->WriteVarint32(_test_boolean_cached_byte_size_); | |
4691 | } | |
4692 | for (int i = 0; i < this->test_boolean_size(); i++) { | |
4693 | ::google::protobuf::internal::WireFormatLite::WriteBoolNoTag( | |
4694 | this->test_boolean(i), output); | |
4695 | } | |
4696 | ||
4697 | // repeated .foo.TestEnumSmall test_enum_small = 14 [packed = true]; | |
4698 | if (this->test_enum_small_size() > 0) { | |
4699 | ::google::protobuf::internal::WireFormatLite::WriteTag( | |
4700 | 14, | |
4701 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4702 | output); | |
4703 | output->WriteVarint32(_test_enum_small_cached_byte_size_); | |
4704 | } | |
4705 | for (int i = 0; i < this->test_enum_small_size(); i++) { | |
4706 | ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag( | |
4707 | this->test_enum_small(i), output); | |
4708 | } | |
4709 | ||
4710 | // repeated .foo.TestEnum test_enum = 15 [packed = true]; | |
4711 | if (this->test_enum_size() > 0) { | |
4712 | ::google::protobuf::internal::WireFormatLite::WriteTag( | |
4713 | 15, | |
4714 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4715 | output); | |
4716 | output->WriteVarint32(_test_enum_cached_byte_size_); | |
4717 | } | |
4718 | for (int i = 0; i < this->test_enum_size(); i++) { | |
4719 | ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag( | |
4720 | this->test_enum(i), output); | |
4721 | } | |
4722 | ||
4723 | if (!unknown_fields().empty()) { | |
4724 | ::google::protobuf::internal::WireFormat::SerializeUnknownFields( | |
4725 | unknown_fields(), output); | |
4726 | } | |
4727 | } | |
4728 | ||
4729 | ::google::protobuf::uint8* TestMessPacked::SerializeWithCachedSizesToArray( | |
4730 | ::google::protobuf::uint8* target) const { | |
4731 | // repeated int32 test_int32 = 1 [packed = true]; | |
4732 | if (this->test_int32_size() > 0) { | |
4733 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4734 | 1, | |
4735 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4736 | target); | |
4737 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4738 | _test_int32_cached_byte_size_, target); | |
4739 | } | |
4740 | for (int i = 0; i < this->test_int32_size(); i++) { | |
4741 | target = ::google::protobuf::internal::WireFormatLite:: | |
4742 | WriteInt32NoTagToArray(this->test_int32(i), target); | |
4743 | } | |
4744 | ||
4745 | // repeated sint32 test_sint32 = 2 [packed = true]; | |
4746 | if (this->test_sint32_size() > 0) { | |
4747 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4748 | 2, | |
4749 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4750 | target); | |
4751 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4752 | _test_sint32_cached_byte_size_, target); | |
4753 | } | |
4754 | for (int i = 0; i < this->test_sint32_size(); i++) { | |
4755 | target = ::google::protobuf::internal::WireFormatLite:: | |
4756 | WriteSInt32NoTagToArray(this->test_sint32(i), target); | |
4757 | } | |
4758 | ||
4759 | // repeated sfixed32 test_sfixed32 = 3 [packed = true]; | |
4760 | if (this->test_sfixed32_size() > 0) { | |
4761 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4762 | 3, | |
4763 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4764 | target); | |
4765 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4766 | _test_sfixed32_cached_byte_size_, target); | |
4767 | } | |
4768 | for (int i = 0; i < this->test_sfixed32_size(); i++) { | |
4769 | target = ::google::protobuf::internal::WireFormatLite:: | |
4770 | WriteSFixed32NoTagToArray(this->test_sfixed32(i), target); | |
4771 | } | |
4772 | ||
4773 | // repeated int64 test_int64 = 4 [packed = true]; | |
4774 | if (this->test_int64_size() > 0) { | |
4775 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4776 | 4, | |
4777 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4778 | target); | |
4779 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4780 | _test_int64_cached_byte_size_, target); | |
4781 | } | |
4782 | for (int i = 0; i < this->test_int64_size(); i++) { | |
4783 | target = ::google::protobuf::internal::WireFormatLite:: | |
4784 | WriteInt64NoTagToArray(this->test_int64(i), target); | |
4785 | } | |
4786 | ||
4787 | // repeated sint64 test_sint64 = 5 [packed = true]; | |
4788 | if (this->test_sint64_size() > 0) { | |
4789 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4790 | 5, | |
4791 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4792 | target); | |
4793 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4794 | _test_sint64_cached_byte_size_, target); | |
4795 | } | |
4796 | for (int i = 0; i < this->test_sint64_size(); i++) { | |
4797 | target = ::google::protobuf::internal::WireFormatLite:: | |
4798 | WriteSInt64NoTagToArray(this->test_sint64(i), target); | |
4799 | } | |
4800 | ||
4801 | // repeated sfixed64 test_sfixed64 = 6 [packed = true]; | |
4802 | if (this->test_sfixed64_size() > 0) { | |
4803 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4804 | 6, | |
4805 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4806 | target); | |
4807 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4808 | _test_sfixed64_cached_byte_size_, target); | |
4809 | } | |
4810 | for (int i = 0; i < this->test_sfixed64_size(); i++) { | |
4811 | target = ::google::protobuf::internal::WireFormatLite:: | |
4812 | WriteSFixed64NoTagToArray(this->test_sfixed64(i), target); | |
4813 | } | |
4814 | ||
4815 | // repeated uint32 test_uint32 = 7 [packed = true]; | |
4816 | if (this->test_uint32_size() > 0) { | |
4817 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4818 | 7, | |
4819 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4820 | target); | |
4821 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4822 | _test_uint32_cached_byte_size_, target); | |
4823 | } | |
4824 | for (int i = 0; i < this->test_uint32_size(); i++) { | |
4825 | target = ::google::protobuf::internal::WireFormatLite:: | |
4826 | WriteUInt32NoTagToArray(this->test_uint32(i), target); | |
4827 | } | |
4828 | ||
4829 | // repeated fixed32 test_fixed32 = 8 [packed = true]; | |
4830 | if (this->test_fixed32_size() > 0) { | |
4831 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4832 | 8, | |
4833 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4834 | target); | |
4835 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4836 | _test_fixed32_cached_byte_size_, target); | |
4837 | } | |
4838 | for (int i = 0; i < this->test_fixed32_size(); i++) { | |
4839 | target = ::google::protobuf::internal::WireFormatLite:: | |
4840 | WriteFixed32NoTagToArray(this->test_fixed32(i), target); | |
4841 | } | |
4842 | ||
4843 | // repeated uint64 test_uint64 = 9 [packed = true]; | |
4844 | if (this->test_uint64_size() > 0) { | |
4845 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4846 | 9, | |
4847 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4848 | target); | |
4849 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4850 | _test_uint64_cached_byte_size_, target); | |
4851 | } | |
4852 | for (int i = 0; i < this->test_uint64_size(); i++) { | |
4853 | target = ::google::protobuf::internal::WireFormatLite:: | |
4854 | WriteUInt64NoTagToArray(this->test_uint64(i), target); | |
4855 | } | |
4856 | ||
4857 | // repeated fixed64 test_fixed64 = 10 [packed = true]; | |
4858 | if (this->test_fixed64_size() > 0) { | |
4859 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4860 | 10, | |
4861 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4862 | target); | |
4863 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4864 | _test_fixed64_cached_byte_size_, target); | |
4865 | } | |
4866 | for (int i = 0; i < this->test_fixed64_size(); i++) { | |
4867 | target = ::google::protobuf::internal::WireFormatLite:: | |
4868 | WriteFixed64NoTagToArray(this->test_fixed64(i), target); | |
4869 | } | |
4870 | ||
4871 | // repeated float test_float = 11 [packed = true]; | |
4872 | if (this->test_float_size() > 0) { | |
4873 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4874 | 11, | |
4875 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4876 | target); | |
4877 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4878 | _test_float_cached_byte_size_, target); | |
4879 | } | |
4880 | for (int i = 0; i < this->test_float_size(); i++) { | |
4881 | target = ::google::protobuf::internal::WireFormatLite:: | |
4882 | WriteFloatNoTagToArray(this->test_float(i), target); | |
4883 | } | |
4884 | ||
4885 | // repeated double test_double = 12 [packed = true]; | |
4886 | if (this->test_double_size() > 0) { | |
4887 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4888 | 12, | |
4889 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4890 | target); | |
4891 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4892 | _test_double_cached_byte_size_, target); | |
4893 | } | |
4894 | for (int i = 0; i < this->test_double_size(); i++) { | |
4895 | target = ::google::protobuf::internal::WireFormatLite:: | |
4896 | WriteDoubleNoTagToArray(this->test_double(i), target); | |
4897 | } | |
4898 | ||
4899 | // repeated bool test_boolean = 13 [packed = true]; | |
4900 | if (this->test_boolean_size() > 0) { | |
4901 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4902 | 13, | |
4903 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4904 | target); | |
4905 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( | |
4906 | _test_boolean_cached_byte_size_, target); | |
4907 | } | |
4908 | for (int i = 0; i < this->test_boolean_size(); i++) { | |
4909 | target = ::google::protobuf::internal::WireFormatLite:: | |
4910 | WriteBoolNoTagToArray(this->test_boolean(i), target); | |
4911 | } | |
4912 | ||
4913 | // repeated .foo.TestEnumSmall test_enum_small = 14 [packed = true]; | |
4914 | if (this->test_enum_small_size() > 0) { | |
4915 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4916 | 14, | |
4917 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4918 | target); | |
4919 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( _test_enum_small_cached_byte_size_, target); | |
4920 | } | |
4921 | for (int i = 0; i < this->test_enum_small_size(); i++) { | |
4922 | target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray( | |
4923 | this->test_enum_small(i), target); | |
4924 | } | |
4925 | ||
4926 | // repeated .foo.TestEnum test_enum = 15 [packed = true]; | |
4927 | if (this->test_enum_size() > 0) { | |
4928 | target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( | |
4929 | 15, | |
4930 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, | |
4931 | target); | |
4932 | target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( _test_enum_cached_byte_size_, target); | |
4933 | } | |
4934 | for (int i = 0; i < this->test_enum_size(); i++) { | |
4935 | target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray( | |
4936 | this->test_enum(i), target); | |
4937 | } | |
4938 | ||
4939 | if (!unknown_fields().empty()) { | |
4940 | target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( | |
4941 | unknown_fields(), target); | |
4942 | } | |
4943 | return target; | |
4944 | } | |
4945 | ||
4946 | int TestMessPacked::ByteSize() const { | |
4947 | int total_size = 0; | |
4948 | ||
4949 | // repeated int32 test_int32 = 1 [packed = true]; | |
4950 | { | |
4951 | int data_size = 0; | |
4952 | for (int i = 0; i < this->test_int32_size(); i++) { | |
4953 | data_size += ::google::protobuf::internal::WireFormatLite:: | |
4954 | Int32Size(this->test_int32(i)); | |
4955 | } | |
4956 | if (data_size > 0) { | |
4957 | total_size += 1 + | |
4958 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
4959 | } | |
4960 | _test_int32_cached_byte_size_ = data_size; | |
4961 | total_size += data_size; | |
4962 | } | |
4963 | ||
4964 | // repeated sint32 test_sint32 = 2 [packed = true]; | |
4965 | { | |
4966 | int data_size = 0; | |
4967 | for (int i = 0; i < this->test_sint32_size(); i++) { | |
4968 | data_size += ::google::protobuf::internal::WireFormatLite:: | |
4969 | SInt32Size(this->test_sint32(i)); | |
4970 | } | |
4971 | if (data_size > 0) { | |
4972 | total_size += 1 + | |
4973 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
4974 | } | |
4975 | _test_sint32_cached_byte_size_ = data_size; | |
4976 | total_size += data_size; | |
4977 | } | |
4978 | ||
4979 | // repeated sfixed32 test_sfixed32 = 3 [packed = true]; | |
4980 | { | |
4981 | int data_size = 0; | |
4982 | data_size = 4 * this->test_sfixed32_size(); | |
4983 | if (data_size > 0) { | |
4984 | total_size += 1 + | |
4985 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
4986 | } | |
4987 | _test_sfixed32_cached_byte_size_ = data_size; | |
4988 | total_size += data_size; | |
4989 | } | |
4990 | ||
4991 | // repeated int64 test_int64 = 4 [packed = true]; | |
4992 | { | |
4993 | int data_size = 0; | |
4994 | for (int i = 0; i < this->test_int64_size(); i++) { | |
4995 | data_size += ::google::protobuf::internal::WireFormatLite:: | |
4996 | Int64Size(this->test_int64(i)); | |
4997 | } | |
4998 | if (data_size > 0) { | |
4999 | total_size += 1 + | |
5000 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5001 | } | |
5002 | _test_int64_cached_byte_size_ = data_size; | |
5003 | total_size += data_size; | |
5004 | } | |
5005 | ||
5006 | // repeated sint64 test_sint64 = 5 [packed = true]; | |
5007 | { | |
5008 | int data_size = 0; | |
5009 | for (int i = 0; i < this->test_sint64_size(); i++) { | |
5010 | data_size += ::google::protobuf::internal::WireFormatLite:: | |
5011 | SInt64Size(this->test_sint64(i)); | |
5012 | } | |
5013 | if (data_size > 0) { | |
5014 | total_size += 1 + | |
5015 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5016 | } | |
5017 | _test_sint64_cached_byte_size_ = data_size; | |
5018 | total_size += data_size; | |
5019 | } | |
5020 | ||
5021 | // repeated sfixed64 test_sfixed64 = 6 [packed = true]; | |
5022 | { | |
5023 | int data_size = 0; | |
5024 | data_size = 8 * this->test_sfixed64_size(); | |
5025 | if (data_size > 0) { | |
5026 | total_size += 1 + | |
5027 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5028 | } | |
5029 | _test_sfixed64_cached_byte_size_ = data_size; | |
5030 | total_size += data_size; | |
5031 | } | |
5032 | ||
5033 | // repeated uint32 test_uint32 = 7 [packed = true]; | |
5034 | { | |
5035 | int data_size = 0; | |
5036 | for (int i = 0; i < this->test_uint32_size(); i++) { | |
5037 | data_size += ::google::protobuf::internal::WireFormatLite:: | |
5038 | UInt32Size(this->test_uint32(i)); | |
5039 | } | |
5040 | if (data_size > 0) { | |
5041 | total_size += 1 + | |
5042 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5043 | } | |
5044 | _test_uint32_cached_byte_size_ = data_size; | |
5045 | total_size += data_size; | |
5046 | } | |
5047 | ||
5048 | // repeated fixed32 test_fixed32 = 8 [packed = true]; | |
5049 | { | |
5050 | int data_size = 0; | |
5051 | data_size = 4 * this->test_fixed32_size(); | |
5052 | if (data_size > 0) { | |
5053 | total_size += 1 + | |
5054 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5055 | } | |
5056 | _test_fixed32_cached_byte_size_ = data_size; | |
5057 | total_size += data_size; | |
5058 | } | |
5059 | ||
5060 | // repeated uint64 test_uint64 = 9 [packed = true]; | |
5061 | { | |
5062 | int data_size = 0; | |
5063 | for (int i = 0; i < this->test_uint64_size(); i++) { | |
5064 | data_size += ::google::protobuf::internal::WireFormatLite:: | |
5065 | UInt64Size(this->test_uint64(i)); | |
5066 | } | |
5067 | if (data_size > 0) { | |
5068 | total_size += 1 + | |
5069 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5070 | } | |
5071 | _test_uint64_cached_byte_size_ = data_size; | |
5072 | total_size += data_size; | |
5073 | } | |
5074 | ||
5075 | // repeated fixed64 test_fixed64 = 10 [packed = true]; | |
5076 | { | |
5077 | int data_size = 0; | |
5078 | data_size = 8 * this->test_fixed64_size(); | |
5079 | if (data_size > 0) { | |
5080 | total_size += 1 + | |
5081 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5082 | } | |
5083 | _test_fixed64_cached_byte_size_ = data_size; | |
5084 | total_size += data_size; | |
5085 | } | |
5086 | ||
5087 | // repeated float test_float = 11 [packed = true]; | |
5088 | { | |
5089 | int data_size = 0; | |
5090 | data_size = 4 * this->test_float_size(); | |
5091 | if (data_size > 0) { | |
5092 | total_size += 1 + | |
5093 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5094 | } | |
5095 | _test_float_cached_byte_size_ = data_size; | |
5096 | total_size += data_size; | |
5097 | } | |
5098 | ||
5099 | // repeated double test_double = 12 [packed = true]; | |
5100 | { | |
5101 | int data_size = 0; | |
5102 | data_size = 8 * this->test_double_size(); | |
5103 | if (data_size > 0) { | |
5104 | total_size += 1 + | |
5105 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5106 | } | |
5107 | _test_double_cached_byte_size_ = data_size; | |
5108 | total_size += data_size; | |
5109 | } | |
5110 | ||
5111 | // repeated bool test_boolean = 13 [packed = true]; | |
5112 | { | |
5113 | int data_size = 0; | |
5114 | data_size = 1 * this->test_boolean_size(); | |
5115 | if (data_size > 0) { | |
5116 | total_size += 1 + | |
5117 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5118 | } | |
5119 | _test_boolean_cached_byte_size_ = data_size; | |
5120 | total_size += data_size; | |
5121 | } | |
5122 | ||
5123 | // repeated .foo.TestEnumSmall test_enum_small = 14 [packed = true]; | |
5124 | { | |
5125 | int data_size = 0; | |
5126 | for (int i = 0; i < this->test_enum_small_size(); i++) { | |
5127 | data_size += ::google::protobuf::internal::WireFormatLite::EnumSize( | |
5128 | this->test_enum_small(i)); | |
5129 | } | |
5130 | if (data_size > 0) { | |
5131 | total_size += 1 + | |
5132 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5133 | } | |
5134 | _test_enum_small_cached_byte_size_ = data_size; | |
5135 | total_size += data_size; | |
5136 | } | |
5137 | ||
5138 | // repeated .foo.TestEnum test_enum = 15 [packed = true]; | |
5139 | { | |
5140 | int data_size = 0; | |
5141 | for (int i = 0; i < this->test_enum_size(); i++) { | |
5142 | data_size += ::google::protobuf::internal::WireFormatLite::EnumSize( | |
5143 | this->test_enum(i)); | |
5144 | } | |
5145 | if (data_size > 0) { | |
5146 | total_size += 1 + | |
5147 | ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); | |
5148 | } | |
5149 | _test_enum_cached_byte_size_ = data_size; | |
5150 | total_size += data_size; | |
5151 | } | |
5152 | ||
5153 | if (!unknown_fields().empty()) { | |
5154 | total_size += | |
5155 | ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( | |
5156 | unknown_fields()); | |
5157 | } | |
5158 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | |
5159 | _cached_size_ = total_size; | |
5160 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); | |
5161 | return total_size; | |
5162 | } | |
5163 | ||
5164 | void TestMessPacked::MergeFrom(const ::google::protobuf::Message& from) { | |
5165 | GOOGLE_CHECK_NE(&from, this); | |
5166 | const TestMessPacked* source = | |
5167 | ::google::protobuf::internal::dynamic_cast_if_available<const TestMessPacked*>( | |
5168 | &from); | |
5169 | if (source == NULL) { | |
5170 | ::google::protobuf::internal::ReflectionOps::Merge(from, this); | |
5171 | } else { | |
5172 | MergeFrom(*source); | |
5173 | } | |
5174 | } | |
5175 | ||
5176 | void TestMessPacked::MergeFrom(const TestMessPacked& from) { | |
5177 | GOOGLE_CHECK_NE(&from, this); | |
5178 | test_int32_.MergeFrom(from.test_int32_); | |
5179 | test_sint32_.MergeFrom(from.test_sint32_); | |
5180 | test_sfixed32_.MergeFrom(from.test_sfixed32_); | |
5181 | test_int64_.MergeFrom(from.test_int64_); | |
5182 | test_sint64_.MergeFrom(from.test_sint64_); | |
5183 | test_sfixed64_.MergeFrom(from.test_sfixed64_); | |
5184 | test_uint32_.MergeFrom(from.test_uint32_); | |
5185 | test_fixed32_.MergeFrom(from.test_fixed32_); | |
5186 | test_uint64_.MergeFrom(from.test_uint64_); | |
5187 | test_fixed64_.MergeFrom(from.test_fixed64_); | |
5188 | test_float_.MergeFrom(from.test_float_); | |
5189 | test_double_.MergeFrom(from.test_double_); | |
5190 | test_boolean_.MergeFrom(from.test_boolean_); | |
5191 | test_enum_small_.MergeFrom(from.test_enum_small_); | |
5192 | test_enum_.MergeFrom(from.test_enum_); | |
5193 | mutable_unknown_fields()->MergeFrom(from.unknown_fields()); | |
5194 | } | |
5195 | ||
5196 | void TestMessPacked::CopyFrom(const ::google::protobuf::Message& from) { | |
5197 | if (&from == this) return; | |
5198 | Clear(); | |
5199 | MergeFrom(from); | |
5200 | } | |
5201 | ||
5202 | void TestMessPacked::CopyFrom(const TestMessPacked& from) { | |
5203 | if (&from == this) return; | |
5204 | Clear(); | |
5205 | MergeFrom(from); | |
5206 | } | |
5207 | ||
5208 | bool TestMessPacked::IsInitialized() const { | |
5209 | ||
5210 | return true; | |
5211 | } | |
5212 | ||
5213 | void TestMessPacked::Swap(TestMessPacked* other) { | |
5214 | if (other != this) { | |
5215 | test_int32_.Swap(&other->test_int32_); | |
5216 | test_sint32_.Swap(&other->test_sint32_); | |
5217 | test_sfixed32_.Swap(&other->test_sfixed32_); | |
5218 | test_int64_.Swap(&other->test_int64_); | |
5219 | test_sint64_.Swap(&other->test_sint64_); | |
5220 | test_sfixed64_.Swap(&other->test_sfixed64_); | |
5221 | test_uint32_.Swap(&other->test_uint32_); | |
5222 | test_fixed32_.Swap(&other->test_fixed32_); | |
5223 | test_uint64_.Swap(&other->test_uint64_); | |
5224 | test_fixed64_.Swap(&other->test_fixed64_); | |
5225 | test_float_.Swap(&other->test_float_); | |
5226 | test_double_.Swap(&other->test_double_); | |
5227 | test_boolean_.Swap(&other->test_boolean_); | |
5228 | test_enum_small_.Swap(&other->test_enum_small_); | |
5229 | test_enum_.Swap(&other->test_enum_); | |
5230 | std::swap(_has_bits_[0], other->_has_bits_[0]); | |
5231 | _unknown_fields_.Swap(&other->_unknown_fields_); | |
5232 | std::swap(_cached_size_, other->_cached_size_); | |
5233 | } | |
5234 | } | |
5235 | ||
5236 | ::google::protobuf::Metadata TestMessPacked::GetMetadata() const { | |
5237 | protobuf_AssignDescriptorsOnce(); | |
5238 | ::google::protobuf::Metadata metadata; | |
5239 | metadata.descriptor = TestMessPacked_descriptor_; | |
5240 | metadata.reflection = TestMessPacked_reflection_; | |
5241 | return metadata; | |
5242 | } | |
5243 | ||
5244 | ||
5245 | // =================================================================== | |
5246 | ||
4062 | 5247 | const ::std::string TestMessOptional::_default_test_string_; |
4063 | 5248 | const ::std::string TestMessOptional::_default_test_bytes_; |
4064 | 5249 | #ifndef _MSC_VER |
0 | 0 | /* Generated by the protocol buffer compiler. DO NOT EDIT! */ |
1 | ||
2 | /* Do not generate deprecated warnings for self */ | |
3 | #ifndef PROTOBUF_C_NO_DEPRECATED | |
4 | #define PROTOBUF_C_NO_DEPRECATED | |
5 | #endif | |
1 | 6 | |
2 | 7 | #include "test.pb-c.h" |
3 | 8 | void foo__person__phone_number__init |
147 | 152 | PROTOBUF_C_OFFSETOF(Foo__Person__PhoneNumber, number), |
148 | 153 | NULL, |
149 | 154 | NULL, |
150 | NULL,NULL /* reserved1, reserved2 */ | |
155 | 0, /* packed */ | |
156 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
151 | 157 | }, |
152 | 158 | { |
153 | 159 | "type", |
158 | 164 | PROTOBUF_C_OFFSETOF(Foo__Person__PhoneNumber, type), |
159 | 165 | &foo__person__phone_type__descriptor, |
160 | 166 | &foo__person__phone_number__type__default_value, |
161 | NULL,NULL /* reserved1, reserved2 */ | |
167 | 0, /* packed */ | |
168 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
162 | 169 | }, |
163 | 170 | }; |
164 | 171 | static const unsigned foo__person__phone_number__field_indices_by_name[] = { |
226 | 233 | PROTOBUF_C_OFFSETOF(Foo__Person, name), |
227 | 234 | NULL, |
228 | 235 | NULL, |
229 | NULL,NULL /* reserved1, reserved2 */ | |
236 | 0, /* packed */ | |
237 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
230 | 238 | }, |
231 | 239 | { |
232 | 240 | "id", |
237 | 245 | PROTOBUF_C_OFFSETOF(Foo__Person, id), |
238 | 246 | NULL, |
239 | 247 | NULL, |
240 | NULL,NULL /* reserved1, reserved2 */ | |
248 | 0, /* packed */ | |
249 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
241 | 250 | }, |
242 | 251 | { |
243 | 252 | "email", |
248 | 257 | PROTOBUF_C_OFFSETOF(Foo__Person, email), |
249 | 258 | NULL, |
250 | 259 | NULL, |
251 | NULL,NULL /* reserved1, reserved2 */ | |
260 | 0, /* packed */ | |
261 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
252 | 262 | }, |
253 | 263 | { |
254 | 264 | "phone", |
259 | 269 | PROTOBUF_C_OFFSETOF(Foo__Person, phone), |
260 | 270 | &foo__person__phone_number__descriptor, |
261 | 271 | NULL, |
262 | NULL,NULL /* reserved1, reserved2 */ | |
272 | 0, /* packed */ | |
273 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
263 | 274 | }, |
264 | 275 | }; |
265 | 276 | static const unsigned foo__person__field_indices_by_name[] = { |
299 | 310 | PROTOBUF_C_OFFSETOF(Foo__LookupResult, person), |
300 | 311 | &foo__person__descriptor, |
301 | 312 | NULL, |
302 | NULL,NULL /* reserved1, reserved2 */ | |
313 | 0, /* packed */ | |
314 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
303 | 315 | }, |
304 | 316 | }; |
305 | 317 | static const unsigned foo__lookup_result__field_indices_by_name[] = { |
336 | 348 | PROTOBUF_C_OFFSETOF(Foo__Name, name), |
337 | 349 | NULL, |
338 | 350 | NULL, |
339 | NULL,NULL /* reserved1, reserved2 */ | |
351 | 0, /* packed */ | |
352 | 0,NULL,NULL /* reserved1,reserved2, etc */ | |
340 | 353 | }, |
341 | 354 | }; |
342 | 355 | static const unsigned foo__name__field_indices_by_name[] = { |
79 | 79 | repeated bytes test_bytes = 17; |
80 | 80 | repeated SubMess test_message = 18; |
81 | 81 | } |
82 | message TestMessPacked { | |
83 | repeated int32 test_int32 = 1 [packed=true]; | |
84 | repeated sint32 test_sint32 = 2 [packed=true]; | |
85 | repeated sfixed32 test_sfixed32 = 3 [packed=true]; | |
86 | repeated int64 test_int64 = 4 [packed=true]; | |
87 | repeated sint64 test_sint64 = 5 [packed=true]; | |
88 | repeated sfixed64 test_sfixed64 = 6 [packed=true]; | |
89 | repeated uint32 test_uint32 = 7 [packed=true]; | |
90 | repeated fixed32 test_fixed32 = 8 [packed=true]; | |
91 | repeated uint64 test_uint64 = 9 [packed=true]; | |
92 | repeated fixed64 test_fixed64 = 10 [packed=true]; | |
93 | repeated float test_float = 11 [packed=true]; | |
94 | repeated double test_double = 12 [packed=true]; | |
95 | repeated bool test_boolean = 13 [packed=true]; | |
96 | repeated TestEnumSmall test_enum_small = 14 [packed=true]; | |
97 | repeated TestEnum test_enum = 15 [packed=true]; | |
98 | } | |
82 | 99 | |
83 | 100 | message TestMessOptional { |
84 | 101 | optional int32 test_int32 = 1; |
975 | 975 | #undef DO_TEST |
976 | 976 | } |
977 | 977 | |
978 | #define DO_TEST_PACKED_REPEATED(lc_member_name, cast, \ | |
979 | static_array, example_packed_data, \ | |
980 | equals_macro) \ | |
981 | do{ \ | |
982 | Foo__TestMessPacked mess = FOO__TEST_MESS_PACKED__INIT; \ | |
983 | Foo__TestMessPacked *mess2; \ | |
984 | size_t len; \ | |
985 | uint8_t *data; \ | |
986 | unsigned i; \ | |
987 | mess.n_##lc_member_name = N_ELEMENTS (static_array); \ | |
988 | mess.lc_member_name = cast static_array; \ | |
989 | mess2 = test_compare_pack_methods ((ProtobufCMessage*)(&mess), &len, &data); \ | |
990 | TEST_VERSUS_STATIC_ARRAY (len, data, example_packed_data); \ | |
991 | assert(mess2->n_##lc_member_name == N_ELEMENTS (static_array)); \ | |
992 | for (i = 0; i < N_ELEMENTS (static_array); i++) \ | |
993 | assert(equals_macro(mess2->lc_member_name[i], static_array[i])); \ | |
994 | free (data); \ | |
995 | foo__test_mess_packed__free_unpacked (mess2, NULL); \ | |
996 | }while(0) | |
997 | ||
998 | static void test_packed_repeated_int32 (void) | |
999 | { | |
1000 | #define DO_TEST(static_array, example_packed_data) \ | |
1001 | DO_TEST_PACKED_REPEATED(test_int32, , \ | |
1002 | static_array, example_packed_data, \ | |
1003 | NUMERIC_EQUALS) | |
1004 | ||
1005 | DO_TEST (int32_arr0, test_packed_repeated_int32_arr0); | |
1006 | DO_TEST (int32_arr1, test_packed_repeated_int32_arr1); | |
1007 | DO_TEST (int32_arr_min_max, test_packed_repeated_int32_arr_min_max); | |
1008 | ||
1009 | #undef DO_TEST | |
1010 | } | |
1011 | ||
1012 | static void test_packed_repeated_sint32 (void) | |
1013 | { | |
1014 | #define DO_TEST(static_array, example_packed_data) \ | |
1015 | DO_TEST_PACKED_REPEATED(test_sint32, , \ | |
1016 | static_array, example_packed_data, \ | |
1017 | NUMERIC_EQUALS) | |
1018 | ||
1019 | DO_TEST (int32_arr0, test_packed_repeated_sint32_arr0); | |
1020 | DO_TEST (int32_arr1, test_packed_repeated_sint32_arr1); | |
1021 | DO_TEST (int32_arr_min_max, test_packed_repeated_sint32_arr_min_max); | |
1022 | ||
1023 | #undef DO_TEST | |
1024 | } | |
1025 | ||
1026 | static void test_packed_repeated_sfixed32 (void) | |
1027 | { | |
1028 | #define DO_TEST(static_array, example_packed_data) \ | |
1029 | DO_TEST_PACKED_REPEATED(test_sfixed32, , \ | |
1030 | static_array, example_packed_data, \ | |
1031 | NUMERIC_EQUALS) | |
1032 | ||
1033 | DO_TEST (int32_arr0, test_packed_repeated_sfixed32_arr0); | |
1034 | DO_TEST (int32_arr1, test_packed_repeated_sfixed32_arr1); | |
1035 | DO_TEST (int32_arr_min_max, test_packed_repeated_sfixed32_arr_min_max); | |
1036 | ||
1037 | #undef DO_TEST | |
1038 | } | |
1039 | ||
1040 | static void test_packed_repeated_uint32 (void) | |
1041 | { | |
1042 | #define DO_TEST(static_array, example_packed_data) \ | |
1043 | DO_TEST_PACKED_REPEATED(test_uint32, , \ | |
1044 | static_array, example_packed_data, \ | |
1045 | NUMERIC_EQUALS) | |
1046 | ||
1047 | DO_TEST (uint32_roundnumbers, test_packed_repeated_uint32_roundnumbers); | |
1048 | DO_TEST (uint32_0_max, test_packed_repeated_uint32_0_max); | |
1049 | ||
1050 | #undef DO_TEST | |
1051 | } | |
1052 | ||
1053 | ||
1054 | ||
1055 | static void test_packed_repeated_fixed32 (void) | |
1056 | { | |
1057 | #define DO_TEST(static_array, example_packed_data) \ | |
1058 | DO_TEST_PACKED_REPEATED(test_fixed32, , \ | |
1059 | static_array, example_packed_data, \ | |
1060 | NUMERIC_EQUALS) | |
1061 | ||
1062 | DO_TEST (uint32_roundnumbers, test_packed_repeated_fixed32_roundnumbers); | |
1063 | DO_TEST (uint32_0_max, test_packed_repeated_fixed32_0_max); | |
1064 | ||
1065 | #undef DO_TEST | |
1066 | } | |
1067 | ||
1068 | static void test_packed_repeated_int64 (void) | |
1069 | { | |
1070 | #define DO_TEST(static_array, example_packed_data) \ | |
1071 | DO_TEST_PACKED_REPEATED(test_int64, , \ | |
1072 | static_array, example_packed_data, \ | |
1073 | NUMERIC_EQUALS) | |
1074 | ||
1075 | DO_TEST (int64_roundnumbers, test_packed_repeated_int64_roundnumbers); | |
1076 | DO_TEST (int64_min_max, test_packed_repeated_int64_min_max); | |
1077 | ||
1078 | #undef DO_TEST | |
1079 | } | |
1080 | ||
1081 | static void test_packed_repeated_sint64 (void) | |
1082 | { | |
1083 | #define DO_TEST(static_array, example_packed_data) \ | |
1084 | DO_TEST_PACKED_REPEATED(test_sint64, , \ | |
1085 | static_array, example_packed_data, \ | |
1086 | NUMERIC_EQUALS) | |
1087 | ||
1088 | DO_TEST (int64_roundnumbers, test_packed_repeated_sint64_roundnumbers); | |
1089 | DO_TEST (int64_min_max, test_packed_repeated_sint64_min_max); | |
1090 | ||
1091 | #undef DO_TEST | |
1092 | } | |
1093 | ||
1094 | static void test_packed_repeated_sfixed64 (void) | |
1095 | { | |
1096 | #define DO_TEST(static_array, example_packed_data) \ | |
1097 | DO_TEST_PACKED_REPEATED(test_sfixed64, , \ | |
1098 | static_array, example_packed_data, \ | |
1099 | NUMERIC_EQUALS) | |
1100 | ||
1101 | DO_TEST (int64_roundnumbers, test_packed_repeated_sfixed64_roundnumbers); | |
1102 | DO_TEST (int64_min_max, test_packed_repeated_sfixed64_min_max); | |
1103 | ||
1104 | #undef DO_TEST | |
1105 | } | |
1106 | ||
1107 | static void test_packed_repeated_uint64 (void) | |
1108 | { | |
1109 | #define DO_TEST(static_array, example_packed_data) \ | |
1110 | DO_TEST_PACKED_REPEATED(test_uint64, , \ | |
1111 | static_array, example_packed_data, \ | |
1112 | NUMERIC_EQUALS) | |
1113 | ||
1114 | DO_TEST(uint64_roundnumbers, test_packed_repeated_uint64_roundnumbers); | |
1115 | DO_TEST(uint64_0_1_max, test_packed_repeated_uint64_0_1_max); | |
1116 | DO_TEST(uint64_random, test_packed_repeated_uint64_random); | |
1117 | ||
1118 | #undef DO_TEST | |
1119 | } | |
1120 | ||
1121 | static void test_packed_repeated_fixed64 (void) | |
1122 | { | |
1123 | #define DO_TEST(static_array, example_packed_data) \ | |
1124 | DO_TEST_PACKED_REPEATED(test_fixed64, , \ | |
1125 | static_array, example_packed_data, \ | |
1126 | NUMERIC_EQUALS) | |
1127 | ||
1128 | DO_TEST(uint64_roundnumbers, test_packed_repeated_fixed64_roundnumbers); | |
1129 | DO_TEST(uint64_0_1_max, test_packed_repeated_fixed64_0_1_max); | |
1130 | DO_TEST(uint64_random, test_packed_repeated_fixed64_random); | |
1131 | ||
1132 | #undef DO_TEST | |
1133 | } | |
1134 | ||
1135 | static void test_packed_repeated_float (void) | |
1136 | { | |
1137 | ||
1138 | #define DO_TEST(static_array, example_packed_data) \ | |
1139 | DO_TEST_PACKED_REPEATED(test_float, , \ | |
1140 | static_array, example_packed_data, \ | |
1141 | NUMERIC_EQUALS) | |
1142 | ||
1143 | DO_TEST(float_random, test_packed_repeated_float_random); | |
1144 | ||
1145 | #undef DO_TEST | |
1146 | } | |
1147 | ||
1148 | static void test_packed_repeated_double (void) | |
1149 | { | |
1150 | ||
1151 | #define DO_TEST(static_array, example_packed_data) \ | |
1152 | DO_TEST_PACKED_REPEATED(test_double, , \ | |
1153 | static_array, example_packed_data, \ | |
1154 | NUMERIC_EQUALS) | |
1155 | ||
1156 | DO_TEST(double_random, test_packed_repeated_double_random); | |
1157 | ||
1158 | #undef DO_TEST | |
1159 | } | |
1160 | ||
1161 | static void test_packed_repeated_boolean (void) | |
1162 | { | |
1163 | ||
1164 | #define DO_TEST(static_array, example_packed_data) \ | |
1165 | DO_TEST_PACKED_REPEATED(test_boolean, , \ | |
1166 | static_array, example_packed_data, \ | |
1167 | NUMERIC_EQUALS) | |
1168 | ||
1169 | DO_TEST(boolean_0, test_packed_repeated_boolean_0); | |
1170 | DO_TEST(boolean_1, test_packed_repeated_boolean_1); | |
1171 | DO_TEST(boolean_random, test_packed_repeated_boolean_random); | |
1172 | ||
1173 | #undef DO_TEST | |
1174 | } | |
1175 | ||
1176 | static void test_packed_repeated_TestEnumSmall (void) | |
1177 | { | |
1178 | ||
1179 | #define DO_TEST(static_array, example_packed_data) \ | |
1180 | DO_TEST_PACKED_REPEATED(test_enum_small, , \ | |
1181 | static_array, example_packed_data, \ | |
1182 | NUMERIC_EQUALS) | |
1183 | ||
1184 | DO_TEST(enum_small_0, test_packed_repeated_enum_small_0); | |
1185 | DO_TEST(enum_small_1, test_packed_repeated_enum_small_1); | |
1186 | DO_TEST(enum_small_random, test_packed_repeated_enum_small_random); | |
1187 | ||
1188 | #undef DO_TEST | |
1189 | } | |
1190 | ||
1191 | static void test_packed_repeated_TestEnum (void) | |
1192 | { | |
1193 | ||
1194 | #define DO_TEST(static_array, example_packed_data) \ | |
1195 | DO_TEST_PACKED_REPEATED(test_enum, , \ | |
1196 | static_array, example_packed_data, \ | |
1197 | NUMERIC_EQUALS) | |
1198 | ||
1199 | DO_TEST(enum_0, test_packed_repeated_enum_0); | |
1200 | DO_TEST(enum_1, test_packed_repeated_enum_1); | |
1201 | DO_TEST(enum_random, test_packed_repeated_enum_random); | |
1202 | ||
1203 | #undef DO_TEST | |
1204 | } | |
1205 | ||
1206 | ||
978 | 1207 | static void test_unknown_fields (void) |
979 | 1208 | { |
980 | 1209 | static Foo__EmptyMess mess = FOO__EMPTY_MESS__INIT; |
1331 | 1560 | { "test repeated bytes", test_repeated_bytes }, |
1332 | 1561 | { "test repeated SubMess", test_repeated_SubMess }, |
1333 | 1562 | |
1563 | { "test packed repeated int32", test_packed_repeated_int32 }, | |
1564 | { "test packed repeated sint32", test_packed_repeated_sint32 }, | |
1565 | { "test packed repeated sfixed32" ,test_packed_repeated_sfixed32 }, | |
1566 | { "test packed repeated uint32", test_packed_repeated_uint32 }, | |
1567 | { "test packed repeated int64", test_packed_repeated_int64 }, | |
1568 | { "test packed repeated sint64", test_packed_repeated_sint64 }, | |
1569 | { "test packed repeated sfixed64", test_packed_repeated_sfixed64 }, | |
1570 | { "test packed repeated fixed32", test_packed_repeated_fixed32 }, | |
1571 | { "test packed repeated uint64", test_packed_repeated_uint64 }, | |
1572 | { "test packed repeated fixed64", test_packed_repeated_fixed64 }, | |
1573 | { "test packed repeated float", test_packed_repeated_float }, | |
1574 | { "test packed repeated double", test_packed_repeated_double }, | |
1575 | { "test packed repeated boolean", test_packed_repeated_boolean }, | |
1576 | { "test packed repeated TestEnumSmall", test_packed_repeated_TestEnumSmall }, | |
1577 | { "test packed repeated TestEnum", test_packed_repeated_TestEnum }, | |
1578 | ||
1334 | 1579 | { "test unknown fields", test_unknown_fields }, |
1335 | 1580 | |
1336 | 1581 | { "test enum lookups", test_enum_lookups }, |