|
@@ -819,6 +819,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
uint32_t *offsets = malloc(valueCount_ * sizeof(uint32_t));
|
|
uint32_t *offsets = malloc(valueCount_ * sizeof(uint32_t));
|
|
|
|
+ if (!offsets) return;
|
|
const char *scan = valueNames_;
|
|
const char *scan = valueNames_;
|
|
for (uint32_t i = 0; i < valueCount_; ++i) {
|
|
for (uint32_t i = 0; i < valueCount_; ++i) {
|
|
offsets[i] = (uint32_t)(scan - valueNames_);
|
|
offsets[i] = (uint32_t)(scan - valueNames_);
|
|
@@ -851,6 +852,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|
nameAsCStr += prefixLen;
|
|
nameAsCStr += prefixLen;
|
|
|
|
|
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
|
|
|
+ if (nameOffsets_ == NULL) return NO;
|
|
|
|
|
|
// Find it.
|
|
// Find it.
|
|
for (uint32_t i = 0; i < valueCount_; ++i) {
|
|
for (uint32_t i = 0; i < valueCount_; ++i) {
|
|
@@ -867,6 +869,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|
|
|
|
|
- (BOOL)getValue:(int32_t *)outValue forEnumTextFormatName:(NSString *)textFormatName {
|
|
- (BOOL)getValue:(int32_t *)outValue forEnumTextFormatName:(NSString *)textFormatName {
|
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
|
|
|
+ if (nameOffsets_ == NULL) return NO;
|
|
|
|
|
|
for (uint32_t i = 0; i < valueCount_; ++i) {
|
|
for (uint32_t i = 0; i < valueCount_; ++i) {
|
|
int32_t value = values_[i];
|
|
int32_t value = values_[i];
|
|
@@ -905,6 +908,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|
|
|
|
|
- (NSString *)getEnumNameForIndex:(uint32_t)index {
|
|
- (NSString *)getEnumNameForIndex:(uint32_t)index {
|
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
|
|
|
+ if (nameOffsets_ == NULL) return nil;
|
|
|
|
|
|
if (index >= valueCount_) {
|
|
if (index >= valueCount_) {
|
|
return nil;
|
|
return nil;
|
|
@@ -916,6 +920,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
|
|
|
|
|
|
- (NSString *)getEnumTextFormatNameForIndex:(uint32_t)index {
|
|
- (NSString *)getEnumTextFormatNameForIndex:(uint32_t)index {
|
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
|
if (nameOffsets_ == NULL) [self calcValueNameOffsets];
|
|
|
|
+ if (nameOffsets_ == NULL) return nil;
|
|
|
|
|
|
if (index >= valueCount_) {
|
|
if (index >= valueCount_) {
|
|
return nil;
|
|
return nil;
|