diff --git a/libraries/AP_Param/AP_Param.cpp b/libraries/AP_Param/AP_Param.cpp index c29871e44c..d2fd2e3b71 100644 --- a/libraries/AP_Param/AP_Param.cpp +++ b/libraries/AP_Param/AP_Param.cpp @@ -2299,28 +2299,25 @@ bool AP_Param::load_defaults_file(const char *filename, bool last_pass) bool AP_Param::count_embedded_param_defaults(uint16_t &count) { const volatile char *ptr = param_defaults_data.data; - uint16_t length = param_defaults_data.length; + int32_t length = param_defaults_data.length; count = 0; - while (length) { + while (length>0) { char line[100]; char *pname; float value; bool read_only; uint16_t i; - uint16_t n = MIN(length, sizeof(line)-1); + uint16_t n = length; for (i=0;i 0) { char line[100]; char *pname; float value; bool read_only; uint16_t i; - uint16_t n = MIN(length, sizeof(line)-1); + uint16_t n = length; for (i=0;i