For the curious: Setup.exe char-> String patch
Gary R Van Sickle
tiberius@braemarinc.com
Fri Feb 1 18:27:00 GMT 2002
> +// does this character exist in the string?
> +// 0 is false, 1 is the first position...
> +size_t
> +String::find(char aChar) const
> +{
> + for (size_t i=0; i < theData->length; ++i)
> + if (theData->theString[i] == aChar)
> + return i;
> + return 0;
>
> ### Won't this return 0 if aChar is in the first position in
> theData->theString?
>
I think it would behoove us greatly to duplicate the semantics of
std::string here, and return a zero-based offset on success, and an "npos"
on failure.
> geturl.cc:
>
> static void
> -init_dialog (char const *url, int length, HWND owner)
> +init_dialog (String const url, int length, HWND owner)
^^^^^^^^^^^^^^^^
This would be better written "const String &url".
--
Gary R. Van Sickle
Braemar Inc.
11481 Rupp Dr.
Burnsville, MN 55337
More information about the Cygwin-patches
mailing list