wininet: Implement InternetCreateUrlA/W with test cases

James Hawkins truiken at
Fri Oct 28 12:29:04 CDT 2005

On 10/28/05, Juan Lang <juan_lang at> wrote:
> Hi James,
> +/* max port num is 655936 => 6 digits */
> Actually, it's 65535.  A correct comment would be appreciated ;)

InternetCreateUrl doesn't check whether it's a valid port number or
not.  The comment is about the maximum value for the port number in
the context of InternetCreateUrl which is the greatest value of a WORD
value before it overflows.

> +    *lpdwUrlLength += strlen("://");
> You should use sizeof instead to avoid the call to strlen.  Same for other
> lengths you use, like "@" and ":".

I disagree.  sizeof belies the intent of the code, whereas strlen is a
better rerpesentative of the fact that im taking the length of a
string.  The time saved using sizeof isn't worth it to me.  If it
doesn't get accepted because of that, I'll change it, but I think it's
fine right now.

> +    if (lpUrlComponents->nPort != 80 ||
> This seems a bit funny.  Port 80 has no meaning for INTERNET_SCHEME_FTP or
> any other non-HTTP protocol, does it?

It won't matter because the port number is always displayed for
non-HTTP protocols, so this is just a quick short-circuit.  You can
think of it list this: if the port number is not 80 it will always be
displayed, but if it is 80, it will only be displayed if the scheme is
not HTTP.

James Hawkins

More information about the wine-devel mailing list