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
c27833b6
Commit
c27833b6
authored
Dec 07, 2015
by
Thomas Van Lenten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION for the projects.
parent
b1b9c254
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
9 deletions
+29
-9
GPBMessage.h
objectivec/GPBMessage.h
+1
-1
GPBMessage.m
objectivec/GPBMessage.m
+8
-2
GPBUtilities.h
objectivec/GPBUtilities.h
+1
-1
project.pbxproj
objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
+2
-0
project.pbxproj
objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
+2
-0
GPBCodedInputStreamTests.m
objectivec/Tests/GPBCodedInputStreamTests.m
+3
-1
GPBMessageTests+Serialization.m
objectivec/Tests/GPBMessageTests+Serialization.m
+0
-0
GPBMessageTests.m
objectivec/Tests/GPBMessageTests.m
+12
-4
No files found.
objectivec/GPBMessage.h
View file @
c27833b6
...
...
@@ -127,7 +127,7 @@ CF_EXTERN_C_END
// Same as -[data], except a delimiter is added to the start of the data
// indicating the size of the message data that follows.
-
(
nullable
NSData
*
)
delimitedData
;
-
(
NSData
*
)
delimitedData
;
// Returns the size of the object if it were serialized.
// This is not a cached value. If you are following a pattern like this:
...
...
objectivec/GPBMessage.m
View file @
c27833b6
...
...
@@ -1212,7 +1212,8 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
NSLog
(
@"%@: Internal exception while building message delimitedData: %@"
,
[
self
class
],
exception
);
#endif
data
=
nil
;
// If it happens, truncate.
data
.
length
=
0
;
}
[
stream
release
];
return
data
;
...
...
@@ -1791,7 +1792,12 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
extensionMap_
=
[[
NSMutableDictionary
alloc
]
init
];
}
[
extensionMap_
setObject
:
value
forKey
:
extension
];
// This pointless cast is for CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION.
// Without it, the compiler complains we're passing an id nullable when
// setObject:forKey: requires a id nonnull for the value. The check for
// !value at the start of the method ensures it isn't nil, but the check
// isn't smart enough to realize that.
[
extensionMap_
setObject
:(
id
)
value
forKey
:
extension
];
GPBExtensionDescriptor
*
descriptor
=
extension
;
...
...
objectivec/GPBUtilities.h
View file @
c27833b6
...
...
@@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
// most likely won't exactly match the original .proto file.
NSString
*
GPBTextFormatForMessage
(
GPBMessage
*
message
,
NSString
*
__nullable
lineIndent
);
NSString
*
GPBTextFormatForUnknownFieldSet
(
GPBUnknownFieldSet
*
unknownSet
,
NSString
*
GPBTextFormatForUnknownFieldSet
(
GPBUnknownFieldSet
*
__nullable
unknownSet
,
NSString
*
__nullable
lineIndent
);
//
...
...
objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
View file @
c27833b6
...
...
@@ -787,6 +787,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY
=
YES
;
CLANG_STATIC_ANALYZER_MODE
=
deep
;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
=
YES
;
CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION
=
YES
;
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES
=
YES
;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS
=
YES
;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION
=
YES
;
...
...
@@ -831,6 +832,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY
=
YES
;
CLANG_STATIC_ANALYZER_MODE
=
deep
;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
=
YES
;
CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION
=
YES
;
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES
=
YES
;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS
=
YES
;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION
=
YES
;
...
...
objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
View file @
c27833b6
...
...
@@ -949,6 +949,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY
=
YES
;
CLANG_STATIC_ANALYZER_MODE
=
deep
;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
=
YES
;
CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION
=
YES
;
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES
=
YES
;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS
=
YES
;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION
=
YES
;
...
...
@@ -994,6 +995,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY
=
YES
;
CLANG_STATIC_ANALYZER_MODE
=
deep
;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
=
YES
;
CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION
=
YES
;
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES
=
YES
;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS
=
YES
;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION
=
YES
;
...
...
objectivec/Tests/GPBCodedInputStreamTests.m
View file @
c27833b6
...
...
@@ -225,8 +225,10 @@
// Serialize and parse it. Make sure to parse from an InputStream, not
// directly from a ByteString, so that CodedInputStream uses buffered
// reading.
NSData
*
messageData
=
message
.
data
;
XCTAssertNotNil
(
messageData
);
GPBCodedInputStream
*
stream
=
[
GPBCodedInputStream
streamWithData
:
message
.
d
ata
];
[
GPBCodedInputStream
streamWithData
:
message
D
ata
];
TestAllTypes
*
message2
=
[
TestAllTypes
parseFromCodedInputStream
:
stream
extensionRegistry
:
nil
error
:
NULL
];
...
...
objectivec/Tests/GPBMessageTests+Serialization.m
View file @
c27833b6
This diff is collapsed.
Click to expand it.
objectivec/Tests/GPBMessageTests.m
View file @
c27833b6
...
...
@@ -195,7 +195,9 @@
// Test merging from data.
result
=
[
self
mergeExtensionsDestination
];
[
result
mergeFromData
:[[
self
mergeExtensionsSource
]
data
]
NSData
*
data
=
[[
self
mergeExtensionsSource
]
data
];
XCTAssertNotNil
(
data
);
[
result
mergeFromData
:
data
extensionRegistry
:[
UnittestRoot
extensionRegistry
]];
resultData
=
[
result
data
];
XCTAssertEqualObjects
(
resultData
,
mergeResultData
);
...
...
@@ -1884,7 +1886,9 @@
XCTAssertEqual
(
msg
.
bar
,
EnumTestMsg_MyEnum_One
);
XCTAssertEqual
(
msg
.
baz
,
EnumTestMsg_MyEnum_NegOne
);
// Bounce to wire and back.
EnumTestMsg
*
msgPrime
=
[
EnumTestMsg
parseFromData
:[
msg
data
]
error
:
NULL
];
NSData
*
data
=
[
msg
data
];
XCTAssertNotNil
(
data
);
EnumTestMsg
*
msgPrime
=
[
EnumTestMsg
parseFromData
:
data
error
:
NULL
];
XCTAssertEqualObjects
(
msgPrime
,
msg
);
XCTAssertEqual
(
msgPrime
.
foo
,
EnumTestMsg_MyEnum_Zero
);
XCTAssertEqual
(
msgPrime
.
bar
,
EnumTestMsg_MyEnum_One
);
...
...
@@ -1896,7 +1900,9 @@
XCTAssertEqual
(
msg
.
bar
,
EnumTestMsg_MyEnum_Two
);
XCTAssertEqual
(
msg
.
baz
,
EnumTestMsg_MyEnum_NegTwo
);
// Bounce to wire and back.
msgPrime
=
[
EnumTestMsg
parseFromData
:[
msg
data
]
error
:
NULL
];
data
=
[
msg
data
];
XCTAssertNotNil
(
data
);
msgPrime
=
[
EnumTestMsg
parseFromData
:
data
error
:
NULL
];
XCTAssertEqualObjects
(
msgPrime
,
msg
);
XCTAssertEqual
(
msgPrime
.
foo
,
EnumTestMsg_MyEnum_Zero
);
XCTAssertEqual
(
msgPrime
.
bar
,
EnumTestMsg_MyEnum_Two
);
...
...
@@ -1917,7 +1923,9 @@
XCTAssertEqual
([
msg
.
mumbleArray
valueAtIndex
:
3
],
EnumTestMsg_MyEnum_NegOne
);
XCTAssertEqual
([
msg
.
mumbleArray
valueAtIndex
:
4
],
EnumTestMsg_MyEnum_NegTwo
);
// Bounce to wire and back.
msgPrime
=
[
EnumTestMsg
parseFromData
:[
msg
data
]
error
:
NULL
];
data
=
[
msg
data
];
XCTAssertNotNil
(
data
);
msgPrime
=
[
EnumTestMsg
parseFromData
:
data
error
:
NULL
];
XCTAssertEqualObjects
(
msgPrime
,
msg
);
XCTAssertEqual
([
msgPrime
.
mumbleArray
valueAtIndex
:
0
],
EnumTestMsg_MyEnum_Zero
);
...
...
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