advpack: Sign-compare warnings fix (Resend)
Michael Stefaniuc
mstefani at redhat.com
Mon Jul 14 14:28:52 CDT 2008
Andrew Talbot wrote:
> Is there anything wrong with this patch, please?
If I might venture a guess it's probably because of the casts. Casts are
evil if not really needed and using casts to get rid of the sign
comparison warnings is debatable at best.
> ---
> Changelog:
> advpack: Sign-compare warnings fix.
>
> diff --git a/dlls/advpack/files.c b/dlls/advpack/files.c
> index 5e9ce30..43c07ea 100644
> --- a/dlls/advpack/files.c
> +++ b/dlls/advpack/files.c
> @@ -709,7 +709,7 @@ HRESULT WINAPI ExtractFilesA(LPCSTR CabName, LPCSTR ExpandDir, DWORD Flags,
> if (FileList)
> {
> szConvertedList = convert_file_list(FileList, &dwFileCount);
> - if (!szConvertedList || dwFileCount == -1)
> + if (!szConvertedList || (LONG)dwFileCount == -1)
This one could be replaced by a comparison with either "-1u" or "~0".
> {
> res = E_FAIL;
> goto done;
> diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c
> index c5a5df0..05a7232 100644
> --- a/dlls/advpack/install.c
> +++ b/dlls/advpack/install.c
> @@ -41,7 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack);
> #define SPAPI_MASK 0xFFFFL
> #define HRESULT_FROM_SPAPI(x) ((x & SPAPI_MASK) | SPAPI_PREFIX)
>
> -#define ADV_HRESULT(x) ((x & SPAPI_ERROR) ? HRESULT_FROM_SPAPI(x) : HRESULT_FROM_WIN32(x))
> +#define ADV_HRESULT(x) ((x & SPAPI_ERROR) ? HRESULT_FROM_SPAPI(x) : (DWORD)HRESULT_FROM_WIN32(x))
>
> #define ADV_SUCCESS 0
> #define ADV_FAILURE 1
>
>
bye
michael
More information about the wine-devel
mailing list