Skip to content

Commit 99fe799

Browse files
committed
Merge branch 'ChrisChares-NSHTTPCookie'
2 parents f26787c + ab51ff1 commit 99fe799

40 files changed

+1700
-165
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ project.xcworkspace
1515

1616
Build
1717
.build
18+
.configuration
1819

CONTRIBUTING.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributing
2+
3+
Contributions to Foundation are welcome! This project follows the [contribution guidelines for the Swift project](https://swift.org/contributing/#contributing-code). A few additional details are outlined below.
4+
5+
## Licensing
6+
7+
By submitting a pull request, you represent that you have the right to license your contribution to Apple and the community, and agree by submitting the patch that your contributions are licensed under the [Swift license](https://swift.org/LICENSE.txt).
8+
9+
10+
## Bug Reports
11+
12+
You can use the `Foundation` component in the [bug reporter](https://bugs.swift.org) if you know your bug is specifically about Swift Foundation.
13+
14+
Please remember to include platform information with your report. If the bug is about the Foundation framework on Darwin, then please use the [Apple bug reporting system](https://bugreport.apple.com).
15+
16+
## Pull Requests
17+
18+
Before embarking on a large amount of work to implement missing functionality, please double-check with the community on the [swift-corelibs-dev](https://lists.swift.org/mailman/listinfo/swift-corelibs-dev) mailing list. Someone may already be working in this area, and we want to avoid duplication of work.
19+
20+
If your request includes functionality changes, please be sure to test your code on Linux as well as OS X. Differences in the compiler and runtime on each platform means that code that compiles and runs correctly on Darwin (where the Objective-C runtime is present) may not compile at all on Linux.
21+
22+
##### Review
23+
24+
Each pull request will be reviewed by a code owner before merging.
25+
26+
* Pull requests should contain small, incremental change.
27+
* Focus on one task. If a pull request contains several unrelated commits, we will ask for the pull request to be split up.
28+
* Please squash work-in-progress commits. Each commit should stand on its own (including the addition of tests if possible). This allows us to bisect issues more effectively.
29+
* After addressing review feedback, please rebase your commit so that we create a clean history in the `master` branch.
30+
31+
##### Tests
32+
33+
All pull requests which contain code changes should come with a new set of automated tests, and every current test must pass on all supported platforms.
34+
35+
##### Documentation
36+
37+
Most of the methods in Foundation are lacking documentation. We appreciate your help in filling out documentation when you implement a method. Use the markdown syntax in the [Swift Naming Guidelines](https://swift.org/documentation/api-design-guidelines.html#write-doc-comment).
38+
39+
## API Changes
40+
41+
The interface of Foundation is intended to be both stable and cross-platform. This means that when API is added to Foundation, it is effectively permanent.
42+
43+
It is therefore critical that any code change that affects the public-facing API go through a full `swift-evolution` review process. This gives us the chance to ensure several important requirements are satisfied:
44+
45+
* The proposal aligns with our current goals for the upcoming release.
46+
* We are comfortable supporting the proposed API for the long term.
47+
* We believe we can make the same change to the API of Darwin Foundation. This could be done via changes in the overlay, changes in the compiler, or changes in Darwin Foundation itself. This must be addressed in every proposal.

CoreFoundation/Base.subproj/CFBase.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,15 @@ CF_EXTERN_C_BEGIN
231231
#define CF_AUTOMATED_REFCOUNT_UNAVAILABLE
232232
#endif
233233

234+
#if DEPLOYMENT_RUNTIME_SWIFT
235+
#ifndef CF_ASSUME_NONNULL_BEGIN
236+
#define CF_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
237+
#endif
238+
#ifndef CF_ASSUME_NONNULL_BEGIN
239+
#define CF_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
240+
#endif
241+
#endif
242+
234243
#ifndef CF_IMPLICIT_BRIDGING_ENABLED
235244
#if __has_feature(arc_cf_code_audited)
236245
#define CF_IMPLICIT_BRIDGING_ENABLED _Pragma("clang arc_cf_code_audited begin")

CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@
1111
#ifndef __COREFOUNDATION_FORSWIFTFOUNDATIONONLY__
1212
#define __COREFOUNDATION_FORSWIFTFOUNDATIONONLY__ 1
1313

14-
#define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
15-
#define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
16-
1714
#include <CoreFoundation/CFBase.h>
1815
#include <CoreFoundation/CFNumber.h>
1916
#include <CoreFoundation/CFLocaleInternal.h>
2017
#include <CoreFoundation/CFCalendar.h>
18+
#include <CoreFoundation/CFXMLInterface.h>
19+
#include <fts.h>
2120

22-
#import <fts.h>
23-
24-
NS_ASSUME_NONNULL_BEGIN
21+
CF_ASSUME_NONNULL_BEGIN
2522

2623
struct __CFSwiftObject {
2724
uintptr_t isa;
@@ -115,6 +112,68 @@ struct _NSMutableStringBridge {
115112
void (*_cfAppendCString)(CFTypeRef str, const char *chars, CFIndex appendLength);
116113
};
117114

115+
struct _NSXMLParserBridge {
116+
_CFXMLInterface _Nullable (*_Nonnull currentParser)();
117+
_CFXMLInterfaceParserInput _Nonnull (*_Nonnull _xmlExternalEntityWithURL)(_CFXMLInterface interface, const char *url, const char * identifier, _CFXMLInterfaceParserContext context, _CFXMLInterfaceExternalEntityLoader originalLoaderFunction);
118+
119+
_CFXMLInterfaceParserContext _Nonnull (*_Nonnull getContext)(_CFXMLInterface ctx);
120+
121+
void (*internalSubset)(_CFXMLInterface ctx, const unsigned char *name, const unsigned char *ExternalID, const unsigned char *SystemID);
122+
int (*isStandalone)(_CFXMLInterface ctx);
123+
int (*hasInternalSubset)(_CFXMLInterface ctx);
124+
int (*hasExternalSubset)(_CFXMLInterface ctx);
125+
_CFXMLInterfaceEntity _Nonnull (*_Nonnull getEntity)(_CFXMLInterface ctx, const unsigned char *name);
126+
void (*notationDecl)(_CFXMLInterface ctx,
127+
const unsigned char *name,
128+
const unsigned char *publicId,
129+
const unsigned char *systemId);
130+
void (*attributeDecl)(_CFXMLInterface ctx,
131+
const unsigned char *elem,
132+
const unsigned char *fullname,
133+
int type,
134+
int def,
135+
const unsigned char *defaultValue,
136+
_CFXMLInterfaceEnumeration tree);
137+
void (*elementDecl)(_CFXMLInterface ctx,
138+
const unsigned char *name,
139+
int type,
140+
_CFXMLInterfaceElementContent content);
141+
void (*unparsedEntityDecl)(_CFXMLInterface ctx,
142+
const unsigned char *name,
143+
const unsigned char *publicId,
144+
const unsigned char *systemId,
145+
const unsigned char *notationName);
146+
void (*startDocument)(_CFXMLInterface ctx);
147+
void (*endDocument)(_CFXMLInterface ctx);
148+
void (*startElementNs)(_CFXMLInterface ctx,
149+
const unsigned char *localname,
150+
const unsigned char *prefix,
151+
const unsigned char *URI,
152+
int nb_namespaces,
153+
const unsigned char *_Nonnull *_Nonnull namespaces,
154+
int nb_attributes,
155+
int nb_defaulted,
156+
const unsigned char *_Nonnull *_Nonnull attributes);
157+
void (*endElementNs)(_CFXMLInterface ctx,
158+
const unsigned char *localname,
159+
const unsigned char *prefix,
160+
const unsigned char *URI);
161+
void (*characters)(_CFXMLInterface ctx,
162+
const unsigned char *ch,
163+
int len);
164+
void (*processingInstruction)(_CFXMLInterface ctx,
165+
const unsigned char *target,
166+
const unsigned char *data);
167+
void (*cdataBlock)(_CFXMLInterface ctx,
168+
const unsigned char *value,
169+
int len);
170+
void (*comment)(_CFXMLInterface ctx, const unsigned char *value);
171+
void (*externalSubset)(_CFXMLInterface ctx,
172+
const unsigned char *name,
173+
const unsigned char *ExternalID,
174+
const unsigned char *SystemID);
175+
};
176+
118177
struct _CFSwiftBridge {
119178
struct _NSObjectBridge NSObject;
120179
struct _NSArrayBridge NSArray;
@@ -125,6 +184,7 @@ struct _CFSwiftBridge {
125184
struct _NSMutableSetBridge NSMutableSet;
126185
struct _NSStringBridge NSString;
127186
struct _NSMutableStringBridge NSMutableString;
187+
struct _NSXMLParserBridge NSXMLParser;
128188
};
129189

130190
__attribute__((__visibility__("hidden"))) extern struct _CFSwiftBridge __CFSwiftBridge;
@@ -211,6 +271,6 @@ extern void _cf_uuid_unparse(const _cf_uuid_t uu, _cf_uuid_string_t out);
211271
extern void _cf_uuid_unparse_lower(const _cf_uuid_t uu, _cf_uuid_string_t out);
212272
extern void _cf_uuid_unparse_upper(const _cf_uuid_t uu, _cf_uuid_string_t out);
213273

214-
NS_ASSUME_NONNULL_END
274+
CF_ASSUME_NONNULL_END
215275

216276
#endif /* __COREFOUNDATION_FORSWIFTFOUNDATIONONLY__ */

CoreFoundation/NumberDate.subproj/CFNumber.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,7 @@ static inline void _CFNumberInit(CFNumberRef result, CFNumberType type, const vo
10991099
case kCFNumberFloat32Type: memmove((void *)&result->_pad, valuePtr, 4); break;
11001100
case kCFNumberFloat64Type: memmove((void *)&result->_pad, valuePtr, 8); break;
11011101
}
1102+
__CFBitfieldSetValue(((struct __CFNumber *)result)->_base._cfinfo[CF_INFO_BITS], 4, 0, (uint8_t)__CFNumberTypeTable[type].canonicalType);
11021103
}
11031104

11041105
CF_EXPORT void _CFNumberInitBool(CFNumberRef result, Boolean value) {

0 commit comments

Comments
 (0)