Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
git-svn-id: http://protobuf-c.googlecode.com/svn/trunk@177 00440858-1255-0410-a3e6-75ea37f81c3a
  • Loading branch information
lahiker42 committed Mar 8, 2009
1 parent a160b17 commit 51f1e86
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AC_INIT(src/google/protobuf-c/protobuf-c.h)
PROTOBUF_C_VERSION=0.9
PROTOBUF_C_VERSION=0.10-beta0

AM_INIT_AUTOMAKE(protobuf-c, $PROTOBUF_C_VERSION)
PACKAGE=protobuf-c
Expand All @@ -21,7 +21,7 @@ you must add '-Iincludedir' to CXXFLAGS
and '-Llibdir' to LDFLAGS.
])])
pbc_savelibs="$LIBS"
LIBS="$LIBS -lprotoc"
LIBS="$LIBS -lprotoc -lprotobuf"
AC_TRY_LINK([#include <google/protobuf/compiler/command_line_interface.h>],
[google::protobuf::compiler::CommandLineInterface cli;],
[],
Expand Down
15 changes: 11 additions & 4 deletions src/google/protobuf-c/protobuf-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ struct _ProtobufCMessageDescriptor
* In particular, ProtobufCMessage doesn't have
* any allocation policy associated with it.
* That's because it is common to create ProtobufCMessage's
* on the stack. In fact, we recommend that if you are
* sending messages.
* on the stack. In fact, we that's what we recommend
* for sending messages (because if you just allocate from the
* stack, then you can't really have a memory leak).
*
* This means that functions like protobuf_c_message_unpack()
* which return a ProtobufCMessage must be paired
Expand All @@ -276,6 +277,14 @@ struct _ProtobufCMessage
};
#define PROTOBUF_C_MESSAGE_INIT(descriptor) { descriptor, 0, NULL }

/* To pack a message: you have two options:
(1) you can compute the size of the message
using protobuf_c_message_get_packed_size()
then pass protobuf_c_message_pack() a buffer of
that length.
(2) Provide a virtual buffer (a ProtobufCBuffer) to
accept data as we scan through it.
*/
size_t protobuf_c_message_get_packed_size(const ProtobufCMessage *message);
size_t protobuf_c_message_pack (const ProtobufCMessage *message,
uint8_t *out);
Expand Down Expand Up @@ -398,8 +407,6 @@ struct _ProtobufCBufferSimple
/* ====== private ====== */
#include "protobuf-c-private.h"

/* TODO: crib from glib */
#define PROTOBUF_C_GNUC_PRINTF(format_argno, ellipsis_argno)

PROTOBUF_C_END_DECLS

Expand Down
4 changes: 4 additions & 0 deletions src/test/test-full.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ enum TestEnumSmall {
VALUE = 0;
OTHER_VALUE = 1;
}

// these number are specifically chosen to test the
// boundaries of when an enum requires a certain number of bytes.
// e.g. 16383 requires 3 bytes; 16383 requires 4.
enum TestEnum {
VALUE0 = 0;
VALUE1 = 1;
Expand Down

0 comments on commit 51f1e86

Please sign in to comment.