<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>I getting the following warnings using a basic Xcode 5 project to build HarfBuzz 0.9.23 (with hb-ft) on Mac OS X, targeting 10.6, 32-bit Intel (i386), using the default compiler (Apple LLVM 5.0).</div>
<div><br>
</div>
<div>harfbuzz/src/hb-font-private.hh:121:42: Implicit conversion loses integer precision: 'long long' to 'hb_position_t' (aka 'int')</div>
<div>harfbuzz/src/hb-font-private.hh:126:42: Implicit conversion loses integer precision: 'long long' to 'hb_position_t' (aka 'int')</div>
<div>harfbuzz/src/hb-font-private.hh:400:85: Implicit conversion loses integer precision: 'long long' to 'hb_position_t' (aka 'int')</div>
<div>harfbuzz/src/hb-ot-layout-common-private.hh:1115:37: Implicit conversion loses integer precision: 'long long' to 'int'</div>
<div>harfbuzz/src/hb-ft.cc:421:97: Implicit conversion loses integer precision: 'unsigned long long' to 'int'</div>
<div>harfbuzz/src/hb-ft.cc:422:97: Implicit conversion loses integer precision: 'unsigned long long' to 'int'</div>
<div><br>
</div>
<div><br>
</div>
<div>All the cases seem to be multiplying by a scale casted to int64 to prevent overflow, then dividing by the scale. Explicitly casting the result silences the warnings. Is there a better solution?</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Scott Fleischman</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh</div>
<div>index 00c0cc3..aa6c515 100644</div>
<div>--- a/src/hb-font-private.hh</div>
<div>+++ b/src/hb-font-private.hh</div>
<div>@@ -118,12 +118,12 @@ struct hb_font_t {</div>
<div> /* Convert from parent-font user-space to our user-space */</div>
<div> inline hb_position_t parent_scale_x_distance (hb_position_t v) {</div>
<div> if (unlikely (parent && parent->x_scale != x_scale))</div>
<div>- return v * (int64_t) this->x_scale / this->parent->x_scale;</div>
<div>+ return (hb_position_t) (v * (int64_t) this->x_scale / this->parent->x_scale);</div>
<div> return v;</div>
<div> }</div>
<div> inline hb_position_t parent_scale_y_distance (hb_position_t v) {</div>
<div> if (unlikely (parent && parent->y_scale != y_scale))</div>
<div>- return v * (int64_t) this->y_scale / this->parent->y_scale;</div>
<div>+ return (hb_position_t) (v * (int64_t) this->y_scale / this->parent->y_scale);</div>
<div> return v;</div>
<div> }</div>
<div> inline hb_position_t parent_scale_x_position (hb_position_t v) {</div>
<div>@@ -397,7 +397,7 @@ struct hb_font_t {</div>
<div> }</div>
<div> </div>
<div> private:</div>
<div>- inline hb_position_t em_scale (int16_t v, int scale) { return v * (int64_t) scale / face->get_upem (); }</div>
<div>+ inline hb_position_t em_scale (int16_t v, int scale) { return (hb_position_t) (v * (int64_t) scale / face->get_upem ()); }</div>
<div> };</div>
<div> </div>
<div> #define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS</div>
<div>diff --git a/src/hb-ft.cc b/src/hb-ft.cc</div>
<div>index 113b0eb..44e0b0b 100644</div>
<div>--- a/src/hb-ft.cc</div>
<div>+++ b/src/hb-ft.cc</div>
<div>@@ -418,8 +418,8 @@ hb_ft_font_create (FT_Face ft_face,</div>
<div> _hb_ft_get_font_funcs (),</div>
<div> ft_face, (hb_destroy_func_t) _do_nothing);</div>
<div> hb_font_set_scale (font,</div>
<div>- ((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16,</div>
<div>- ((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16);</div>
<div>+ (int) (((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16),</div>
<div>+ (int) (((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16));</div>
<div> hb_font_set_ppem (font,</div>
<div> ft_face->size->metrics.x_ppem,</div>
<div> ft_face->size->metrics.y_ppem);</div>
<div>diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh</div>
<div>index 1e75930..367db95 100644</div>
<div>--- a/src/hb-ot-layout-common-private.hh</div>
<div>+++ b/src/hb-ot-layout-common-private.hh</div>
<div>@@ -1112,7 +1112,7 @@ struct Device</div>
<div> </div>
<div> if (!pixels) return 0;</div>
<div> </div>
<div>- return pixels * (int64_t) scale / ppem;</div>
<div>+ return (int) (pixels * (int64_t) scale / ppem);</div>
<div> }</div>
</div>
<div><br>
</div>
</body>
</html>