Open Bug 1048391 Opened 10 years ago Updated 2 years ago

Implicit conversion of signed to unsigned in |AddToHash| generates warnings

Categories

(Core :: MFBT, defect)

defect

Tracking

()

People

(Reporter: erahm, Unassigned)

References

Details

This is a follow up to bug 1047176, comment 11. On Windows (at least) with WAE enabled this causes build failures.

> Comment on attachment 8466344 [details] [diff] [review]
> Part 3: Cast to unsigned char in HashString
> 
> Review of attachment 8466344 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I think the right place to fix this is in the AddToHash overload the
> compiler is actually complaining about.  Something like:
> 
> template<typename A>
> MOZ_WARN_UNUSED_RESULT inline uint32_t
> AddToHash(uint32_t aHash, A aA)
> {
>   return detail::AddU32ToHash(aHash, static_cast<MakeUnsigned<A>::Type>(aA));
> }
> 
> but probably with some more smarts to deal with 64-bit |A| types, so that
> any errors we might have gotten from the implicit cast previously are not
> silenced by the explicit cast we now use.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.