[urlmon 1/2] Cast-qual warning fix

Joris Huizer joris_huizer at yahoo.com
Wed Feb 7 05:56:24 CST 2007


--- Paul Vriens <paul.vriens.wine at gmail.com> wrote:

> Hi,
> 
> Fix a warning and remove the now not needed cast.
> 
> Changelog
>      Cast-qual warning fix
> 
> Cheers,
> 
> Paul.
> 
> 
> > diff --git a/dlls/urlmon/umon.c
b/dlls/urlmon/umon.c
> index 49260ab..d593c81 100644
> --- a/dlls/urlmon/umon.c
> +++ b/dlls/urlmon/umon.c
> @@ -1605,7 +1605,7 @@ HRESULT WINAPI
> URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller,
> LPCWSTR szURL, LPW
>      HRESULT hr;
>      LPWSTR ext;
>  
> -    static const WCHAR header[] = {
> +    static WCHAR header[] = {
>          'H','T','T','P','/','1','.','0','
> ','2','0','0',' ',
>         
> 'O','K','\\','r','\\','n','\\','r','\\','n',0
>      };
> @@ -1631,7 +1631,7 @@ HRESULT WINAPI
> URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller,
> LPCWSTR szURL, LPW
>      modified.dwLowDateTime = 0;
>  
>      if (!CommitUrlCacheEntryW(szURL, cache_path,
> expire, modified, NORMAL_CACHE_ENTRY,
> -                              (LPWSTR)header,
> sizeof(header), NULL, NULL))
> +                              header,
> sizeof(header), NULL, NULL))
>          return E_FAIL;
>  
>      if (lstrlenW(cache_path) > dwBufLength)
> -- 

If CommitUrlCacheEntryW does not take a constant
pointer, this might be dangerous - if it changes the
string, the next time this code executes the wrong
(modified) string gets used

If this is indeed possible, the static keyword needs
to be dropped too (ensuring the string is
reinitialised with the next call)

If it is only not possible in this particular case,
sorry for complaining; (though it may be possible to
factor out that part of the code that is used, thus
ensuring constness)

If this is not possible in general, the function
CommitUrlCacheEntryW should take a constant pointer
instead

(same for the other patch)
regards,

Joris


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com



More information about the wine-devel mailing list