|
@@ -39,6 +39,12 @@
|
|
#import "GPBUnknownField.h"
|
|
#import "GPBUnknownField.h"
|
|
#import "GPBUnknownFieldSet.h"
|
|
#import "GPBUnknownFieldSet.h"
|
|
|
|
|
|
|
|
+// Direct access is use for speed, to avoid even internally declaring things
|
|
|
|
+// read/write, etc. The warning is enabled in the project to ensure code calling
|
|
|
|
+// protos can turn on -Wdirect-ivar-access without issues.
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
|
|
|
+
|
|
static void AppendTextFormatForMessage(GPBMessage *message,
|
|
static void AppendTextFormatForMessage(GPBMessage *message,
|
|
NSMutableString *toStr,
|
|
NSMutableString *toStr,
|
|
NSString *lineIndent);
|
|
NSString *lineIndent);
|
|
@@ -891,7 +897,7 @@ void GPBSetMessageGroupField(GPBMessage *self,
|
|
|
|
|
|
// Only exists for public api, no core code should use this.
|
|
// Only exists for public api, no core code should use this.
|
|
id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field) {
|
|
id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field) {
|
|
-#if DEBUG
|
|
|
|
|
|
+#if defined(DEBUG) && DEBUG
|
|
if (field.fieldType != GPBFieldTypeRepeated) {
|
|
if (field.fieldType != GPBFieldTypeRepeated) {
|
|
[NSException raise:NSInvalidArgumentException
|
|
[NSException raise:NSInvalidArgumentException
|
|
format:@"%@.%@ is not a repeated field.",
|
|
format:@"%@.%@ is not a repeated field.",
|
|
@@ -903,7 +909,7 @@ id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field) {
|
|
|
|
|
|
// Only exists for public api, no core code should use this.
|
|
// Only exists for public api, no core code should use this.
|
|
void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array) {
|
|
void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array) {
|
|
-#if DEBUG
|
|
|
|
|
|
+#if defined(DEBUG) && DEBUG
|
|
if (field.fieldType != GPBFieldTypeRepeated) {
|
|
if (field.fieldType != GPBFieldTypeRepeated) {
|
|
[NSException raise:NSInvalidArgumentException
|
|
[NSException raise:NSInvalidArgumentException
|
|
format:@"%@.%@ is not a repeated field.",
|
|
format:@"%@.%@ is not a repeated field.",
|
|
@@ -957,7 +963,7 @@ void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id
|
|
GPBSetObjectIvarWithField(self, field, array);
|
|
GPBSetObjectIvarWithField(self, field, array);
|
|
}
|
|
}
|
|
|
|
|
|
-#if DEBUG
|
|
|
|
|
|
+#if defined(DEBUG) && DEBUG
|
|
static NSString *TypeToStr(GPBDataType dataType) {
|
|
static NSString *TypeToStr(GPBDataType dataType) {
|
|
switch (dataType) {
|
|
switch (dataType) {
|
|
case GPBDataTypeBool:
|
|
case GPBDataTypeBool:
|
|
@@ -993,7 +999,7 @@ static NSString *TypeToStr(GPBDataType dataType) {
|
|
|
|
|
|
// Only exists for public api, no core code should use this.
|
|
// Only exists for public api, no core code should use this.
|
|
id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field) {
|
|
id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field) {
|
|
-#if DEBUG
|
|
|
|
|
|
+#if defined(DEBUG) && DEBUG
|
|
if (field.fieldType != GPBFieldTypeMap) {
|
|
if (field.fieldType != GPBFieldTypeMap) {
|
|
[NSException raise:NSInvalidArgumentException
|
|
[NSException raise:NSInvalidArgumentException
|
|
format:@"%@.%@ is not a map<> field.",
|
|
format:@"%@.%@ is not a map<> field.",
|
|
@@ -1006,7 +1012,7 @@ id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field) {
|
|
// Only exists for public api, no core code should use this.
|
|
// Only exists for public api, no core code should use this.
|
|
void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field,
|
|
void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field,
|
|
id dictionary) {
|
|
id dictionary) {
|
|
-#if DEBUG
|
|
|
|
|
|
+#if defined(DEBUG) && DEBUG
|
|
if (field.fieldType != GPBFieldTypeMap) {
|
|
if (field.fieldType != GPBFieldTypeMap) {
|
|
[NSException raise:NSInvalidArgumentException
|
|
[NSException raise:NSInvalidArgumentException
|
|
format:@"%@.%@ is not a map<> field.",
|
|
format:@"%@.%@ is not a map<> field.",
|
|
@@ -1133,6 +1139,8 @@ static void AppendTextFormatForMapMessageField(
|
|
[toStr appendString:@"\n"];
|
|
[toStr appendString:@"\n"];
|
|
|
|
|
|
[toStr appendString:valueLine];
|
|
[toStr appendString:valueLine];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wswitch-enum"
|
|
switch (valueDataType) {
|
|
switch (valueDataType) {
|
|
case GPBDataTypeString:
|
|
case GPBDataTypeString:
|
|
AppendStringEscaped(value, toStr);
|
|
AppendStringEscaped(value, toStr);
|
|
@@ -1153,6 +1161,7 @@ static void AppendTextFormatForMapMessageField(
|
|
NSCAssert(NO, @"Can't happen");
|
|
NSCAssert(NO, @"Can't happen");
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+#pragma clang diagnostic pop
|
|
[toStr appendString:@"\n"];
|
|
[toStr appendString:@"\n"];
|
|
|
|
|
|
[toStr appendString:msgEnd];
|
|
[toStr appendString:msgEnd];
|
|
@@ -1174,6 +1183,8 @@ static void AppendTextFormatForMapMessageField(
|
|
}
|
|
}
|
|
|
|
|
|
[toStr appendString:valueLine];
|
|
[toStr appendString:valueLine];
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
+#pragma clang diagnostic ignored "-Wswitch-enum"
|
|
switch (valueDataType) {
|
|
switch (valueDataType) {
|
|
case GPBDataTypeString:
|
|
case GPBDataTypeString:
|
|
AppendStringEscaped(valueObj, toStr);
|
|
AppendStringEscaped(valueObj, toStr);
|
|
@@ -1211,6 +1222,7 @@ static void AppendTextFormatForMapMessageField(
|
|
[toStr appendString:valueObj];
|
|
[toStr appendString:valueObj];
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+#pragma clang diagnostic pop
|
|
[toStr appendString:@"\n"];
|
|
[toStr appendString:@"\n"];
|
|
|
|
|
|
[toStr appendString:msgEnd];
|
|
[toStr appendString:msgEnd];
|
|
@@ -1706,6 +1718,8 @@ NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key,
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#pragma clang diagnostic pop
|
|
|
|
+
|
|
#pragma mark - GPBMessageSignatureProtocol
|
|
#pragma mark - GPBMessageSignatureProtocol
|
|
|
|
|
|
// A series of selectors that are used solely to get @encoding values
|
|
// A series of selectors that are used solely to get @encoding values
|