Skip to content

Commit fbc6857

Browse files
Apple Open Sourceopensource-apple
authored andcommitted
1 parent 9e50c05 commit fbc6857

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

URL.subproj/CFURL.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,24 +1405,24 @@ static void computeSanitizedString(CFURLRef url) {
14051405
if (!scanCharacters(alloc, & sanitizedString, &(((struct __CFURL *)url)->_flags), cstring, ustring, useCString, base, string_length, &mark, 0, url->_encoding)) {
14061406
((struct __CFURL *)url)->_flags |= ORIGINAL_AND_URL_STRINGS_MATCH;
14071407
}
1408-
if ( sanitizedString )
1409-
_setSanitizedString( (struct __CFURL*) url, sanitizedString );
1408+
if ( sanitizedString ) {
1409+
_setSanitizedString( (struct __CFURL*) url, sanitizedString );
1410+
}
14101411
} else {
14111412
// Go component by component
14121413
CFIndex currentComponent = HAS_USER;
14131414
mark = 0;
1415+
CFMutableStringRef sanitizedString = NULL;
14141416
while (currentComponent < (HAS_FRAGMENT << 1)) {
14151417
CFRange componentRange = _rangeForComponent(url->_flags, url->ranges, currentComponent);
14161418
if (componentRange.location != kCFNotFound) {
1417-
CFMutableStringRef sanitizedString = NULL;
14181419
scanCharacters(alloc, & sanitizedString, &(((struct __CFURL *)url)->_flags), cstring, ustring, useCString, componentRange.location, componentRange.location + componentRange.length, &mark, currentComponent, url->_encoding);
1419-
1420-
if ( sanitizedString )
1421-
_setSanitizedString( (struct __CFURL*) url, sanitizedString );
14221420
}
14231421
currentComponent = currentComponent << 1;
14241422
}
1425-
if (!_getSanitizedString(url)) {
1423+
if (sanitizedString) {
1424+
_setSanitizedString((struct __CFURL *)url, sanitizedString);
1425+
} else {
14261426
((struct __CFURL *)url)->_flags |= ORIGINAL_AND_URL_STRINGS_MATCH;
14271427
}
14281428
}

0 commit comments

Comments
 (0)