stephane / libmodbus

A Modbus library for Linux, Mac OS, FreeBSD and Windows
http://libmodbus.org
GNU Lesser General Public License v2.1
3.33k stars 1.71k forks source link

modbus_set_error_recovery #71

Closed ghost closed 11 years ago

ghost commented 12 years ago

When I compile libmodbus (3.0.3) my compiler (g++ 4.7.1)says:

../xline/libmodbus/src/modbus.c: In function 'modbus_set_error_recovery':

../xline/libmodbus/src/modbus.c:1406:5: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]

maybe is not important....

typedef enum { MODBUS_ERROR_RECOVERY_NONE = 0, MODBUS_ERROR_RECOVERY_LINK = (1<<1), MODBUS_ERROR_RECOVERY_PROTOCOL = (1<<2),

} modbus_error_recovery_mode;

int modbus_set_error_recovery(modbus_t *ctx, modbus_error_recovery_mode error_recovery) { (1406 line-->) if (error_recovery >= 0) { ctx->error_recovery = (uint8_t) error_recovery; } else { errno = EINVAL; return -1; }

return 0;

}

ghost commented 12 years ago

why my issue is bold?

stephane commented 11 years ago

This issue has been fixed in modbus 3.1 and I've just pushed this commit in v3.0.X branch (4396649fe04). thank you for the report.

PS: github provides a Preview tab to check the final result of comment