Bug 1317588 Part 5 - Change Side's operator++ from postfix to prefix.
The postfix operator++ was actually incorrectly implemented as a prefix
version. Since it's only used in NS_FOR_CSS_SIDES, let's changed it to
prefix version.
MozReview-Commit-ID: GbdB2ZC9KyW
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -402,19 +402,19 @@ enum SideBits {
// We use an int32_t helper variable (instead of a Side) for our loop counter,
// to avoid triggering undefined behavior just before we exit the loop (at
// which point the counter is incremented beyond the largest valid Side value).
#define NS_FOR_CSS_SIDES(var_) \
int32_t MOZ_CONCAT(var_,__LINE__) = mozilla::eSideTop; \
for (mozilla::Side var_; \
MOZ_CONCAT(var_,__LINE__) <= mozilla::eSideLeft && \
((var_ = mozilla::Side(MOZ_CONCAT(var_,__LINE__))), true); \
- MOZ_CONCAT(var_,__LINE__)++)
+ ++MOZ_CONCAT(var_,__LINE__))
-static inline Side operator++(Side& side, int) {
+static inline Side& operator++(Side& side) {
MOZ_ASSERT(side >= eSideTop && side <= eSideLeft,
"Out of range side");
side = Side(side + 1);
return side;
}
} // namespace mozilla