Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
cdd5b3b8
Commit
cdd5b3b8
authored
May 26, 2015
by
Paul Yang
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #426 from thomasvl/mac_fixup_for_a3_branch
ObjC fixup for the branch.
parents
621bf820
58cd4a47
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
35 deletions
+15
-35
.gitignore
.gitignore
+2
-1
project.pbxproj
objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
+2
-2
project.pbxproj
objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
+2
-2
GPBMessageTests+Serialization.m
objectivec/Tests/GPBMessageTests+Serialization.m
+6
-22
unittest_runtime_proto2.proto
objectivec/Tests/unittest_runtime_proto2.proto
+2
-3
unittest_runtime_proto3.proto
objectivec/Tests/unittest_runtime_proto3.proto
+1
-5
No files found.
.gitignore
View file @
cdd5b3b8
...
@@ -92,7 +92,8 @@ objectivec/ProtocolBuffers_OSX.xcodeproj/xcuserdata/
...
@@ -92,7 +92,8 @@ objectivec/ProtocolBuffers_OSX.xcodeproj/xcuserdata/
objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcuserdata/
objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcuserdata/
objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/ProtocolBuffers_iOS.xccheckout
objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/ProtocolBuffers_iOS.xccheckout
objectivec/ProtocolBuffers_iOS.xcodeproj/xcuserdata/
objectivec/ProtocolBuffers_iOS.xcodeproj/xcuserdata/
objectivec/**/.DS_Store
# OS X's Finder creates these for state about opened windows/etc.
**/.DS_Store
# Comformance test output
# Comformance test output
conformance/.libs/
conformance/.libs/
...
...
objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
View file @
cdd5b3b8
...
@@ -725,7 +725,7 @@
...
@@ -725,7 +725,7 @@
INFOPLIST_FILE
=
"Tests/UnitTests-Info.plist"
;
INFOPLIST_FILE
=
"Tests/UnitTests-Info.plist"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"
;
PRODUCT_NAME
=
UnitTests
;
PRODUCT_NAME
=
UnitTests
;
SWIFT_OBJC_BRIDGING_HEADER
=
"
$(SRCROOT)/
Tests/UnitTests-Bridging-Header.h"
;
SWIFT_OBJC_BRIDGING_HEADER
=
"Tests/UnitTests-Bridging-Header.h"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
};
};
name
=
Debug
;
name
=
Debug
;
...
@@ -742,7 +742,7 @@
...
@@ -742,7 +742,7 @@
INFOPLIST_FILE
=
"Tests/UnitTests-Info.plist"
;
INFOPLIST_FILE
=
"Tests/UnitTests-Info.plist"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"
;
PRODUCT_NAME
=
UnitTests
;
PRODUCT_NAME
=
UnitTests
;
SWIFT_OBJC_BRIDGING_HEADER
=
"
$(SRCROOT)/
Tests/UnitTests-Bridging-Header.h"
;
SWIFT_OBJC_BRIDGING_HEADER
=
"Tests/UnitTests-Bridging-Header.h"
;
};
};
name
=
Release
;
name
=
Release
;
};
};
...
...
objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
View file @
cdd5b3b8
...
@@ -875,7 +875,7 @@
...
@@ -875,7 +875,7 @@
"\"$(DEVELOPER_DIR)/usr/lib\""
,
"\"$(DEVELOPER_DIR)/usr/lib\""
,
);
);
PRODUCT_NAME
=
UnitTests
;
PRODUCT_NAME
=
UnitTests
;
SWIFT_OBJC_BRIDGING_HEADER
=
"
$(SRCROOT)/
Tests/UnitTests-Bridging-Header.h"
;
SWIFT_OBJC_BRIDGING_HEADER
=
"Tests/UnitTests-Bridging-Header.h"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
TEST_HOST
=
"$(BUILT_PRODUCTS_DIR)/iOSTestHarness.app/iOSTestHarness"
;
TEST_HOST
=
"$(BUILT_PRODUCTS_DIR)/iOSTestHarness.app/iOSTestHarness"
;
...
@@ -903,7 +903,7 @@
...
@@ -903,7 +903,7 @@
"\"$(DEVELOPER_DIR)/usr/lib\""
,
"\"$(DEVELOPER_DIR)/usr/lib\""
,
);
);
PRODUCT_NAME
=
UnitTests
;
PRODUCT_NAME
=
UnitTests
;
SWIFT_OBJC_BRIDGING_HEADER
=
"
$(SRCROOT)/
Tests/UnitTests-Bridging-Header.h"
;
SWIFT_OBJC_BRIDGING_HEADER
=
"Tests/UnitTests-Bridging-Header.h"
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
TARGETED_DEVICE_FAMILY
=
"1,2"
;
TEST_HOST
=
"$(BUILT_PRODUCTS_DIR)/iOSTestHarness.app/iOSTestHarness"
;
TEST_HOST
=
"$(BUILT_PRODUCTS_DIR)/iOSTestHarness.app/iOSTestHarness"
;
};
};
...
...
objectivec/Tests/GPBMessageTests+Serialization.m
View file @
cdd5b3b8
...
@@ -146,9 +146,6 @@ static NSData *DataFromCStr(const char *str) {
...
@@ -146,9 +146,6 @@ static NSData *DataFromCStr(const char *str) {
orig
.
repeatedEnumArray
=
orig
.
repeatedEnumArray
=
[
GPBEnumArray
arrayWithValidationFunction
:
Message3_Enum_IsValidValue
[
GPBEnumArray
arrayWithValidationFunction
:
Message3_Enum_IsValidValue
rawValue
:
Message3_Enum_Extra3
];
rawValue
:
Message3_Enum_Extra3
];
orig
.
repeatedPackedEnumArray
=
[
GPBEnumArray
arrayWithValidationFunction
:
Message3_Enum_IsValidValue
rawValue
:
Message3_Enum_Extra3
];
orig
.
oneofEnum
=
Message3_Enum_Extra3
;
orig
.
oneofEnum
=
Message3_Enum_Extra3
;
Message2
*
msg
=
[[
Message2
alloc
]
initWithData
:[
orig
data
]
error
:
NULL
];
Message2
*
msg
=
[[
Message2
alloc
]
initWithData
:[
orig
data
]
error
:
NULL
];
...
@@ -157,19 +154,16 @@ static NSData *DataFromCStr(const char *str) {
...
@@ -157,19 +154,16 @@ static NSData *DataFromCStr(const char *str) {
XCTAssertFalse
(
msg
.
hasOptionalEnum
);
XCTAssertFalse
(
msg
.
hasOptionalEnum
);
XCTAssertEqual
(
msg
.
repeatedEnumArray
.
count
,
0U
);
XCTAssertEqual
(
msg
.
repeatedEnumArray
.
count
,
0U
);
XCTAssertEqual
(
msg
.
repeatedPackedEnumArray
.
count
,
0U
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
// All the values should be in unknown fields.
// All the values should be in unknown fields.
GPBUnknownFieldSet
*
unknownFields
=
msg
.
unknownFields
;
GPBUnknownFieldSet
*
unknownFields
=
msg
.
unknownFields
;
XCTAssertEqual
([
unknownFields
countOfFields
],
4
U
);
XCTAssertEqual
([
unknownFields
countOfFields
],
3
U
);
XCTAssertTrue
([
unknownFields
hasField
:
Message2_FieldNumber_OptionalEnum
]);
XCTAssertTrue
([
unknownFields
hasField
:
Message2_FieldNumber_OptionalEnum
]);
XCTAssertTrue
(
XCTAssertTrue
(
[
unknownFields
hasField
:
Message2_FieldNumber_RepeatedEnumArray
]);
[
unknownFields
hasField
:
Message2_FieldNumber_RepeatedEnumArray
]);
XCTAssertTrue
(
[
unknownFields
hasField
:
Message2_FieldNumber_RepeatedPackedEnumArray
]);
XCTAssertTrue
([
unknownFields
hasField
:
Message2_FieldNumber_OneofEnum
]);
XCTAssertTrue
([
unknownFields
hasField
:
Message2_FieldNumber_OneofEnum
]);
GPBField
*
field
=
[
unknownFields
getField
:
Message2_FieldNumber_OptionalEnum
];
GPBField
*
field
=
[
unknownFields
getField
:
Message2_FieldNumber_OptionalEnum
];
...
@@ -177,22 +171,12 @@ static NSData *DataFromCStr(const char *str) {
...
@@ -177,22 +171,12 @@ static NSData *DataFromCStr(const char *str) {
XCTAssertEqual
([
field
.
varintList
valueAtIndex
:
0
],
XCTAssertEqual
([
field
.
varintList
valueAtIndex
:
0
],
(
uint64_t
)
Message3_Enum_Extra3
);
(
uint64_t
)
Message3_Enum_Extra3
);
// TODO(teboring): This test could fail without explicitly marking the repeated_enum in Message3
// Repeated in proto3 default to packed, so this will be length delimited
// to be unpacked. This is becaucse proto3 repeated primitive field is packed by default. However,
// unknown field, and the value (Message3_Enum_Extra3) encodes into one byte.
// the proto2 primitive repeated field is still unpacked by default. Previously, parsing of the
// repeated_enum field would fail. To fix it:
// 1) Objective-C implementation of parsing should be able to parse packed field for unpacked
// field and vice versa.
// 2) repeated_packed_enum in Message3 should be removed, because it's unnecessary now.
field
=
[
unknownFields
getField
:
Message2_FieldNumber_RepeatedEnumArray
];
field
=
[
unknownFields
getField
:
Message2_FieldNumber_RepeatedEnumArray
];
XCTAssertEqual
(
field
.
varintList
.
count
,
1U
);
XCTAssertEqual
(
field
.
lengthDelimitedList
.
count
,
1U
);
XCTAssertEqual
([
field
.
varintList
valueAtIndex
:
0
],
NSData
*
expected
=
DataFromCStr
(
"
\x1E
"
);
(
uint64_t
)
Message3_Enum_Extra3
);
XCTAssertEqualObjects
([
field
.
lengthDelimitedList
objectAtIndex
:
0
],
expected
);
field
=
[
unknownFields
getField
:
Message2_FieldNumber_RepeatedPackedEnumArray
];
XCTAssertEqual
(
field
.
varintList
.
count
,
1U
);
XCTAssertEqual
([
field
.
varintList
valueAtIndex
:
0
],
(
uint64_t
)
Message3_Enum_Extra3
);
field
=
[
unknownFields
getField
:
Message2_FieldNumber_OneofEnum
];
field
=
[
unknownFields
getField
:
Message2_FieldNumber_OneofEnum
];
XCTAssertEqual
(
field
.
varintList
.
count
,
1U
);
XCTAssertEqual
(
field
.
varintList
.
count
,
1U
);
...
...
objectivec/Tests/unittest_runtime_proto2.proto
View file @
cdd5b3b8
...
@@ -78,9 +78,8 @@ message Message2 {
...
@@ -78,9 +78,8 @@ message Message2 {
repeated
group
RepeatedGroup
=
46
{
repeated
group
RepeatedGroup
=
46
{
optional
int32
a
=
47
;
optional
int32
a
=
47
;
}
}
repeated
Message2
repeated_message
=
48
;
repeated
Message2
repeated_message
=
48
;
repeated
Enum
repeated_enum
=
49
;
repeated
Enum
repeated_enum
=
49
;
repeated
Enum
repeated_packed_enum
=
50
[
packed
=
true
];
oneof
o
{
oneof
o
{
int32
oneof_int32
=
51
[
default
=
100
];
int32
oneof_int32
=
51
[
default
=
100
];
...
...
objectivec/Tests/unittest_runtime_proto3.proto
View file @
cdd5b3b8
...
@@ -75,11 +75,7 @@ message Message3 {
...
@@ -75,11 +75,7 @@ message Message3 {
repeated
bytes
repeated_bytes
=
45
;
repeated
bytes
repeated_bytes
=
45
;
// No 'group' in proto3.
// No 'group' in proto3.
repeated
Message3
repeated_message
=
48
;
repeated
Message3
repeated_message
=
48
;
// TODO(teboring): In proto3, repeated primitive field is packed by default.
repeated
Enum
repeated_enum
=
49
;
// testProto2UnknownEnumToUnknownField needs repeated_enum to be unpacked.
// Remove this option when testProto2UnknownEnumToUnknownField.
repeated
Enum
repeated_enum
=
49
[
packed
=
false
];
repeated
Enum
repeated_packed_enum
=
50
[
packed
=
true
];
oneof
o
{
oneof
o
{
int32
oneof_int32
=
51
;
int32
oneof_int32
=
51
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment