mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 21:00:50 +00:00
Bug 1540357 - Fix implicit int truncation in dom/canvas's dom/* includes. r=qdot
Depends on D25496 Differential Revision: https://phabricator.services.mozilla.com/D25497 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
e6f79726e5
commit
2f84637131
@ -910,7 +910,8 @@ inline SelectionTypeMask ToSelectionTypeMask(SelectionType aSelectionType) {
|
||||
MOZ_ASSERT(aSelectionType != SelectionType::eInvalid);
|
||||
return aSelectionType == SelectionType::eNone
|
||||
? 0
|
||||
: (1 << (static_cast<uint8_t>(aSelectionType) - 1));
|
||||
: static_cast<SelectionTypeMask>(
|
||||
1 << (static_cast<uint8_t>(aSelectionType) - 1));
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -102,7 +102,7 @@ inline float UInt8bitToAudioSample<float>(uint8_t aValue) {
|
||||
}
|
||||
template <>
|
||||
inline int16_t UInt8bitToAudioSample<int16_t>(uint8_t aValue) {
|
||||
return (int16_t(aValue) << 8) + aValue + INT16_MIN;
|
||||
return static_cast<int16_t>((aValue << 8) + aValue + INT16_MIN);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -126,7 +126,7 @@ inline float Int24bitToAudioSample<float>(int32_t aValue) {
|
||||
}
|
||||
template <>
|
||||
inline int16_t Int24bitToAudioSample<int16_t>(int32_t aValue) {
|
||||
return aValue / 256;
|
||||
return static_cast<int16_t>(aValue / 256);
|
||||
}
|
||||
|
||||
template <typename SrcT, typename DstT>
|
||||
|
@ -46,7 +46,8 @@ class SVGAnimatedPreserveAspectRatio final {
|
||||
if (aAlign < SVG_ALIGN_MIN_VALID || aAlign > SVG_ALIGN_MAX_VALID) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
SetBaseValue(SVGPreserveAspectRatio(aAlign, mBaseVal.GetMeetOrSlice()),
|
||||
SetBaseValue(SVGPreserveAspectRatio(static_cast<uint8_t>(aAlign),
|
||||
mBaseVal.GetMeetOrSlice()),
|
||||
aSVGElement);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -56,7 +57,8 @@ class SVGAnimatedPreserveAspectRatio final {
|
||||
aMeetOrSlice > SVG_MEETORSLICE_MAX_VALID) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
SetBaseValue(SVGPreserveAspectRatio(mBaseVal.GetAlign(), aMeetOrSlice),
|
||||
SetBaseValue(SVGPreserveAspectRatio(mBaseVal.GetAlign(),
|
||||
static_cast<uint8_t>(aMeetOrSlice)),
|
||||
aSVGElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class SVGPreserveAspectRatio final {
|
||||
mMeetOrSlice(
|
||||
dom::SVGPreserveAspectRatio_Binding::SVG_MEETORSLICE_UNKNOWN) {}
|
||||
|
||||
SVGPreserveAspectRatio(uint16_t aAlign, uint16_t aMeetOrSlice)
|
||||
SVGPreserveAspectRatio(uint8_t aAlign, uint8_t aMeetOrSlice)
|
||||
: mAlign(aAlign), mMeetOrSlice(aMeetOrSlice) {}
|
||||
|
||||
static nsresult FromString(const nsAString& aString,
|
||||
@ -59,7 +59,7 @@ class SVGPreserveAspectRatio final {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint16_t GetAlign() const { return mAlign; }
|
||||
auto GetAlign() const { return mAlign; }
|
||||
|
||||
nsresult SetMeetOrSlice(uint16_t aMeetOrSlice) {
|
||||
if (aMeetOrSlice < SVG_MEETORSLICE_MIN_VALID ||
|
||||
@ -69,7 +69,7 @@ class SVGPreserveAspectRatio final {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint16_t GetMeetOrSlice() const { return mMeetOrSlice; }
|
||||
auto GetMeetOrSlice() const { return mMeetOrSlice; }
|
||||
|
||||
PLDHashNumber Hash() const { return HashGeneric(mAlign, mMeetOrSlice); }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user