Skip to content

Commit b74af0a

Browse files
committed
Add support and tests for URLComponents.percentEncodedQueryItems
- rdar://59439703 (URLComponents.percentEncodedQueryItems missing on linux) Fixes from @millenomi - Constant strings must be correctly memory-managed in SCF. - Do not associate API availability to CFURLComponents calls when compiling SCF on Darwin
1 parent 908227d commit b74af0a

File tree

5 files changed

+357
-70
lines changed

5 files changed

+357
-70
lines changed

CoreFoundation/URL.subproj/CFURLComponents.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ static CFArrayRef _CFURLComponentsCopyQueryItemsInternal(CFURLComponentsRef comp
12821282
}
12831283
}
12841284
else {
1285-
nameString = CFSTR("");
1285+
nameString = CFRetain(CFSTR(""));
12861286
}
12871287
CFTypeRef keys[] = {_kCFURLComponentsNameKey};
12881288
CFTypeRef values[] = {nameString};
@@ -1343,7 +1343,7 @@ static CFArrayRef _CFURLComponentsCopyQueryItemsInternal(CFURLComponentsRef comp
13431343
}
13441344
}
13451345
else {
1346-
nameString = CFSTR("");
1346+
nameString = CFRetain(CFSTR(""));
13471347
}
13481348
CFTypeRef keys[] = {_kCFURLComponentsNameKey};
13491349
CFTypeRef values[] = {nameString};
@@ -1464,6 +1464,8 @@ static Boolean _CFURLComponentsSetQueryItemsInternal(CFURLComponentsRef componen
14641464
return ( result );
14651465
}
14661466

1467+
1468+
14671469
CF_EXPORT void _CFURLComponentsSetQueryItems(CFURLComponentsRef components, CFArrayRef names, CFArrayRef values ) {
14681470
(void)_CFURLComponentsSetQueryItemsInternal(components, names, values, true); // _CFURLComponentsSetQueryItemsInternal cannot fail if addPercentEncoding is true
14691471
}

0 commit comments

Comments
 (0)