Commit 70602f40 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Fixed broken if statements: unsigned < 0?

parent e027861c
...@@ -1137,7 +1137,8 @@ static void mb_shift_write( ...@@ -1137,7 +1137,8 @@ static void mb_shift_write(
for (i = 0; i < (quant + sh) / 8; i++) { for (i = 0; i < (quant + sh) / 8; i++) {
if (i == 0) { if (i == 0) {
unsigned char mask = ~0 << sh; unsigned char mask = ~0;
mask = mask << sh;
out[0] &= ~mask; out[0] &= ~mask;
out[0] |= mask & (in[0] << sh); out[0] |= mask & (in[0] << sh);
...@@ -1147,7 +1148,8 @@ static void mb_shift_write( ...@@ -1147,7 +1148,8 @@ static void mb_shift_write(
} }
} }
if ((quant + sh) % 8 != 0) { if ((quant + sh) % 8 != 0) {
unsigned char mask = ~0 << ((quant + sh) % 8); unsigned char mask = ~0;
mask = mask << ((quant + sh) % 8);
mask = ~mask; mask = ~mask;
out[i] &= ~mask; out[i] &= ~mask;
......
...@@ -986,7 +986,8 @@ static void mb_shift_write( ...@@ -986,7 +986,8 @@ static void mb_shift_write(
for (i = 0; i < (quant + sh) / 8; i++) { for (i = 0; i < (quant + sh) / 8; i++) {
if (i == 0) { if (i == 0) {
unsigned char mask = ~0 << sh; unsigned char mask = ~0;
mask = mask << sh;
out[0] &= ~mask; out[0] &= ~mask;
out[0] |= mask & (in[0] << sh); out[0] |= mask & (in[0] << sh);
...@@ -996,7 +997,8 @@ static void mb_shift_write( ...@@ -996,7 +997,8 @@ static void mb_shift_write(
} }
} }
if ((quant + sh) % 8 != 0) { if ((quant + sh) % 8 != 0) {
unsigned char mask = ~0 << ((quant + sh) % 8); unsigned char mask = ~0;
mask = mask << ((quant + sh) % 8);
mask = ~mask; mask = ~mask;
out[i] &= ~mask; out[i] &= ~mask;
......
...@@ -273,9 +273,13 @@ static pwr_tStatus IoCardRead( ...@@ -273,9 +273,13 @@ static pwr_tStatus IoCardRead(
/* Buttons */ /* Buttons */
idx = js.number; idx = js.number;
/*
// TODO:
// js.number is an unsigned 8-bit, which has a maximum value of 256.
// KEY_MAX - BTN_MISC = 511, so this is always false.
if (js.number < KEY_MAX - BTN_MISC) if (js.number < KEY_MAX - BTN_MISC)
idx = local->button_map[js.number]; idx = local->button_map[js.number];
else else */
break; break;
*(pwr_tBoolean*)cp->chanlist[idx].vbp = (js.value != 0); *(pwr_tBoolean*)cp->chanlist[idx].vbp = (js.value != 0);
......
...@@ -4595,23 +4595,27 @@ int sev_dbhdf5::check_deadband(pwr_eType type, unsigned int size, ...@@ -4595,23 +4595,27 @@ int sev_dbhdf5::check_deadband(pwr_eType type, unsigned int size,
} }
break; break;
case pwr_eType_UInt64: case pwr_eType_UInt64:
if (ABS(*(pwr_tUInt64*)value - *(pwr_tUInt64*)oldvalue) < deadband) { if (ABS(((pwr_tInt64)(*(pwr_tUInt64*)value - *(pwr_tUInt64*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
case pwr_eType_UInt32: case pwr_eType_UInt32:
case pwr_eType_Boolean: case pwr_eType_Boolean:
if (ABS(*(pwr_tUInt32*)value - *(pwr_tUInt32*)oldvalue) < deadband) { if (ABS(((pwr_tInt32)(*(pwr_tUInt32*)value - *(pwr_tUInt32*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
case pwr_eType_UInt16: case pwr_eType_UInt16:
if (ABS(*(pwr_tUInt16*)value - *(pwr_tUInt16*)oldvalue) < deadband) { if (ABS(((pwr_tInt16)(*(pwr_tUInt16*)value - *(pwr_tUInt16*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
case pwr_eType_UInt8: case pwr_eType_UInt8:
if (ABS(*(pwr_tUInt8*)value - *(pwr_tUInt8*)oldvalue) < deadband) { if (ABS(((pwr_tInt8)(*(pwr_tUInt8*)value - *(pwr_tUInt8*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
......
...@@ -1323,8 +1323,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx, ...@@ -1323,8 +1323,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt64))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt64)))
|| (ABS(*(pwr_tUInt64*)buf || (ABS(((pwr_tInt64)(*(pwr_tUInt64*)buf
- *(pwr_tUInt64*)m_items[item_idx].old_value) - *(pwr_tUInt64*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
update_time_only = 1; update_time_only = 1;
} else { } else {
...@@ -1337,8 +1337,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx, ...@@ -1337,8 +1337,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt32))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt32)))
|| (ABS(*(pwr_tUInt32*)buf || (ABS(((pwr_tInt32)(*(pwr_tUInt32*)buf
- *(pwr_tUInt32*)m_items[item_idx].old_value) - *(pwr_tUInt32*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
update_time_only = 1; update_time_only = 1;
} else { } else {
...@@ -1350,8 +1350,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx, ...@@ -1350,8 +1350,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt16))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt16)))
|| (ABS(*(pwr_tUInt16*)buf || (ABS(((pwr_tInt16)(*(pwr_tUInt16*)buf
- *(pwr_tUInt16*)m_items[item_idx].old_value) - *(pwr_tUInt16*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
update_time_only = 1; update_time_only = 1;
} else { } else {
...@@ -1363,8 +1363,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx, ...@@ -1363,8 +1363,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt8))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt8)))
|| (ABS(*(pwr_tUInt8*)buf || (ABS(((pwr_tInt8)(*(pwr_tUInt8*)buf
- *(pwr_tUInt8*)m_items[item_idx].old_value) - *(pwr_tUInt8*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
update_time_only = 1; update_time_only = 1;
} else { } else {
...@@ -1464,8 +1464,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx, ...@@ -1464,8 +1464,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt64))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt64)))
|| (ABS(*(pwr_tUInt64*)buf || (ABS(((pwr_tInt64)(*(pwr_tUInt64*)buf
- *(pwr_tUInt64*)m_items[item_idx].old_value) - *(pwr_tUInt64*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
m_items[item_idx].deadband_active = 1; m_items[item_idx].deadband_active = 1;
set_jump = 1; set_jump = 1;
...@@ -1477,8 +1477,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx, ...@@ -1477,8 +1477,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt32))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt32)))
|| (ABS(*(pwr_tUInt32*)buf || (ABS(((pwr_tInt32)(*(pwr_tUInt32*)buf
- *(pwr_tUInt32*)m_items[item_idx].old_value) - *(pwr_tUInt32*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
m_items[item_idx].deadband_active = 1; m_items[item_idx].deadband_active = 1;
set_jump = 1; set_jump = 1;
...@@ -1489,8 +1489,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx, ...@@ -1489,8 +1489,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt16))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt16)))
|| (ABS(*(pwr_tUInt16*)buf || (ABS(((pwr_tInt16)(*(pwr_tUInt16*)buf
- *(pwr_tUInt16*)m_items[item_idx].old_value) - *(pwr_tUInt16*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
m_items[item_idx].deadband_active = 1; m_items[item_idx].deadband_active = 1;
set_jump = 1; set_jump = 1;
...@@ -1501,8 +1501,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx, ...@@ -1501,8 +1501,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt8))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt8)))
|| (ABS(*(pwr_tUInt8*)buf || (ABS(((pwr_tInt8)(*(pwr_tUInt8*)buf
- *(pwr_tUInt8*)m_items[item_idx].old_value) - *(pwr_tUInt8*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
m_items[item_idx].deadband_active = 1; m_items[item_idx].deadband_active = 1;
set_jump = 1; set_jump = 1;
...@@ -3893,23 +3893,27 @@ int sev_dbms::check_deadband(pwr_eType type, unsigned int size, ...@@ -3893,23 +3893,27 @@ int sev_dbms::check_deadband(pwr_eType type, unsigned int size,
} }
break; break;
case pwr_eType_UInt64: case pwr_eType_UInt64:
if (ABS(*(pwr_tUInt64*)value - *(pwr_tUInt64*)oldvalue) < deadband) { if (ABS(((pwr_tInt64)(*(pwr_tUInt64*)value - *(pwr_tUInt64*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
case pwr_eType_UInt32: case pwr_eType_UInt32:
case pwr_eType_Boolean: case pwr_eType_Boolean:
if (ABS(*(pwr_tUInt32*)value - *(pwr_tUInt32*)oldvalue) < deadband) { if (ABS(((pwr_tInt32)(*(pwr_tUInt32*)value - *(pwr_tUInt32*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
case pwr_eType_UInt16: case pwr_eType_UInt16:
if (ABS(*(pwr_tUInt16*)value - *(pwr_tUInt16*)oldvalue) < deadband) { if (ABS(((pwr_tInt16)(*(pwr_tUInt16*)value - *(pwr_tUInt16*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
case pwr_eType_UInt8: case pwr_eType_UInt8:
if (ABS(*(pwr_tUInt8*)value - *(pwr_tUInt8*)oldvalue) < deadband) { if (ABS(((pwr_tInt8)(*(pwr_tUInt8*)value - *(pwr_tUInt8*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
......
...@@ -703,8 +703,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx, ...@@ -703,8 +703,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt64))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt64)))
|| (ABS(*(pwr_tUInt64*)buf || (ABS(((pwr_tInt64)(*(pwr_tUInt64*)buf
- *(pwr_tUInt64*)m_items[item_idx].old_value) - *(pwr_tUInt64*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
update_time_only = 1; update_time_only = 1;
} else { } else {
...@@ -717,8 +717,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx, ...@@ -717,8 +717,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt32))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt32)))
|| (ABS(*(pwr_tUInt32*)buf || (ABS(((pwr_tInt32)(*(pwr_tUInt32*)buf
- *(pwr_tUInt32*)m_items[item_idx].old_value) - *(pwr_tUInt32*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
update_time_only = 1; update_time_only = 1;
} else { } else {
...@@ -730,8 +730,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx, ...@@ -730,8 +730,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt16))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt16)))
|| (ABS(*(pwr_tUInt16*)buf || (ABS(((pwr_tInt16)(*(pwr_tUInt16*)buf
- *(pwr_tUInt16*)m_items[item_idx].old_value) - *(pwr_tUInt16*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
update_time_only = 1; update_time_only = 1;
} else { } else {
...@@ -743,8 +743,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx, ...@@ -743,8 +743,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt8))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt8)))
|| (ABS(*(pwr_tUInt8*)buf || (ABS(((pwr_tInt8)(*(pwr_tUInt8*)buf
- *(pwr_tUInt8*)m_items[item_idx].old_value) - *(pwr_tUInt8*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
update_time_only = 1; update_time_only = 1;
} else { } else {
...@@ -844,8 +844,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx, ...@@ -844,8 +844,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt64))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt64)))
|| (ABS(*(pwr_tUInt64*)buf || (ABS(((pwr_tInt64)(*(pwr_tUInt64*)buf
- *(pwr_tUInt64*)m_items[item_idx].old_value) - *(pwr_tUInt64*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
m_items[item_idx].deadband_active = 1; m_items[item_idx].deadband_active = 1;
set_jump = 1; set_jump = 1;
...@@ -857,8 +857,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx, ...@@ -857,8 +857,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt32))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt32)))
|| (ABS(*(pwr_tUInt32*)buf || (ABS(((pwr_tInt32)(*(pwr_tUInt32*)buf
- *(pwr_tUInt32*)m_items[item_idx].old_value) - *(pwr_tUInt32*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
m_items[item_idx].deadband_active = 1; m_items[item_idx].deadband_active = 1;
set_jump = 1; set_jump = 1;
...@@ -869,8 +869,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx, ...@@ -869,8 +869,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt16))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt16)))
|| (ABS(*(pwr_tUInt16*)buf || (ABS(((pwr_tInt16)(*(pwr_tUInt16*)buf
- *(pwr_tUInt16*)m_items[item_idx].old_value) - *(pwr_tUInt16*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
m_items[item_idx].deadband_active = 1; m_items[item_idx].deadband_active = 1;
set_jump = 1; set_jump = 1;
...@@ -881,8 +881,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx, ...@@ -881,8 +881,8 @@ int sev_dbsqlite::store_value(pwr_tStatus* sts, void* thread, int item_idx,
if ((feqf(m_items[item_idx].deadband, 0.0f) if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp( && !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt8))) buf, m_items[item_idx].old_value, sizeof(pwr_tUInt8)))
|| (ABS(*(pwr_tUInt8*)buf || (ABS(((pwr_tInt8)(*(pwr_tUInt8*)buf
- *(pwr_tUInt8*)m_items[item_idx].old_value) - *(pwr_tUInt8*)m_items[item_idx].old_value)))
< m_items[item_idx].deadband)) { < m_items[item_idx].deadband)) {
m_items[item_idx].deadband_active = 1; m_items[item_idx].deadband_active = 1;
set_jump = 1; set_jump = 1;
...@@ -2812,23 +2812,27 @@ int sev_dbsqlite::check_deadband(pwr_eType type, unsigned int size, ...@@ -2812,23 +2812,27 @@ int sev_dbsqlite::check_deadband(pwr_eType type, unsigned int size,
} }
break; break;
case pwr_eType_UInt64: case pwr_eType_UInt64:
if (ABS(*(pwr_tUInt64*)value - *(pwr_tUInt64*)oldvalue) < deadband) { if (ABS(((pwr_tInt64)(*(pwr_tUInt64*)value - *(pwr_tUInt64*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
case pwr_eType_UInt32: case pwr_eType_UInt32:
case pwr_eType_Boolean: case pwr_eType_Boolean:
if (ABS(*(pwr_tUInt32*)value - *(pwr_tUInt32*)oldvalue) < deadband) { if (ABS(((pwr_tInt32)(*(pwr_tUInt32*)value - *(pwr_tUInt32*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
case pwr_eType_UInt16: case pwr_eType_UInt16:
if (ABS(*(pwr_tUInt16*)value - *(pwr_tUInt16*)oldvalue) < deadband) { if (ABS(((pwr_tInt16)(*(pwr_tUInt16*)value - *(pwr_tUInt16*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
case pwr_eType_UInt8: case pwr_eType_UInt8:
if (ABS(*(pwr_tUInt8*)value - *(pwr_tUInt8*)oldvalue) < deadband) { if (ABS(((pwr_tInt8)(*(pwr_tUInt8*)value - *(pwr_tUInt8*)oldvalue)))
< deadband) {
deadband_active = 1; deadband_active = 1;
} }
break; break;
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
*/ */
#define PWR_XDR_BYTES(xdrs, addr, len) \ #define PWR_XDR_BYTES(xdrs, addr, len) \
{ \ { \
if (((xdrs)->x_handy -= len) < 0) \ if (((int) ((xdrs)->x_handy -= len)) < 0) \
return (FALSE); \ return (FALSE); \
\ \
if ((xdrs)->x_op == XDR_DECODE) \ if ((xdrs)->x_op == XDR_DECODE) \
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
*/ */
#define PWR_XDR_STRING(xdrs, addr, len) \ #define PWR_XDR_STRING(xdrs, addr, len) \
{ \ { \
if (((xdrs)->x_handy -= len) < 0) \ if (((int) ((xdrs)->x_handy -= len)) < 0) \
return (FALSE); \ return (FALSE); \
\ \
if ((xdrs)->x_op == XDR_DECODE) \ if ((xdrs)->x_op == XDR_DECODE) \
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
*/ */
#define PWR_XDR_INT(xdrs, objp, objtype) \ #define PWR_XDR_INT(xdrs, objp, objtype) \
{ \ { \
if (((xdrs)->x_handy -= sizeof(int)) < 0) \ if (((int) ((xdrs)->x_handy -= sizeof(int))) < 0) \
return (FALSE); \ return (FALSE); \
\ \
if ((xdrs)->x_op == XDR_DECODE) \ if ((xdrs)->x_op == XDR_DECODE) \
......
...@@ -4991,7 +4991,7 @@ static int xnav_open_func(void* client_data, void* client_flag) ...@@ -4991,7 +4991,7 @@ static int xnav_open_func(void* client_data, void* client_flag)
xao->pop(); xao->pop();
} else { } else {
xao = xnav->xattone_new( xao = xnav->xattone_new(
&aref, title_str, bypass ? pwr_mPrv_RtWrite : xnav->priv, &sts); &aref, title_str, bypass ? pwr_mPrv_RtWrite : ((pwr_mPrv) xnav->priv), &sts);
if (EVEN(sts)) if (EVEN(sts))
xnav->message('E', "Unable to open attribute"); xnav->message('E', "Unable to open attribute");
else { else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment