aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBArray.m
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2015-05-21 17:14:52 -0400
committerThomas Van Lenten <thomasvl@google.com>2015-05-22 14:27:31 -0400
commit1dcc329427fd103a0abd96ab787270f5d0a31861 (patch)
treecf1c52df0e1effa3d0985a3406a71c38c3a4e487 /objectivec/GPBArray.m
parentc3480926f98eb7c45224daae5cf0373e120b3b8d (diff)
downloadprotobuf-1dcc329427fd103a0abd96ab787270f5d0a31861.tar.gz
protobuf-1dcc329427fd103a0abd96ab787270f5d0a31861.tar.bz2
protobuf-1dcc329427fd103a0abd96ab787270f5d0a31861.zip
Objective C Second Alpha Drop
- Style fixups in the code. - map<> serialization fixes and more tests. - Autocreation of map<> fields (to match repeated fields). - @@protoc_insertion_point(global_scope|imports). - Fixup proto2 syntax extension support. - Move all startup code to +initialize so it happen on class usage and not app startup. - Have generated headers use forward declarations and move imports into generated code, reduces what is need at compile time to speed up compiled and avoid pointless rippling of rebuilds.
Diffstat (limited to 'objectivec/GPBArray.m')
-rw-r--r--objectivec/GPBArray.m80
1 files changed, 50 insertions, 30 deletions
diff --git a/objectivec/GPBArray.m b/objectivec/GPBArray.m
index 6aa3df2e..60b08ad1 100644
--- a/objectivec/GPBArray.m
+++ b/objectivec/GPBArray.m
@@ -149,7 +149,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
//%PDDM-DEFINE ARRAY_IMMUTABLE_CORE(NAME, TYPE, ACCESSOR_NAME, FORMAT)
//%- (void)dealloc {
-//% NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+//% NSAssert(!_autocreator,
+//% @"%@: Autocreator must be cleared before release, autocreator: %@",
+//% [self class], _autocreator);
//% free(_values);
//% [super dealloc];
//%}
@@ -214,7 +216,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
//% if (values == NULL || count == 0) return;
//%MUTATION_HOOK_##HOOK_1() NSUInteger initialCount = _count;
//% NSUInteger newCount = initialCount + count;
-//%MAYBE_GROW_TO_SET_COUNT(newCount);
+//%MAYBE_GROW_TO_SET_COUNT(newCount)
//% memcpy(&_values[initialCount], values, count * sizeof(TYPE));
//% if (_autocreator) {
//% GPBAutocreatedArrayModified(_autocreator, self);
@@ -225,7 +227,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
//%VALIDATE_RANGE(index, _count + 1)
//%MUTATION_HOOK_##HOOK_2() NSUInteger initialCount = _count;
//% NSUInteger newCount = initialCount + 1;
-//%MAYBE_GROW_TO_SET_COUNT(newCount);
+//%MAYBE_GROW_TO_SET_COUNT(newCount)
//% if (index != initialCount) {
//% memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(TYPE));
//% }
@@ -355,7 +357,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
- (void)dealloc {
- NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+ NSAssert(!_autocreator,
+ @"%@: Autocreator must be cleared before release, autocreator: %@",
+ [self class], _autocreator);
free(_values);
[super dealloc];
}
@@ -442,7 +446,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
memcpy(&_values[initialCount], values, count * sizeof(int32_t));
if (_autocreator) {
GPBAutocreatedArrayModified(_autocreator, self);
@@ -460,7 +464,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
if (index != initialCount) {
memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(int32_t));
}
@@ -598,7 +602,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
- (void)dealloc {
- NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+ NSAssert(!_autocreator,
+ @"%@: Autocreator must be cleared before release, autocreator: %@",
+ [self class], _autocreator);
free(_values);
[super dealloc];
}
@@ -685,7 +691,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
memcpy(&_values[initialCount], values, count * sizeof(uint32_t));
if (_autocreator) {
GPBAutocreatedArrayModified(_autocreator, self);
@@ -703,7 +709,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
if (index != initialCount) {
memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(uint32_t));
}
@@ -841,7 +847,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
- (void)dealloc {
- NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+ NSAssert(!_autocreator,
+ @"%@: Autocreator must be cleared before release, autocreator: %@",
+ [self class], _autocreator);
free(_values);
[super dealloc];
}
@@ -928,7 +936,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
memcpy(&_values[initialCount], values, count * sizeof(int64_t));
if (_autocreator) {
GPBAutocreatedArrayModified(_autocreator, self);
@@ -946,7 +954,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
if (index != initialCount) {
memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(int64_t));
}
@@ -1084,7 +1092,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
- (void)dealloc {
- NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+ NSAssert(!_autocreator,
+ @"%@: Autocreator must be cleared before release, autocreator: %@",
+ [self class], _autocreator);
free(_values);
[super dealloc];
}
@@ -1171,7 +1181,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
memcpy(&_values[initialCount], values, count * sizeof(uint64_t));
if (_autocreator) {
GPBAutocreatedArrayModified(_autocreator, self);
@@ -1189,7 +1199,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
if (index != initialCount) {
memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(uint64_t));
}
@@ -1327,7 +1337,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
- (void)dealloc {
- NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+ NSAssert(!_autocreator,
+ @"%@: Autocreator must be cleared before release, autocreator: %@",
+ [self class], _autocreator);
free(_values);
[super dealloc];
}
@@ -1414,7 +1426,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
memcpy(&_values[initialCount], values, count * sizeof(float));
if (_autocreator) {
GPBAutocreatedArrayModified(_autocreator, self);
@@ -1432,7 +1444,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
if (index != initialCount) {
memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(float));
}
@@ -1570,7 +1582,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
- (void)dealloc {
- NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+ NSAssert(!_autocreator,
+ @"%@: Autocreator must be cleared before release, autocreator: %@",
+ [self class], _autocreator);
free(_values);
[super dealloc];
}
@@ -1657,7 +1671,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
memcpy(&_values[initialCount], values, count * sizeof(double));
if (_autocreator) {
GPBAutocreatedArrayModified(_autocreator, self);
@@ -1675,7 +1689,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
if (index != initialCount) {
memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(double));
}
@@ -1813,7 +1827,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
- (void)dealloc {
- NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+ NSAssert(!_autocreator,
+ @"%@: Autocreator must be cleared before release, autocreator: %@",
+ [self class], _autocreator);
free(_values);
[super dealloc];
}
@@ -1900,7 +1916,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
memcpy(&_values[initialCount], values, count * sizeof(BOOL));
if (_autocreator) {
GPBAutocreatedArrayModified(_autocreator, self);
@@ -1918,7 +1934,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
if (index != initialCount) {
memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(BOOL));
}
@@ -2083,7 +2099,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
// This block of code is generated, do not edit it directly.
- (void)dealloc {
- NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+ NSAssert(!_autocreator,
+ @"%@: Autocreator must be cleared before release, autocreator: %@",
+ [self class], _autocreator);
free(_values);
[super dealloc];
}
@@ -2229,7 +2247,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
memcpy(&_values[initialCount], values, count * sizeof(int32_t));
if (_autocreator) {
GPBAutocreatedArrayModified(_autocreator, self);
@@ -2247,7 +2265,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
if (index != initialCount) {
memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(int32_t));
}
@@ -2332,7 +2350,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
memcpy(&_values[initialCount], values, count * sizeof(int32_t));
if (_autocreator) {
GPBAutocreatedArrayModified(_autocreator, self);
@@ -2355,7 +2373,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
if (newCount > _capacity) {
[self internalResizeToCapacity:CapacityFromCount(newCount)];
}
- _count = newCount;;
+ _count = newCount;
if (index != initialCount) {
memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(int32_t));
}
@@ -2407,7 +2425,9 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
- (void)dealloc {
- NSAssert(!_autocreator, @"Autocreator must be cleared before release.");
+ NSAssert(!_autocreator,
+ @"%@: Autocreator must be cleared before release, autocreator: %@",
+ [self class], _autocreator);
[_array release];
[super dealloc];
}