Explicitly cast to uin16_t to avoid an invalid implicit type narrowing.
authorgeorge@mozilla.com <george@mozilla.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 27 Aug 2012 19:31:10 +0000 (19:31 +0000)
committergeorge@mozilla.com <george@mozilla.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 27 Aug 2012 19:31:10 +0000 (19:31 +0000)
This was causing a build failure on OS X for us:

SkOTTable_head.h:124:72: error: non-type template argument evaluates to -2, which cannot be narrowed to type 'uint16_t' (aka 'unsigned short') [-Wc++11-narrowing]

Review URL: https://codereview.appspot.com/6482067

git-svn-id: http://skia.googlecode.com/svn/trunk@5290 2bbb7eff-a529-9590-31e7-b0007b416f81

src/sfnt/SkOTTable_head.h

index 67b696f..3d2c0f1 100644 (file)
@@ -120,8 +120,8 @@ struct SkOTTableHead {
             ((FullyMixedDirectionalGlyphs, SkTEndian_SwapBE16(0)))
             ((OnlyStronglyLTR, SkTEndian_SwapBE16(1)))
             ((StronglyLTR, SkTEndian_SwapBE16(2)))
-            ((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(-1))))
-            ((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(-2))))
+            ((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16((uint16_t)-1))))
+            ((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16((uint16_t)-2))))
             SK_SEQ_END,
         (value)SK_SEQ_END)
     } fontDirectionHint;