xbmc/xbmc — pull request #4980 by jmarshallnz (2014-07-03 01:46:20+00:00)
Title: Url protocol compares

This small series focuses on the comparing of URL protocols, in particular for determining protocol type.

While paths in XBMC are generally compared case-sensitive (in particular, anything that ends up in a database anywhere) and while protocols are generally lower-case (CURL forces this at the moment) nevertheless, we shouldn't really be comparing protocols all over the show using functions for strings - rather we should have a central place to determine whether a URL has a particular protocol or not.

This is a start on that, dealing only with CURL and URIUtils, where most of this happens. Note that the comparison here is case-insensitive in CURL, as it's lower-cased there anyway in SetProtocol().

The introduced function URIUtils::PathStart() on the other hand has been made case-sensitive, as that compares longer portions of the path than just the protocol, thus may contain portions that should be compared case-sensitive.

Long-term, moving to using CURL where reasonable rather than converting to/from all the time should be the goal regardless - at least by having a set of functions for the common operations, we don't have to grep the code for string utility functions for finding path compares.

Assuming this is accepted, I'll rebase the stdstring removal series on this as we'll hit a bunch of cases for use of these two functions as we go. We may also need a few more, but we'll see how we go.

@Karlson2k, @Montellese your thoughts?