[vlc-devel] [PATCHv3 01/12] add a new type of module: vlc_renderer
Rémi Denis-Courmont
remi at remlab.net
Thu Mar 31 12:42:14 CEST 2016
Le 2016-03-31 10:16, Steve Lhomme a écrit :
>>> +bool
>>> +vlc_renderer_equals(vlc_renderer *p_renderer, const char
>>> *psz_renderer)
>>
>> Again: don´t do that. This function does not work and it never will.
>>
>>> +{
>>> + assert(p_renderer->target.psz_protocol != NULL
>>> + && p_renderer->target.psz_host != NULL);
>>> +
>>> + vlc_url_t url;
>>> + vlc_UrlParse(&url, psz_renderer);
>>> + if (url.psz_protocol == NULL || url.psz_host == NULL)
>>> + {
>>> + vlc_UrlClean(&url);
>>> + return false;
>>> + }
>>> + const char *psz_option1 = p_renderer->target.psz_option !=
>>> NULL
>>> + ? p_renderer->target.psz_option : "";
>>> + const char *psz_option2 = url.psz_option != NULL ?
>>> url.psz_option : "";
>>> + bool b_ret = !strcmp(p_renderer->target.psz_protocol,
>>> url.psz_protocol) + &&
>>> !strcmp(p_renderer->target.psz_host,
>>> url.psz_host) + && !strcmp(psz_option1, psz_option2)
>>> + && p_renderer->target.i_port == url.i_port;
>>> + vlc_UrlClean(&url);
>>> + return b_ret;
>>> +}
>
> So the solution is to copy all these lines everywhere we need them ?
No. The solution is to not depend on uniform resource comparison.
> With possible bugs are at every different copy ?
This function even fails to compare URLs correctly, let alone compare
actual resources.
> And yes it works as it is and we use it.
Except that is impossible. There are no defined methods to compare
uniform resources for equivalence/equality; the exact semantics are an
implementation detail of the respective origin server.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list