Codebase list protobuf-c / a8a36e5
Imported Upstream version 0.14 Robert S. Edmonds 10 years ago
34 changed file(s) with 3313 addition(s) and 428 deletion(s). Raw diff Collapse all Expand all
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
022 0.12:
123 - for field names which are reserved words, use the real name
224 given in the protobuf-c file, not the mangled name which
00 SUBDIRS = src
11
22 EXTRA_DIST = scripts pkgwriteinfo.in
3
4 pkgconfigdir = $(libdir)/pkgconfig
5 pkgconfig_DATA = libprotobuf-c.pc
36
47 # --- packages ---
58 DEBARCH = `dpkg --print-architecture`
1212 # PARTICULAR PURPOSE.
1313
1414 @SET_MAKE@
15
1516 srcdir = @srcdir@
1617 top_srcdir = @top_srcdir@
1718 VPATH = @srcdir@
3536 build_triplet = @build@
3637 host_triplet = @host@
3738 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
4143 subdir = .
4244 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
4345 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
4648 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
4749 configure.lineno configure.status.lineno
4850 mkinstalldirs = $(install_sh) -d
49 CONFIG_CLEAN_FILES = pkgwriteinfo
51 CONFIG_CLEAN_FILES = pkgwriteinfo libprotobuf-c.pc
5052 SOURCES =
5153 DIST_SOURCES =
5254 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
5557 install-recursive installcheck-recursive installdirs-recursive \
5658 pdf-recursive ps-recursive uninstall-info-recursive \
5759 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)
5869 ETAGS = etags
5970 CTAGS = ctags
6071 DIST_SUBDIRS = $(SUBDIRS)
7889 AUTOHEADER = @AUTOHEADER@
7990 AUTOMAKE = @AUTOMAKE@
8091 AWK = @AWK@
92 BUILD_PROTOC_C_FALSE = @BUILD_PROTOC_C_FALSE@
93 BUILD_PROTOC_C_TRUE = @BUILD_PROTOC_C_TRUE@
8194 CC = @CC@
8295 CCDEPMODE = @CCDEPMODE@
8396 CFLAGS = @CFLAGS@
176189 target_alias = @target_alias@
177190 SUBDIRS = src
178191 EXTRA_DIST = scripts pkgwriteinfo.in
192 pkgconfigdir = $(libdir)/pkgconfig
193 pkgconfig_DATA = libprotobuf-c.pc
179194
180195 # --- packages ---
181196 DEBARCH = `dpkg --print-architecture`
217232 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
218233 pkgwriteinfo: $(top_builddir)/config.status $(srcdir)/pkgwriteinfo.in
219234 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 $@
220237
221238 mostlyclean-libtool:
222239 -rm -f *.lo
227244 distclean-libtool:
228245 -rm -f libtool
229246 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
230264
231265 # This directory's subdirectories are mostly independent; you can cd
232266 # into them and run `make' without going through this Makefile.
504538 exit 1; } >&2
505539 check-am: all-am
506540 check: check-recursive
507 all-am: Makefile
541 all-am: Makefile $(DATA)
508542 installdirs: installdirs-recursive
509543 installdirs-am:
544 for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
545 test -z "$$dir" || $(mkdir_p) "$$dir"; \
546 done
510547 install: install-recursive
511548 install-exec: install-exec-recursive
512549 install-data: install-data-recursive
551588
552589 info-am:
553590
554 install-data-am:
591 install-data-am: install-pkgconfigDATA
555592
556593 install-exec-am:
557594
579616
580617 ps-am:
581618
582 uninstall-am: uninstall-info-am
619 uninstall-am: uninstall-info-am uninstall-pkgconfigDATA
583620
584621 uninstall-info: uninstall-info-recursive
585622
591628 distclean-tags distcleancheck distdir distuninstallcheck dvi \
592629 dvi-am html html-am info info-am install install-am \
593630 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 \
597634 maintainer-clean-recursive mostlyclean mostlyclean-generic \
598635 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
600638
601639 deb:
602640 test -r protobuf-c-@VERSION@.tar.gz || $(MAKE) dist
+29
-11
TODO less more
00 ----------------------
11 --- IMPORTANT TODO ---
22 ----------------------
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);
133 - 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
146
157 --------------------
168 --- NEEDED TESTS ---
2214 - default values
2315 - message unpack alloc failures when allocating new slab
2416 - 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
2520
2621 ---------------------
2722 --- DOCUMENTATION ---
3429 --- LOW PRIORITY STUFF ---
3530 --------------------------
3631 - 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);
3842
3943 ------------------------------------
4044 --- EXTREMELY LOW PRIORITY STUFF ---
4953 -------------------------
5054 --- IDEAS TO CONSIDER ---
5155 -------------------------
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.
5267
5368 - lifetime functions for messages:
5469 message__new()
6580 - Rewrite the code-generator in C, including the parser.
6681 - This would have the huge advantage that we could use ".proto" files
6782 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
00 #! /bin/sh
11 # 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.
33 #
44 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
55 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
725725 # Identity of this package.
726726 PACKAGE_NAME='protobuf-c'
727727 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'
730730 PACKAGE_BUGREPORT=''
731731
732732 # Factoring default headers for most tests.
869869 ac_ct_F77
870870 LIBTOOL
871871 PROTOC
872 BUILD_PROTOC_C_TRUE
873 BUILD_PROTOC_C_FALSE
872874 LIBOBJS
873875 LTLIBOBJS'
874876 ac_subst_files=''
13891391 # Omit some internal or obsolete options to make the list less imposing.
13901392 # This message is too long to be a string in the A/UX 3.1 sh.
13911393 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.
13931395
13941396 Usage: $0 [OPTION]... [VAR=VALUE]...
13951397
14591461
14601462 if test -n "$ac_init_help"; then
14611463 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:";;
14631465 esac
14641466 cat <<\_ACEOF
14651467
14731475 --enable-fast-install[=PKGS]
14741476 optimize for fast installation [default=yes]
14751477 --disable-libtool-lock avoid locking (might break parallel builds)
1478 --disable-protoc Suppress build of protoc_c
14761479
14771480 Optional Packages:
14781481 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
15601563 test -n "$ac_init_help" && exit $ac_status
15611564 if $ac_init_version; then
15621565 cat <<\_ACEOF
1563 protobuf-c configure 0.12
1566 protobuf-c configure 0.14
15641567 generated by GNU Autoconf 2.61
15651568
15661569 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
15741577 This file contains any messages produced by compilers while
15751578 running configure, to aid debugging if configure makes a mistake.
15761579
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
15781581 generated by GNU Autoconf 2.61. Invocation command line was
15791582
15801583 $ $0 $@
22442247
22452248 # Define the identity of the package.
22462249 PACKAGE='protobuf-c'
2247 VERSION='0.12'
2250 VERSION='0.14'
22482251
22492252
22502253 cat >>confdefs.h <<_ACEOF
47654768 ;;
47664769 *-*-irix6*)
47674770 # Find out which ABI we are using.
4768 echo '#line 4769 "configure"' > conftest.$ac_ext
4771 echo '#line 4772 "configure"' > conftest.$ac_ext
47694772 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
47704773 (eval $ac_compile) 2>&5
47714774 ac_status=$?
73457348 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
73467349 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
73477350 -e 's:$: $lt_compiler_flag:'`
7348 (eval echo "\"\$as_me:7349: $lt_compile\"" >&5)
7351 (eval echo "\"\$as_me:7352: $lt_compile\"" >&5)
73497352 (eval "$lt_compile" 2>conftest.err)
73507353 ac_status=$?
73517354 cat conftest.err >&5
7352 echo "$as_me:7353: \$? = $ac_status" >&5
7355 echo "$as_me:7356: \$? = $ac_status" >&5
73537356 if (exit $ac_status) && test -s "$ac_outfile"; then
73547357 # The compiler can only warn and ignore the option if not recognized
73557358 # So say no if there are warnings other than the usual output.
76357638 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
76367639 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
76377640 -e 's:$: $lt_compiler_flag:'`
7638 (eval echo "\"\$as_me:7639: $lt_compile\"" >&5)
7641 (eval echo "\"\$as_me:7642: $lt_compile\"" >&5)
76397642 (eval "$lt_compile" 2>conftest.err)
76407643 ac_status=$?
76417644 cat conftest.err >&5
7642 echo "$as_me:7643: \$? = $ac_status" >&5
7645 echo "$as_me:7646: \$? = $ac_status" >&5
76437646 if (exit $ac_status) && test -s "$ac_outfile"; then
76447647 # The compiler can only warn and ignore the option if not recognized
76457648 # So say no if there are warnings other than the usual output.
77397742 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
77407743 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
77417744 -e 's:$: $lt_compiler_flag:'`
7742 (eval echo "\"\$as_me:7743: $lt_compile\"" >&5)
7745 (eval echo "\"\$as_me:7746: $lt_compile\"" >&5)
77437746 (eval "$lt_compile" 2>out/conftest.err)
77447747 ac_status=$?
77457748 cat out/conftest.err >&5
7746 echo "$as_me:7747: \$? = $ac_status" >&5
7749 echo "$as_me:7750: \$? = $ac_status" >&5
77477750 if (exit $ac_status) && test -s out/conftest2.$ac_objext
77487751 then
77497752 # The compiler can only warn and ignore the option if not recognized
1011610119 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1011710120 lt_status=$lt_dlunknown
1011810121 cat > conftest.$ac_ext <<EOF
10119 #line 10120 "configure"
10122 #line 10123 "configure"
1012010123 #include "confdefs.h"
1012110124
1012210125 #if HAVE_DLFCN_H
1021610219 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1021710220 lt_status=$lt_dlunknown
1021810221 cat > conftest.$ac_ext <<EOF
10219 #line 10220 "configure"
10222 #line 10223 "configure"
1022010223 #include "confdefs.h"
1022110224
1022210225 #if HAVE_DLFCN_H
1261712620 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1261812621 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1261912622 -e 's:$: $lt_compiler_flag:'`
12620 (eval echo "\"\$as_me:12621: $lt_compile\"" >&5)
12623 (eval echo "\"\$as_me:12624: $lt_compile\"" >&5)
1262112624 (eval "$lt_compile" 2>conftest.err)
1262212625 ac_status=$?
1262312626 cat conftest.err >&5
12624 echo "$as_me:12625: \$? = $ac_status" >&5
12627 echo "$as_me:12628: \$? = $ac_status" >&5
1262512628 if (exit $ac_status) && test -s "$ac_outfile"; then
1262612629 # The compiler can only warn and ignore the option if not recognized
1262712630 # So say no if there are warnings other than the usual output.
1272112724 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1272212725 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1272312726 -e 's:$: $lt_compiler_flag:'`
12724 (eval echo "\"\$as_me:12725: $lt_compile\"" >&5)
12727 (eval echo "\"\$as_me:12728: $lt_compile\"" >&5)
1272512728 (eval "$lt_compile" 2>out/conftest.err)
1272612729 ac_status=$?
1272712730 cat out/conftest.err >&5
12728 echo "$as_me:12729: \$? = $ac_status" >&5
12731 echo "$as_me:12732: \$? = $ac_status" >&5
1272912732 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1273012733 then
1273112734 # The compiler can only warn and ignore the option if not recognized
1431914322 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1432014323 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1432114324 -e 's:$: $lt_compiler_flag:'`
14322 (eval echo "\"\$as_me:14323: $lt_compile\"" >&5)
14325 (eval echo "\"\$as_me:14326: $lt_compile\"" >&5)
1432314326 (eval "$lt_compile" 2>conftest.err)
1432414327 ac_status=$?
1432514328 cat conftest.err >&5
14326 echo "$as_me:14327: \$? = $ac_status" >&5
14329 echo "$as_me:14330: \$? = $ac_status" >&5
1432714330 if (exit $ac_status) && test -s "$ac_outfile"; then
1432814331 # The compiler can only warn and ignore the option if not recognized
1432914332 # So say no if there are warnings other than the usual output.
1442314426 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1442414427 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1442514428 -e 's:$: $lt_compiler_flag:'`
14426 (eval echo "\"\$as_me:14427: $lt_compile\"" >&5)
14429 (eval echo "\"\$as_me:14430: $lt_compile\"" >&5)
1442714430 (eval "$lt_compile" 2>out/conftest.err)
1442814431 ac_status=$?
1442914432 cat out/conftest.err >&5
14430 echo "$as_me:14431: \$? = $ac_status" >&5
14433 echo "$as_me:14434: \$? = $ac_status" >&5
1443114434 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1443214435 then
1443314436 # The compiler can only warn and ignore the option if not recognized
1664316646 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1664416647 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1664516648 -e 's:$: $lt_compiler_flag:'`
16646 (eval echo "\"\$as_me:16647: $lt_compile\"" >&5)
16649 (eval echo "\"\$as_me:16650: $lt_compile\"" >&5)
1664716650 (eval "$lt_compile" 2>conftest.err)
1664816651 ac_status=$?
1664916652 cat conftest.err >&5
16650 echo "$as_me:16651: \$? = $ac_status" >&5
16653 echo "$as_me:16654: \$? = $ac_status" >&5
1665116654 if (exit $ac_status) && test -s "$ac_outfile"; then
1665216655 # The compiler can only warn and ignore the option if not recognized
1665316656 # So say no if there are warnings other than the usual output.
1693316936 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1693416937 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1693516938 -e 's:$: $lt_compiler_flag:'`
16936 (eval echo "\"\$as_me:16937: $lt_compile\"" >&5)
16939 (eval echo "\"\$as_me:16940: $lt_compile\"" >&5)
1693716940 (eval "$lt_compile" 2>conftest.err)
1693816941 ac_status=$?
1693916942 cat conftest.err >&5
16940 echo "$as_me:16941: \$? = $ac_status" >&5
16943 echo "$as_me:16944: \$? = $ac_status" >&5
1694116944 if (exit $ac_status) && test -s "$ac_outfile"; then
1694216945 # The compiler can only warn and ignore the option if not recognized
1694316946 # So say no if there are warnings other than the usual output.
1703717040 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1703817041 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1703917042 -e 's:$: $lt_compiler_flag:'`
17040 (eval echo "\"\$as_me:17041: $lt_compile\"" >&5)
17043 (eval echo "\"\$as_me:17044: $lt_compile\"" >&5)
1704117044 (eval "$lt_compile" 2>out/conftest.err)
1704217045 ac_status=$?
1704317046 cat out/conftest.err >&5
17044 echo "$as_me:17045: \$? = $ac_status" >&5
17047 echo "$as_me:17048: \$? = $ac_status" >&5
1704517048 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1704617049 then
1704717050 # The compiler can only warn and ignore the option if not recognized
2060820611 done
2060920612
2061020613
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
2061120633 # --- Check for the protobuf library. ---
20612 ac_ext=cpp
20634 if test $BUILD_PROTOC_C = 1; then
20635 ac_ext=cpp
2061320636 ac_cpp='$CXXCPP $CPPFLAGS'
2061420637 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
2061520638 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
2074520768 :
2074620769 else
2074720770 { { 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
2075520783 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;}
2076320796 { (exit 1); exit 1; }; }
2076420797 fi
2076520798
2076620799
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
2077020803 /* confdefs.h. */
2077120804 _ACEOF
2077220805 cat confdefs.h >>conftest.$ac_ext
2080520838 sed 's/^/| /' conftest.$ac_ext >&5
2080620839
2080720840 { { 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
2081120844 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;}
2081520848 { (exit 1); exit 1; }; }
2081620849 fi
2081720850
2081820851 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2081920852 conftest$ac_exeext conftest.$ac_ext
20820 LIBS="$pbc_savelibs"
20821 ac_ext=c
20853 LIBS="$pbc_savelibs"
20854 ac_ext=c
2082220855 ac_cpp='$CPP $CPPFLAGS'
2082320856 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
2082420857 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
2082520858 ac_compiler_gnu=$ac_cv_c_compiler_gnu
2082620859
2082720860
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
2084120866
2084220867 # We try to use, where possible the headers <endian.h>, <mach/endian.h>,
2084320868 # and <machine/endian.h>, in that order. They must define the macros
2148321508 _ACEOF
2148421509
2148521510
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"
2148721512
2148821513 cat >confcache <<\_ACEOF
2148921514 # This file is a shell script that caches the results of configure
2163221657 Usually this means the macro was only invoked conditionally." >&2;}
2163321658 { (exit 1); exit 1; }; }
2163421659 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
2163521667
2163621668 : ${CONFIG_STATUS=./config.status}
2163721669 ac_clean_files_save=$ac_clean_files
2193221964 # report actual input values of CONFIG_FILES etc. instead of their
2193321965 # values after options handling.
2193421966 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
2193621968 generated by GNU Autoconf 2.61. Invocation command line was
2193721969
2193821970 CONFIG_FILES = $CONFIG_FILES
2197922011 _ACEOF
2198022012 cat >>$CONFIG_STATUS <<_ACEOF
2198122013 ac_cs_version="\\
21982 protobuf-c config.status 0.12
22014 protobuf-c config.status 0.14
2198322015 configured by $0, generated by GNU Autoconf 2.61,
2198422016 with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
2198522017
2208822120 "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
2208922121 "src/test/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;;
2209022122 "pkgwriteinfo") CONFIG_FILES="$CONFIG_FILES pkgwriteinfo" ;;
22123 "libprotobuf-c.pc") CONFIG_FILES="$CONFIG_FILES libprotobuf-c.pc" ;;
2209122124
2209222125 *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
2209322126 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
2229422327 ac_ct_F77!$ac_ct_F77$ac_delim
2229522328 LIBTOOL!$LIBTOOL$ac_delim
2229622329 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
2229722332 LIBOBJS!$LIBOBJS$ac_delim
2229822333 LTLIBOBJS!$LTLIBOBJS$ac_delim
2229922334 _ACEOF
2230022335
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
2230222337 break
2230322338 elif $ac_last_try; then
2230422339 { { 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])
11 AM_INIT_AUTOMAKE([1.9 foreign])
22 PACKAGE=protobuf-c
33 AC_PROG_CC
1111 AC_CHECK_HEADERS(malloc.h)
1212 AC_CHECK_HEADERS(winsock.h)
1313
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
1421 # --- 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.
1927
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.
3632
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
4556 fi
46
4757
4858 dnl ------ define IS_LITTLE_ENDIAN ------
4959 # We try to use, where possible the headers <endian.h>, <mach/endian.h>,
103113 fi
104114 AC_DEFINE_UNQUOTED(IS_LITTLE_ENDIAN, $is_little_endian)
105115
106 AC_OUTPUT( Makefile src/Makefile src/test/Makefile pkgwriteinfo )
116 AC_OUTPUT(Makefile src/Makefile src/test/Makefile pkgwriteinfo libprotobuf-c.pc)
107117
108118
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
00 9
11
22 dir
3 196
3 245
44 https://protobuf-c.googlecode.com/svn/trunk/scripts
55 https://protobuf-c.googlecode.com/svn
66
0 if BUILD_PROTOC_C
01 SUBDIRS = . test
12 bin_PROGRAMS = protoc-c
2 lib_LTLIBRARIES = libprotobuf-c.la
3 protobufcincludedir = $(includedir)/google/protobuf-c
43 protoc_c_SOURCES = \
54 google/protobuf/compiler/c/c_service.cc \
65 google/protobuf/compiler/c/c_helpers.cc \
1615 google/protobuf/compiler/c/c_message_field.cc \
1716 google/protobuf/compiler/c/main.cc \
1817 google/protobuf/compiler/c/c_bytes_field.cc
19
2018 protoc_c_LDADD = \
2119 -lprotoc -lprotobuf -lpthread
20 endif
21
22 lib_LTLIBRARIES = libprotobuf-c.la
23 protobufcincludedir = $(includedir)/google/protobuf-c
24
2225
2326 libprotobuf_c_la_SOURCES = \
2427 google/protobuf-c/protobuf-c-dispatch.c \
3737 POST_UNINSTALL = :
3838 build_triplet = @build@
3939 host_triplet = @host@
40 bin_PROGRAMS = protoc-c$(EXEEXT)
40 @BUILD_PROTOC_C_TRUE@bin_PROGRAMS = protoc-c$(EXEEXT)
4141 subdir = src
4242 DIST_COMMON = $(noinst_HEADERS) $(protobufcinclude_HEADERS) \
4343 $(srcdir)/Makefile.am $(srcdir)/Makefile.in compile
6363 libprotobuf_c_la_OBJECTS = $(am_libprotobuf_c_la_OBJECTS)
6464 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
6565 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)
7390 protoc_c_OBJECTS = $(am_protoc_c_OBJECTS)
7491 protoc_c_DEPENDENCIES =
7592 DEFAULT_INCLUDES = -I. -I$(srcdir)
92109 CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
93110 $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
94111 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)
96114 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
97115 html-recursive info-recursive install-data-recursive \
98116 install-exec-recursive install-info-recursive \
103121 HEADERS = $(noinst_HEADERS) $(protobufcinclude_HEADERS)
104122 ETAGS = etags
105123 CTAGS = ctags
106 DIST_SUBDIRS = $(SUBDIRS)
124 DIST_SUBDIRS = . test
107125 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
108126 ACLOCAL = @ACLOCAL@
109127 AMDEP_FALSE = @AMDEP_FALSE@
114132 AUTOHEADER = @AUTOHEADER@
115133 AUTOMAKE = @AUTOMAKE@
116134 AWK = @AWK@
135 BUILD_PROTOC_C_FALSE = @BUILD_PROTOC_C_FALSE@
136 BUILD_PROTOC_C_TRUE = @BUILD_PROTOC_C_TRUE@
117137 CC = @CC@
118138 CCDEPMODE = @CCDEPMODE@
119139 CFLAGS = @CFLAGS@
210230 sharedstatedir = @sharedstatedir@
211231 sysconfdir = @sysconfdir@
212232 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
214253 lib_LTLIBRARIES = libprotobuf-c.la
215254 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
235255 libprotobuf_c_la_SOURCES = \
236256 google/protobuf-c/protobuf-c-dispatch.c \
237257 google/protobuf-c/protobuf-c-data-buffer.c \
3737 (*variables)["name"] = FieldName(descriptor);
3838 (*variables)["default"] =
3939 "\"" + CEscape(descriptor->default_value_string()) + "\"";
40 (*variables)["deprecated"] = FieldDeprecated(descriptor);
4041 }
4142
4243 // ===================================================================
5657 {
5758 switch (descriptor_->label()) {
5859 case FieldDescriptor::LABEL_REQUIRED:
59 printer->Print(variables_, "ProtobufCBinaryData $name$;\n");
60 printer->Print(variables_, "ProtobufCBinaryData $name$$deprecated$;\n");
6061 break;
6162 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");
6465 break;
6566 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");
6869 break;
6970 }
7071 }
4444 + "__" + ToUpper(default_value->name());
4545 } else
4646 (*variables)["default"] = "0";
47 (*variables)["deprecated"] = FieldDeprecated(descriptor);
4748 }
4849
4950 // ===================================================================
6162 {
6263 switch (descriptor_->label()) {
6364 case FieldDescriptor::LABEL_REQUIRED:
64 printer->Print(variables_, "$type$ $name$;\n");
65 printer->Print(variables_, "$type$ $name$$deprecated$;\n");
6566 break;
6667 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");
6970 break;
7071 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");
7374 break;
7475 }
7576 }
3838 FieldGenerator::~FieldGenerator()
3939 {
4040 }
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 }
4162
4263 void FieldGenerator::GenerateDescriptorInitializerGeneric(io::Printer* printer,
4364 bool optional_uses_has,
6182 variables["default_value"] = "NULL";
6283 }
6384
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
6492 printer->Print(variables,
6593 "{\n"
6694 " \"$proto_name$\",\n"
6795 " $value$,\n"
6896 " PROTOBUF_C_LABEL_$LABEL$,\n"
6997 " PROTOBUF_C_TYPE_$TYPE$,\n");
98 bool packed = false;
7099 switch (descriptor_->label()) {
71100 case FieldDescriptor::LABEL_REQUIRED:
72101 printer->Print(variables, " 0, /* quantifier_offset */\n");
85114 printer->Print(variables, " PROTOBUF_C_OFFSETOF($classname$, $name$),\n");
86115 printer->Print(variables, " $descriptor_addr$,\n");
87116 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");
89119 printer->Print("},\n");
90120 }
91121
179179 void FileGenerator::GenerateSource(io::Printer* printer) {
180180 printer->Print(
181181 "/* 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"
182187 "\n"
183188 "#include \"$basename$.pb-c.h\"\n",
184189 "basename", StripProto(file_->name()));
235235 result.append("_");
236236 }
237237 return result;
238 }
239
240 string FieldDeprecated(const FieldDescriptor* field) {
241 if (field->options().deprecated()) {
242 return " PROTOBUF_C_DEPRECATED";
243 }
244 return "";
238245 }
239246
240247 string StripProto(const string& filename) {
2525 #include <string>
2626 #include <vector>
2727 #include <google/protobuf/descriptor.h>
28 #include <google/protobuf/descriptor.pb.h>
2829 #include <google/protobuf/io/printer.h>
2930
3031 namespace google {
6061 // should be using lowercase-with-underscores style for proto field names
6162 // anyway, so normally this just returns field->name().
6263 string FieldName(const FieldDescriptor* field);
64
65 // Get macro string for deprecated field
66 string FieldDeprecated(const FieldDescriptor* field);
6367
6468 // Returns the scope where the field was defined (for extensions, this is
6569 // different from the message type to which the field applies).
4545 map<string, string> vars;
4646 vars["name"] = FieldName(descriptor_);
4747 vars["type"] = FullNameToC(descriptor_->message_type()->full_name());
48 vars["deprecated"] = FieldDeprecated(descriptor_);
4849 switch (descriptor_->label()) {
4950 case FieldDescriptor::LABEL_REQUIRED:
5051 case FieldDescriptor::LABEL_OPTIONAL:
51 printer->Print(vars, "$type$ *$name$;\n");
52 printer->Print(vars, "$type$ *$name$$deprecated$;\n");
5253 break;
5354 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");
5657 break;
5758 }
5859 }
6565 }
6666 vars["c_type"] = c_type;
6767 vars["name"] = FieldName(descriptor_);
68 vars["deprecated"] = FieldDeprecated(descriptor_);
6869
6970 switch (descriptor_->label()) {
7071 case FieldDescriptor::LABEL_REQUIRED:
71 printer->Print(vars, "$c_type$ $name$;\n");
72 printer->Print(vars, "$c_type$ $name$$deprecated$;\n");
7273 break;
7374 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");
7677 break;
7778 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");
8081 break;
8182 }
8283 }
3737 (*variables)["name"] = FieldName(descriptor);
3838 (*variables)["default"] = FullNameToLower(descriptor->full_name())
3939 + "__default_value";
40 (*variables)["deprecated"] = FieldDeprecated(descriptor);
4041 }
4142
4243 // ===================================================================
5455 switch (descriptor_->label()) {
5556 case FieldDescriptor::LABEL_REQUIRED:
5657 case FieldDescriptor::LABEL_OPTIONAL:
57 printer->Print(variables_, "char *$name$;\n");
58 printer->Print(variables_, "char *$name$$deprecated$;\n");
5859 break;
5960 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");
6263 break;
6364 }
6465 }
299299 {
300300 unsigned new_size = d->notifies_desired_alloced * 2;
301301 ProtobufC_FDNotify *n = ALLOC (new_size * sizeof (ProtobufC_FDNotify));
302 Callback *c = ALLOC (new_size * sizeof (Callback));
302303 memcpy (n, d->base.notifies_desired, d->notifies_desired_alloced * sizeof (ProtobufC_FDNotify));
303304 FREE (d->base.notifies_desired);
305 memcpy (c, d->callbacks, d->notifies_desired_alloced * sizeof (Callback));
306 FREE (d->callbacks);
304307 d->base.notifies_desired = n;
308 d->callbacks = c;
305309 d->notifies_desired_alloced = new_size;
306310 }
307311 #if DEBUG_DISPATCH_INTERNALS
372376 unsigned ch_ind = fm->change_index;
373377 unsigned from = d->base.n_changes - 1;
374378 ProtobufC_FD from_fd;
379 fm->change_index = -1;
375380 if (ch_ind == from)
376381 {
377382 d->base.n_changes--;
404409 from_fd = d->base.notifies_desired[from].fd;
405410 get_fd_map (d, from_fd)->notify_desired_index = nd_ind;
406411 d->base.notifies_desired[nd_ind] = d->base.notifies_desired[from];
412 d->callbacks[nd_ind] = d->callbacks[from];
407413 d->base.n_notifies_desired--;
408414 }
409415
447447 return le;
448448 #else
449449 return (le << 24) | (le >> 24)
450 | ((le >> 8) & 0xff0000)
451 | ((le << 8) & 0xff00);
450 | ((le >> 8) & 0xff00)
451 | ((le << 8) & 0xff0000);
452452 #endif
453453 }
454454 #define uint32_from_le uint32_to_le /* make the code more readable, i guess */
776776 client->autoreconnect = 1;
777777 client->autoreconnect_millis = millis;
778778 }
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
779790 void
780791 protobuf_c_rpc_client_disable_autoreconnect (ProtobufC_RPC_Client *client)
781792 {
13421353
13431354 return rv;
13441355 }
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 }
4545 ProtobufCService *protobuf_c_rpc_client_new (ProtobufC_RPC_AddressType type,
4646 const char *name,
4747 const ProtobufCServiceDescriptor *descriptor,
48 ProtobufCDispatch *dispatch);
48 ProtobufCDispatch *dispatch /* or NULL */
49 );
4950
5051 /* forcing the client to connect */
5152 typedef enum
100101 protobuf_c_rpc_server_new (ProtobufC_RPC_AddressType type,
101102 const char *name,
102103 ProtobufCService *service,
103 ProtobufCDispatch *dispatch);
104 ProtobufCDispatch *dispatch /* or NULL */
105 );
104106 ProtobufCService *
105107 protobuf_c_rpc_server_destroy (ProtobufC_RPC_Server *server,
106108 protobuf_c_boolean free_underlying_service);
1414 * under the License.
1515 */
1616
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
2632 */
2733
2834 #include <stdio.h> /* for occasional printf()s */
372378 size_t count,
373379 const void *member)
374380 {
375 size_t rv = get_tag_size (field->id) * count;
381 size_t header_size;
382 size_t rv = 0;
376383 unsigned i;
377384 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;
378390 switch (field->type)
379391 {
380392 case PROTOBUF_C_TYPE_SINT32:
436448 break;
437449 //case PROTOBUF_C_TYPE_GROUP: // NOT SUPPORTED
438450 }
439 return rv;
451 if (field->packed)
452 header_size += uint32_size (rv);
453 return header_size + rv;
440454 }
441455
442456 /* Get the packed size of a unknown field (meaning one that
465479 rv += required_field_get_packed_size (field, member);
466480 else if (field->label == PROTOBUF_C_LABEL_OPTIONAL)
467481 rv += optional_field_get_packed_size (field, qmember, member);
468 else
482 else
469483 rv += repeated_field_get_packed_size (field, * (const size_t *) qmember, member);
470484 }
471485 for (i = 0; i < message->n_unknown_fields; i++)
472486 rv += unknown_field_get_packed_size (&message->unknown_fields[i]);
473
474487 return rv;
475488 }
476489 /* === pack() === */
800813 return 0;
801814 }
802815
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
803855 static size_t
804856 repeated_field_pack (const ProtobufCFieldDescriptor *field,
805857 size_t count,
807859 uint8_t *out)
808860 {
809861 char *array = * (char * const *) member;
810 size_t siz;
811862 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 }
821970 }
822971 static size_t
823972 unknown_field_pack (const ProtobufCMessageUnknownField *field,
9911140 }
9921141
9931142 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
9941311 repeated_field_pack_to_buffer (const ProtobufCFieldDescriptor *field,
9951312 unsigned count,
9961313 const void *member,
9971314 ProtobufCBuffer *buffer)
9981315 {
9991316 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 }
10111346 }
10121347
10131348 static size_t
11371472 const uint8_t *data;
11381473 };
11391474
1140 #define MESSAGE_GET_UNKNOWNS(message) \
1141 STRUCT_MEMBER_PTR (ProtobufCMessageUnknownFieldArray, \
1142 (message), (message)->descriptor->unknown_field_array_offset)
1143
11441475 static inline uint32_t
11451476 scan_length_prefixed_data (size_t len, const uint8_t *data, size_t *prefix_len_out)
11461477 {
11701501 return 0;
11711502 }
11721503 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 }
11731572 }
11741573
11751574 static inline uint32_t
14161815 return 1;
14171816 }
14181817
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
14191972 static protobuf_c_boolean
14201973 parse_member (ScannedMember *scanned_member,
14211974 ProtobufCMessage *message,
14411994 case PROTOBUF_C_LABEL_OPTIONAL:
14421995 return parse_optional_member (scanned_member, member, message, allocator);
14431996 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);
14452002 }
14462003 PROTOBUF_C_ASSERT_NOT_REACHED ();
14472004 return 0;
14482005 }
14492006
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 {
14542015 unsigned i;
2016 memset (message, 0, desc->sizeof_message);
2017 message->descriptor = desc;
14552018 for (i = 0; i < desc->n_fields; i++)
14562019 if (desc->fields[i].default_value != NULL
14572020 && desc->fields[i].label != PROTOBUF_C_LABEL_REPEATED)
15392102 size_t n_unknown = 0;
15402103 unsigned f;
15412104 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;
15422109
15432110 ASSERT_IS_MESSAGE_DESCRIPTOR (desc);
15442111
15452112 if (allocator == NULL)
15462113 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
15472119 DO_ALLOC (rv, allocator, desc->sizeof_message, return NULL);
15482120 scanned_member_slabs[0] = first_member_slab;
15492121
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);
15542131
15552132 while (rem > 0)
15562133 {
15812158 {
15822159 field = desc->fields + field_index;
15832160 last_field = field;
2161 last_field_index = field_index;
15842162 }
15852163 }
15862164 else
15872165 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));
15882169
15892170 at += used;
15902171 rem -= used;
16662247
16672248 if (field != NULL && field->label == PROTOBUF_C_LABEL_REPEATED)
16682249 {
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;
16702267 }
16712268
16722269 at += tmp.len;
16732270 rem -= tmp.len;
16742271 }
16752272
1676 /* allocate space for repeated fields */
2273 /* allocate space for repeated fields, also check that all required fields have been set */
16772274 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 {
16812279 size_t siz = sizeof_elt_in_repeated_array (field->type);
16822280 size_t *n_ptr = STRUCT_MEMBER_PTR (size_t, rv, field->quantifier_offset);
16832281 if (*n_ptr != 0)
16972295 CLEAR_REMAINING_N_PTRS (); goto error_cleanup);
16982296 #undef CLEAR_REMAINING_N_PTRS
16992297 }
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;
17002305 }
2306 }
2307 }
17012308
17022309 /* allocate space for unknown fields */
17032310 if (n_unknown)
18262433 }
18272434
18282435 /* === services === */
1829 typedef void (*DestroyHandler)(void *service);
18302436 typedef void (*GenericHandler)(void *service,
18312437 const ProtobufCMessage *input,
18322438 ProtobufCClosure closure,
18902496 return desc->values + desc->values_by_name[mid].index;
18912497 else if (rv < 0)
18922498 {
1893 count = start + count - (mid - 1);
2499 count = start + count - (mid + 1);
18942500 start = mid + 1;
18952501 }
18962502 else
19732579 return desc->methods + desc->method_indices_by_name[mid];
19742580 if (rv < 0)
19752581 {
1976 count = start + count - (mid - 1);
2582 count = start + count - (mid + 1);
19772583 start = mid + 1;
19782584 }
19792585 else
1717 #ifndef __PROTOBUF_C_RUNTIME_H_
1818 #define __PROTOBUF_C_RUNTIME_H_
1919
20 #include <inttypes.h>
2120 #include <stddef.h>
2221 #include <assert.h>
2322
2726 #else
2827 # define PROTOBUF_C_BEGIN_DECLS
2928 # 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
3054 #endif
3155
3256 PROTOBUF_C_BEGIN_DECLS
88112
89113 /* This is a configurable allocator.
90114 * 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
92116 * some nonstandard allocation functions.
117 *
118 * NOTE: you may modify this allocator.
93119 */
94120 extern ProtobufCAllocator protobuf_c_default_allocator; /* settable */
95121
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 */
97126 extern ProtobufCAllocator protobuf_c_system_allocator; /* use malloc, free etc */
98127
99128 /* This is the function that our default allocators call when they
203232 unsigned offset;
204233 const void *descriptor; /* for MESSAGE and ENUM types */
205234 const void *default_value; /* or NULL if no default-value */
206
207 void *reserved1;
235 protobuf_c_boolean packed;
236
237 unsigned reserved_flags;
208238 void *reserved2;
239 void *reserved3;
209240 };
210241 /* ProtobufCMessageDescriptor: description of a message.
211242 *
299330 void protobuf_c_message_free_unpacked (ProtobufCMessage *message,
300331 ProtobufCAllocator *allocator);
301332
302 /* WARNING: 'to_init' must be a block of memory
333 /* WARNING: 'message' must be a block of memory
303334 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)))
305336
306337 /* --- services --- */
307338 typedef struct _ProtobufCMethodDescriptor ProtobufCMethodDescriptor;
1717 ../libprotobuf-c.la
1818 cxx_generate_packed_data_SOURCES = \
1919 cxx-generate-packed-data.cc generated-code/test-full.pb.cc
20 cxx-generate-packed-data.$(OBJEXT): generated-code/test-full.pb.h
2021 cxx_generate_packed_data_LDADD = -lprotobuf
2122 cxx_generate_packed_data_LDFLAGS = -pthread
2223 example_server_SOURCES = \
111111 AUTOHEADER = @AUTOHEADER@
112112 AUTOMAKE = @AUTOMAKE@
113113 AWK = @AWK@
114 BUILD_PROTOC_C_FALSE = @BUILD_PROTOC_C_FALSE@
115 BUILD_PROTOC_C_TRUE = @BUILD_PROTOC_C_TRUE@
114116 CC = @CC@
115117 CCDEPMODE = @CCDEPMODE@
116118 CFLAGS = @CFLAGS@
672674 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
673675 tags uninstall uninstall-am uninstall-info-am
674676
677 cxx-generate-packed-data.$(OBJEXT): generated-code/test-full.pb.h
675678
676679 generated-code/test.pb-c.c generated-code/test.pb-c.h: ../protoc-c$(EXEEXT) $(srcdir)/test.proto
677680 mkdir -p generated-code
2323 generated-code/test.pb-c.c Protobuf-C generated code based on test.proto
2424
2525 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.
5555 T(0), T(2097152), T(268435455), T(127), T(16383), T(16384) };
5656 #undef T
5757
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" };
751751 mess.add_test_message()->set_test(667);
752752 dump_message_bytes(&mess, "test_repeated_submess_1");
753753 }
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
754926
755927 static void dump_test_unknown_fields (void)
756928 {
758930 const google::protobuf::Message::Reflection *reflection = mess.GetReflection();
759931 google::protobuf::UnknownFieldSet *fs = reflection->MutableUnknownFields(&mess);
760932
761 #if PROTOC_VERSION >= 2001000
933 #if GOOGLE_PROTOBUF_VERSION >= 2001000
762934 fs->AddVarint(5454, 255);
763935 fs->AddFixed32(5555, 260);
764936 #else
773945
774946 fs->Clear();
775947
776 #if PROTOC_VERSION >= 2001000
948 #if GOOGLE_PROTOBUF_VERSION >= 2001000
777949 fs->AddLengthDelimited(6666, "xxxxxxxx");
778950 fs->AddFixed64(7777, 0x10101);
779951 #else
8451017 dump_test_repeated_string ();
8461018 dump_test_repeated_bytes ();
8471019 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 ();
8481035 dump_test_unknown_fields ();
8491036 return 0;
8501037 }
00 /* 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
16
27 #include "test-full.pb-c.h"
38 void foo__sub_mess__init
430435 PROTOBUF_C_ASSERT (message->base.descriptor == &foo__test_mess__descriptor);
431436 protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
432437 }
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 }
433481 void foo__test_mess_optional__init
434482 (Foo__TestMessOptional *message)
435483 {
14301478 PROTOBUF_C_OFFSETOF(Foo__SubMess, test),
14311479 NULL,
14321480 NULL,
1433 NULL,NULL /* reserved1, reserved2 */
1481 0, /* packed */
1482 0,NULL,NULL /* reserved1,reserved2, etc */
14341483 },
14351484 };
14361485 static const unsigned foo__sub_mess__field_indices_by_name[] = {
14671516 PROTOBUF_C_OFFSETOF(Foo__TestFieldNo15, test),
14681517 NULL,
14691518 NULL,
1470 NULL,NULL /* reserved1, reserved2 */
1519 0, /* packed */
1520 0,NULL,NULL /* reserved1,reserved2, etc */
14711521 },
14721522 };
14731523 static const unsigned foo__test_field_no15__field_indices_by_name[] = {
15041554 PROTOBUF_C_OFFSETOF(Foo__TestFieldNo16, test),
15051555 NULL,
15061556 NULL,
1507 NULL,NULL /* reserved1, reserved2 */
1557 0, /* packed */
1558 0,NULL,NULL /* reserved1,reserved2, etc */
15081559 },
15091560 };
15101561 static const unsigned foo__test_field_no16__field_indices_by_name[] = {
15411592 PROTOBUF_C_OFFSETOF(Foo__TestFieldNo2047, test),
15421593 NULL,
15431594 NULL,
1544 NULL,NULL /* reserved1, reserved2 */
1595 0, /* packed */
1596 0,NULL,NULL /* reserved1,reserved2, etc */
15451597 },
15461598 };
15471599 static const unsigned foo__test_field_no2047__field_indices_by_name[] = {
15781630 PROTOBUF_C_OFFSETOF(Foo__TestFieldNo2048, test),
15791631 NULL,
15801632 NULL,
1581 NULL,NULL /* reserved1, reserved2 */
1633 0, /* packed */
1634 0,NULL,NULL /* reserved1,reserved2, etc */
15821635 },
15831636 };
15841637 static const unsigned foo__test_field_no2048__field_indices_by_name[] = {
16151668 PROTOBUF_C_OFFSETOF(Foo__TestFieldNo262143, test),
16161669 NULL,
16171670 NULL,
1618 NULL,NULL /* reserved1, reserved2 */
1671 0, /* packed */
1672 0,NULL,NULL /* reserved1,reserved2, etc */
16191673 },
16201674 };
16211675 static const unsigned foo__test_field_no262143__field_indices_by_name[] = {
16521706 PROTOBUF_C_OFFSETOF(Foo__TestFieldNo262144, test),
16531707 NULL,
16541708 NULL,
1655 NULL,NULL /* reserved1, reserved2 */
1709 0, /* packed */
1710 0,NULL,NULL /* reserved1,reserved2, etc */
16561711 },
16571712 };
16581713 static const unsigned foo__test_field_no262144__field_indices_by_name[] = {
16891744 PROTOBUF_C_OFFSETOF(Foo__TestFieldNo33554431, test),
16901745 NULL,
16911746 NULL,
1692 NULL,NULL /* reserved1, reserved2 */
1747 0, /* packed */
1748 0,NULL,NULL /* reserved1,reserved2, etc */
16931749 },
16941750 };
16951751 static const unsigned foo__test_field_no33554431__field_indices_by_name[] = {
17261782 PROTOBUF_C_OFFSETOF(Foo__TestFieldNo33554432, test),
17271783 NULL,
17281784 NULL,
1729 NULL,NULL /* reserved1, reserved2 */
1785 0, /* packed */
1786 0,NULL,NULL /* reserved1,reserved2, etc */
17301787 },
17311788 };
17321789 static const unsigned foo__test_field_no33554432__field_indices_by_name[] = {
17631820 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_int32),
17641821 NULL,
17651822 NULL,
1766 NULL,NULL /* reserved1, reserved2 */
1823 0, /* packed */
1824 0,NULL,NULL /* reserved1,reserved2, etc */
17671825 },
17681826 {
17691827 "test_sint32",
17741832 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_sint32),
17751833 NULL,
17761834 NULL,
1777 NULL,NULL /* reserved1, reserved2 */
1835 0, /* packed */
1836 0,NULL,NULL /* reserved1,reserved2, etc */
17781837 },
17791838 {
17801839 "test_sfixed32",
17851844 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_sfixed32),
17861845 NULL,
17871846 NULL,
1788 NULL,NULL /* reserved1, reserved2 */
1847 0, /* packed */
1848 0,NULL,NULL /* reserved1,reserved2, etc */
17891849 },
17901850 {
17911851 "test_int64",
17961856 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_int64),
17971857 NULL,
17981858 NULL,
1799 NULL,NULL /* reserved1, reserved2 */
1859 0, /* packed */
1860 0,NULL,NULL /* reserved1,reserved2, etc */
18001861 },
18011862 {
18021863 "test_sint64",
18071868 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_sint64),
18081869 NULL,
18091870 NULL,
1810 NULL,NULL /* reserved1, reserved2 */
1871 0, /* packed */
1872 0,NULL,NULL /* reserved1,reserved2, etc */
18111873 },
18121874 {
18131875 "test_sfixed64",
18181880 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_sfixed64),
18191881 NULL,
18201882 NULL,
1821 NULL,NULL /* reserved1, reserved2 */
1883 0, /* packed */
1884 0,NULL,NULL /* reserved1,reserved2, etc */
18221885 },
18231886 {
18241887 "test_uint32",
18291892 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_uint32),
18301893 NULL,
18311894 NULL,
1832 NULL,NULL /* reserved1, reserved2 */
1895 0, /* packed */
1896 0,NULL,NULL /* reserved1,reserved2, etc */
18331897 },
18341898 {
18351899 "test_fixed32",
18401904 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_fixed32),
18411905 NULL,
18421906 NULL,
1843 NULL,NULL /* reserved1, reserved2 */
1907 0, /* packed */
1908 0,NULL,NULL /* reserved1,reserved2, etc */
18441909 },
18451910 {
18461911 "test_uint64",
18511916 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_uint64),
18521917 NULL,
18531918 NULL,
1854 NULL,NULL /* reserved1, reserved2 */
1919 0, /* packed */
1920 0,NULL,NULL /* reserved1,reserved2, etc */
18551921 },
18561922 {
18571923 "test_fixed64",
18621928 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_fixed64),
18631929 NULL,
18641930 NULL,
1865 NULL,NULL /* reserved1, reserved2 */
1931 0, /* packed */
1932 0,NULL,NULL /* reserved1,reserved2, etc */
18661933 },
18671934 {
18681935 "test_float",
18731940 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_float),
18741941 NULL,
18751942 NULL,
1876 NULL,NULL /* reserved1, reserved2 */
1943 0, /* packed */
1944 0,NULL,NULL /* reserved1,reserved2, etc */
18771945 },
18781946 {
18791947 "test_double",
18841952 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_double),
18851953 NULL,
18861954 NULL,
1887 NULL,NULL /* reserved1, reserved2 */
1955 0, /* packed */
1956 0,NULL,NULL /* reserved1,reserved2, etc */
18881957 },
18891958 {
18901959 "test_boolean",
18951964 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_boolean),
18961965 NULL,
18971966 NULL,
1898 NULL,NULL /* reserved1, reserved2 */
1967 0, /* packed */
1968 0,NULL,NULL /* reserved1,reserved2, etc */
18991969 },
19001970 {
19011971 "test_enum_small",
19061976 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_enum_small),
19071977 &foo__test_enum_small__descriptor,
19081978 NULL,
1909 NULL,NULL /* reserved1, reserved2 */
1979 0, /* packed */
1980 0,NULL,NULL /* reserved1,reserved2, etc */
19101981 },
19111982 {
19121983 "test_enum",
19171988 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_enum),
19181989 &foo__test_enum__descriptor,
19191990 NULL,
1920 NULL,NULL /* reserved1, reserved2 */
1991 0, /* packed */
1992 0,NULL,NULL /* reserved1,reserved2, etc */
19211993 },
19221994 {
19231995 "test_string",
19282000 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_string),
19292001 NULL,
19302002 NULL,
1931 NULL,NULL /* reserved1, reserved2 */
2003 0, /* packed */
2004 0,NULL,NULL /* reserved1,reserved2, etc */
19322005 },
19332006 {
19342007 "test_bytes",
19392012 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_bytes),
19402013 NULL,
19412014 NULL,
1942 NULL,NULL /* reserved1, reserved2 */
2015 0, /* packed */
2016 0,NULL,NULL /* reserved1,reserved2, etc */
19432017 },
19442018 {
19452019 "test_message",
19502024 PROTOBUF_C_OFFSETOF(Foo__TestMess, test_message),
19512025 &foo__sub_mess__descriptor,
19522026 NULL,
1953 NULL,NULL /* reserved1, reserved2 */
2027 0, /* packed */
2028 0,NULL,NULL /* reserved1,reserved2, etc */
19542029 },
19552030 };
19562031 static const unsigned foo__test_mess__field_indices_by_name[] = {
19932068 (ProtobufCMessageInit) foo__test_mess__init,
19942069 NULL,NULL,NULL /* reserved[123] */
19952070 };
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 };
19962291 static const ProtobufCFieldDescriptor foo__test_mess_optional__field_descriptors[18] =
19972292 {
19982293 {
20042299 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_int32),
20052300 NULL,
20062301 NULL,
2007 NULL,NULL /* reserved1, reserved2 */
2302 0, /* packed */
2303 0,NULL,NULL /* reserved1,reserved2, etc */
20082304 },
20092305 {
20102306 "test_sint32",
20152311 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_sint32),
20162312 NULL,
20172313 NULL,
2018 NULL,NULL /* reserved1, reserved2 */
2314 0, /* packed */
2315 0,NULL,NULL /* reserved1,reserved2, etc */
20192316 },
20202317 {
20212318 "test_sfixed32",
20262323 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_sfixed32),
20272324 NULL,
20282325 NULL,
2029 NULL,NULL /* reserved1, reserved2 */
2326 0, /* packed */
2327 0,NULL,NULL /* reserved1,reserved2, etc */
20302328 },
20312329 {
20322330 "test_int64",
20372335 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_int64),
20382336 NULL,
20392337 NULL,
2040 NULL,NULL /* reserved1, reserved2 */
2338 0, /* packed */
2339 0,NULL,NULL /* reserved1,reserved2, etc */
20412340 },
20422341 {
20432342 "test_sint64",
20482347 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_sint64),
20492348 NULL,
20502349 NULL,
2051 NULL,NULL /* reserved1, reserved2 */
2350 0, /* packed */
2351 0,NULL,NULL /* reserved1,reserved2, etc */
20522352 },
20532353 {
20542354 "test_sfixed64",
20592359 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_sfixed64),
20602360 NULL,
20612361 NULL,
2062 NULL,NULL /* reserved1, reserved2 */
2362 0, /* packed */
2363 0,NULL,NULL /* reserved1,reserved2, etc */
20632364 },
20642365 {
20652366 "test_uint32",
20702371 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_uint32),
20712372 NULL,
20722373 NULL,
2073 NULL,NULL /* reserved1, reserved2 */
2374 0, /* packed */
2375 0,NULL,NULL /* reserved1,reserved2, etc */
20742376 },
20752377 {
20762378 "test_fixed32",
20812383 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_fixed32),
20822384 NULL,
20832385 NULL,
2084 NULL,NULL /* reserved1, reserved2 */
2386 0, /* packed */
2387 0,NULL,NULL /* reserved1,reserved2, etc */
20852388 },
20862389 {
20872390 "test_uint64",
20922395 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_uint64),
20932396 NULL,
20942397 NULL,
2095 NULL,NULL /* reserved1, reserved2 */
2398 0, /* packed */
2399 0,NULL,NULL /* reserved1,reserved2, etc */
20962400 },
20972401 {
20982402 "test_fixed64",
21032407 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_fixed64),
21042408 NULL,
21052409 NULL,
2106 NULL,NULL /* reserved1, reserved2 */
2410 0, /* packed */
2411 0,NULL,NULL /* reserved1,reserved2, etc */
21072412 },
21082413 {
21092414 "test_float",
21142419 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_float),
21152420 NULL,
21162421 NULL,
2117 NULL,NULL /* reserved1, reserved2 */
2422 0, /* packed */
2423 0,NULL,NULL /* reserved1,reserved2, etc */
21182424 },
21192425 {
21202426 "test_double",
21252431 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_double),
21262432 NULL,
21272433 NULL,
2128 NULL,NULL /* reserved1, reserved2 */
2434 0, /* packed */
2435 0,NULL,NULL /* reserved1,reserved2, etc */
21292436 },
21302437 {
21312438 "test_boolean",
21362443 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_boolean),
21372444 NULL,
21382445 NULL,
2139 NULL,NULL /* reserved1, reserved2 */
2446 0, /* packed */
2447 0,NULL,NULL /* reserved1,reserved2, etc */
21402448 },
21412449 {
21422450 "test_enum_small",
21472455 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_enum_small),
21482456 &foo__test_enum_small__descriptor,
21492457 NULL,
2150 NULL,NULL /* reserved1, reserved2 */
2458 0, /* packed */
2459 0,NULL,NULL /* reserved1,reserved2, etc */
21512460 },
21522461 {
21532462 "test_enum",
21582467 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_enum),
21592468 &foo__test_enum__descriptor,
21602469 NULL,
2161 NULL,NULL /* reserved1, reserved2 */
2470 0, /* packed */
2471 0,NULL,NULL /* reserved1,reserved2, etc */
21622472 },
21632473 {
21642474 "test_string",
21692479 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_string),
21702480 NULL,
21712481 NULL,
2172 NULL,NULL /* reserved1, reserved2 */
2482 0, /* packed */
2483 0,NULL,NULL /* reserved1,reserved2, etc */
21732484 },
21742485 {
21752486 "test_bytes",
21802491 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_bytes),
21812492 NULL,
21822493 NULL,
2183 NULL,NULL /* reserved1, reserved2 */
2494 0, /* packed */
2495 0,NULL,NULL /* reserved1,reserved2, etc */
21842496 },
21852497 {
21862498 "test_message",
21912503 PROTOBUF_C_OFFSETOF(Foo__TestMessOptional, test_message),
21922504 &foo__sub_mess__descriptor,
21932505 NULL,
2194 NULL,NULL /* reserved1, reserved2 */
2506 0, /* packed */
2507 0,NULL,NULL /* reserved1,reserved2, etc */
21952508 },
21962509 };
21972510 static const unsigned foo__test_mess_optional__field_indices_by_name[] = {
22452558 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredInt32, test),
22462559 NULL,
22472560 NULL,
2248 NULL,NULL /* reserved1, reserved2 */
2561 0, /* packed */
2562 0,NULL,NULL /* reserved1,reserved2, etc */
22492563 },
22502564 };
22512565 static const unsigned foo__test_mess_required_int32__field_indices_by_name[] = {
22822596 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredSInt32, test),
22832597 NULL,
22842598 NULL,
2285 NULL,NULL /* reserved1, reserved2 */
2599 0, /* packed */
2600 0,NULL,NULL /* reserved1,reserved2, etc */
22862601 },
22872602 };
22882603 static const unsigned foo__test_mess_required_sint32__field_indices_by_name[] = {
23192634 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredSFixed32, test),
23202635 NULL,
23212636 NULL,
2322 NULL,NULL /* reserved1, reserved2 */
2637 0, /* packed */
2638 0,NULL,NULL /* reserved1,reserved2, etc */
23232639 },
23242640 };
23252641 static const unsigned foo__test_mess_required_sfixed32__field_indices_by_name[] = {
23562672 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredInt64, test),
23572673 NULL,
23582674 NULL,
2359 NULL,NULL /* reserved1, reserved2 */
2675 0, /* packed */
2676 0,NULL,NULL /* reserved1,reserved2, etc */
23602677 },
23612678 };
23622679 static const unsigned foo__test_mess_required_int64__field_indices_by_name[] = {
23932710 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredSInt64, test),
23942711 NULL,
23952712 NULL,
2396 NULL,NULL /* reserved1, reserved2 */
2713 0, /* packed */
2714 0,NULL,NULL /* reserved1,reserved2, etc */
23972715 },
23982716 };
23992717 static const unsigned foo__test_mess_required_sint64__field_indices_by_name[] = {
24302748 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredSFixed64, test),
24312749 NULL,
24322750 NULL,
2433 NULL,NULL /* reserved1, reserved2 */
2751 0, /* packed */
2752 0,NULL,NULL /* reserved1,reserved2, etc */
24342753 },
24352754 };
24362755 static const unsigned foo__test_mess_required_sfixed64__field_indices_by_name[] = {
24672786 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredUInt32, test),
24682787 NULL,
24692788 NULL,
2470 NULL,NULL /* reserved1, reserved2 */
2789 0, /* packed */
2790 0,NULL,NULL /* reserved1,reserved2, etc */
24712791 },
24722792 };
24732793 static const unsigned foo__test_mess_required_uint32__field_indices_by_name[] = {
25042824 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredFixed32, test),
25052825 NULL,
25062826 NULL,
2507 NULL,NULL /* reserved1, reserved2 */
2827 0, /* packed */
2828 0,NULL,NULL /* reserved1,reserved2, etc */
25082829 },
25092830 };
25102831 static const unsigned foo__test_mess_required_fixed32__field_indices_by_name[] = {
25412862 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredUInt64, test),
25422863 NULL,
25432864 NULL,
2544 NULL,NULL /* reserved1, reserved2 */
2865 0, /* packed */
2866 0,NULL,NULL /* reserved1,reserved2, etc */
25452867 },
25462868 };
25472869 static const unsigned foo__test_mess_required_uint64__field_indices_by_name[] = {
25782900 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredFixed64, test),
25792901 NULL,
25802902 NULL,
2581 NULL,NULL /* reserved1, reserved2 */
2903 0, /* packed */
2904 0,NULL,NULL /* reserved1,reserved2, etc */
25822905 },
25832906 };
25842907 static const unsigned foo__test_mess_required_fixed64__field_indices_by_name[] = {
26152938 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredFloat, test),
26162939 NULL,
26172940 NULL,
2618 NULL,NULL /* reserved1, reserved2 */
2941 0, /* packed */
2942 0,NULL,NULL /* reserved1,reserved2, etc */
26192943 },
26202944 };
26212945 static const unsigned foo__test_mess_required_float__field_indices_by_name[] = {
26522976 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredDouble, test),
26532977 NULL,
26542978 NULL,
2655 NULL,NULL /* reserved1, reserved2 */
2979 0, /* packed */
2980 0,NULL,NULL /* reserved1,reserved2, etc */
26562981 },
26572982 };
26582983 static const unsigned foo__test_mess_required_double__field_indices_by_name[] = {
26893014 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredBool, test),
26903015 NULL,
26913016 NULL,
2692 NULL,NULL /* reserved1, reserved2 */
3017 0, /* packed */
3018 0,NULL,NULL /* reserved1,reserved2, etc */
26933019 },
26943020 };
26953021 static const unsigned foo__test_mess_required_bool__field_indices_by_name[] = {
27263052 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredEnum, test),
27273053 &foo__test_enum__descriptor,
27283054 NULL,
2729 NULL,NULL /* reserved1, reserved2 */
3055 0, /* packed */
3056 0,NULL,NULL /* reserved1,reserved2, etc */
27303057 },
27313058 };
27323059 static const unsigned foo__test_mess_required_enum__field_indices_by_name[] = {
27633090 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredEnumSmall, test),
27643091 &foo__test_enum_small__descriptor,
27653092 NULL,
2766 NULL,NULL /* reserved1, reserved2 */
3093 0, /* packed */
3094 0,NULL,NULL /* reserved1,reserved2, etc */
27673095 },
27683096 };
27693097 static const unsigned foo__test_mess_required_enum_small__field_indices_by_name[] = {
28003128 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredString, test),
28013129 NULL,
28023130 NULL,
2803 NULL,NULL /* reserved1, reserved2 */
3131 0, /* packed */
3132 0,NULL,NULL /* reserved1,reserved2, etc */
28043133 },
28053134 };
28063135 static const unsigned foo__test_mess_required_string__field_indices_by_name[] = {
28373166 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredBytes, test),
28383167 NULL,
28393168 NULL,
2840 NULL,NULL /* reserved1, reserved2 */
3169 0, /* packed */
3170 0,NULL,NULL /* reserved1,reserved2, etc */
28413171 },
28423172 };
28433173 static const unsigned foo__test_mess_required_bytes__field_indices_by_name[] = {
28743204 PROTOBUF_C_OFFSETOF(Foo__TestMessRequiredMessage, test),
28753205 &foo__sub_mess__descriptor,
28763206 NULL,
2877 NULL,NULL /* reserved1, reserved2 */
3207 0, /* packed */
3208 0,NULL,NULL /* reserved1,reserved2, etc */
28783209 },
28793210 };
28803211 static const unsigned foo__test_mess_required_message__field_indices_by_name[] = {
29413272 PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_int32),
29423273 NULL,
29433274 &foo__default_required_values__v_int32__default_value,
2944 NULL,NULL /* reserved1, reserved2 */
3275 0, /* packed */
3276 0,NULL,NULL /* reserved1,reserved2, etc */
29453277 },
29463278 {
29473279 "v_uint32",
29523284 PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_uint32),
29533285 NULL,
29543286 &foo__default_required_values__v_uint32__default_value,
2955 NULL,NULL /* reserved1, reserved2 */
3287 0, /* packed */
3288 0,NULL,NULL /* reserved1,reserved2, etc */
29563289 },
29573290 {
29583291 "v_int64",
29633296 PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_int64),
29643297 NULL,
29653298 &foo__default_required_values__v_int64__default_value,
2966 NULL,NULL /* reserved1, reserved2 */
3299 0, /* packed */
3300 0,NULL,NULL /* reserved1,reserved2, etc */
29673301 },
29683302 {
29693303 "v_uint64",
29743308 PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_uint64),
29753309 NULL,
29763310 &foo__default_required_values__v_uint64__default_value,
2977 NULL,NULL /* reserved1, reserved2 */
3311 0, /* packed */
3312 0,NULL,NULL /* reserved1,reserved2, etc */
29783313 },
29793314 {
29803315 "v_float",
29853320 PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_float),
29863321 NULL,
29873322 &foo__default_required_values__v_float__default_value,
2988 NULL,NULL /* reserved1, reserved2 */
3323 0, /* packed */
3324 0,NULL,NULL /* reserved1,reserved2, etc */
29893325 },
29903326 {
29913327 "v_double",
29963332 PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_double),
29973333 NULL,
29983334 &foo__default_required_values__v_double__default_value,
2999 NULL,NULL /* reserved1, reserved2 */
3335 0, /* packed */
3336 0,NULL,NULL /* reserved1,reserved2, etc */
30003337 },
30013338 {
30023339 "v_string",
30073344 PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_string),
30083345 NULL,
30093346 &foo__default_required_values__v_string__default_value,
3010 NULL,NULL /* reserved1, reserved2 */
3347 0, /* packed */
3348 0,NULL,NULL /* reserved1,reserved2, etc */
30113349 },
30123350 {
30133351 "v_bytes",
30183356 PROTOBUF_C_OFFSETOF(Foo__DefaultRequiredValues, v_bytes),
30193357 NULL,
30203358 &foo__default_required_values__v_bytes__default_value,
3021 NULL,NULL /* reserved1, reserved2 */
3359 0, /* packed */
3360 0,NULL,NULL /* reserved1,reserved2, etc */
30223361 },
30233362 };
30243363 static const unsigned foo__default_required_values__field_indices_by_name[] = {
30713410 PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_int32),
30723411 NULL,
30733412 &foo__default_optional_values__v_int32__default_value,
3074 NULL,NULL /* reserved1, reserved2 */
3413 0, /* packed */
3414 0,NULL,NULL /* reserved1,reserved2, etc */
30753415 },
30763416 {
30773417 "v_uint32",
30823422 PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_uint32),
30833423 NULL,
30843424 &foo__default_optional_values__v_uint32__default_value,
3085 NULL,NULL /* reserved1, reserved2 */
3425 0, /* packed */
3426 0,NULL,NULL /* reserved1,reserved2, etc */
30863427 },
30873428 {
30883429 "v_int64",
30933434 PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_int64),
30943435 NULL,
30953436 &foo__default_optional_values__v_int64__default_value,
3096 NULL,NULL /* reserved1, reserved2 */
3437 0, /* packed */
3438 0,NULL,NULL /* reserved1,reserved2, etc */
30973439 },
30983440 {
30993441 "v_uint64",
31043446 PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_uint64),
31053447 NULL,
31063448 &foo__default_optional_values__v_uint64__default_value,
3107 NULL,NULL /* reserved1, reserved2 */
3449 0, /* packed */
3450 0,NULL,NULL /* reserved1,reserved2, etc */
31083451 },
31093452 {
31103453 "v_float",
31153458 PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_float),
31163459 NULL,
31173460 &foo__default_optional_values__v_float__default_value,
3118 NULL,NULL /* reserved1, reserved2 */
3461 0, /* packed */
3462 0,NULL,NULL /* reserved1,reserved2, etc */
31193463 },
31203464 {
31213465 "v_double",
31263470 PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_double),
31273471 NULL,
31283472 &foo__default_optional_values__v_double__default_value,
3129 NULL,NULL /* reserved1, reserved2 */
3473 0, /* packed */
3474 0,NULL,NULL /* reserved1,reserved2, etc */
31303475 },
31313476 {
31323477 "v_string",
31373482 PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_string),
31383483 NULL,
31393484 &foo__default_optional_values__v_string__default_value,
3140 NULL,NULL /* reserved1, reserved2 */
3485 0, /* packed */
3486 0,NULL,NULL /* reserved1,reserved2, etc */
31413487 },
31423488 {
31433489 "v_bytes",
31483494 PROTOBUF_C_OFFSETOF(Foo__DefaultOptionalValues, v_bytes),
31493495 NULL,
31503496 &foo__default_optional_values__v_bytes__default_value,
3151 NULL,NULL /* reserved1, reserved2 */
3497 0, /* packed */
3498 0,NULL,NULL /* reserved1,reserved2, etc */
31523499 },
31533500 };
31543501 static const unsigned foo__default_optional_values__field_indices_by_name[] = {
31923539 PROTOBUF_C_OFFSETOF(Foo__AllocValues, o_bytes),
31933540 NULL,
31943541 NULL,
3195 NULL,NULL /* reserved1, reserved2 */
3542 0, /* packed */
3543 0,NULL,NULL /* reserved1,reserved2, etc */
31963544 },
31973545 {
31983546 "r_string",
32033551 PROTOBUF_C_OFFSETOF(Foo__AllocValues, r_string),
32043552 NULL,
32053553 NULL,
3206 NULL,NULL /* reserved1, reserved2 */
3554 0, /* packed */
3555 0,NULL,NULL /* reserved1,reserved2, etc */
32073556 },
32083557 {
32093558 "a_string",
32143563 PROTOBUF_C_OFFSETOF(Foo__AllocValues, a_string),
32153564 NULL,
32163565 NULL,
3217 NULL,NULL /* reserved1, reserved2 */
3566 0, /* packed */
3567 0,NULL,NULL /* reserved1,reserved2, etc */
32183568 },
32193569 {
32203570 "a_bytes",
32253575 PROTOBUF_C_OFFSETOF(Foo__AllocValues, a_bytes),
32263576 NULL,
32273577 NULL,
3228 NULL,NULL /* reserved1, reserved2 */
3578 0, /* packed */
3579 0,NULL,NULL /* reserved1,reserved2, etc */
32293580 },
32303581 {
32313582 "a_mess",
32363587 PROTOBUF_C_OFFSETOF(Foo__AllocValues, a_mess),
32373588 &foo__default_required_values__descriptor,
32383589 NULL,
3239 NULL,NULL /* reserved1, reserved2 */
3590 0, /* packed */
3591 0,NULL,NULL /* reserved1,reserved2, etc */
32403592 },
32413593 };
32423594 static const unsigned foo__alloc_values__field_indices_by_name[] = {
4343 const ::google::protobuf::Descriptor* TestMess_descriptor_ = NULL;
4444 const ::google::protobuf::internal::GeneratedMessageReflection*
4545 TestMess_reflection_ = NULL;
46 const ::google::protobuf::Descriptor* TestMessPacked_descriptor_ = NULL;
47 const ::google::protobuf::internal::GeneratedMessageReflection*
48 TestMessPacked_reflection_ = NULL;
4649 const ::google::protobuf::Descriptor* TestMessOptional_descriptor_ = NULL;
4750 const ::google::protobuf::internal::GeneratedMessageReflection*
4851 TestMessOptional_reflection_ = NULL;
292295 ::google::protobuf::DescriptorPool::generated_pool(),
293296 ::google::protobuf::MessageFactory::generated_factory(),
294297 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);
296328 static const int TestMessOptional_offsets_[18] = {
297329 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessOptional, test_int32_),
298330 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessOptional, test_sint32_),
324356 ::google::protobuf::DescriptorPool::generated_pool(),
325357 ::google::protobuf::MessageFactory::generated_factory(),
326358 sizeof(TestMessOptional));
327 TestMessRequiredInt32_descriptor_ = file->message_type(11);
359 TestMessRequiredInt32_descriptor_ = file->message_type(12);
328360 static const int TestMessRequiredInt32_offsets_[1] = {
329361 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredInt32, test_),
330362 };
339371 ::google::protobuf::DescriptorPool::generated_pool(),
340372 ::google::protobuf::MessageFactory::generated_factory(),
341373 sizeof(TestMessRequiredInt32));
342 TestMessRequiredSInt32_descriptor_ = file->message_type(12);
374 TestMessRequiredSInt32_descriptor_ = file->message_type(13);
343375 static const int TestMessRequiredSInt32_offsets_[1] = {
344376 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredSInt32, test_),
345377 };
354386 ::google::protobuf::DescriptorPool::generated_pool(),
355387 ::google::protobuf::MessageFactory::generated_factory(),
356388 sizeof(TestMessRequiredSInt32));
357 TestMessRequiredSFixed32_descriptor_ = file->message_type(13);
389 TestMessRequiredSFixed32_descriptor_ = file->message_type(14);
358390 static const int TestMessRequiredSFixed32_offsets_[1] = {
359391 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredSFixed32, test_),
360392 };
369401 ::google::protobuf::DescriptorPool::generated_pool(),
370402 ::google::protobuf::MessageFactory::generated_factory(),
371403 sizeof(TestMessRequiredSFixed32));
372 TestMessRequiredInt64_descriptor_ = file->message_type(14);
404 TestMessRequiredInt64_descriptor_ = file->message_type(15);
373405 static const int TestMessRequiredInt64_offsets_[1] = {
374406 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredInt64, test_),
375407 };
384416 ::google::protobuf::DescriptorPool::generated_pool(),
385417 ::google::protobuf::MessageFactory::generated_factory(),
386418 sizeof(TestMessRequiredInt64));
387 TestMessRequiredSInt64_descriptor_ = file->message_type(15);
419 TestMessRequiredSInt64_descriptor_ = file->message_type(16);
388420 static const int TestMessRequiredSInt64_offsets_[1] = {
389421 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredSInt64, test_),
390422 };
399431 ::google::protobuf::DescriptorPool::generated_pool(),
400432 ::google::protobuf::MessageFactory::generated_factory(),
401433 sizeof(TestMessRequiredSInt64));
402 TestMessRequiredSFixed64_descriptor_ = file->message_type(16);
434 TestMessRequiredSFixed64_descriptor_ = file->message_type(17);
403435 static const int TestMessRequiredSFixed64_offsets_[1] = {
404436 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredSFixed64, test_),
405437 };
414446 ::google::protobuf::DescriptorPool::generated_pool(),
415447 ::google::protobuf::MessageFactory::generated_factory(),
416448 sizeof(TestMessRequiredSFixed64));
417 TestMessRequiredUInt32_descriptor_ = file->message_type(17);
449 TestMessRequiredUInt32_descriptor_ = file->message_type(18);
418450 static const int TestMessRequiredUInt32_offsets_[1] = {
419451 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredUInt32, test_),
420452 };
429461 ::google::protobuf::DescriptorPool::generated_pool(),
430462 ::google::protobuf::MessageFactory::generated_factory(),
431463 sizeof(TestMessRequiredUInt32));
432 TestMessRequiredFixed32_descriptor_ = file->message_type(18);
464 TestMessRequiredFixed32_descriptor_ = file->message_type(19);
433465 static const int TestMessRequiredFixed32_offsets_[1] = {
434466 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredFixed32, test_),
435467 };
444476 ::google::protobuf::DescriptorPool::generated_pool(),
445477 ::google::protobuf::MessageFactory::generated_factory(),
446478 sizeof(TestMessRequiredFixed32));
447 TestMessRequiredUInt64_descriptor_ = file->message_type(19);
479 TestMessRequiredUInt64_descriptor_ = file->message_type(20);
448480 static const int TestMessRequiredUInt64_offsets_[1] = {
449481 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredUInt64, test_),
450482 };
459491 ::google::protobuf::DescriptorPool::generated_pool(),
460492 ::google::protobuf::MessageFactory::generated_factory(),
461493 sizeof(TestMessRequiredUInt64));
462 TestMessRequiredFixed64_descriptor_ = file->message_type(20);
494 TestMessRequiredFixed64_descriptor_ = file->message_type(21);
463495 static const int TestMessRequiredFixed64_offsets_[1] = {
464496 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredFixed64, test_),
465497 };
474506 ::google::protobuf::DescriptorPool::generated_pool(),
475507 ::google::protobuf::MessageFactory::generated_factory(),
476508 sizeof(TestMessRequiredFixed64));
477 TestMessRequiredFloat_descriptor_ = file->message_type(21);
509 TestMessRequiredFloat_descriptor_ = file->message_type(22);
478510 static const int TestMessRequiredFloat_offsets_[1] = {
479511 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredFloat, test_),
480512 };
489521 ::google::protobuf::DescriptorPool::generated_pool(),
490522 ::google::protobuf::MessageFactory::generated_factory(),
491523 sizeof(TestMessRequiredFloat));
492 TestMessRequiredDouble_descriptor_ = file->message_type(22);
524 TestMessRequiredDouble_descriptor_ = file->message_type(23);
493525 static const int TestMessRequiredDouble_offsets_[1] = {
494526 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredDouble, test_),
495527 };
504536 ::google::protobuf::DescriptorPool::generated_pool(),
505537 ::google::protobuf::MessageFactory::generated_factory(),
506538 sizeof(TestMessRequiredDouble));
507 TestMessRequiredBool_descriptor_ = file->message_type(23);
539 TestMessRequiredBool_descriptor_ = file->message_type(24);
508540 static const int TestMessRequiredBool_offsets_[1] = {
509541 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredBool, test_),
510542 };
519551 ::google::protobuf::DescriptorPool::generated_pool(),
520552 ::google::protobuf::MessageFactory::generated_factory(),
521553 sizeof(TestMessRequiredBool));
522 TestMessRequiredEnum_descriptor_ = file->message_type(24);
554 TestMessRequiredEnum_descriptor_ = file->message_type(25);
523555 static const int TestMessRequiredEnum_offsets_[1] = {
524556 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredEnum, test_),
525557 };
534566 ::google::protobuf::DescriptorPool::generated_pool(),
535567 ::google::protobuf::MessageFactory::generated_factory(),
536568 sizeof(TestMessRequiredEnum));
537 TestMessRequiredEnumSmall_descriptor_ = file->message_type(25);
569 TestMessRequiredEnumSmall_descriptor_ = file->message_type(26);
538570 static const int TestMessRequiredEnumSmall_offsets_[1] = {
539571 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredEnumSmall, test_),
540572 };
549581 ::google::protobuf::DescriptorPool::generated_pool(),
550582 ::google::protobuf::MessageFactory::generated_factory(),
551583 sizeof(TestMessRequiredEnumSmall));
552 TestMessRequiredString_descriptor_ = file->message_type(26);
584 TestMessRequiredString_descriptor_ = file->message_type(27);
553585 static const int TestMessRequiredString_offsets_[1] = {
554586 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredString, test_),
555587 };
564596 ::google::protobuf::DescriptorPool::generated_pool(),
565597 ::google::protobuf::MessageFactory::generated_factory(),
566598 sizeof(TestMessRequiredString));
567 TestMessRequiredBytes_descriptor_ = file->message_type(27);
599 TestMessRequiredBytes_descriptor_ = file->message_type(28);
568600 static const int TestMessRequiredBytes_offsets_[1] = {
569601 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredBytes, test_),
570602 };
579611 ::google::protobuf::DescriptorPool::generated_pool(),
580612 ::google::protobuf::MessageFactory::generated_factory(),
581613 sizeof(TestMessRequiredBytes));
582 TestMessRequiredMessage_descriptor_ = file->message_type(28);
614 TestMessRequiredMessage_descriptor_ = file->message_type(29);
583615 static const int TestMessRequiredMessage_offsets_[1] = {
584616 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TestMessRequiredMessage, test_),
585617 };
594626 ::google::protobuf::DescriptorPool::generated_pool(),
595627 ::google::protobuf::MessageFactory::generated_factory(),
596628 sizeof(TestMessRequiredMessage));
597 EmptyMess_descriptor_ = file->message_type(29);
629 EmptyMess_descriptor_ = file->message_type(30);
598630 static const int EmptyMess_offsets_[1] = {
599631 };
600632 EmptyMess_reflection_ =
608640 ::google::protobuf::DescriptorPool::generated_pool(),
609641 ::google::protobuf::MessageFactory::generated_factory(),
610642 sizeof(EmptyMess));
611 DefaultRequiredValues_descriptor_ = file->message_type(30);
643 DefaultRequiredValues_descriptor_ = file->message_type(31);
612644 static const int DefaultRequiredValues_offsets_[8] = {
613645 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DefaultRequiredValues, v_int32_),
614646 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DefaultRequiredValues, v_uint32_),
630662 ::google::protobuf::DescriptorPool::generated_pool(),
631663 ::google::protobuf::MessageFactory::generated_factory(),
632664 sizeof(DefaultRequiredValues));
633 DefaultOptionalValues_descriptor_ = file->message_type(31);
665 DefaultOptionalValues_descriptor_ = file->message_type(32);
634666 static const int DefaultOptionalValues_offsets_[8] = {
635667 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DefaultOptionalValues, v_int32_),
636668 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DefaultOptionalValues, v_uint32_),
652684 ::google::protobuf::DescriptorPool::generated_pool(),
653685 ::google::protobuf::MessageFactory::generated_factory(),
654686 sizeof(DefaultOptionalValues));
655 AllocValues_descriptor_ = file->message_type(32);
687 AllocValues_descriptor_ = file->message_type(33);
656688 static const int AllocValues_offsets_[5] = {
657689 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AllocValues, o_bytes_),
658690 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AllocValues, r_string_),
706738 TestFieldNo33554432_descriptor_, &TestFieldNo33554432::default_instance());
707739 ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
708740 TestMess_descriptor_, &TestMess::default_instance());
741 ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
742 TestMessPacked_descriptor_, &TestMessPacked::default_instance());
709743 ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
710744 TestMessOptional_descriptor_, &TestMessOptional::default_instance());
711745 ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
777811 delete TestFieldNo33554432_reflection_;
778812 delete TestMess::default_instance_;
779813 delete TestMess_reflection_;
814 delete TestMessPacked::default_instance_;
815 delete TestMessPacked_reflection_;
780816 delete TestMessOptional::default_instance_;
781817 delete TestMessOptional_reflection_;
782818 delete TestMessRequiredInt32::default_instance_;
851887 "\030\016 \003(\0162\022.foo.TestEnumSmall\022 \n\ttest_enum\030"
852888 "\017 \003(\0162\r.foo.TestEnum\022\023\n\013test_string\030\020 \003("
853889 "\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);
910957 ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
911958 "test-full.proto", &protobuf_RegisterTypes);
912959 SubMess::default_instance_ = new SubMess();
919966 TestFieldNo33554431::default_instance_ = new TestFieldNo33554431();
920967 TestFieldNo33554432::default_instance_ = new TestFieldNo33554432();
921968 TestMess::default_instance_ = new TestMess();
969 TestMessPacked::default_instance_ = new TestMessPacked();
922970 TestMessOptional::default_instance_ = new TestMessOptional();
923971 TestMessRequiredInt32::default_instance_ = new TestMessRequiredInt32();
924972 TestMessRequiredSInt32::default_instance_ = new TestMessRequiredSInt32();
9521000 TestFieldNo33554431::default_instance_->InitAsDefaultInstance();
9531001 TestFieldNo33554432::default_instance_->InitAsDefaultInstance();
9541002 TestMess::default_instance_->InitAsDefaultInstance();
1003 TestMessPacked::default_instance_->InitAsDefaultInstance();
9551004 TestMessOptional::default_instance_->InitAsDefaultInstance();
9561005 TestMessRequiredInt32::default_instance_->InitAsDefaultInstance();
9571006 TestMessRequiredSInt32::default_instance_->InitAsDefaultInstance();
40594108
40604109 // ===================================================================
40614110
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
40625247 const ::std::string TestMessOptional::_default_test_string_;
40635248 const ::std::string TestMessOptional::_default_test_bytes_;
40645249 #ifndef _MSC_VER
00 /* 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
16
27 #include "test.pb-c.h"
38 void foo__person__phone_number__init
147152 PROTOBUF_C_OFFSETOF(Foo__Person__PhoneNumber, number),
148153 NULL,
149154 NULL,
150 NULL,NULL /* reserved1, reserved2 */
155 0, /* packed */
156 0,NULL,NULL /* reserved1,reserved2, etc */
151157 },
152158 {
153159 "type",
158164 PROTOBUF_C_OFFSETOF(Foo__Person__PhoneNumber, type),
159165 &foo__person__phone_type__descriptor,
160166 &foo__person__phone_number__type__default_value,
161 NULL,NULL /* reserved1, reserved2 */
167 0, /* packed */
168 0,NULL,NULL /* reserved1,reserved2, etc */
162169 },
163170 };
164171 static const unsigned foo__person__phone_number__field_indices_by_name[] = {
226233 PROTOBUF_C_OFFSETOF(Foo__Person, name),
227234 NULL,
228235 NULL,
229 NULL,NULL /* reserved1, reserved2 */
236 0, /* packed */
237 0,NULL,NULL /* reserved1,reserved2, etc */
230238 },
231239 {
232240 "id",
237245 PROTOBUF_C_OFFSETOF(Foo__Person, id),
238246 NULL,
239247 NULL,
240 NULL,NULL /* reserved1, reserved2 */
248 0, /* packed */
249 0,NULL,NULL /* reserved1,reserved2, etc */
241250 },
242251 {
243252 "email",
248257 PROTOBUF_C_OFFSETOF(Foo__Person, email),
249258 NULL,
250259 NULL,
251 NULL,NULL /* reserved1, reserved2 */
260 0, /* packed */
261 0,NULL,NULL /* reserved1,reserved2, etc */
252262 },
253263 {
254264 "phone",
259269 PROTOBUF_C_OFFSETOF(Foo__Person, phone),
260270 &foo__person__phone_number__descriptor,
261271 NULL,
262 NULL,NULL /* reserved1, reserved2 */
272 0, /* packed */
273 0,NULL,NULL /* reserved1,reserved2, etc */
263274 },
264275 };
265276 static const unsigned foo__person__field_indices_by_name[] = {
299310 PROTOBUF_C_OFFSETOF(Foo__LookupResult, person),
300311 &foo__person__descriptor,
301312 NULL,
302 NULL,NULL /* reserved1, reserved2 */
313 0, /* packed */
314 0,NULL,NULL /* reserved1,reserved2, etc */
303315 },
304316 };
305317 static const unsigned foo__lookup_result__field_indices_by_name[] = {
336348 PROTOBUF_C_OFFSETOF(Foo__Name, name),
337349 NULL,
338350 NULL,
339 NULL,NULL /* reserved1, reserved2 */
351 0, /* packed */
352 0,NULL,NULL /* reserved1,reserved2, etc */
340353 },
341354 };
342355 static const unsigned foo__name__field_indices_by_name[] = {
7979 repeated bytes test_bytes = 17;
8080 repeated SubMess test_message = 18;
8181 }
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 }
8299
83100 message TestMessOptional {
84101 optional int32 test_int32 = 1;
975975 #undef DO_TEST
976976 }
977977
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
9781207 static void test_unknown_fields (void)
9791208 {
9801209 static Foo__EmptyMess mess = FOO__EMPTY_MESS__INIT;
13311560 { "test repeated bytes", test_repeated_bytes },
13321561 { "test repeated SubMess", test_repeated_SubMess },
13331562
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
13341579 { "test unknown fields", test_unknown_fields },
13351580
13361581 { "test enum lookups", test_enum_lookups },