diff --git a/protobuf/runtime/src/com/google/protobuf/Descriptors_PackagePrivate.h b/protobuf/runtime/src/com/google/protobuf/Descriptors_PackagePrivate.h index 5829afda29..f66b9a97cd 100644 --- a/protobuf/runtime/src/com/google/protobuf/Descriptors_PackagePrivate.h +++ b/protobuf/runtime/src/com/google/protobuf/Descriptors_PackagePrivate.h @@ -177,9 +177,8 @@ CF_EXTERN_C_BEGIN NS_RETURNS_RETAINED CGPDescriptor *CGPInitDescriptor(Class messageClass, Class builderClass, CGPMessageFlags flags, size_t storageSize); -void CGPInitFields( - CGPDescriptor *descriptor, jint fieldCount, CGPFieldData *fieldData, - jint oneofCount, const CGPOneofData *oneofData); +void CGPInitFields(CGPDescriptor *descriptor, jint fieldCount, CGPFieldData *fieldData, + jint oneofCount, const CGPOneofData *oneofData); CGP_ALWAYS_INLINE BOOL CGPIsExtendable(const CGPDescriptor *descriptor) { return descriptor->flags_ & CGPMessageFlagExtendable; diff --git a/protobuf/runtime/src/com/google/protobuf/FieldTypes.h b/protobuf/runtime/src/com/google/protobuf/FieldTypes.h index 5c61026278..1e7f83e5d7 100644 --- a/protobuf/runtime/src/com/google/protobuf/FieldTypes.h +++ b/protobuf/runtime/src/com/google/protobuf/FieldTypes.h @@ -61,24 +61,15 @@ #define TYPE_RETAIN_Double(value) value #define TYPE_RETAIN_Bool(value) value #define TYPE_RETAIN_Enum(value) value -#if __has_feature(objc_arc) -#define TYPE_RETAIN_Retainable(value) value -#else -#define TYPE_RETAIN_Retainable(value) [value retain] -#endif - -#define TYPE_ASSIGN_Int(assignee, value) assignee = value -#define TYPE_ASSIGN_Long(assignee, value) assignee = value -#define TYPE_ASSIGN_Float(assignee, value) assignee = value -#define TYPE_ASSIGN_Double(assignee, value) assignee = value -#define TYPE_ASSIGN_Bool(assignee, value) assignee = value -#define TYPE_ASSIGN_Enum(assignee, value) assignee = value -#if __has_feature(objc_arc) -#define TYPE_ASSIGN_Retainable(assignee, value) assignee = value -#else -#define TYPE_ASSIGN_Retainable(assignee, value) \ - ([assignee autorelease], assignee = [value retain]) -#endif +#define TYPE_RETAIN_Retainable(value) RETAIN_(value) + +#define TYPE_ASSIGN_Int(assignee, value) (assignee = value) +#define TYPE_ASSIGN_Long(assignee, value) (assignee = value) +#define TYPE_ASSIGN_Float(assignee, value) (assignee = value) +#define TYPE_ASSIGN_Double(assignee, value) (assignee = value) +#define TYPE_ASSIGN_Bool(assignee, value) (assignee = value) +#define TYPE_ASSIGN_Enum(assignee, value) (assignee = value) +#define TYPE_ASSIGN_Retainable(assignee, value) (AUTORELEASE(assignee), assignee = RETAIN_(value)) #define HASH_Int(value) value #define HASH_Long(value) (int)((uint64_t)value ^ ((uint64_t)value >> 32)) @@ -117,79 +108,77 @@ // Creates a switch statement over the java types grouping enums together with // the other object types. -#define SWITCH_TYPES_NO_ENUM(type, CASE_MACRO) \ - switch (type) { \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_INT: \ - CASE_MACRO(Int) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_LONG: \ - CASE_MACRO(Long) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_FLOAT: \ - CASE_MACRO(Float) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_DOUBLE: \ - CASE_MACRO(Double) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_BOOLEAN: \ - CASE_MACRO(Bool) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_STRING: \ +#define SWITCH_TYPES_NO_ENUM(type, CASE_MACRO) \ + switch (type) { \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_INT: \ + CASE_MACRO(Int) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_LONG: \ + CASE_MACRO(Long) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_FLOAT: \ + CASE_MACRO(Float) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_DOUBLE: \ + CASE_MACRO(Double) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_BOOLEAN: \ + CASE_MACRO(Bool) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_STRING: \ case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_BYTE_STRING: \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_ENUM: \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_MESSAGE: \ - CASE_MACRO(Id) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_ENUM: \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_MESSAGE: \ + CASE_MACRO(Id) \ } // Creates a switch statement over the java types separating enums from the // other object types. -#define SWITCH_TYPES_WITH_ENUM(type, CASE_MACRO) \ - switch (type) { \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_INT: \ - CASE_MACRO(Int) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_LONG: \ - CASE_MACRO(Long) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_FLOAT: \ - CASE_MACRO(Float) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_DOUBLE: \ - CASE_MACRO(Double) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_BOOLEAN: \ - CASE_MACRO(Bool) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_STRING: \ +#define SWITCH_TYPES_WITH_ENUM(type, CASE_MACRO) \ + switch (type) { \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_INT: \ + CASE_MACRO(Int) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_LONG: \ + CASE_MACRO(Long) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_FLOAT: \ + CASE_MACRO(Float) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_DOUBLE: \ + CASE_MACRO(Double) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_BOOLEAN: \ + CASE_MACRO(Bool) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_STRING: \ case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_BYTE_STRING: \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_MESSAGE: \ - CASE_MACRO(Retainable) \ - case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_ENUM: \ - CASE_MACRO(Enum) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_MESSAGE: \ + CASE_MACRO(Retainable) \ + case ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_ENUM: \ + CASE_MACRO(Enum) \ } - // Declares the given macro once for each java field type, grouping enums and // the other object types together as "Id". Non-retainable types use the // PRIMITIVE_TYPE_MACRO, retainable types use the RETAINABLE_TYPE_MACRO #define FOR_EACH_TYPE_NO_ENUM(PRIMITIVE_TYPE_MACRO, RETAINABLE_TYPE_MACRO) \ - PRIMITIVE_TYPE_MACRO(Int) \ - PRIMITIVE_TYPE_MACRO(Long) \ - PRIMITIVE_TYPE_MACRO(Float) \ - PRIMITIVE_TYPE_MACRO(Double) \ - PRIMITIVE_TYPE_MACRO(Bool) \ + PRIMITIVE_TYPE_MACRO(Int) \ + PRIMITIVE_TYPE_MACRO(Long) \ + PRIMITIVE_TYPE_MACRO(Float) \ + PRIMITIVE_TYPE_MACRO(Double) \ + PRIMITIVE_TYPE_MACRO(Bool) \ RETAINABLE_TYPE_MACRO(Id) - // Declares the given macro once for each java field type, declaring it // separately for enums (as "Enum) and the other object types (as "Retainable"). #define FOR_EACH_TYPE_WITH_ENUM(MACRO) \ - MACRO(Int) \ - MACRO(Long) \ - MACRO(Float) \ - MACRO(Double) \ - MACRO(Bool) \ - MACRO(Enum) \ + MACRO(Int) \ + MACRO(Long) \ + MACRO(Float) \ + MACRO(Double) \ + MACRO(Bool) \ + MACRO(Enum) \ MACRO(Retainable) // Declares the given macro once for each java field type except for retainable -//types. +// types. #define FOR_EACH_TYPE_NO_RETAINABLE(MACRO) \ - MACRO(Int) \ - MACRO(Long) \ - MACRO(Float) \ - MACRO(Double) \ - MACRO(Bool) \ + MACRO(Int) \ + MACRO(Long) \ + MACRO(Float) \ + MACRO(Double) \ + MACRO(Bool) \ MACRO(Enum) // The remainder of this file is copied from the translation of the types @@ -218,7 +207,7 @@ typedef NS_ENUM(NSUInteger, ComGoogleProtobufDescriptors_FieldDescriptor_Type_En typedef ComGoogleProtobufDescriptors_FieldDescriptor_Type_Enum CGPFieldType; -@interface ComGoogleProtobufDescriptors_FieldDescriptor_Type : JavaLangEnum < NSCopying > +@interface ComGoogleProtobufDescriptors_FieldDescriptor_Type : JavaLangEnum #pragma mark Public @@ -226,7 +215,9 @@ typedef ComGoogleProtobufDescriptors_FieldDescriptor_Type_Enum CGPFieldType; - (ComGoogleProtobufDescriptorProtos_FieldDescriptorProto_Type *)toProto; -+ (ComGoogleProtobufDescriptors_FieldDescriptor_Type *)valueOfWithComGoogleProtobufDescriptorProtos_FieldDescriptorProto_Type:(ComGoogleProtobufDescriptorProtos_FieldDescriptorProto_Type *)type; ++ (ComGoogleProtobufDescriptors_FieldDescriptor_Type *) + valueOfWithComGoogleProtobufDescriptorProtos_FieldDescriptorProto_Type: + (ComGoogleProtobufDescriptorProtos_FieldDescriptorProto_Type *)type; #pragma mark Package-Private @@ -241,7 +232,8 @@ typedef ComGoogleProtobufDescriptors_FieldDescriptor_Type_Enum CGPFieldType; J2OBJC_STATIC_INIT(ComGoogleProtobufDescriptors_FieldDescriptor_Type) /*! INTERNAL ONLY - Use enum accessors declared below. */ -FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_Type *ComGoogleProtobufDescriptors_FieldDescriptor_Type_values_[]; +FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_Type + *ComGoogleProtobufDescriptors_FieldDescriptor_Type_values_[]; inline ComGoogleProtobufDescriptors_FieldDescriptor_Type * ComGoogleProtobufDescriptors_FieldDescriptor_Type_get_DOUBLE(void); @@ -315,13 +307,17 @@ inline ComGoogleProtobufDescriptors_FieldDescriptor_Type * ComGoogleProtobufDescriptors_FieldDescriptor_Type_get_SINT64(void); J2OBJC_ENUM_CONSTANT(ComGoogleProtobufDescriptors_FieldDescriptor_Type, SINT64) -FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_Type *ComGoogleProtobufDescriptors_FieldDescriptor_Type_valueOfWithComGoogleProtobufDescriptorProtos_FieldDescriptorProto_Type_(ComGoogleProtobufDescriptorProtos_FieldDescriptorProto_Type *type); +FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_Type * +ComGoogleProtobufDescriptors_FieldDescriptor_Type_valueOfWithComGoogleProtobufDescriptorProtos_FieldDescriptorProto_Type_( + ComGoogleProtobufDescriptorProtos_FieldDescriptorProto_Type *type); FOUNDATION_EXPORT IOSObjectArray *ComGoogleProtobufDescriptors_FieldDescriptor_Type_values(void); -FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_Type *ComGoogleProtobufDescriptors_FieldDescriptor_Type_valueOfWithNSString_(NSString *name); +FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_Type * +ComGoogleProtobufDescriptors_FieldDescriptor_Type_valueOfWithNSString_(NSString *name); -FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_Type *ComGoogleProtobufDescriptors_FieldDescriptor_Type_fromOrdinal(NSUInteger ordinal); +FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_Type * +ComGoogleProtobufDescriptors_FieldDescriptor_Type_fromOrdinal(NSUInteger ordinal); J2OBJC_TYPE_LITERAL_HEADER(ComGoogleProtobufDescriptors_FieldDescriptor_Type) @@ -337,7 +333,7 @@ typedef NS_ENUM(NSUInteger, ComGoogleProtobufDescriptors_FieldDescriptor_JavaTyp ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_MESSAGE = 8, }; -@interface ComGoogleProtobufDescriptors_FieldDescriptor_JavaType : JavaLangEnum < NSCopying > +@interface ComGoogleProtobufDescriptors_FieldDescriptor_JavaType : JavaLangEnum #pragma mark Package-Private @@ -352,7 +348,8 @@ typedef NS_ENUM(NSUInteger, ComGoogleProtobufDescriptors_FieldDescriptor_JavaTyp J2OBJC_STATIC_INIT(ComGoogleProtobufDescriptors_FieldDescriptor_JavaType) /*! INTERNAL ONLY - Use enum accessors declared below. */ -FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_JavaType *ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_values_[]; +FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_JavaType + *ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_values_[]; inline ComGoogleProtobufDescriptors_FieldDescriptor_JavaType * ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_get_INT(void); @@ -393,10 +390,12 @@ J2OBJC_ENUM_CONSTANT(ComGoogleProtobufDescriptors_FieldDescriptor_JavaType, MESS FOUNDATION_EXPORT IOSObjectArray *ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_values( void); -FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_JavaType *ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_valueOfWithNSString_(NSString *name); +FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_JavaType * +ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_valueOfWithNSString_(NSString *name); -FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_JavaType *ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_fromOrdinal(NSUInteger ordinal); +FOUNDATION_EXPORT ComGoogleProtobufDescriptors_FieldDescriptor_JavaType * +ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_fromOrdinal(NSUInteger ordinal); J2OBJC_TYPE_LITERAL_HEADER(ComGoogleProtobufDescriptors_FieldDescriptor_JavaType) -#endif // __ComGoogleProtobufFieldTypes_H__ +#endif // __ComGoogleProtobufFieldTypes_H__ diff --git a/protobuf/runtime/src/com/google/protobuf/GeneratedMessage.mm b/protobuf/runtime/src/com/google/protobuf/GeneratedMessage.mm index 0027d399ff..50f31bcd34 100644 --- a/protobuf/runtime/src/com/google/protobuf/GeneratedMessage.mm +++ b/protobuf/runtime/src/com/google/protobuf/GeneratedMessage.mm @@ -71,8 +71,8 @@ #define NIL_CHECK_Float(value) #define NIL_CHECK_Double(value) #define NIL_CHECK_Bool(value) -#define NIL_CHECK_Enum(value) (void)nil_chk(value); -#define NIL_CHECK_Retainable(value) (void)nil_chk(value); +#define NIL_CHECK_Enum(value) (void)nil_chk(value) +#define NIL_CHECK_Retainable(value) (void)nil_chk(value) // Forward declarations. class CGPExtensionValue; @@ -508,7 +508,8 @@ static BOOL AddClearMethod(Class cls, SEL sel, CGPFieldDescriptor *field) { #define GET_SINGULAR_SETTER_IMP(NAME) \ static IMP GetSingularSetterImp##NAME(size_t offset, CGPHasLocator hasLoc) { \ return imp_implementationWithBlock(^id(id msg, TYPE_##NAME value) { \ - NIL_CHECK_##NAME(value) SingularSet##NAME(msg, value, offset, hasLoc); \ + NIL_CHECK_##NAME(value); \ + SingularSet##NAME(msg, value, offset, hasLoc); \ return msg; \ }); \ } @@ -520,8 +521,8 @@ static BOOL AddClearMethod(Class cls, SEL sel, CGPFieldDescriptor *field) { #define GET_REPEATED_SETTER_IMP(NAME) \ static IMP GetRepeatedSetterImp##NAME(size_t offset) { \ return imp_implementationWithBlock(^id(id msg, jint idx, TYPE_##NAME value) { \ - NIL_CHECK_##NAME(value) \ - CGPRepeatedFieldSet##NAME(REPEATED_FIELD_PTR(msg, offset), idx, value); \ + NIL_CHECK_##NAME(value); \ + CGPRepeatedFieldSet##NAME(REPEATED_FIELD_PTR(msg, offset), idx, value); \ return msg; \ }); \ } @@ -572,12 +573,13 @@ static BOOL AddBuilderSetterMethod(Class cls, SEL sel, CGPFieldDescriptor *field return class_addMethod(cls, sel, imp, "@@:@"); } -#define GET_ADDER_IMP(NAME) \ - static IMP GetAdderImp##NAME(size_t offset) { \ - return imp_implementationWithBlock(^id(id msg, TYPE_##NAME value) { \ - NIL_CHECK_##NAME(value) CGPRepeatedFieldAdd##NAME(REPEATED_FIELD_PTR(msg, offset), value); \ - return msg; \ - }); \ +#define GET_ADDER_IMP(NAME) \ + static IMP GetAdderImp##NAME(size_t offset) { \ + return imp_implementationWithBlock(^id(id msg, TYPE_##NAME value) { \ + NIL_CHECK_##NAME(value); \ + CGPRepeatedFieldAdd##NAME(REPEATED_FIELD_PTR(msg, offset), value); \ + return msg; \ + }); \ } FOR_EACH_TYPE_WITH_ENUM(GET_ADDER_IMP) diff --git a/protobuf/runtime/src/com/google/protobuf/RepeatedField.m b/protobuf/runtime/src/com/google/protobuf/RepeatedField.m index 90a090af6d..1d8a92b1bb 100644 --- a/protobuf/runtime/src/com/google/protobuf/RepeatedField.m +++ b/protobuf/runtime/src/com/google/protobuf/RepeatedField.m @@ -82,8 +82,8 @@ void CGPRepeatedFieldCopyData(CGPRepeatedField *field, CGPFieldJavaType type) { } } -void CGPRepeatedFieldAppendOther( - CGPRepeatedField *field, CGPRepeatedField *other, CGPFieldJavaType type) { +void CGPRepeatedFieldAppendOther(CGPRepeatedField *field, CGPRepeatedField *other, + CGPFieldJavaType type) { uint32_t otherSize = CGPRepeatedFieldSize(other); if (otherSize == 0) { return; @@ -130,7 +130,7 @@ id CGPRepeatedFieldGet(CGPRepeatedField *field, jint index, CGPFieldDescriptor * CGPRepeatedFieldCheckBounds(field, index); #define REPEATED_GET_CASE(NAME) \ - return CGPToReflectionType##NAME(((TYPE_##NAME *)field->data->buffer)[index], descriptor); \ + return CGPToReflectionType##NAME(((TYPE_##NAME *)field->data->buffer)[index], descriptor); SWITCH_TYPES_WITH_ENUM(CGPFieldGetJavaType(descriptor), REPEATED_GET_CASE) @@ -143,9 +143,7 @@ void CGPRepeatedMessageFieldRemove(CGPRepeatedField *field, jint index) { id *msgBuffer = (id *)field->data->buffer; AUTORELEASE(msgBuffer[index]); if (count > (uint32_t)index + 1) { - memmove(&(msgBuffer[index]), - &(msgBuffer[index + 1]), - sizeof(id) * (count - (index + 1))); + memmove(&(msgBuffer[index]), &(msgBuffer[index + 1]), sizeof(id) * (count - (index + 1))); } field->data->size -= 1; } @@ -153,11 +151,11 @@ void CGPRepeatedMessageFieldRemove(CGPRepeatedField *field, jint index) { void CGPRepeatedFieldSet(CGPRepeatedField *field, jint index, id value, CGPFieldJavaType type) { CGPRepeatedFieldCheckBounds(field, index); -#define REPEATED_SET_CASE(NAME) \ - { \ +#define REPEATED_SET_CASE(NAME) \ + { \ TYPE_##NAME *ptr = &((TYPE_##NAME *)field->data->buffer)[index]; \ - TYPE_ASSIGN_##NAME(*ptr, CGPFromReflectionType##NAME(value)); \ - break; \ + TYPE_ASSIGN_##NAME(*ptr, CGPFromReflectionType##NAME(value)); \ + break; \ } SWITCH_TYPES_WITH_ENUM(type, REPEATED_SET_CASE) @@ -167,8 +165,8 @@ void CGPRepeatedFieldSet(CGPRepeatedField *field, jint index, id value, CGPField // Make sure to reserve enough space in the buffer BEFORE calling this. static void CGPRepeatedFieldAddUnsafe(CGPRepeatedFieldData *data, id value, CGPFieldJavaType type) { -#define REPEATED_ADD_CASE(NAME) \ - ((TYPE_##NAME *)data->buffer)[data->size++] = \ +#define REPEATED_ADD_CASE(NAME) \ + ((TYPE_##NAME *)data->buffer)[data->size++] = \ TYPE_RETAIN_##NAME(CGPFromReflectionType##NAME(value)); \ break; @@ -185,8 +183,8 @@ void CGPRepeatedFieldAdd(CGPRepeatedField *field, id value, CGPFieldJavaType typ CGPRepeatedFieldAddUnsafe(field->data, value, type); } -void CGPRepeatedFieldAssignFromList( - CGPRepeatedField *field, id list, CGPFieldJavaType type) { +void CGPRepeatedFieldAssignFromList(CGPRepeatedField *field, id list, + CGPFieldJavaType type) { CGPRepeatedFieldClear(field, type); CGPRepeatedFieldReserve(field, [list size], CGPGetTypeSize(type)); @@ -203,10 +201,10 @@ void CGPRepeatedFieldAssignFromList( return newList; } -#define REPEATED_COPY_ELEM_CASE(NAME) \ - for (uint32_t i = 0; i < data->size; i++) { \ +#define REPEATED_COPY_ELEM_CASE(NAME) \ + for (uint32_t i = 0; i < data->size; i++) { \ [newList addWithId:CGPToReflectionType##NAME(((TYPE_##NAME *)data->buffer)[i], descriptor)]; \ - } \ + } \ break; SWITCH_TYPES_WITH_ENUM(CGPFieldGetJavaType(descriptor), REPEATED_COPY_ELEM_CASE) @@ -254,7 +252,7 @@ @interface CGPRepeatedFieldList : JavaUtilAbstractList { @end // We need a subclass for String fields which must implement the ProtocolStringList interface. -@interface CGPRepeatedStringFieldList : CGPRepeatedFieldList < ComGoogleProtobufProtocolStringList > +@interface CGPRepeatedStringFieldList : CGPRepeatedFieldList @end @interface CGPStringAsByteStringList : JavaUtilAbstractList { @@ -265,8 +263,9 @@ @interface CGPStringAsByteStringList : JavaUtilAbstractList { id CGPNewRepeatedFieldList(CGPRepeatedField *field, CGPFieldJavaType type) { CGPRepeatedFieldList *list = - type == ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_STRING ? - [[CGPRepeatedStringFieldList alloc] init] : [[CGPRepeatedFieldList alloc] init]; + type == ComGoogleProtobufDescriptors_FieldDescriptor_JavaType_Enum_STRING + ? [[CGPRepeatedStringFieldList alloc] init] + : [[CGPRepeatedFieldList alloc] init]; CGPRepeatedFieldData *data = field->data; if (data != NULL) { list->field_.data = data; @@ -293,7 +292,7 @@ - (id)getWithInt:(jint)index { CGPRepeatedFieldCheckBounds(&field_, index); #define REPEATED_LIST_GET_CASE(NAME) \ - return CGPBoxedValue##NAME(((TYPE_##NAME *)field_.data->buffer)[index]); \ + return CGPBoxedValue##NAME(((TYPE_##NAME *)field_.data->buffer)[index]); SWITCH_TYPES_NO_ENUM(type_, REPEATED_LIST_GET_CASE)