diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx index ebf3700c667d..51468b472bd5 100644 --- a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx +++ b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx @@ -156,7 +156,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stor if (tmpLongVal > std::numeric_limits::max() ) tmpIntVal = std::numeric_limits::max(); else // Casting is safe here. - tmpIntVal = static_cast(tmpLongVal); + tmpIntVal = static_cast(tmpLongVal & 0xFFFFFFFF); tmpLongVal -= tmpIntVal; diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index 82930d0ba466..8bb22e06c956 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -450,24 +450,23 @@ static hchar s_hh2kssm(hchar hh) if (hh >= HCA_TG) return sal::static_int_cast(hhtg_tg[hh - HCA_TG]); if (idx == 0x1F) - hh = hh - 0x1F00 + 0x360; + hh = (hh - 0x1F00 + 0x360) & 0xFFFF; else { hh -= HCA_KSS; if (hh >= 0x360) hh += 0xC0; } - idx = hh / 0xC0 + 217; + idx = (hh / 0xC0 + 217) & 0xFFFF; i = hh % 0xC0; if (i >= 95) i -= 2; i += 48; if (i >= 127) i += 18; - return (idx << 8) | i; + return ((idx << 8) | i) & 0xFFFF; } - static hchar lineCharConv(hchar ch) { int flag; diff --git a/tools/source/misc/fix16.cxx b/tools/source/misc/fix16.cxx index 95104bbbb9de..b726acb8f660 100644 --- a/tools/source/misc/fix16.cxx +++ b/tools/source/misc/fix16.cxx @@ -70,7 +70,7 @@ fix16_t fix16_mul(fix16_t inArg0, fix16_t inArg1) return fix16_overflow; } - fix16_t result = static_cast(product >> 16); + fix16_t result = (product >> 16) & 0xFFFF; result += (product & 0x8000) >> 15; return result;