Commit Graph

3548 Commits

Author SHA1 Message Date
kenton@google.com
1ea526879c Add full-system test for custom enum value options. (Previously, only a
parsing test in parser_unittest.cc existed.)
2008-12-02 20:08:45 +00:00
kenton@google.com
2f669cbe75 * Avoid using pushd/popd in generate_descriptor_proto.sh because they are
bash-only features, and /bin/sh is not a symlink to bash on all systems.
* If an input file is a Windows absolute path (e.g. "C:\foo\bar.proto") and
  the import path only contains "." (or contains "." but does not contain
  the file), protoc incorrectly thought that the file was under ".", because
  it thought that the path was relative (since it didn't start with a slash).
  This has been fixed.
2008-12-02 05:59:15 +00:00
kenton@google.com
eb241fadf2 Fix call to superclass.__init__() to work on newer versions of Python. 2008-12-02 02:33:13 +00:00
kenton@google.com
a001ed0c03 * Update version compatibility stuff -- 2.0.3 is in no way compatible with
2.0.2.
* Minor Tru64 fix.
2008-12-01 23:47:49 +00:00
kenton@google.com
9f1752889c Update CHANGES.txt with stuff from 2.0.3. 2008-11-25 19:37:10 +00:00
Jon Skeet
3f22511100 Added address book example 2008-11-24 16:09:39 +00:00
Jon Skeet
828510cdbd Refactor IsInitialized to match Java version 2008-11-24 11:17:17 +00:00
Jon Skeet
4cf9e3c619 Fix property special-casing 2008-11-24 11:11:28 +00:00
kenton@google.com
26bd9eee6e Integrate changes from internal code.
protoc
* Enum values may now have custom options, using syntax similar to field
  options.
* Fixed bug where .proto files which use custom options but don't actually
  define them (i.e. they import another .proto file defining the options)
  had to explicitly import descriptor.proto.
* Adjacent string literals in .proto files will now be concatenated, like in
  C.

C++
* Generated message classes now have a Swap() method which efficiently swaps
  the contents of two objects.
* All message classes now have a SpaceUsed() method which returns an estimate
  of the number of bytes of allocated memory currently owned by the object.
  This is particularly useful when you are reusing a single message object
  to improve performance but want to make sure it doesn't bloat up too large.
* New method Message::SerializeAsString() returns a string containing the
  serialized data.  May be more convenient than calling
  SerializeToString(string*).
* In debug mode, log error messages when string-type fields are found to
  contain bytes that are not valid UTF-8.
* Fixed bug where a message with multiple extension ranges couldn't parse
  extensions.
* Fixed bug where MergeFrom(const Message&) didn't do anything if invoked on
  a message that contained no fields (but possibly contained extensions).
* Fixed ShortDebugString() to not be O(n^2).  Durr.
* Fixed crash in TextFormat parsing if the first token in the input caused a
  tokenization error.

Java
* New overload of mergeFrom() which parses a slice of a byte array instead
  of the whole thing.
* New method ByteString.asReadOnlyByteBuffer() does what it sounds like.
* Improved performance of isInitialized() when optimizing for code size.

Python
* Corrected ListFields() signature in Message base class to match what
  subclasses actually implement.
* Some minor refactoring.
2008-11-21 00:06:27 +00:00
kenton@google.com
a2a32c2043 Support HP C++ on Tru64.
Patch (mostly) by Vincent Choinière <Choiniere.Vincent@hydro.qc.ca>.
2008-11-14 17:29:32 +00:00
Jon Skeet
1d131c98f0 New options now work fine. 2008-11-13 22:29:48 +00:00
Jon Skeet
d6343be707 Refactored options 2008-11-12 23:39:44 +00:00
kenton@google.com
8da400ed12 Fix bugs in zero_copy_stream_impl.
Patch from Frank Chu.
2008-11-07 18:38:13 +00:00
kenton@google.com
32d0c3b853 Only build tests when running "make check", not "make". 2008-11-07 18:06:24 +00:00
kenton@google.com
d0580eafd3 Fixed alignment issue that caused bus errors on platforms like sparc which
require all memory reads to be aligned.  Specifically, it turns out that
sizeof(RepeatedField<bool>) is 20 on 64-bit sparc with GCC 3.4.6.  This is
strange, since one of RepeatedField's members is a pointer, which I thought
meant that it had to be 64-bit aligned, which means its size should be a
multiple of 64 bits.  But, 20 is not a multiple of 8.  I don't understand why
this is the case, but if this is possible, then DynamicMessage's strategy of
sorting fields in descending order by size and then tightly packing doesn't
work.  To fix this, I got rid of the sort step and instead added code that
aligns each field's offset appropriately based on the field's size.

Also in this revision:  Fix an error message that named a flag incorrectly.
2008-11-07 02:07:18 +00:00
kenton@google.com
de75437573 Simplify some template usage so that older compilers can handle it. (Users
report that MSVC 2003 in particular needs this change.)
2008-11-06 21:36:28 +00:00
kenton@google.com
3e91fcdd87 Work around GCC 4.3.0 x86_64 compiler bug (seen on Fedora 9).
Details:

For each message type, protoc generates an array of byte offsets of each of
the fields within the message class.  These offsets are later used by the
reflection implementation.  Prior to this revision, the offset arrays were
allocated as global variables.  Since they were just arrays of ints, they
should have been initialized at compile time.  Unfortunately, GCC 4.3.0
incorrectly decides that they cannot be initialized at compile time because
the values used to initialize the array have type ptrdiff_t, and GCC 4.3.0
does not recognize that it can convert ptrdiff_t to int at compile time.  This
bug did not seem to exist in previous versions of GCC.  Google's compiler
team has submitted a fix for this bug back to the GCC project, but we will
have to work around it anyway since Fedora 9 shipped with GCC 4.3.0.
2008-11-06 04:37:30 +00:00
Jon Skeet
60c059b8f0 Replaced copyright notice 2008-10-23 21:17:56 +01:00
Jon Skeet
20bfd9bf50 Fix bug in GeneratedBuilder.MergeFrom 2008-10-23 21:05:58 +01:00
Jon Skeet
b8c2fc57fc Fixed bug in GeneratedBuilder.MergeFrom - only fields already set in builder would be merged. 2008-10-22 14:19:05 +01:00
Jon Skeet
52a035a4af A few tweaks 2008-10-22 14:11:30 +01:00
Jon Skeet
87d6a3b8f7 Ignore solution cache files 2008-10-22 14:01:37 +01:00
Jon Skeet
6803686bc0 First cut at new layout 2008-10-22 13:30:34 +01:00
Jon Skeet
f0589506c9 Wiping slate clean to start again with new layout. 2008-10-22 13:18:49 +01:00
Jon Skeet
e60ce8bfaf Final commit before changing layout 2008-10-22 07:11:17 +01:00
kenton@google.com
580cf3c47c Update MSVC installation instructions for static linking change. 2008-10-21 17:18:26 +00:00
The Android Open Source Project
35be73bfeb Initial Contribution 2008-10-21 07:00:00 -07:00
kenton@google.com
3bdc135653 Avoid an "unused parameter" warning when using high warning levels. 2008-10-16 23:00:34 +00:00
kenton@google.com
7b29a2695c Update version number to 2.0.3-SNAPSHOT. 2008-10-16 22:56:18 +00:00
kenton@google.com
16b31d2a94 Make Python example output identical to C++ and Java by removing redundant
spaces.
2008-10-07 02:38:12 +00:00
kenton@google.com
a41a9dd532 * Fixed template specialization syntax that MSVC 2005 didn't like. Not sure if
it was valid or not.
* Moved UTF-8 coding directive to the right place in reflection_test.py.
2008-10-03 17:27:48 +00:00
Jon Skeet
7f90d8ee57 Made things a bit more public for the sake of ProtoGen 2008-10-02 21:46:17 +01:00
kenton@google.com
c76caaccb8 Improvements to configure.ac from Jeff Bailey. 2008-09-30 22:11:21 +00:00
kenton@google.com
cf3f638c92 Pass -Wall,no-obsolete to autoreconf. 2008-09-30 22:01:45 +00:00
kenton@google.com
7516a69050 Improve autogen.sh. 2008-09-30 20:55:25 +00:00
kenton@google.com
c7f06b2ad5 Added clarification to license that generated code is owned by the owner of the
input file.
2008-09-30 18:30:23 +00:00
kenton@google.com
9b10f5845a * Fix build on MSVC.
* Switch to statically-linked libraries instead of DLLs on MSVC.
2008-09-30 00:09:40 +00:00
kenton@google.com
0b3023fa65 Add file missing from rev 50. 2008-09-24 20:32:37 +00:00
kenton@google.com
24bf56fb3a Integrate changes from internal Google-internal branch.
General
  * License changed from Apache 2.0 to New BSD.
  * It is now possible to define custom "options", which are basically
    annotations which may be placed on definitions in a .proto file.
    For example, you might define a field option called "foo" like so:
      import "google/protobuf/descriptor.proto"
      extend google.protobuf.FieldOptions {
        optional string foo = 12345;
      }
    Then you annotate a field using the "foo" option:
      message MyMessage {
        optional int32 some_field = 1 [(foo) = "bar"]
      }
    The value of this option is then visible via the message's
    Descriptor:
      const FieldDescriptor* field =
        MyMessage::descriptor()->FindFieldByName("some_field");
      assert(field->options().GetExtension(foo) == "bar");
    This feature has been implemented and tested in C++ and Java.
    Other languages may or may not need to do extra work to support
    custom options, depending on how they construct descriptors.

  C++
  * Fixed some GCC warnings that only occur when using -pedantic.
  * Improved static initialization code, making ordering more
    predictable among other things.
  * TextFormat will no longer accept messages which contain multiple
    instances of a singular field.  Previously, the latter instance
    would overwrite the former.
  * Now works on systems that don't have hash_map.

  Python
  * Strings now use the "unicode" type rather than the "str" type.
    String fields may still be assigned ASCII "str" values; they will
    automatically be converted.
  * Adding a property to an object representing a repeated field now
    raises an exception.  For example:
      # No longer works (and never should have).
      message.some_repeated_field.foo = 1
2008-09-24 20:31:01 +00:00
kenton@google.com
3121a56ab4 Add file that was mysteriously missing from SVN tree. 2008-09-23 21:05:07 +00:00
kenton@google.com
a69deb6477 Explicitly identify superclass in initializer lists for generated message
classes.  This avoids a warning when using GCC's -pedantic option.
2008-09-23 20:03:24 +00:00
kenton@google.com
4410396f11 Work around absence of hash_map.
Also, update version numbers to 2.0.2-SNAPSHOT.
2008-09-19 16:53:32 +00:00
temporal
4014b9f83f Add @Override annotation to generated Java code where appropriate.
Patch from Brian Atkinson <nairb774@gmail.com>.
2008-09-17 02:41:14 +00:00
temporal
bf86b546c3 Add code suggested by Michal Januszewski <michalj@gmail.com> to ensure that
Python tests run correctly even when a previous version of the library is
already installed.  I was unable to reproduce his problem on my machine but
the fix seems harmless enough.
2008-09-15 17:58:05 +00:00
Jon Skeet
7fd62ffd77 Initial setup of generator code. Little real functionality so far. 2008-09-04 15:13:21 +01:00
Jon Skeet
4658a3dd7e Doc fix 2008-09-04 14:44:03 +01:00
Jon Skeet
dd9703ba53 Reduce dependencies 2008-09-04 14:43:43 +01:00
Jon Skeet
881db010cb Fix initialization check when an optional field has required subfields 2008-09-04 14:43:17 +01:00
Jon Skeet
0dabc77f7f Renamed GeneratedRepeatException to GeneratedRepeatExtension 2008-09-04 14:41:09 +01:00
Jon Skeet
be432ca43c Added a doc TODO 2008-09-04 14:35:05 +01:00