Minor changes proposed for compiling in Win32/GCC


#1

Hello,

Latest GIT version doens’t compile on GCC/Win32 because of the flag INTERNET_OPTION_DISABLE_AUTODIAL in the file file src/native\windows\juce_win32_Network.cpp. I’ve added the definition at the top of the file in the same way as the flag INTERNET_FLAG_NEED_FILE, which is already defined there:

#ifndef INTERNET_OPTION_DISABLE_AUTODIAL #define INTERNET_OPTION_DISABLE_AUTODIAL 70 #endif
Also, compiling in Win32/GCC produces two minor warnings that can be easily fixed. Here are the fixes, if you want to add them to the official JUCE code. First line is the original, sencond line is the modified:

In src/native/windows/juce_win32_Files.cpp, line 541:

[code]- if (VerQueryValue (buffer, _T("\"), (LPVOID*) &vffi, &len))

  •    if (VerQueryValue (buffer, (LPTSTR)_T("\\"), (LPVOID*) &vffi, &len))[/code]
    

In src/native/windows/juce_win32_PlatformUtils.cpp, line 58:

[code]- if (RegCreateKeyEx (rootKey, name, 0, L"", REG_OPTION_NON_VOLATILE,

  •        if (RegCreateKeyEx (rootKey, name, 0, NULL, REG_OPTION_NON_VOLATILE,
                               (KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS[/code]
    

I’ve verifed that these changes produce clean compilations in both GCC (TDM-MinGW 4.4.1) and MSVC (Express 8.0), debug and release.


#2

Thanks! The first two changes look fine, but the MSDN docs specifically say that the RegCreateKeyEx param can’t be null! Why did you need to change it?


#3

The second parameter of RegCreateKeyEx is mandatory, but the fourth one is optional (http://msdn.microsoft.com/en-us/library/ms724844(VS.85).aspx). Maybe you read it too fast? :stuck_out_tongue:

[quote]lpClass [in, optional]
The user-defined class type of this key. This parameter may be ignored. This parameter can be NULL.[/quote]
The original code produces this warning in GCC:

src\native/windows/juce_win32_PlatformUtils.cpp:59: warning: deprecated conversion from string constant to ‘WCHAR*’

So it’s just a matter of producing clean compilation in GCC without these warnings. In my main project I extensively use RegCreateKeyEx with NULL in the 4th parameter, everything working fine.
Thanks!


#4

Ah, I was indeed reading the wrong parameter there, you’re quite right, it should be null! Your other changes are already done, I’ll add that one too in my next check-in.


#5

Great, thanks!