Bug 1317588 Part 5 - Change Side's operator++ from postfix to prefix. r=mats
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 23 Nov 2016 16:55:04 +0800
changeset 324065 0c03c2ddda3a4e58295c9f3e1670237cd8b75fb9
parent 324064 88f2c7f0a24a5d7e1f82769ae24aed5c0cf9bed7
child 324066 d430f267791ea1ca694ab1da5a6669e62dad406f
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersmats
bugs1317588
milestone53.0a1
Bug 1317588 Part 5 - Change Side's operator++ from postfix to prefix. r=mats 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
gfx/2d/Types.h
--- 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