| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // http://code.google.com/p/protobuf/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| 11 // * Redistributions in binary form must reproduce the above | 11 // * Redistributions in binary form must reproduce the above |
| 12 // copyright notice, this list of conditions and the following disclaimer | 12 // copyright notice, this list of conditions and the following disclaimer |
| 13 // in the documentation and/or other materials provided with the | 13 // in the documentation and/or other materials provided with the |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 if (&from == to) return; | 49 if (&from == to) return; |
| 50 Clear(to); | 50 Clear(to); |
| 51 Merge(from, to); | 51 Merge(from, to); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void ReflectionOps::Merge(const Message& from, Message* to) { | 54 void ReflectionOps::Merge(const Message& from, Message* to) { |
| 55 GOOGLE_CHECK_NE(&from, to); | 55 GOOGLE_CHECK_NE(&from, to); |
| 56 | 56 |
| 57 const Descriptor* descriptor = from.GetDescriptor(); | 57 const Descriptor* descriptor = from.GetDescriptor(); |
| 58 GOOGLE_CHECK_EQ(to->GetDescriptor(), descriptor) | 58 GOOGLE_CHECK_EQ(to->GetDescriptor(), descriptor) |
| 59 << "Tried to merge messages of different types."; | 59 << "Tried to merge messages of different types " |
| 60 << "(merge " << descriptor->full_name() |
| 61 << " to " << to->GetDescriptor()->full_name() << ")"; |
| 60 | 62 |
| 61 const Reflection* from_reflection = from.GetReflection(); | 63 const Reflection* from_reflection = from.GetReflection(); |
| 62 const Reflection* to_reflection = to->GetReflection(); | 64 const Reflection* to_reflection = to->GetReflection(); |
| 63 | 65 |
| 64 vector<const FieldDescriptor*> fields; | 66 vector<const FieldDescriptor*> fields; |
| 65 from_reflection->ListFields(from, &fields); | 67 from_reflection->ListFields(from, &fields); |
| 66 for (int i = 0; i < fields.size(); i++) { | 68 for (int i = 0; i < fields.size(); i++) { |
| 67 const FieldDescriptor* field = fields[i]; | 69 const FieldDescriptor* field = fields[i]; |
| 68 | 70 |
| 69 if (field->is_repeated()) { | 71 if (field->is_repeated()) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 SubMessagePrefix(prefix, field, -1), | 260 SubMessagePrefix(prefix, field, -1), |
| 259 errors); | 261 errors); |
| 260 } | 262 } |
| 261 } | 263 } |
| 262 } | 264 } |
| 263 } | 265 } |
| 264 | 266 |
| 265 } // namespace internal | 267 } // namespace internal |
| 266 } // namespace protobuf | 268 } // namespace protobuf |
| 267 } // namespace google | 269 } // namespace google |
| OLD | NEW |