Jump to content
Sign in to follow this  
Jon

Worst AutoIt Bug Award

Recommended Posts

jvanegmond

If the variant class still has the operators overloaded, I can see why someone could make an easy mistake like that.

Share this post


Link to post
Share on other sites
Valik

If it's casting away const it's doing so using the C cast method:

Find all "const_cast", Subfolders, Find Results 1, "Entire Solution"
  C:\Data\My Programs\C++\Autoit\autoit\src\script_inet.cpp(336):       // const_cast is used here because the function expects LPVOID.  The casts are safe, though.
  C:\Data\My Programs\C++\Autoit\autoit\src\script_inet.cpp(337):       InternetSetOption(hInet, INTERNET_OPTION_PROXY_USERNAME, const_cast<LPTSTR>(sProxyUser.c_str()), static_cast<DWORD>(sProxyUser.length() + 1) );
  C:\Data\My Programs\C++\Autoit\autoit\src\script_inet.cpp(338):       InternetSetOption(hInet, INTERNET_OPTION_PROXY_PASSWORD, const_cast<LPTSTR>(sProxyPass.c_str()), static_cast<DWORD>(sProxyPass.length() + 1));
  C:\Data\My Programs\C++\Autoit\autoit\src\CreateProcessSimple.cpp(206):   ProfileInfo.lpUserName = const_cast<LPWSTR>(lpUsername);
  C:\Data\My Programs\C++\Autoit\autoit\src\script_inet.cpp(336):       // const_cast is used here because the function expects LPVOID.  The casts are safe, though.
  C:\Data\My Programs\C++\Autoit\autoit\src\script_inet.cpp(337):       InternetSetOption(hInet, INTERNET_OPTION_PROXY_USERNAME, const_cast<LPTSTR>(sProxyUser.c_str()), static_cast<DWORD>(sProxyUser.length() + 1) );
  C:\Data\My Programs\C++\Autoit\autoit\src\script_inet.cpp(338):       InternetSetOption(hInet, INTERNET_OPTION_PROXY_PASSWORD, const_cast<LPTSTR>(sProxyPass.c_str()), static_cast<DWORD>(sProxyPass.length() + 1));
  C:\Data\My Programs\C++\Autoit\autoit\src\CreateProcessSimple.cpp(206):   ProfileInfo.lpUserName = const_cast<LPWSTR>(lpUsername);
  Matching lines: 8 Matching files: 4   Total files searched: 294

I wrote all those const_cast and all of them are correct. My code is const-correct, the C API we are using is not, thus I must cast away const.

Edited by Valik

Share this post


Link to post
Share on other sites
Richard Robertson

Is that worst as in the bug report being difficult or worst as in "why is the splash modifying the variable"?

Share this post


Link to post
Share on other sites
Valik

Ugh. _tcstok() modifies the string, that's why it doesn't take a fucking constant. Sigh. Wonder how many more stupid lines like that are in the code?

Share this post


Link to post
Share on other sites
funkey

Funny function Mandar! :huh2:

Func StringGetFirstLine($str)
    SplashTextOn("", $str, -10, -10, 0, 0, 32 + 1)
    SplashOff()
    Return $str
EndFunc

Now it is perfect! ;)


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×